找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15605|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    9 C0 J# y/ H' a: c, P4 P+ s  u
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig, C1 {- s5 T( L
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:2 r  ~. N4 A5 G! {
usage: himr <address> <value>. sample: himr 0x80040000 0x0
" u1 H( }6 f' D5 {% u9 W( q  n. E& R" O0 b/ B: g
  I/ O0 s. A& H
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?* _5 P# q+ v, b! I; _
/ V9 s; ?. F1 h* m5 w$ a, [
补充内容 (2012-3-8 09:42):
0 r' w3 r1 }, }  ~. J5 D: }http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数6 w' j2 X: q0 [4 Z
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。+ k" G. {; ?) e+ F( _: \

! ?2 `  ^+ [- P6 `. mhimr <address> <value>. sample: himr 0x80040000 0x02 |6 q0 F. V) W3 Q/ @

2 P% [2 k- m# U* R/ a例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
* Y5 y" i( ^, y, Y7 g3 j0 U  vhimr 0x80040000 0x00' W" o3 H+ v; [8 X% W" ?
himr 0x80040001 0x11* E7 {! r, Q; g3 |/ p
himr 0x80040002 0x22  ^1 Q% z- p* ^7 V
himr 0x80040003 0x33
1 Z+ B0 e+ \+ rhimr 0x80040004 0x44
2 S: n* I$ z5 X$ \: G/ hhimr 0x80040005 0x55
  I) G; H5 n4 z4 Z) G
7 s; g; u1 m" Q) N2 NSN也是类似。3 s; P. z) @: f/ c+ M1 {
! }6 R2 q1 t; P+ y. ^# L/ F( v
现在主要是,谁告诉我们MAC和SN的地址?: |; ~/ M- E; G3 K! }
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 2 W& c! ^3 a7 U! J0 e
一直想找到运程修改MAC和SN的办法,苦于无解啊

) B/ m) q2 [7 q源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
1 E8 q( v0 C8 H/ p& I
% A& }7 |% `) c- T修改的代码早有了。到今天不会编译。
# I+ u: s9 l* x& `1 P4 x需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    * w* f% L- _3 x6 y& h
  2. #include <malloc.h>4 _  S( M( b( d! J5 n2 b
  3. #include <sys/types.h>1 C8 ~8 V2 g5 v
  4. #include <sys/stat.h>
    1 R, N6 l# m! K$ W9 i, u4 n
  5. #include <sys/ioctl.h>
    ) ?0 w! \' `/ p  x
  6. #include <stdio.h>) j$ `: f* J# ~$ _% |
  7. #include <string.h>1 C0 d* }4 Z* S* ^
  8. 5 A5 s( T2 y9 s% _6 E7 p5 [) P
  9. typedef struct {
    ( Z* a1 \+ p) T4 i
  10.         unsigned int        e2prom_cmd_sub_addr;# f; J3 U, D' {: O8 ?
  11.         unsigned int        sub_addr_count;
    8 w& C2 H' W! d4 b
  12.         unsigned char*        e2prom_cmd_data;
    + x. Z2 o/ m7 a
  13.         unsigned int        data_count;
    . G# h/ Y: c2 }1 v3 ^, U
  14. } e2prom_s_cmd;
    ! o; r8 F  M3 s, Y9 G

  15.   Z3 \$ k0 p* f  Q  g
  16. #define E2PROM_CMD_READ 1; `- K! _+ G7 K, z
  17. #define E2PROM_CMD_WRITE 2
    5 y8 s* r% N6 {0 t; V# d6 p9 l8 V
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    4 p/ \8 S. [/ [% `

  19. - I6 v% `% p8 K) q4 q) S
  20. static int readparam(unsigned char *mac, unsigned char *stbid): e$ c; n( S0 l, L, R  r
  21. {
    " M; g0 ?3 @: J1 F" f. w' _# I
  22.         int fd, ret;% Q" [9 n7 k, n: p! _+ y
  23.         e2prom_s_cmd arg;0 f) S# h% x+ O4 {  {- U
  24.         unsigned char buf[0x18];
    ! h( ?, L- S# D+ t7 O* V
  25. $ Q) c$ C$ a, X5 ?. [
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
      R% N; O3 _" b) E
  27.         if (fd  < 0) {- [0 l$ a$ D( ^  }7 m
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    7 o8 u& t" M; c/ v& ?
  29.                 return -1;! ^  w% Q; X6 Q
  30.         }# }2 A. g0 N9 ?8 n5 F
  31.         arg.sub_addr_count      = 2;: B; z- a+ e. a" ~7 u1 X! u- ^: d
  32.         arg.data_count          = 0x18;: e+ i' T8 g* U1 J/ b' j/ H
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    2 [+ A( D) [" G) \0 a
  34.         arg.e2prom_cmd_data     = buf;
    , X" z+ S1 \+ N0 N8 g  ~6 ?
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);4 h' S! L0 A1 S  U
  36.         if (ret != 0) {) s# ]( N+ z6 \2 R
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);6 X- \0 X) o$ C) H6 q
  38.                 return -1;" e8 K  b& Y4 I
  39.         }; E' C8 U* D  E, n
  40.         memcpy(mac, buf, 6);2 [5 e1 d$ Y+ d
  41.         memcpy(stbid, &buf[6], 18);
    3 y$ S. R# m  d# `: h8 D% G+ q
  42.         stbid[18] = '\0';1 k; U9 i% h- e+ a& u
  43. * O- F2 I5 ~2 s
  44.         return 0;
    7 ]) h) C7 {9 s- u2 m
  45. }
    5 y; n: H0 d& [; r: r3 _" W

  46. 9 F  [2 q9 p! y  K5 \9 ~8 f
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)0 d+ U+ K7 n6 R: |
  48. {) ^2 m, Y2 T6 B3 g, q  R" a
  49.         int fd, ret;1 g8 b7 P5 H( @6 Y. A8 K
  50.         e2prom_s_cmd arg;
    4 Z( x; H0 k& I1 P; v5 q7 d
  51.         unsigned char buf[0x18];
    1 W: Y& M7 D8 R3 Z  Q- ~

  52. 7 C  H, h2 Y+ g
  53.         memcpy(buf, mac, 6);; H. |- @+ d$ G* k
  54.         memcpy(&buf[6], stbid, 18);! ~2 p' A& k" B# I4 p
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    , t) e! U: j0 I. _8 F( W3 i
  56.         if (fd  < 0) {
    " Z2 f6 p' p0 q: I3 V1 F8 b
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    , {1 ]" n# }% L. p! o: |
  58.                 return -1;
    + e& C5 h, z  D  r. n5 S# X$ K
  59.         }
    - {0 C0 W0 l( x3 a- U
  60.         arg.sub_addr_count      = 2;1 B' Z( Y5 G8 K  v6 B4 ^  t' k
  61.         arg.data_count          = 0x18;" {6 E. z7 `& d4 ^
  62.         arg.e2prom_cmd_sub_addr = 0x290;4 g: X$ V) i5 J, {7 [& C9 K. ]
  63.         arg.e2prom_cmd_data     = buf;- y7 [' W) V' D5 F. a, Y& @
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);, N2 ~, L) Y' J: \' T) w' G
  65.         if (ret != 0) {# T3 Z3 h  ]( K" W3 g
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    3 q! [) T! g7 H- `1 Q  ~. q
  67.                 return -1;
    2 |7 B2 ?' y4 [0 _6 b# f/ B  G* H
  68.         }* p1 X6 ~' _. j) j$ U. o: ~4 w

  69. 8 }, R0 v! B$ X: P. u. i
  70.         return 0;
    ' S1 V6 i6 |& M) |# i/ A
  71. }8 `) x" ^1 a8 B( L. v3 {  F
  72. % c8 ]$ o4 a6 [9 \+ f# Z, l
  73. int main(). V# S  k4 ]) v" r
  74. {. {1 N4 N6 s3 j7 i( O
  75.         char c;) N' Q1 [+ c) A: T
  76.         int i, macs[6];, L# [& {; W; O3 j- M' e) w
  77.         unsigned char mac[6];
    5 `; X; k) _; H% f$ f' v
  78.         unsigned char stbid[256];
    6 c6 v& s" T4 P! c

  79. , N5 w0 L4 h7 x) L! A2 T( W5 y4 I+ e
  80.         if (readparam(mac, stbid) < 0)) ~" U/ N3 Y0 x9 K2 d# T
  81.                 return 1;2 Q! M. q- T$ i8 r; h

  82. ; Z) A. J. L( \
  83.         printf("Current parameters: \n");( \1 ^. @% M3 |* J' g' m
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);3 _. j  O+ t: a; K
  85.         printf("  STBID: %s\n", stbid);8 p* u$ m8 t, k) N. P* `
  86.        
    $ Y  F5 \9 `, g- |
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    $ {8 P! p/ n( w5 ]6 l
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    ; A9 k: m5 i/ K
  89.                 printf("Input MAC error\n");
    ( ]: S* o0 Z) u, }
  90.                 return 1;1 u, T! {' t1 G- d! Q0 y1 e
  91.         }/ K8 R/ q$ G* E7 K5 n2 U' I
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    6 j0 H9 U4 c! }: s8 G
  93.         printf("\nPlease input new STBID: ");
    . Q: t+ w% K2 R5 v
  94.         scanf("%s", stbid);  Z' Z/ S+ j& U- Q; {
  95.         if (strlen(stbid) != 18) {  m: @2 p& s7 R
  96.                 printf("Invalid stbid\n");: b6 G  c* |: F
  97.                 return 1;
    3 T% ^% ~# l- G' U* w" ]
  98.         }4 l+ D/ H* J2 n
  99.         printf("\nNew parameters: \n");) o" T4 G, }$ ^1 O6 t" @% d  K
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);$ w3 L# r3 ]6 {. f( A4 ?) f5 F  o+ ]+ ?, e
  101.         printf("  STBID: %s\n", stbid);
    . A+ s9 n) `9 ?# M+ e
  102. 0 F8 E* }; t8 s& G
  103.         printf("\nDo you want to change paramemters? (y/N) ");* A7 J6 g1 X$ {" v" x9 D( [
  104.         for (;;) {. U4 {2 ?0 z9 D4 P
  105.                 c = getchar();5 F9 a$ z+ V- m3 _& p
  106.                 if (c == 'y' || c == 'Y')
    0 s: {8 S- t  N, w1 |9 l9 Q
  107.                         break;/ j: ^2 N7 |$ N: H
  108.                 if (c == 'n' || c == 'N') {
    2 l/ A, J% ]1 r4 [9 B
  109.                         printf("\nAborted.\n");" o) w8 _2 r, j1 M1 t
  110.                         return 1;8 m# K" J  f. d. o/ Z$ W
  111.                 }
      F4 R5 k0 x% l$ o
  112.         }
    ) S7 _$ v9 E2 V2 [7 M3 |6 B
  113.         if (writeparam(mac, stbid) == 0)
    - Q! a" [8 h3 C+ D- h- a' o( L! a
  114.                 printf("Parameters changed.\n");
    * I) r* O, `: x8 i9 O. m/ l' j

  115. * f9 p" ]- C. Q5 u0 ~1 T
  116.         return 0;& \2 B& h6 ]) S7 h$ e, ]
  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
! W; q, B; ], _6 e" D9 ]& Y在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

. y4 O' e& j- Z3 J% ~7 v/ L你用的编译命令行格式是什么?
2 b) L0 R3 Q2 H/ a
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

GMT+8, 2026-2-17 15:50 , Processed in 0.024037 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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