查看: 17700|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr$ O/ \+ |. Z1 v* l
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    9 w8 Q* F' L( I7 d8 n5 e8 W
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:* e1 a' h  G. X. h
usage: himr <address> <value>. sample: himr 0x80040000 0x0. ?( R  w" H" J, ]  X: ?' b
- M5 j+ n9 O0 ^* v

$ p! x5 [, {. F不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
6 L- p3 X4 z  a- K5 L9 g1 O3 W( M) ~1 @& d% r  W
补充内容 (2012-3-8 09:42):% j! g; T! `8 T* ?+ _8 ^
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
. g# F$ t3 h. @! p5 J- R$ L这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。
/ |) z7 a# o. W4 z: w% S
& m- g/ g4 Q% e9 g! Whimr <address> <value>. sample: himr 0x80040000 0x0' l0 i  x; f2 L$ t
) h  ~& O; l# g8 |" E! @
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
. ]$ y9 D+ F8 H& H+ E" }" g! Whimr 0x80040000 0x00
$ \2 [/ n% e9 |+ a* Z4 V* Nhimr 0x80040001 0x11
7 x" P" z- s/ G( [  T$ @himr 0x80040002 0x22
3 b- ^4 f% F2 Xhimr 0x80040003 0x33
' W- Y, u  ?+ fhimr 0x80040004 0x443 g* ?4 e0 v2 K! Z) K
himr 0x80040005 0x55) I* S) k+ G# v* I. k8 f1 h; y9 u
2 f# k: t" E! a# P* e7 a
SN也是类似。
9 l, g; Z0 r; F$ a4 p
+ x, h2 H8 L1 W* b现在主要是,谁告诉我们MAC和SN的地址?; G* A2 H# g% r3 Z$ N2 B
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37
8 V6 ~( O$ P  K7 v8 Y( E一直想找到运程修改MAC和SN的办法,苦于无解啊

1 i2 u/ N- c$ [. @% A源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 ( T  v1 m: c" W" l2 [- P/ C$ j" ?
/ ~* k. u0 }( b+ O
修改的代码早有了。到今天不会编译。- o7 a' ?8 A9 z1 U0 j
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    . Y/ X" q0 m: |( _- P1 q# t/ W
  2. #include <malloc.h>' c! l8 l/ O+ G' @
  3. #include <sys/types.h>' ?$ B; R! @' U& s$ l
  4. #include <sys/stat.h>
    7 {: G( _4 v1 q" o+ Q
  5. #include <sys/ioctl.h>
    % k$ v- k) E% d0 k5 z# x0 ~  o. G
  6. #include <stdio.h>2 f* ^1 B* J( N  v- V' V
  7. #include <string.h>
    ) R1 P. Q( s# N8 Z( B1 @, h+ [1 \# M/ m
  8. & w% c/ _# N  o& [" s* p
  9. typedef struct {
    , R: i$ V* v6 {5 U6 X9 }$ K- W
  10.         unsigned int        e2prom_cmd_sub_addr;2 e7 |' Z: W2 w9 L! R
  11.         unsigned int        sub_addr_count;
    * o) w0 q$ l/ `2 O5 j6 N
  12.         unsigned char*        e2prom_cmd_data;
    ; B( @4 Q8 \+ Y+ V' R# Y
  13.         unsigned int        data_count;
    1 i: c* _5 E6 e4 Q6 r, B
  14. } e2prom_s_cmd;
    0 `, J! t& T5 G) I1 j3 }
  15. ' s6 A1 A1 M' K4 k  |, Q
  16. #define E2PROM_CMD_READ 1
    ) P$ b: y* J% G( b$ V: y- ?
  17. #define E2PROM_CMD_WRITE 27 q8 R8 j  d! S& i9 m
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    & }& o9 v1 R) \
  19. : o! j+ ^' q# L- o4 z! Y
  20. static int readparam(unsigned char *mac, unsigned char *stbid)- F" C' ]1 j7 {5 f
  21. {
    9 `1 N3 y& ]8 M8 L0 K
  22.         int fd, ret;
    8 ]" k6 J. U/ m! V; R
  23.         e2prom_s_cmd arg;/ N/ _( @6 x' ]# v! O6 u6 Z$ B
  24.         unsigned char buf[0x18];
    ' q& I: `, V5 v: Z" U2 l
  25. # ]0 ]- w5 T  {1 d/ _: ?
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    + M8 s$ {+ U' u$ d# M- V
  27.         if (fd  < 0) {7 t. I; C6 Z2 _. b+ I! x8 v; R0 v
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ( x. @, o5 g0 q
  29.                 return -1;% d' e5 |( D9 t4 \/ j/ s- {, q
  30.         }
    3 ~6 S' }" [  x& I$ h! i9 S
  31.         arg.sub_addr_count      = 2;
    9 E; L0 w$ ^: n7 S3 r1 C) `' V
  32.         arg.data_count          = 0x18;0 t/ C+ ]* `! R* J6 I% s, p8 }4 y
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    6 v& W  T2 t1 ]
  34.         arg.e2prom_cmd_data     = buf;
    ! o+ _" ~6 e- K* M: i5 j
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    , R! ]: R) ]! v; f! ^. j& x( D
  36.         if (ret != 0) {
    + r3 k1 D: W6 {& g+ A7 v
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);7 G0 ~- I2 n$ t
  38.                 return -1;7 I! k2 I& E" U
  39.         }9 n; d: _9 V( {5 U; t. r1 Z2 d
  40.         memcpy(mac, buf, 6);8 Z3 I: r6 x# c, w+ \4 T+ K
  41.         memcpy(stbid, &buf[6], 18);
    : f* m' L- f6 j! G3 E1 W
  42.         stbid[18] = '\0';* H4 m: [' L! J2 N' c
  43. ) y: W+ w% u( H+ L1 U% s8 X. |
  44.         return 0;8 M# a; u( X2 I. |
  45. }, L8 f$ t- o( H$ w& B% ~0 B# }
  46. ' v7 |3 w5 N- h% H6 f; X, p2 ]" G
  47. static int writeparam(unsigned char *mac, unsigned char *stbid): v4 `0 `5 t% x8 J. Z
  48. {' p' n4 g! n  f1 c+ @. _" G
  49.         int fd, ret;3 Z6 ?1 U' b/ U' v2 H6 D* B2 ?2 t# f
  50.         e2prom_s_cmd arg;( c* y" e5 [1 v, o4 e
  51.         unsigned char buf[0x18];
    : A4 l+ h$ |% j- s" |2 c* |

  52. & a  \) I+ ~1 P$ M9 t' B1 v
  53.         memcpy(buf, mac, 6);& A- q$ O" |5 Q" g, A
  54.         memcpy(&buf[6], stbid, 18);
    * e3 L7 l, z( D4 g: w0 p
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    # y7 W) _( n. h, ~! l; N
  56.         if (fd  < 0) {
    . d3 g3 ?$ H6 _
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);2 B( U! `+ a, ]. B, \" e5 P1 m
  58.                 return -1;' }& U/ B9 M1 I3 e' f% L4 \! R
  59.         }
    & {  ~/ K- M) B2 G' t) \" {3 d
  60.         arg.sub_addr_count      = 2;, B0 q  n$ j% T/ d6 _* _4 C0 `$ S
  61.         arg.data_count          = 0x18;
    7 V3 s- w( W/ G3 }& q" g* R
  62.         arg.e2prom_cmd_sub_addr = 0x290;
      U- Y5 d% O4 D1 a! y
  63.         arg.e2prom_cmd_data     = buf;7 N5 K8 C/ P  F8 V
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);* i+ I- d6 p/ o$ W8 l. O; B) I4 B
  65.         if (ret != 0) {/ a  Y9 J0 O, y  V$ r1 g2 _9 k
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);) g! Y8 l3 \, R! \: U
  67.                 return -1;" I8 h9 {' {* l
  68.         }8 a' R0 j7 Q6 `

  69.   m. i- t' O+ |8 f7 O1 Y; z
  70.         return 0;/ [( _! f5 q2 n$ Q7 p
  71. }, u$ T* u7 I. A+ p
  72. ! w1 ]5 u" K4 _2 ], f; g) p
  73. int main()
    4 n5 ]1 u& ~4 z3 m
  74. {1 d# \' X0 ~9 S
  75.         char c;( P9 h7 {+ P' ^
  76.         int i, macs[6];
    2 j) _1 J8 J( T8 N6 `; {' G+ i
  77.         unsigned char mac[6];% m: N. [) ], p9 U
  78.         unsigned char stbid[256];! L; Q6 {2 n+ Q1 l. t

  79. ) X- R' `6 |9 x  i. o
  80.         if (readparam(mac, stbid) < 0)8 C4 K7 ?7 W8 p: h" {
  81.                 return 1;
    * H( Q) @4 e% ^' H  x" v

  82. & l" r9 D# e3 K* u5 P# q$ Z
  83.         printf("Current parameters: \n");1 Z" V- j: Y/ n/ {5 d4 ]8 Q3 R
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    - ^9 e. t- g% V' d
  85.         printf("  STBID: %s\n", stbid);" e. y: L* ]# {
  86.         4 [. w. s  G' P( k2 |
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    - u3 n1 q/ m/ N; F; S
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    ! q# k) U8 l3 S) ]
  89.                 printf("Input MAC error\n");8 s! a7 u6 \9 n' V0 ~; I2 ?
  90.                 return 1;
    $ ]0 d' j3 w) q2 T8 V) L
  91.         }. q" U! K  F7 w& R1 v- r1 Y
  92.         for (i=0; i<6; i++)mac[i] = macs[i];# u! y5 u, Q. L$ ]2 q% m- m- `
  93.         printf("\nPlease input new STBID: ");
    . P( t) @& L) a3 H7 s- V$ j3 j
  94.         scanf("%s", stbid);: M9 u4 W) q+ s5 D
  95.         if (strlen(stbid) != 18) {# Q% `* b& D7 B/ l0 D$ X5 V# ]
  96.                 printf("Invalid stbid\n");
    . R# F2 P4 t- l* t" v8 r
  97.                 return 1;& e2 O; C  B4 e/ T7 a
  98.         }
    $ ?- O4 r4 ^0 V" q
  99.         printf("\nNew parameters: \n");8 U# L6 B7 q; D$ L7 S6 |- ?( {6 z, Y
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    ) f3 n% e4 `5 B/ @
  101.         printf("  STBID: %s\n", stbid);. B% @, z! a. J' ?7 N8 r
  102. , R( `6 J7 k) K7 \+ O) h- M
  103.         printf("\nDo you want to change paramemters? (y/N) ");# s2 T5 A5 _* t; j& n+ |+ g
  104.         for (;;) {9 x  h2 {/ e  g$ l! x
  105.                 c = getchar();9 \( f& ^/ X0 b( i
  106.                 if (c == 'y' || c == 'Y')* f. F$ ]5 }; o
  107.                         break;: x/ \4 b% X: k6 w  Q
  108.                 if (c == 'n' || c == 'N') {
    * D0 i  m( o. b& y# r2 U) ?7 E
  109.                         printf("\nAborted.\n");
    4 |  y* F* k0 j1 c
  110.                         return 1;3 l& A2 ?: m. s5 h
  111.                 }
    5 S3 s* O/ z4 v% y) ^/ F& v
  112.         }) o5 r9 S" i9 f" C1 \) ^
  113.         if (writeparam(mac, stbid) == 0) 0 O' Q& J5 ]# D$ |3 F5 e
  114.                 printf("Parameters changed.\n");# C! q! H: B1 M3 m
  115. 9 V  l4 \& H  f; L9 Z6 n( k7 u
  116.         return 0;) b5 _: b9 w, l8 D
  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
4 `" z: M1 H+ k% }在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

# b* o& C5 Q% r- a你用的编译命令行格式是什么?7 W6 w6 D* J# W+ R( U2 U1 R
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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