找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12800|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
usage: himr <address> <value>. sample: himr 0x80040000 0x0


不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?

补充内容 (2012-3-8 09:42):
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。

himr <address> <value>. sample: himr 0x80040000 0x0

例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
himr 0x80040000 0x00
himr 0x80040001 0x11
himr 0x80040002 0x22
himr 0x80040003 0x33
himr 0x80040004 0x44
himr 0x80040005 0x55

SN也是类似。

现在主要是,谁告诉我们MAC和SN的地址?
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊

点评

源代码有,可惜不会编译。  详情 回复 发表于 2012-3-12 19:15
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
一直想找到运程修改MAC和SN的办法,苦于无解啊

源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑

修改的代码早有了。到今天不会编译。
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
  2. #include <malloc.h>
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5. #include <sys/ioctl.h>
  6. #include <stdio.h>
  7. #include <string.h>

  8. typedef struct {
  9.         unsigned int        e2prom_cmd_sub_addr;
  10.         unsigned int        sub_addr_count;
  11.         unsigned char*        e2prom_cmd_data;
  12.         unsigned int        data_count;
  13. } e2prom_s_cmd;

  14. #define E2PROM_CMD_READ 1
  15. #define E2PROM_CMD_WRITE 2
  16. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"

  17. static int readparam(unsigned char *mac, unsigned char *stbid)
  18. {
  19.         int fd, ret;
  20.         e2prom_s_cmd arg;
  21.         unsigned char buf[0x18];

  22.         fd = open(E2PROM_DEVICE, O_RDWR);
  23.         if (fd  < 0) {
  24.                 printf("Device %s open error.\n", E2PROM_DEVICE);
  25.                 return -1;
  26.         }
  27.         arg.sub_addr_count      = 2;
  28.         arg.data_count          = 0x18;
  29.         arg.e2prom_cmd_sub_addr = 0x290;
  30.         arg.e2prom_cmd_data     = buf;
  31.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
  32.         if (ret != 0) {
  33.                 printf("Device %s read error.\n", E2PROM_DEVICE);
  34.                 return -1;
  35.         }
  36.         memcpy(mac, buf, 6);
  37.         memcpy(stbid, &buf[6], 18);
  38.         stbid[18] = '\0';

  39.         return 0;
  40. }

  41. static int writeparam(unsigned char *mac, unsigned char *stbid)
  42. {
  43.         int fd, ret;
  44.         e2prom_s_cmd arg;
  45.         unsigned char buf[0x18];

  46.         memcpy(buf, mac, 6);
  47.         memcpy(&buf[6], stbid, 18);
  48.         fd = open(E2PROM_DEVICE, O_RDWR);
  49.         if (fd  < 0) {
  50.                 printf("Device %s open error.\n", E2PROM_DEVICE);
  51.                 return -1;
  52.         }
  53.         arg.sub_addr_count      = 2;
  54.         arg.data_count          = 0x18;
  55.         arg.e2prom_cmd_sub_addr = 0x290;
  56.         arg.e2prom_cmd_data     = buf;
  57.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
  58.         if (ret != 0) {
  59.                 printf("Device %s write error.\n", E2PROM_DEVICE);
  60.                 return -1;
  61.         }

  62.         return 0;
  63. }

  64. int main()
  65. {
  66.         char c;
  67.         int i, macs[6];
  68.         unsigned char mac[6];
  69.         unsigned char stbid[256];

  70.         if (readparam(mac, stbid) < 0)
  71.                 return 1;

  72.         printf("Current parameters: \n");
  73.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
  74.         printf("  STBID: %s\n", stbid);
  75.        
  76.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
  77.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
  78.                 printf("Input MAC error\n");
  79.                 return 1;
  80.         }
  81.         for (i=0; i<6; i++)mac[i] = macs[i];
  82.         printf("\nPlease input new STBID: ");
  83.         scanf("%s", stbid);
  84.         if (strlen(stbid) != 18) {
  85.                 printf("Invalid stbid\n");
  86.                 return 1;
  87.         }
  88.         printf("\nNew parameters: \n");
  89.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
  90.         printf("  STBID: %s\n", stbid);

  91.         printf("\nDo you want to change paramemters? (y/N) ");
  92.         for (;;) {
  93.                 c = getchar();
  94.                 if (c == 'y' || c == 'Y')
  95.                         break;
  96.                 if (c == 'n' || c == 'N') {
  97.                         printf("\nAborted.\n");
  98.                         return 1;
  99.                 }
  100.         }
  101.         if (writeparam(mac, stbid) == 0)
  102.                 printf("Parameters changed.\n");

  103.         return 0;
  104. }
复制代码
 楼主| 发表于 2012-3-23 18:24:12 | 显示全部楼层
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

点评

你用的编译命令行格式是什么?  详情 回复 发表于 2012-5-11 11:20
发表于 2012-5-11 11:20:03 | 显示全部楼层
0522 发表于 2012-3-23 18:24
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

你用的编译命令行格式是什么?

点评

就是那个tar包里的Readme说明。  详情 回复 发表于 2012-5-29 22:05
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|宽带技术网 |网站地图

粤公网安备 44152102000001号

GMT+8, 2024-5-11 19:38 , Processed in 0.026784 second(s), 5 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表