查看: 16003|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr$ W# _2 @. D. G( Z1 G
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    0 o+ [' b( O0 c0 ^- h2 s4 X
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
, q0 Q: K% P; I5 j. R5 J% \usage: himr <address> <value>. sample: himr 0x80040000 0x0: I+ S/ [8 n5 a9 w; L
+ O% [8 U. @+ H  X8 K  \
$ K+ q/ \6 |1 N% s& ~
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
- u. {+ P: }+ Z, }  Y- v6 {4 u8 J6 d, `. C9 N/ S4 u
补充内容 (2012-3-8 09:42):1 F- B. v% X& ]4 g% O
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
3 o' I/ V* I, `% H; p) P; a这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。) i( q' N+ i) P$ _
3 R: m4 U, U# m9 r. P$ D* E- L3 z$ M$ A
himr <address> <value>. sample: himr 0x80040000 0x0: A* n/ |% H+ F! V

5 t, I, B4 p; `3 j2 D) Y例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。/ L" N2 g, Z# O+ m  M0 d- t6 x
himr 0x80040000 0x00- H1 M. z8 K6 u# G) w
himr 0x80040001 0x11: a+ ?+ R8 ?$ x8 G, m
himr 0x80040002 0x22
$ V8 }' G6 \" f/ m" k& l5 [himr 0x80040003 0x33
5 t! m% b' ?+ x6 a# F0 I( S% jhimr 0x80040004 0x44  F/ z2 U( x& T& ^/ n- S6 S& M) r
himr 0x80040005 0x55+ r, n# W- c" Y6 j, }  i
  F' B. ?1 k) z" K$ F. A
SN也是类似。4 X% @, D* g, ^/ |3 d) ]% T

, k6 q6 J3 J& P) z% Y现在主要是,谁告诉我们MAC和SN的地址?) B8 }. p$ T* v& z" c# h
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
. ^9 ^1 \3 Q. U; U3 i, e一直想找到运程修改MAC和SN的办法,苦于无解啊
6 M/ H0 _/ E+ v5 q2 L
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
( J- C* l( u% ~& n/ @- k% }6 f6 ~! h/ {5 p8 y# H2 R
修改的代码早有了。到今天不会编译。
0 F& F( q$ N. x5 ~, v需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    ' }7 [/ k* A" d# M2 V! G4 v: s
  2. #include <malloc.h>
    & x0 ]- E2 D: L( J) B* x+ Z
  3. #include <sys/types.h>9 W' W) V: e/ Z. W- n
  4. #include <sys/stat.h>. J; H4 T" f& |) o7 @3 B$ D
  5. #include <sys/ioctl.h>
    - ?6 m# q7 K: L" F: {
  6. #include <stdio.h>
    9 n3 o6 B" H- t- @4 h
  7. #include <string.h>+ L# ]. f9 T6 h: s' F# X1 A
  8. 9 p( N! J+ v9 K9 j; p( ?
  9. typedef struct {
    $ {. D# B  m" P. N
  10.         unsigned int        e2prom_cmd_sub_addr;- N; [5 K8 g) g
  11.         unsigned int        sub_addr_count;% _& _* B" m. O- R; H* C) ]
  12.         unsigned char*        e2prom_cmd_data;
    6 m) j7 n3 W3 n6 u+ z( t7 }
  13.         unsigned int        data_count;! o1 I$ \1 e* o7 I- ]" G) X. s& |0 W$ j
  14. } e2prom_s_cmd;
    5 M' L. R1 o: ~5 h  ?9 V
  15. + D* X' c" ]" z/ g4 ]4 J
  16. #define E2PROM_CMD_READ 12 ^+ w! ~) l& @+ ~* ]8 ]' Y, X
  17. #define E2PROM_CMD_WRITE 2
      s# ^& \! E* m) V2 s3 E/ R
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    8 F9 y) e/ I# D2 G

  19. + Z: l1 g/ e; U+ V8 s0 X8 O+ x% w1 g8 I
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    & }$ W4 h/ N; e1 u' Z: s# s
  21. {
      d; N. R- @2 N8 D. @% V9 {+ Y
  22.         int fd, ret;2 [/ a; {/ S+ {  F
  23.         e2prom_s_cmd arg;8 |# G! Z! q( @* `) @$ R
  24.         unsigned char buf[0x18];
    6 U) o7 D- B4 U3 i- Q: i' s

  25. ( R/ v% r0 F0 h. Q  p
  26.         fd = open(E2PROM_DEVICE, O_RDWR);* n7 z* y0 R7 V
  27.         if (fd  < 0) {
    , L" i! m1 _1 y- ^5 h5 v9 |  `
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    $ G( R# Z5 A' p3 J4 b9 J/ _
  29.                 return -1;
    % W& }1 p: H7 N( _% B0 n
  30.         }; U1 `/ e  j  j* y, Q* O
  31.         arg.sub_addr_count      = 2;  B" F9 n! t  A9 S( O  W0 X* l
  32.         arg.data_count          = 0x18;) k4 Q0 @2 R3 D2 ?
  33.         arg.e2prom_cmd_sub_addr = 0x290;# V; m1 q/ Z; k9 ?
  34.         arg.e2prom_cmd_data     = buf;
    ' h+ }) \- ^0 \3 Q1 P2 L- B
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);& s2 ^; v/ O$ Q! Z: H6 c
  36.         if (ret != 0) {/ j. V3 u: U' w! _1 j
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);8 H. y: t2 d5 |% a+ d
  38.                 return -1;
    + ~5 b: E, r" d9 [4 K) B' l# g
  39.         }
    0 ]  ]" e* d- O7 Q7 {  X0 a
  40.         memcpy(mac, buf, 6);& G) H4 p* z2 O3 r( O
  41.         memcpy(stbid, &buf[6], 18);2 R& r3 S$ ^) K8 t
  42.         stbid[18] = '\0';) @& q/ ]! m6 @8 n! ^$ o$ @2 U# |
  43. ! T: H) b5 e4 }9 K8 V
  44.         return 0;( N( l/ p( e' y9 D% _2 h# O
  45. }9 D) [$ b8 _; w& O7 ?

  46. , v; p: D7 s2 c7 P7 K5 k) A
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    % c6 I+ B4 W0 v& q7 N: W  E7 p
  48. {
      F/ R; l7 c& O+ }  \
  49.         int fd, ret;0 I) M$ W! b: F) Z* f0 _' \" a/ f
  50.         e2prom_s_cmd arg;
    / o9 e% i2 o; V' N
  51.         unsigned char buf[0x18];! L3 A* X. \4 O  p0 b$ B& c% u! o

  52. 3 s1 P2 o, X' V  V6 X4 W
  53.         memcpy(buf, mac, 6);
    " l+ q4 ?( |, h: V3 D7 {
  54.         memcpy(&buf[6], stbid, 18);
    + K0 y* ~! u! [6 u7 [7 h2 X
  55.         fd = open(E2PROM_DEVICE, O_RDWR);5 K0 P: B! s0 h/ q' t/ h1 e! G
  56.         if (fd  < 0) {
    ; h* j0 l$ H9 v' I& D6 I" s: E
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);$ e( d. D# V) t3 J
  58.                 return -1;4 \7 w  F5 \3 q: ?8 \2 C
  59.         }& X, t" t3 |: I% x4 @# P
  60.         arg.sub_addr_count      = 2;; D0 f0 s1 W4 Q  ?( Q! }$ _7 }
  61.         arg.data_count          = 0x18;
    , X) ~9 `* V, l3 e4 b- z4 h: V2 [% M6 Y
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    6 c' b: Y& c  _( v
  63.         arg.e2prom_cmd_data     = buf;4 w# x6 g  }% S4 }& E8 s. V
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    * B$ U$ G5 P- y$ }6 a
  65.         if (ret != 0) {
    * b" j2 K7 c6 K0 @+ p0 g9 }# Y
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    4 d) g2 _, H$ j2 H0 f- }
  67.                 return -1;5 a  {. Z. |( @0 I. b
  68.         }
    $ k0 E) L5 f0 ], O2 [2 X8 y

  69. ( |$ Y- n5 R8 g
  70.         return 0;" \5 ?8 ]& Z- ]& B4 V; H+ K+ F
  71. }7 T2 E# }1 }* _2 B2 \: N2 h

  72. , B1 Z/ Z8 K& O9 O* a6 P. q
  73. int main()
    + c. _( H) l- r) ?' }
  74. {* ~! v+ k# ~- J% }3 W
  75.         char c;
    4 W  K, s6 W. n( P4 _
  76.         int i, macs[6];
    1 q& z. @6 I4 E* O% E) J. o
  77.         unsigned char mac[6];( O! W/ p4 J  z  T, h7 e9 `) |
  78.         unsigned char stbid[256];0 }, n0 x2 Y+ M
  79. % r4 k' B% ]* l* u0 s6 Q
  80.         if (readparam(mac, stbid) < 0)
    . M9 \. k( ~$ @( S3 I  W" W( X
  81.                 return 1;
    # Z2 c! Y6 o0 _; o4 ~" I
  82. ; Q+ `0 B  L1 N. T* k: ?# d; R( C
  83.         printf("Current parameters: \n");: J- w8 f7 s: E& X. W  F6 q. z* K
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    + ]8 E3 N2 [: `* K
  85.         printf("  STBID: %s\n", stbid);/ B. f5 u) Q3 F* q1 H2 E
  86.         0 ?- I( J% F  _' Y& n1 T
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");. t7 h1 x7 }8 U! m1 `) {
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {9 X3 f: {2 T$ b9 a1 O  Q
  89.                 printf("Input MAC error\n");* `4 S$ h9 V5 ~/ K: Z
  90.                 return 1;
      ]; v0 n$ g# O: J2 a
  91.         }% s0 C# r) J! J$ Z! G
  92.         for (i=0; i<6; i++)mac[i] = macs[i];  S+ O% y9 z7 E& u! B' m7 Y' o
  93.         printf("\nPlease input new STBID: ");
    0 E. g3 f  U+ t- M; r9 w
  94.         scanf("%s", stbid);( z: v" q# V  U+ L
  95.         if (strlen(stbid) != 18) {- v  L! q3 Z- b
  96.                 printf("Invalid stbid\n");3 }+ r0 X7 }* o4 ]1 q
  97.                 return 1;
    1 S' x5 y" c  V; O' _# f9 t9 P  x. l% B
  98.         }
    ) ?8 k' w( o& A2 H6 O8 G" K3 t
  99.         printf("\nNew parameters: \n");; j4 f4 J& G7 i/ p7 w
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    - u" Q" Z! k0 f6 y; }. m
  101.         printf("  STBID: %s\n", stbid);& K$ i# ?* d4 c' l! @8 U4 S/ ~

  102. 0 B" w  x2 u- z5 u+ V* _. g! d0 S
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    5 `6 f0 ]7 I" H: }- E8 O
  104.         for (;;) {
    4 B" c5 j1 S( ~7 e( v1 v
  105.                 c = getchar();2 U9 V( l9 T3 L1 f0 q! n$ ^
  106.                 if (c == 'y' || c == 'Y')* g! D* v6 B7 P7 n4 V
  107.                         break;
    & l/ q+ f7 @* f& O1 b7 u+ @
  108.                 if (c == 'n' || c == 'N') {" C/ g5 s0 F3 F
  109.                         printf("\nAborted.\n");
    + ?& w2 O' E# z
  110.                         return 1;( f( {) O3 ~! @
  111.                 }
    9 R# w4 l' e+ n  Y5 j$ H7 E
  112.         }/ `: {2 s% s! h# l$ A4 Z
  113.         if (writeparam(mac, stbid) == 0) + M* q1 Z; q/ Q' o: }  H
  114.                 printf("Parameters changed.\n");7 e$ F; ~4 m5 ?4 _2 S

  115. 1 a; i* H. y0 K
  116.         return 0;
    ( U* c1 C- \  c7 Y+ e4 l! f" 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
8 x9 n* Z) M. M$ T% ~; j8 J在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

' m; I3 ?8 \  p7 u你用的编译命令行格式是什么?: Z' D2 X- ^* c2 b1 i
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

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