找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15637|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    0 m7 K% T, l) j" D1 k+ I
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig& z& u5 b) ]& a: E6 x
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
- w0 f/ H7 _; Z- e- Lusage: himr <address> <value>. sample: himr 0x80040000 0x0) J- a+ q2 h( r; K. N. |& g

8 P8 J. @* J/ P
/ U" b$ [. O7 ~8 ]# T# i& X不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?, x7 M& E- F3 @7 |

3 _0 ]4 U. a# P* x补充内容 (2012-3-8 09:42):2 Y& z2 n1 T  o) [$ @0 _
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
$ k# Z+ _! e1 D* |/ A' j% y这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
( A( S3 r0 `" h( Z6 F. ~- a" c% z! W% f& L+ |! @0 {
himr <address> <value>. sample: himr 0x80040000 0x07 @3 B" L( v5 I  @' ?. x/ G
* o* g, p) M* {& J- q# C
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。* e4 {. l7 r/ E3 p4 N* A
himr 0x80040000 0x00
/ Y' {3 `, `; |# E. D6 H. b1 x  @himr 0x80040001 0x11
$ Y& J; I3 ~/ Qhimr 0x80040002 0x22% z5 N7 l- k* c6 T
himr 0x80040003 0x33
1 M1 K) a8 z+ b! y+ p6 Ehimr 0x80040004 0x442 y* D: |0 B* y8 W  o
himr 0x80040005 0x55+ Y( B1 O( c1 X" _
8 r( F) ?' D' P: l5 H
SN也是类似。
6 B# ]. V+ i5 r3 j+ h; F4 G& m$ N, \9 p
现在主要是,谁告诉我们MAC和SN的地址?9 M, {- K% A; F5 O( w5 ~% [* Q
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37   w  Z& e5 p- V& ]
一直想找到运程修改MAC和SN的办法,苦于无解啊
8 |: ~  O' A$ \+ _
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
& x6 L$ I6 a2 m0 @# x% _8 J& `; x
. U6 \: j1 W6 \0 i/ ?% ~7 o修改的代码早有了。到今天不会编译。" J; ]' U1 U0 s& c1 t* T
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    . L+ B/ g/ U3 c8 a& S3 ]' J5 @
  2. #include <malloc.h>
    ; p1 s  y/ P$ K) A8 Y
  3. #include <sys/types.h>, o2 D; n6 v; c
  4. #include <sys/stat.h>
    ' ]( B# r' R; I$ k7 \+ u0 A+ l
  5. #include <sys/ioctl.h>! }7 X+ N: ^" d: }# N
  6. #include <stdio.h>) X* R; Q  e  J2 ]; p( M4 q- v/ T( I, E
  7. #include <string.h>
    4 l8 x5 c5 h! ~& s8 a

  8. 2 U' ]  P% U/ w
  9. typedef struct {) p" u' i# d( q* X3 p! b
  10.         unsigned int        e2prom_cmd_sub_addr;
    " }  ~9 c& C, O1 k6 Q+ `
  11.         unsigned int        sub_addr_count;
    0 t8 a% {( [' `3 ^5 d
  12.         unsigned char*        e2prom_cmd_data;1 ^8 g3 F' A0 z+ z
  13.         unsigned int        data_count;! S" _; o$ }" D5 \2 I
  14. } e2prom_s_cmd;, w2 r1 d3 [( k
  15. 4 n' [( {; T, ~# r" l
  16. #define E2PROM_CMD_READ 1) G" O# m) ~  ^! }1 i4 C
  17. #define E2PROM_CMD_WRITE 2
    : K7 {( B" O  R2 C/ R
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"" u& }1 V0 [( h% O

  19. # x3 x, T6 Z; A* h% F- ?# k/ H( ]
  20. static int readparam(unsigned char *mac, unsigned char *stbid)4 p' \7 i& |6 ~8 n5 t
  21. {
      g6 T1 W' p( j+ l  p
  22.         int fd, ret;, R0 G& @$ b* {" x* W' Z/ _
  23.         e2prom_s_cmd arg;
    " H. [7 q! g9 S4 G
  24.         unsigned char buf[0x18];
    ' F  h# T6 L7 D5 }  b, z, y# y

  25. . w# T; x- ]% S- I5 C- u1 X% l
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    1 p9 ^' W" q  w. ^- R
  27.         if (fd  < 0) {
    8 e( r6 k) L8 R/ S0 n; G
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ! a) w7 E9 Y  C! Y
  29.                 return -1;
    ' Z: O8 o8 L; J3 J2 H; U2 r2 I  X; L
  30.         }
    / y+ e4 h$ Z" ~' d9 ~5 V. N. a
  31.         arg.sub_addr_count      = 2;. r3 V# l7 {7 Y3 ~" M
  32.         arg.data_count          = 0x18;1 p: o' A+ D1 o6 b9 d5 A
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    - t$ G: _7 n1 z; j/ b+ ]  X: q
  34.         arg.e2prom_cmd_data     = buf;# x) v0 T+ ~$ r/ K
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    - {( E' H) Q8 D# `
  36.         if (ret != 0) {. i- }$ V+ ]  v, X# i0 j
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    # u* h8 D0 q0 J3 V* t
  38.                 return -1;9 o5 ]* ~0 q# h7 O
  39.         }1 z6 H% W' f( @# e) l5 x" g
  40.         memcpy(mac, buf, 6);
    & e( w3 F: {! ~0 q
  41.         memcpy(stbid, &buf[6], 18);
    ( B7 Z( {1 o) S
  42.         stbid[18] = '\0';
    * ^0 h, c# M: }
  43. # @, x. g8 r8 T7 \
  44.         return 0;% I- ^0 n. b) r) l1 z
  45. }
    0 ], a! F: P0 l4 E, x+ s5 Z

  46. 2 W$ w+ {! T; Z$ F' r8 t" D" U. Z
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    ; {% p! G  `* W( O. h
  48. {3 u3 t( w5 d2 ~
  49.         int fd, ret;
    * R3 b* C  x7 a, i: l% }
  50.         e2prom_s_cmd arg;; E3 o5 U6 [) O, w- x) \) u: I5 _  G; h
  51.         unsigned char buf[0x18];! q4 n# w; R0 ]7 l8 f( O5 f
  52. : z, N' D: m/ u
  53.         memcpy(buf, mac, 6);
    : C4 _# P: ^3 D6 v
  54.         memcpy(&buf[6], stbid, 18);2 A- }- A1 m! z; j
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    * g  r2 W  I& ]# y/ a0 n+ V7 r: ^
  56.         if (fd  < 0) {! b1 ^% f3 b5 ~
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    6 j6 ~: z" ^" |: S* V7 u
  58.                 return -1;
    + q% x5 p# U; R' {1 ?  W
  59.         }
    5 i0 x8 Q* u+ v; W# o8 Z) K
  60.         arg.sub_addr_count      = 2;
    : m5 Y! R7 |9 z3 S; q
  61.         arg.data_count          = 0x18;
    + a- X9 O8 n# c' y& K% k
  62.         arg.e2prom_cmd_sub_addr = 0x290;! K$ e  X$ a3 x  x; S) H( [
  63.         arg.e2prom_cmd_data     = buf;
    * J6 a' K! U! {* K. ]
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    & ^) k% ?$ q! R* A) C- o5 E
  65.         if (ret != 0) {
    ) `/ H- K. _, N: t( y- C4 f
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
      c' j7 H* Y7 m' H
  67.                 return -1;  H$ T1 w8 r& l. d8 u7 V
  68.         }8 d3 O8 t! I3 I9 `2 C* y  V

  69. ! T! I8 D9 b# E7 e7 T# e  U# ?
  70.         return 0;1 H8 r# f9 M# A  k
  71. }
    + X2 ]$ _8 `* H' v

  72. & N7 j2 y. U+ f
  73. int main()
    9 \/ D+ ?5 l/ h5 b' p; T" G& K
  74. {' I4 O# G. t$ b5 r
  75.         char c;
    ( r; B4 _2 g9 P7 U! d1 ~
  76.         int i, macs[6];
    " @. l3 j' v: D6 S
  77.         unsigned char mac[6];5 O. K# y# a; s" y
  78.         unsigned char stbid[256];
    1 {& B9 w) ]! _: Y

  79. # F. d6 s7 r+ b: d# I5 N- t! f. b
  80.         if (readparam(mac, stbid) < 0)
    ) l7 h& F' U7 X6 O5 w4 w2 i  D/ R
  81.                 return 1;
    0 l/ d7 _) }3 X) `

  82. ) |! V1 {; Y+ i8 p* \) ]  `
  83.         printf("Current parameters: \n");' D' f+ W* g7 U3 B3 n. X
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);4 L4 [: ~* ?! M0 W2 Q
  85.         printf("  STBID: %s\n", stbid);
    ; i) m* u. ~8 T- l/ w- r6 [/ c
  86.         . g2 u$ t3 j2 K1 A4 v! u1 r) G
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    : E0 k  i3 ?2 w; M- v
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    5 L  y& d: n) Q" w# J9 T8 U4 F
  89.                 printf("Input MAC error\n");& H: C: A1 f  L$ `0 T/ e0 Z
  90.                 return 1;
    : \+ x' f6 O8 h
  91.         }
    $ `0 r# h2 X6 ?2 n/ Z! n
  92.         for (i=0; i<6; i++)mac[i] = macs[i];  n. Q+ D) }9 P( t' b
  93.         printf("\nPlease input new STBID: ");. g! S) {+ T+ }% l& J$ H
  94.         scanf("%s", stbid);
    8 T6 ~9 w7 A  M" K' ~4 {3 t
  95.         if (strlen(stbid) != 18) {
    # ~" p( p: S' E( o- c
  96.                 printf("Invalid stbid\n");2 W6 k8 w4 Y1 M4 O5 X! z  h1 ^
  97.                 return 1;% D& r9 n% ?; m4 H# b, b
  98.         }! Q: O3 _% C' }) v. z
  99.         printf("\nNew parameters: \n");" q0 I; H9 g4 y! [
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);+ Z' u' u# s/ l1 P
  101.         printf("  STBID: %s\n", stbid);
    ) f% t# b  a& }* r' ~

  102. / T/ M" Z5 j1 Q4 h+ F) z4 h# I
  103.         printf("\nDo you want to change paramemters? (y/N) ");  ]$ U4 G' V) _4 L) D
  104.         for (;;) {
    1 ]* X! u& _7 V) D, L
  105.                 c = getchar();$ V8 f, e/ J' ]6 E$ z
  106.                 if (c == 'y' || c == 'Y')
    3 |  O3 X. n' I5 s8 m8 N
  107.                         break;' A( T+ J1 {. a; L# n  a" t4 B& D
  108.                 if (c == 'n' || c == 'N') {% H8 k  n6 d4 ?" ^
  109.                         printf("\nAborted.\n");  b. y0 _* Z5 b$ `- z1 a9 ]
  110.                         return 1;
    % `/ b( I7 |" k2 G1 j2 q2 d6 @! j
  111.                 }. R0 p: n' T$ s! |/ v
  112.         }( M+ }3 P4 J4 n) ]7 \
  113.         if (writeparam(mac, stbid) == 0)
    6 `: h& @3 J# a
  114.                 printf("Parameters changed.\n");
    9 x: R9 Z2 q' `

  115. 7 v; B' h) Y' H2 ?! q; ?, B
  116.         return 0;) c/ S+ V1 B+ U
  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
& B1 f* a3 p( `/ y* s在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

$ n( b3 ?$ u0 t' T你用的编译命令行格式是什么?
" `: w) Q5 ?; L6 O
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

Archiver|小黑屋|宽带技术网 |网站地图 粤公网安备44152102000001号

GMT+8, 2026-2-21 00:30 , Processed in 0.024613 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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