查看: 16029|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
      }7 D+ U+ l2 u
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
      F. k! j% O5 P
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
1 R, d- c3 s" e1 s+ i8 v! ^/ s5 |8 ]usage: himr <address> <value>. sample: himr 0x80040000 0x0
" w  d$ l0 u. L2 ^- e$ H2 B( s, {+ n

8 g: O5 ]7 R0 }" w( t0 v+ Q& b0 G( N不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
3 ~/ z) r( W  o
7 m; z4 }' o9 S! f% ]( w. e补充内容 (2012-3-8 09:42):
  b; L9 s2 e: n3 u/ @. \/ V8 ?* chttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数' C9 h/ q1 W4 ~2 o4 l2 {
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
( |$ _% f  N  c$ A* Q
, F% s) L' [8 t$ k' A6 nhimr <address> <value>. sample: himr 0x80040000 0x0
0 Q9 U. m* D* x" ]7 B0 G  e) r( W7 L1 ~" `, B+ @  i
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
. r% C8 N0 P: E9 k$ Z+ }2 Fhimr 0x80040000 0x00; D9 Q, v7 m& ^4 Y8 `! u% Z
himr 0x80040001 0x11
! z5 Y, v# J& H0 W. b3 Y$ Dhimr 0x80040002 0x22  D7 ?& B( Z/ z2 N2 ~
himr 0x80040003 0x33. _/ I$ s. b2 W  @; G
himr 0x80040004 0x443 G0 B- _( a: d+ [) i: K5 e  N
himr 0x80040005 0x55
2 H; S- I3 Q5 p( ~) d% ]% [: ]( D
3 H4 e  }' ^. @; z+ g& a, OSN也是类似。; t: }/ i+ W5 z! O. J3 n
+ O! C; Y, W8 T
现在主要是,谁告诉我们MAC和SN的地址?
; \7 d! b& A* v
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 # |# R% P$ [) a4 J1 v6 l8 P* S$ D+ ~
一直想找到运程修改MAC和SN的办法,苦于无解啊
% _# S, Y% R9 x2 V
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 1 E7 |; v- ~( s4 s$ c$ Q
: Z4 |* R+ X- I7 ~( k5 }! D! G; O$ C
修改的代码早有了。到今天不会编译。5 ~% G0 b; M& L! J
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    0 t9 e4 H! k/ x7 Z
  2. #include <malloc.h>2 T0 n% J# C) b. I5 |
  3. #include <sys/types.h>: d* P' R7 O3 h# j( s2 U$ _4 j
  4. #include <sys/stat.h>
    , H7 o3 O" o' T0 s+ u: ?
  5. #include <sys/ioctl.h>1 i( b: \  q3 m
  6. #include <stdio.h>
    2 l! g# N  N* l% ]
  7. #include <string.h>
    & f& I3 J# j: e% o4 ^3 t
  8. 2 t7 w6 c- G& j* W5 `3 ~* r
  9. typedef struct {
    # c' \$ O0 z$ O. D9 d5 ]7 r4 @
  10.         unsigned int        e2prom_cmd_sub_addr;5 F% ]2 {- `- M9 O2 h6 z' R
  11.         unsigned int        sub_addr_count;
    ; I6 E3 E5 h$ S8 y+ p1 s( e4 e. p
  12.         unsigned char*        e2prom_cmd_data;  w3 n$ `" o, }5 y& s
  13.         unsigned int        data_count;
    ; a0 e8 U  n( j" m' B' P1 j" o
  14. } e2prom_s_cmd;) s2 Q/ Z4 C5 A+ J. B9 s- Z
  15. ' `6 a# a/ j5 R4 p
  16. #define E2PROM_CMD_READ 1
    # k% J/ J) b" h. g
  17. #define E2PROM_CMD_WRITE 2
    ! ?' q( Y" C1 C
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16") u# M: L7 y3 X8 S
  19. 9 b9 ?3 T( q% [, z! U7 }4 z
  20. static int readparam(unsigned char *mac, unsigned char *stbid)5 G* y' Y, O& {7 q; a" g2 |
  21. {( g$ `5 s- d% }; X
  22.         int fd, ret;
    4 F0 [& }% ]- X9 y
  23.         e2prom_s_cmd arg;
    & E% }$ p2 Y3 s$ c
  24.         unsigned char buf[0x18];+ l- H6 ~; u% u9 P. Z

  25. ! k" l/ ~$ h% v: Y9 S& g5 T( j
  26.         fd = open(E2PROM_DEVICE, O_RDWR);% u. D5 Z$ T2 _4 X6 Z0 x; e
  27.         if (fd  < 0) {/ F/ [1 u; d7 g3 s, Q
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    4 R' ]$ x" h. n% a# q) B
  29.                 return -1;# o+ [' q/ c- @$ N, {; f3 z( S
  30.         }4 q# t1 N' y3 X  V
  31.         arg.sub_addr_count      = 2;
    4 E& {& ^9 j6 V# x4 p4 F
  32.         arg.data_count          = 0x18;' ?( s( Y7 Y2 T2 x/ h
  33.         arg.e2prom_cmd_sub_addr = 0x290;# f( Y" ?% g( B! l9 l9 k
  34.         arg.e2prom_cmd_data     = buf;! k+ p8 j9 j% s1 ^+ v( V$ Q
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);0 D0 m. z# V8 \+ z! z
  36.         if (ret != 0) {1 g0 Z( }% z  r/ V: ~# @0 z$ w
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
      ?  h: D7 @& R- o. |- o
  38.                 return -1;
    4 c, o( }& b+ @
  39.         }
    7 A' e, U0 J1 Y/ x: `5 B
  40.         memcpy(mac, buf, 6);
    8 g. J% \! r' J: ?. T
  41.         memcpy(stbid, &buf[6], 18);
    ! t6 _8 u: m2 [! n; _
  42.         stbid[18] = '\0';
    # v. \/ ?+ S6 M

  43. 5 w( [; y( R* B# r; _1 A  N
  44.         return 0;
    2 {( j) u" C( W! i, ]  o
  45. }+ Z9 ]4 D5 h. w, ^9 |
  46. " P: {7 p4 i/ n# L6 B$ X
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)% A" B3 I5 J2 B' l( x
  48. {
    ) H4 c2 g5 I1 j/ ]" S( a
  49.         int fd, ret;5 T- y7 I, a/ J' j: ?# T
  50.         e2prom_s_cmd arg;4 F; D# g0 Z3 S. A5 N$ T; _
  51.         unsigned char buf[0x18];8 e% t7 S, e6 B6 I9 ?0 F1 d# a

  52. , p8 u7 h8 R1 ]9 t3 d
  53.         memcpy(buf, mac, 6);! g" L( |* w5 l2 C+ S+ H
  54.         memcpy(&buf[6], stbid, 18);
    $ D) r5 M1 D6 Y3 \. l0 k
  55.         fd = open(E2PROM_DEVICE, O_RDWR);, I' |* ~7 `, M+ P9 |
  56.         if (fd  < 0) {
    ' E; ]0 X- s" W
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    - ^! c# U( @8 `- t
  58.                 return -1;
    % y. O, L8 r2 E! L! Q
  59.         }) l1 t& g9 B. O: d  t2 H/ S
  60.         arg.sub_addr_count      = 2;' {8 N; a  q$ y- }  B' h# f' i) M
  61.         arg.data_count          = 0x18;
    / G7 @% U. f6 E, k; o* O, d
  62.         arg.e2prom_cmd_sub_addr = 0x290;8 T% r( H8 m2 x; s5 j
  63.         arg.e2prom_cmd_data     = buf;
    . T3 C! B4 i8 l3 k  \* X' C, I
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    2 \* r2 e) R: i1 p
  65.         if (ret != 0) {7 W; d- i5 v5 u: g7 D" E
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    7 y4 y/ F, p5 t0 `1 M: @( ?8 P$ ?
  67.                 return -1;0 U' B! b. x7 p& T- y6 |# Y
  68.         }. T) d1 f5 S7 }# L% [/ F( P. M

  69. 3 e0 _% ?8 S' r- w; U
  70.         return 0;
    * b: J5 i: i! a$ ~' G- ^
  71. }
    ) g* E! ^2 v  S7 g
  72. # U) v3 f: n5 ]4 [
  73. int main()3 j) K5 K7 A5 U' g! I, K% F
  74. {. \6 H/ ], X1 j) s% J
  75.         char c;% a3 V% y% n& l% c3 h. \+ ]
  76.         int i, macs[6];
    - w$ M5 Q6 ^" a( b6 I0 {9 o* U
  77.         unsigned char mac[6];  u2 J5 Y. `9 k5 s  \2 `
  78.         unsigned char stbid[256];
    % H/ u/ j8 U# q

  79. $ b) M* F# c& |$ S& o4 X' m
  80.         if (readparam(mac, stbid) < 0)( t, \1 c5 h5 @0 A* S! J
  81.                 return 1;
    ; I. y" u% {2 [6 [

  82. " g0 j9 F, q/ S* y  R. r, G) e
  83.         printf("Current parameters: \n");
    5 p& X  N  R! V# v& N9 L
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    ; R+ g' d' h& l0 p! d5 B
  85.         printf("  STBID: %s\n", stbid);
    6 V1 \; }7 y" }/ ^- d
  86.           S- M0 _& E) A& v; J8 K
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    1 {  s3 v; j# [9 `3 t
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {  U) M2 G, H* ^! w
  89.                 printf("Input MAC error\n");
    5 G5 G/ A6 O7 x$ F
  90.                 return 1;/ t: V. o& f# c7 P7 F. H# T  o# ]
  91.         }
    ) R8 b3 Q. t- d' e' L0 t, e% w
  92.         for (i=0; i<6; i++)mac[i] = macs[i];' m9 D. f( ]- v! o$ ]! m! Z
  93.         printf("\nPlease input new STBID: ");5 F' b$ F3 _- R+ w4 a! R, y
  94.         scanf("%s", stbid);
    0 B, r  O7 M2 u0 M
  95.         if (strlen(stbid) != 18) {, x6 f6 B/ p1 g
  96.                 printf("Invalid stbid\n");
    4 A2 f- B5 g1 L/ x
  97.                 return 1;+ M- W3 P/ I. h- u# E
  98.         }- |# H6 h. V5 N1 O8 L! T
  99.         printf("\nNew parameters: \n");
    * ]1 h0 e1 m: d* u
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);$ N2 C; m; m3 ^: t6 y; O
  101.         printf("  STBID: %s\n", stbid);! U. k2 u, I, M+ n
  102.   b6 P, R& H7 R* z8 p- ?- `
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    , u9 J! Y& [( ]
  104.         for (;;) {. y; q& S6 `% Z5 m4 C. ^4 @
  105.                 c = getchar();: S; e3 H$ n- ~  ~; j- B
  106.                 if (c == 'y' || c == 'Y')
    . ~: U; f" w. l; W- T& }9 B
  107.                         break;. K$ B; Y! V- }. s- }
  108.                 if (c == 'n' || c == 'N') {: I+ k: ?, @* i+ J
  109.                         printf("\nAborted.\n");
    $ |2 F$ H, G& |* E# S: E; p
  110.                         return 1;2 `$ c) P: V. ?& k3 J3 w  I& R
  111.                 }* N  m& i8 v. {7 R
  112.         }
    0 l. `( l2 f# l" s2 K6 ^
  113.         if (writeparam(mac, stbid) == 0) 6 S  Z5 b9 c0 @/ Y5 q; R
  114.                 printf("Parameters changed.\n");; L$ N' [4 P+ q. l
  115. , N# |/ k( u& v. B( }; c( _
  116.         return 0;4 A# r4 e- c% D# l
  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
8 |+ l$ z( \$ L6 I. J在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

- D. g( q1 a" h. Q你用的编译命令行格式是什么?8 b5 F1 X, |0 b( V/ P( {
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

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