查看: 16426|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr" I' u# K6 l! ?( Z7 T
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    " v/ A1 k* T3 `- o
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:$ m7 @7 L3 |" F& ^
usage: himr <address> <value>. sample: himr 0x80040000 0x0! ]2 D' V+ o; ^) L
( w, ^0 ?. ^7 x, r( n
( R, [% Y3 Z( C
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?* V! L# ]- t: H2 Z4 `

4 L' \' Y% F; W! f) N4 L' w补充内容 (2012-3-8 09:42):5 E- S$ G# l1 U9 P
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数& v% R4 h+ N$ F1 N2 L
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
6 y/ R1 d3 Y! o, k5 v* U; W: }
9 e7 ?/ w( Z2 @' vhimr <address> <value>. sample: himr 0x80040000 0x0
, w, a7 t2 A$ L' M4 F, U7 B/ F$ |4 J3 \4 x2 E7 Z
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。( N: F2 W4 p) t  [- o& n2 y
himr 0x80040000 0x00
4 X0 ]" Y  P# I3 ehimr 0x80040001 0x11
7 m3 F; W. X4 |3 ]0 n3 ^) Zhimr 0x80040002 0x22
. y4 O4 F' B8 `( f: C6 M3 ?. P: \himr 0x80040003 0x33
4 u* M) G9 X! D4 _+ a8 k' t# Rhimr 0x80040004 0x44
: Y- l* A. a8 \. D6 V' lhimr 0x80040005 0x55& r+ K5 m, X7 i: ^9 o% c: B: _' g5 [

; e$ q& ~! j: I) DSN也是类似。+ g4 T( o( t6 b4 Z
: _5 q' y5 N" n- f) }- f2 M5 _3 J
现在主要是,谁告诉我们MAC和SN的地址?8 a% e9 t" V" A$ A
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
% ~- S3 k* {/ q9 a0 ~一直想找到运程修改MAC和SN的办法,苦于无解啊
3 S2 z, j6 Z" H# e& I
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
+ B  r" p( w5 ]+ q1 q" ]- B& K4 k+ \. Y% c3 \% n. a
修改的代码早有了。到今天不会编译。) L% }: J7 l- h4 H4 `  x! s* C
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>* h" j) k  ]# `5 q+ ~- d
  2. #include <malloc.h>
    * h  E" I, H+ C3 C4 ?
  3. #include <sys/types.h>
    , w9 X! w: j0 d0 k1 W
  4. #include <sys/stat.h>+ x# B1 p* r9 \5 Q- Z; W& r
  5. #include <sys/ioctl.h># \4 j' Q5 T1 ^) n) n
  6. #include <stdio.h>
    ' \1 Z/ H, y) h: j! w
  7. #include <string.h>
    . n0 _  t. Q' z2 }( F$ h3 q. Z
  8. ' n5 Q7 k: r5 _1 Q& b, _% L$ P' Y* i& _, E
  9. typedef struct {0 k1 K: d; h9 f! J7 j( ~" @2 y
  10.         unsigned int        e2prom_cmd_sub_addr;( u1 t' U( L% n5 S' f
  11.         unsigned int        sub_addr_count;" X. Z7 \- z* B- p7 x
  12.         unsigned char*        e2prom_cmd_data;  Z+ l, x* I5 U8 M. f
  13.         unsigned int        data_count;
    / v6 K' U2 |- G! s
  14. } e2prom_s_cmd;
    * f5 ?0 p! Q' x$ V, V- `6 v
  15. 7 a& E0 r) P# _9 m$ U1 ]
  16. #define E2PROM_CMD_READ 1
    ( j% \7 u% k" f, _1 q4 V6 F: a
  17. #define E2PROM_CMD_WRITE 25 [4 \  Q# B  p6 a* q% f& @. F& O
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    ! s' m- h. O1 L$ a" I
  19.   F- E4 |' b. V
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    6 }5 x! x: `' {7 W
  21. {8 q- d7 H9 H" k* z( C6 Q5 n
  22.         int fd, ret;) P0 ^7 v& R% F9 ~2 B" M
  23.         e2prom_s_cmd arg;% L0 h: C% d5 a, c  Q
  24.         unsigned char buf[0x18];5 O6 `' k- F# \1 {( w+ r% j! j
  25. & G4 ^( u- r& m
  26.         fd = open(E2PROM_DEVICE, O_RDWR);, B4 z' R8 O8 }& [4 ^3 t
  27.         if (fd  < 0) {
    + I$ N1 d) C- e6 D' \
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);( T. ~: D$ Z5 U: X- T5 k( O  g
  29.                 return -1;3 _* Z% l/ Q$ K. O
  30.         }% z/ Q* x: E6 Y4 `) W6 m
  31.         arg.sub_addr_count      = 2;+ e% J& f5 d# U  r
  32.         arg.data_count          = 0x18;
      \/ i# x! }/ Q: h& g, C( V8 u
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    0 w" F: {3 l/ ?  H8 C3 Y9 l& O" |
  34.         arg.e2prom_cmd_data     = buf;& B% @9 \4 J5 t2 S' @% G+ v! p% B
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);; [- n9 N3 R. {# [& O. m
  36.         if (ret != 0) {
    6 g, g( y2 J6 L
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
      v+ j6 [. `' \6 {1 v4 q1 k5 C! k6 u
  38.                 return -1;
    + c: c! @" r2 |  q5 i3 o& d( D
  39.         }
    2 l& b+ F# }* O9 \& m/ N1 V) E" w
  40.         memcpy(mac, buf, 6);
    + B1 h% e7 N& h2 k+ Q2 j& `: m+ V
  41.         memcpy(stbid, &buf[6], 18);6 f+ c1 M) v9 Z) {! Z
  42.         stbid[18] = '\0';5 E- Q" y% G/ S. S2 W7 _

  43. 9 C, H/ j6 k" l. Z( K3 i! `/ n
  44.         return 0;
    ; }8 g& _0 ?9 ]' e- ~7 k0 m
  45. }
    * [9 |3 \# S! s3 y% Z
  46. 5 m. D6 N2 X$ i) F1 q( `' P
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    1 {& Q) }5 Y. A0 q
  48. {; y1 u/ _  }6 G& G9 e
  49.         int fd, ret;
    , t" g; x$ a: x
  50.         e2prom_s_cmd arg;/ p% X4 a( y9 _( w: w7 Q, ?/ i
  51.         unsigned char buf[0x18];
    ; V6 U3 b$ N4 d7 O. I4 g

  52. 9 y+ t8 G# P! _- t9 ]
  53.         memcpy(buf, mac, 6);1 B5 }+ y* F) R) @
  54.         memcpy(&buf[6], stbid, 18);4 A6 t, q+ k4 @1 B" w+ l
  55.         fd = open(E2PROM_DEVICE, O_RDWR);: E0 L. O( K% R, y
  56.         if (fd  < 0) {
    ( U2 N( g. q& s% n9 g7 e
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);: A: |6 b% z- f
  58.                 return -1;
    ; n3 R9 x. X! z
  59.         }2 p. B1 x6 d0 s9 u2 f
  60.         arg.sub_addr_count      = 2;  v  X, y) f5 O9 e
  61.         arg.data_count          = 0x18;
    , b* X- V; g2 |4 e' ~
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    % ]2 q7 P; q: _& b# S  z7 F
  63.         arg.e2prom_cmd_data     = buf;
    * I; [; X7 u$ d- F1 u* ~
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);$ t$ v4 ~+ m, z1 ~/ y/ u" p
  65.         if (ret != 0) {4 Y6 w: p  Y  O1 }
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    6 [/ `. B  x8 j" I4 H% f) @9 v4 t
  67.                 return -1;
    7 P% b, |! J% ~( s' O
  68.         }; l/ n* Q8 }. F! d4 D, U

  69. - X) I" R$ r3 \
  70.         return 0;
    8 J7 P7 a; G7 f. }! H
  71. }
    7 w; j: U  ]2 Y" z' N/ f
  72. 2 k* e+ I9 L7 r% ^; i6 e. L( x
  73. int main()7 d' K) v. U/ s- q
  74. {
    . l% @9 \( T3 O& }& t
  75.         char c;* z( K* ~2 q  c9 r' T6 T- y  q4 b
  76.         int i, macs[6];
    - b8 j7 E( C9 w& g3 ]
  77.         unsigned char mac[6];- J* ]: D! V( Z9 L4 V  N
  78.         unsigned char stbid[256];2 Y# P, `) h( F! @6 t3 S

  79. : n/ C7 \' }7 g0 L' e2 q( M
  80.         if (readparam(mac, stbid) < 0)6 o0 y6 {' \" P/ T: T3 v( Q1 c
  81.                 return 1;
    0 b+ ?9 Q/ J4 K9 a9 x" n7 N5 F' S
  82. 9 L7 ?$ V7 V; k7 l! {2 d7 ~
  83.         printf("Current parameters: \n");
    + d1 O# f# P1 |: }: x* w
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    0 R# V' e$ U5 H
  85.         printf("  STBID: %s\n", stbid);8 l5 M1 l, B$ I5 D8 u& o
  86.        
    * C! ?1 p5 S5 j) [
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");5 r4 I& n- N4 A: ?7 h* ~+ }
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {( E0 P3 s9 e( V: [+ c4 z
  89.                 printf("Input MAC error\n");
      _. q2 [* u& \$ T/ j+ [
  90.                 return 1;" x0 B) K! n  @+ E1 {$ k
  91.         }; V* D7 K5 t0 x( D# D- ]* q
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    ' S# X/ \/ Q$ d: M) g
  93.         printf("\nPlease input new STBID: ");$ h7 L$ H1 n5 X7 ]
  94.         scanf("%s", stbid);7 ~! d- b% g% l3 y
  95.         if (strlen(stbid) != 18) {, D1 G* b% E, ^" @/ q
  96.                 printf("Invalid stbid\n");$ V$ ^' `& T5 N+ r; y& Q* X7 E9 F
  97.                 return 1;, [5 |( Q8 k4 d6 f
  98.         }
    " p& d9 Y& A+ ]4 H; z/ _# _# ]
  99.         printf("\nNew parameters: \n");9 w  [- G3 b- j  L) ?6 E
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);5 ^$ ?' c% i. l$ Y6 j' H
  101.         printf("  STBID: %s\n", stbid);
    6 `/ v( ?+ ~' R9 }+ Z

  102. 0 L& w8 o. I$ j5 q* A5 E5 n; e
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    , U( \0 J( H8 G5 I' {  q0 v
  104.         for (;;) {) U, Q: ]* x) [6 [5 C: G& @
  105.                 c = getchar();8 {3 W5 }0 {9 {' p  t
  106.                 if (c == 'y' || c == 'Y')
    , m" K  j" |: H! @7 }  E& ]
  107.                         break;' k" M& S/ y/ Y
  108.                 if (c == 'n' || c == 'N') {
    0 G% g# g' a6 k/ k% `
  109.                         printf("\nAborted.\n");
    ! I" f' u0 D. w9 \8 i/ S/ j2 k
  110.                         return 1;
    % Z8 h! G% E6 V; e
  111.                 }
    $ [! U: y4 g% b, Q/ I
  112.         }
    . i# n2 d" j4 w/ X5 I' ~. `, ^8 ^
  113.         if (writeparam(mac, stbid) == 0) ! B5 Y& E( g, U1 |3 k
  114.                 printf("Parameters changed.\n");
    + ^7 R5 ^1 o+ A4 J: q: N* B
  115. / p) X6 f6 p) l
  116.         return 0;
    & |, B; e5 G) W
  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 $ P' [1 [: f* N2 {+ U: o/ S
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
% T/ X* U) n1 u# o1 _9 W9 g/ g6 z
你用的编译命令行格式是什么?
$ P) f7 X+ `% f
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

在本版发帖QQ客服返回顶部