查看: 16312|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    ' D9 I' L1 Y8 i9 o8 T1 @
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig! Q( {2 J  J* k* a, T% E
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:$ W. U0 p; x5 c, \6 P7 r
usage: himr <address> <value>. sample: himr 0x80040000 0x0
0 B4 X6 L2 r* T$ h5 n: g$ G) _9 {5 v/ ?, {' P4 H  |
1 I. a9 O) k4 o! g3 X
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
1 ]  A- w, E4 p6 w$ a, R$ r: G! m, O% q/ |) c/ Q! j" \; H
补充内容 (2012-3-8 09:42):
9 w: c) B/ s! ~2 M. Ehttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数/ z/ h7 {) @4 K$ E, P9 ?
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。  _, K  M# S, ~8 [+ ?
2 H( v7 {  X& U  Y# `$ F8 j3 {
himr <address> <value>. sample: himr 0x80040000 0x0/ l( J( Z) L& R

3 L# H% _0 A# F/ C例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
! L) h/ _. l% U+ z6 ]himr 0x80040000 0x00
+ Y2 b8 m* X& Z, K$ d+ X) Ohimr 0x80040001 0x11
! j* _; B6 s2 `7 ohimr 0x80040002 0x221 m* w- p4 G) p+ A: |& T
himr 0x80040003 0x33. U+ \+ p" \- J8 p) p9 s
himr 0x80040004 0x44( c; ?. A6 I7 E2 ~
himr 0x80040005 0x55
( s  F* N+ t0 l8 h! D5 y& b) y; P8 d" ~- D2 S4 V, b
SN也是类似。
5 D+ [) q4 ^* n7 n) A4 {: Z3 C9 B2 s# j# Y3 O) o+ _  y; p# G" r
现在主要是,谁告诉我们MAC和SN的地址?
7 C9 N6 w; o) j+ J2 ]9 n
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 2 w) S" q. s" n7 L$ a2 |
一直想找到运程修改MAC和SN的办法,苦于无解啊

& C* M6 K! A" V( ^: e$ n源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
7 p& t. |& Y3 L) C, h9 \; q7 g. {$ f3 o) z) O5 ]- g% j# b2 g
修改的代码早有了。到今天不会编译。; K8 h1 a0 d1 b$ W9 j$ `( d
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    # T+ w2 \+ L4 K4 W
  2. #include <malloc.h>
    # A) }7 I) r' u, v
  3. #include <sys/types.h>
    ' L6 Y0 ^/ \3 P+ N- q
  4. #include <sys/stat.h>( W, T0 w9 J$ m" X3 W+ ~4 Y( }
  5. #include <sys/ioctl.h>2 D& K3 n, f4 [  p# o; n6 M
  6. #include <stdio.h>
      d- v' q5 t2 ?  _) C9 C
  7. #include <string.h>
    5 a' z5 {2 U3 U- A; L3 h

  8. 7 a2 W9 E8 u  Z0 e. Y1 Q
  9. typedef struct {
    ; L: g  G/ P7 m8 o0 n: `' }" Y
  10.         unsigned int        e2prom_cmd_sub_addr;
    ' U7 Q! D  k& U
  11.         unsigned int        sub_addr_count;
    ) U, V& s7 G% q/ K
  12.         unsigned char*        e2prom_cmd_data;
    * g4 f2 S5 L: e8 J# d+ ?5 o5 f
  13.         unsigned int        data_count;0 y% N9 r# C8 C: r
  14. } e2prom_s_cmd;
    7 V8 j8 }' Y6 v
  15. - \% }" b/ \' B0 z# z3 b
  16. #define E2PROM_CMD_READ 1
    4 M# y; O) C1 p7 E  I  t1 Y* F1 p# B
  17. #define E2PROM_CMD_WRITE 2
    ) A  r7 k4 ]4 m0 H) _
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"6 S4 e8 m1 w$ x; O! G

  19. 8 a( M* [" {; j! x$ l/ Y
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    * p0 R2 v3 T2 `7 X; J1 v
  21. {
    & ?# r. ?5 z) H4 E
  22.         int fd, ret;
    ) z- C( a; X7 _% a/ K$ o; r+ `
  23.         e2prom_s_cmd arg;
    # J( l, X/ r& X
  24.         unsigned char buf[0x18];4 ?/ f# c3 M& j! z3 t

  25. % Z8 y4 p2 H/ [# j+ [
  26.         fd = open(E2PROM_DEVICE, O_RDWR);  X4 g# r5 [9 {1 J$ V
  27.         if (fd  < 0) {6 U9 y* J: `4 c  w
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);. h) {  ^5 ]: M
  29.                 return -1;
    9 m; L/ o1 D6 F
  30.         }: B5 [0 s9 D- A+ v
  31.         arg.sub_addr_count      = 2;) d$ g: B- P$ |/ J5 _! U! g7 E. \
  32.         arg.data_count          = 0x18;
    : F& i5 ?4 k2 J3 g
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    ; }. Z% K4 t9 ]$ _3 r( G% ^, G% y
  34.         arg.e2prom_cmd_data     = buf;% i6 _7 w7 V: j/ x3 v" W# d
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);3 k: B3 ?8 A6 A' t
  36.         if (ret != 0) {; F- w% _8 f4 H) z; c
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    0 G2 R0 Y! S  }
  38.                 return -1;; }2 l( Z5 f$ {" n+ m) E
  39.         }$ k7 x6 q0 w' ~) b* C
  40.         memcpy(mac, buf, 6);: ~3 D; W4 F. z7 Z( L3 T  y* I
  41.         memcpy(stbid, &buf[6], 18);  z1 ?* p. @+ D) n; w
  42.         stbid[18] = '\0';4 Y' h) z, i5 r% M& k% \

  43. 2 G# U! Q2 h" y# ~: ^& ^
  44.         return 0;
    4 H' [- _7 K* a5 F% r/ v+ Q! }* K  a! j
  45. }! A! h1 O5 E; {' X1 e: N

  46. ; ?0 O: ]. |, N5 \( W; |9 S7 V
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)0 g, B0 c1 H" F2 L/ ^& d( A
  48. {
    ! `: u8 z: N6 H/ x5 I8 z
  49.         int fd, ret;
    / [# J+ z2 H4 t% j0 @4 r6 w
  50.         e2prom_s_cmd arg;. b5 C2 {$ u/ F" T- U9 x6 ~
  51.         unsigned char buf[0x18];
    9 x% w( S8 x& Z  a' X( `
  52. . w% U6 \9 Q6 |- p. ^. q. G( r  [
  53.         memcpy(buf, mac, 6);  {  Y6 [5 e6 @; x
  54.         memcpy(&buf[6], stbid, 18);
    $ L3 D  z) q- [1 l- F# v
  55.         fd = open(E2PROM_DEVICE, O_RDWR);8 D( Z" Q" t% K; h
  56.         if (fd  < 0) {( P- n6 B8 z) h  `0 r! u' M
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ' M- U# z% X9 _% K9 x: i) r
  58.                 return -1;
    6 E# j. H. c6 H1 t
  59.         }
    5 a) E! ], R9 W* j( H
  60.         arg.sub_addr_count      = 2;
    ! v! z0 {8 M6 d2 R* G/ ^
  61.         arg.data_count          = 0x18;
    ' b6 |: P7 \3 y/ G: e
  62.         arg.e2prom_cmd_sub_addr = 0x290;* G" E5 e- U2 [2 ~9 l; S
  63.         arg.e2prom_cmd_data     = buf;
    ! Y4 W% Y$ a; Q  y7 t3 S, Z
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);2 b) b2 B0 U! g  Z9 D' g9 e
  65.         if (ret != 0) {
    9 b6 d: e5 A* Z5 S
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);0 ~- z) R. |) {, A( q
  67.                 return -1;
    ! h6 m: g: B+ q3 s+ y
  68.         }+ o; g5 A8 Z+ w* c
  69. 1 Z" \4 E. P/ p5 Y
  70.         return 0;+ Y4 ]' B% q. Y' ]
  71. }' p+ d  F# W3 v' v

  72.   u7 G9 h% h5 e, x
  73. int main()
    ; y& w- K/ d( v  M
  74. {
    & i' q+ u) J2 |) @3 k
  75.         char c;4 q" t$ F+ H7 \
  76.         int i, macs[6];5 e* ?2 G( C0 Q7 U! f( o! V1 K
  77.         unsigned char mac[6];
    ; C8 N. t9 A3 p) p* [8 i$ ]
  78.         unsigned char stbid[256];
    ' E) w; e1 I$ [6 ]+ r% _& i
  79. 3 g8 ?/ ~! s0 L! ~, u6 Y
  80.         if (readparam(mac, stbid) < 0)
    5 {/ E$ c2 s, K3 r( K$ p# n
  81.                 return 1;
    : H' v2 a7 c3 {9 z
  82. 1 y, p- Y3 d3 s( R9 d
  83.         printf("Current parameters: \n");1 W$ m# ]1 _; R5 p9 ]
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    . _- T* s+ o1 ~; U' V2 l& g
  85.         printf("  STBID: %s\n", stbid);
    3 z3 K' }, r: @/ Q- n0 w
  86.        
    4 G( _$ V- l- D; _
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    % n' f; Z' Q3 X& t9 r- w; m
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {3 e- I9 q2 N5 w- L( v
  89.                 printf("Input MAC error\n");
    - n4 Y: F  L! }, P5 S
  90.                 return 1;1 h7 L& e) o( ^  v% h
  91.         }1 V9 Y# ]$ ?/ T7 x4 Q% r4 d1 b/ }
  92.         for (i=0; i<6; i++)mac[i] = macs[i];% _6 G- c4 l6 a, _  p) o
  93.         printf("\nPlease input new STBID: ");
    - k2 v* h- ^8 D3 P+ V
  94.         scanf("%s", stbid);
    8 q% ?) t3 v+ y. |
  95.         if (strlen(stbid) != 18) {& J! X0 v' R# c2 S, i9 m
  96.                 printf("Invalid stbid\n");
    % e! n" `- ?+ e, i, h6 b) t
  97.                 return 1;/ m4 Y0 N$ e  I0 C8 a! \- D( B; F
  98.         }
    . o/ ~: Q4 O4 L# b1 I4 i  D9 D
  99.         printf("\nNew parameters: \n");, I9 A9 ^' \4 J; A3 r9 ~
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);# U6 N/ G3 w5 s; S
  101.         printf("  STBID: %s\n", stbid);6 f& p# f4 v. E% o$ C2 c

  102. ' i# a( x7 K* k9 K
  103.         printf("\nDo you want to change paramemters? (y/N) ");* Q" z- m; ]1 D- `& s% C8 E
  104.         for (;;) {+ y- B3 r- k* ~2 _) C$ V
  105.                 c = getchar();% Z# ]) A6 t- a* e" t; K. a/ j
  106.                 if (c == 'y' || c == 'Y')) v1 w& U4 i+ e/ G. q
  107.                         break;+ y! N) z9 ~+ R8 ~. b/ t
  108.                 if (c == 'n' || c == 'N') {3 I) E' a2 T# k3 r: f. h
  109.                         printf("\nAborted.\n");
    : ]2 g2 {) |" b5 Q; J+ B
  110.                         return 1;9 D/ P" N7 x, Q
  111.                 }* r# o% \  F, R. e
  112.         }/ F1 X- z7 N* s) p! e% a
  113.         if (writeparam(mac, stbid) == 0) ' h5 j; @4 A# C
  114.                 printf("Parameters changed.\n");" v. M8 t% s6 e$ |. N3 o

  115. : V# R- z9 c2 X5 Z0 `$ e
  116.         return 0;0 A5 \+ O$ J$ o* y6 {6 f: ?' j
  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
+ l; y3 p3 ~$ z2 g% r- g0 q1 k在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

- b( k; S; [, X& ~你用的编译命令行格式是什么?0 W3 \2 h  o7 j, b7 j& \
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

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