查看: 18043|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    + D; ~! I' b! [7 n
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig8 t. r' @8 D7 h5 D( J
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
# e! M3 C+ b! |! F; }; [0 o4 @4 Gusage: himr <address> <value>. sample: himr 0x80040000 0x07 o& M$ B5 R" _( Y* M  d! Z9 @

' L; B( _) n5 R- Y/ `5 _. s) F1 W; B7 c) A2 f
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?+ f2 O% W4 O9 X8 `* f
2 g* F6 y" q# @) i( X) Q
补充内容 (2012-3-8 09:42):+ a: s# s! p. t5 u* F: G
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数( f* d! a% ^# y/ ^% ?
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。
5 J8 U! I# g! H) [+ D% x+ r
2 A, ^& r0 r9 K8 r! Hhimr <address> <value>. sample: himr 0x80040000 0x0" D) V4 `8 H* `; ^' c

2 E7 J7 }& k! r3 M例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。. X1 {5 ^8 `0 \" r0 Z
himr 0x80040000 0x00
& _2 j/ }5 |- m  n6 r9 Chimr 0x80040001 0x11* K+ K+ r4 t: M+ l5 z
himr 0x80040002 0x22
. R$ u- O. J. Thimr 0x80040003 0x33* d1 Y9 {& U. U, i  z
himr 0x80040004 0x44
+ P5 ^7 F8 U' z* ~9 Thimr 0x80040005 0x55
9 l9 c0 E  B9 F2 S: B4 g3 H2 Z- a2 Q( Z
SN也是类似。
9 ^% x* o, [( H% C
) M- ]; `# W3 F现在主要是,谁告诉我们MAC和SN的地址?
7 z) S6 p2 }% @: ]1 S5 U
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37 1 L. Q' @0 `4 a
一直想找到运程修改MAC和SN的办法,苦于无解啊
8 E& y" Z* c: X  \( h: Q
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
+ u: P! T- }: c, M! ?6 x1 m. y' z& a9 u
修改的代码早有了。到今天不会编译。. ~6 l. Q: I* n8 [
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>* r. V- j" o' k3 a2 M
  2. #include <malloc.h>) ~2 E# n5 {$ X$ B
  3. #include <sys/types.h>+ u4 |* M& k# I8 w; Y
  4. #include <sys/stat.h>9 `7 y" o( f: l# P' c
  5. #include <sys/ioctl.h>- \" E, U& ~% [3 y' v5 L3 h1 w) A
  6. #include <stdio.h>9 s; J; N5 X+ c/ K8 a+ ?$ @% [
  7. #include <string.h>3 l/ J5 R* w. i4 [+ O

  8. ! G' i; [+ Z& S" ?
  9. typedef struct {
    4 Z0 f# s0 B; M: f. @; u, j
  10.         unsigned int        e2prom_cmd_sub_addr;
    1 J2 e( r+ o( K' |
  11.         unsigned int        sub_addr_count;$ c3 [; t# o9 m7 D+ ^4 @3 y/ ?( ~
  12.         unsigned char*        e2prom_cmd_data;
    ! C7 ~* O9 {1 C: n
  13.         unsigned int        data_count;: D( [3 ]' V0 h# H$ x
  14. } e2prom_s_cmd;
    $ h3 e7 `  h$ p7 M
  15. / S5 P1 y8 q* a5 ]5 `
  16. #define E2PROM_CMD_READ 12 j9 u" s/ g7 ?6 o
  17. #define E2PROM_CMD_WRITE 2) |2 L1 N5 r" N$ B
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16") `2 d9 S* e1 t" p' P
  19. ' ]  }: m# g  I& Z7 D& T8 P. a' B8 D7 x
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
      J; M4 d+ f* E: m. H$ ~
  21. {
    ; v6 E5 u1 H1 h
  22.         int fd, ret;2 @' P8 Z3 R7 R! z
  23.         e2prom_s_cmd arg;' s1 S  ?, B# Z2 K# ]# p
  24.         unsigned char buf[0x18];
    - n' z6 \8 m. c* Q6 I
  25. " ?' H  r4 G, @4 x0 N: i& K
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    & W* F2 ^. [3 a
  27.         if (fd  < 0) {
    6 p1 |7 m, o: f6 ^: c' e
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    7 ], ~: ?- r- C
  29.                 return -1;$ ?5 m  |0 d" F
  30.         }" Z/ K( u  f0 W5 S. U2 ^/ S5 I; ?
  31.         arg.sub_addr_count      = 2;4 |- N% `+ h4 p/ b. b2 |. d/ Q
  32.         arg.data_count          = 0x18;
    9 U5 d# @3 ~1 M/ Q
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    - D. w, d; Z# \( d
  34.         arg.e2prom_cmd_data     = buf;, J8 a( x! c4 ^' n6 }
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);2 Q5 G* f8 {. e
  36.         if (ret != 0) {
    9 I- ]+ N/ B- V% }* ?
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    9 |& R" L) W1 p4 l: L! G' S/ X$ b2 {
  38.                 return -1;- W: g' K& l: Z/ F& B4 l9 ?5 X2 d
  39.         }
    ; @5 h' o! g" s
  40.         memcpy(mac, buf, 6);
    % _6 J5 }4 V5 J4 E6 t/ S2 K% @5 N2 j
  41.         memcpy(stbid, &buf[6], 18);2 Y' Q5 @( s, r; H0 g- w# s
  42.         stbid[18] = '\0';/ j% t. k; A+ b2 B3 A2 X/ s& t
  43. / w/ f! ~3 O! c0 J1 ?
  44.         return 0;
    : q/ y+ z4 Q3 g  T0 U, f8 p
  45. }  K& o( P' K8 F" I- E

  46.   x6 e9 h5 ]) K+ S1 Z: c9 K
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    1 I  t) p7 ^9 {, P$ q% l
  48. {& @. H; a0 K: X: ]2 U3 {
  49.         int fd, ret;7 Z& t6 r6 \9 i5 \2 Z! P/ V$ V
  50.         e2prom_s_cmd arg;( D6 v! J$ o- g0 t& F9 f( W  c
  51.         unsigned char buf[0x18];
    ' [6 w; u/ P" p/ i  s% d. M# V3 n
  52. : D2 D, m# Y$ n& {% U
  53.         memcpy(buf, mac, 6);
    & E& W4 T! z( y+ y
  54.         memcpy(&buf[6], stbid, 18);# |: ]2 e& t; Z1 k
  55.         fd = open(E2PROM_DEVICE, O_RDWR);1 v* j) r: [8 _" |4 f: Y
  56.         if (fd  < 0) {" I- B1 ~- R" U7 U( P; `' K
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);$ o. @+ s( w" u& M8 o
  58.                 return -1;, A& v+ J2 Z% `5 ~! ^7 q
  59.         }
    8 q2 N: N4 y8 `: w6 p( s; I
  60.         arg.sub_addr_count      = 2;
    9 h# U# h5 v. W+ ?. q3 T
  61.         arg.data_count          = 0x18;4 V# G1 O* v* R* Z  X9 y' o
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    2 a; a( L9 C& o
  63.         arg.e2prom_cmd_data     = buf;
    & J; ^' a8 q$ @3 B7 l" Y
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);$ }6 t4 N# b5 |4 l4 Y1 b, ?
  65.         if (ret != 0) {
    8 b0 m" j& h+ z/ S( K% C
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);1 [. S7 {  r# u  K- x) W1 X) f% N
  67.                 return -1;
    0 O$ V8 ]4 A4 Y$ v$ V1 D9 y
  68.         }' r0 k; l, O) X. L7 V' K' D, A
  69. 9 W& F, E  I) }! f- k0 ?
  70.         return 0;. i( p  Q1 \; h
  71. }- P1 ?7 F0 y' g8 W
  72. & J. y( C* `7 ]% `3 h  k
  73. int main()
    8 e) z3 v+ k8 |6 f' d1 R
  74. {
    + n1 g  G6 g4 c' [, f
  75.         char c;
    $ u1 U- v2 s& }
  76.         int i, macs[6];
    9 s+ Y& E* t4 p( g* X
  77.         unsigned char mac[6];/ ?5 {  q+ _4 d1 i
  78.         unsigned char stbid[256];2 N0 ]6 C! u. P# R+ k4 ]" k
  79. 4 I! @- H5 y+ S; h  c  W
  80.         if (readparam(mac, stbid) < 0)
    9 e! e- Y8 V; D+ s
  81.                 return 1;
    9 F" c3 y; k+ K! y
  82. 3 z7 d' r3 D6 o- i# c6 b
  83.         printf("Current parameters: \n");: S" ]# d6 M" R9 p% Z9 M
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    ( [- M* K4 O* r3 G: N9 Q6 G& W
  85.         printf("  STBID: %s\n", stbid);
    8 V" C0 O- Y. ~- p
  86.         0 ?& q) V) F3 w8 j1 g) L/ b* U
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    4 u# V+ l4 k+ d
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    ( s  y, Z2 q. b2 W, x
  89.                 printf("Input MAC error\n");; m5 i0 ^+ d% A$ @8 G
  90.                 return 1;: w9 U! e1 V# D$ T; Q+ o  P* v! ^
  91.         }
    + ~) f2 W8 g6 `1 {0 @4 g1 b
  92.         for (i=0; i<6; i++)mac[i] = macs[i];0 y# @" W7 I4 _; Z, v
  93.         printf("\nPlease input new STBID: ");7 Q# {  W) Z0 u
  94.         scanf("%s", stbid);
    . T$ N2 l! v2 |  S
  95.         if (strlen(stbid) != 18) {9 K% ?5 y5 ]" K  f: ~
  96.                 printf("Invalid stbid\n");
    3 K; t5 k1 M" S9 A6 d
  97.                 return 1;
    4 j2 Y) Z7 `+ g( V
  98.         }1 u7 d* k8 P! x  D
  99.         printf("\nNew parameters: \n");
    " a$ y# \) z. l, H2 R6 h
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);1 {& R. I3 l0 X8 V  Y& U; O  \
  101.         printf("  STBID: %s\n", stbid);8 ]& t, t% }+ p' S8 O+ d3 }
  102. 4 h" ^8 Z( o' ?* [4 \- c( u  ?7 Z
  103.         printf("\nDo you want to change paramemters? (y/N) ");( R* f8 W' d" s7 O: p
  104.         for (;;) {1 L( {$ k& X8 {* N. W! k- p; x8 ^
  105.                 c = getchar();6 O8 ~2 q/ e! }5 K% n4 V# N
  106.                 if (c == 'y' || c == 'Y')
    " b/ G0 l# _) s, |6 Y9 D
  107.                         break;
    5 m; Q0 ~3 C+ @$ s/ Z: h; U
  108.                 if (c == 'n' || c == 'N') {" ?: c3 n# G5 a. W
  109.                         printf("\nAborted.\n");
    7 n4 l# k7 H9 E' g: G1 z
  110.                         return 1;
    ) [" I( w/ W7 ]' K+ i. C) u
  111.                 }! p$ g* q0 ?$ a! l8 U( C4 w
  112.         }
    5 N, {' r7 K2 q' I% h9 e7 d; X) L
  113.         if (writeparam(mac, stbid) == 0) ( u* A9 P8 S# h; [0 D6 I
  114.                 printf("Parameters changed.\n");9 q/ [8 Q  ~: c7 l1 A! X  h7 u. B

  115. # ~/ J. ^; W' `1 p1 n
  116.         return 0;
    8 N" h/ b8 I* N  n7 J8 y
  117. }
复制代码
 楼主| 发表于 2012-3-23 18:24:12 |福建| 显示全部楼层
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
发表于 2012-5-11 11:20:03 |浙江| 显示全部楼层
0522 发表于 2012-3-23 18:24 5 L+ I4 m/ m0 m8 D4 _" G" y. Z
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
/ g/ k; ?5 A5 }" V" |
你用的编译命令行格式是什么?
$ D/ h7 K3 {, K& B. z" g
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

相关侵权、举报、投诉及建议等,请发 E-mail:yesdong@qq.com

Powered by Discuz! X5.0 Licensed © 2001-2026 Discuz! Team.44152102000001

在本版发帖返回顶部