查看: 17096|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr4 _# H6 h2 ?: ?; A
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig9 L: g2 T3 ?" c1 _
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:! s- o$ n3 B" f) c+ t" Z* j3 X
usage: himr <address> <value>. sample: himr 0x80040000 0x0
& h/ E2 c) `0 h/ u, u3 z0 \9 h) _0 r! K$ m* n8 E
: M4 @* W: |$ V; t
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
- u8 v4 A9 M+ @2 ?2 e5 `8 y) |& R; g6 Y2 {- R3 L# r
补充内容 (2012-3-8 09:42):7 R9 Q# {1 Z$ |; f9 `. R# l9 |
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
) h& y( X: o0 C1 {+ r! N这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。
2 T; X: [6 {) P7 ^) Z. ?
. h8 {% K& B% i6 _2 z' Ahimr <address> <value>. sample: himr 0x80040000 0x06 F* \! o# ~- }' R# g
& a3 k5 E: Y+ i" K* q0 ~
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
. \' o4 t+ Y) ~9 z% m& G9 h* f: ghimr 0x80040000 0x00
5 C6 h8 y% u5 v5 ~' Khimr 0x80040001 0x11) G7 H' b6 ^7 z
himr 0x80040002 0x22
. I9 u) i' y4 x7 D# b( mhimr 0x80040003 0x338 N! r' a! n, D! V; k( M
himr 0x80040004 0x44
6 A2 g0 B) U2 ihimr 0x80040005 0x55, q1 _* P* R5 G: }' C  \3 `9 c
! F9 w1 X7 D) ^' Z% M! K
SN也是类似。5 `( I' R) b0 U; J5 P

+ z5 O$ R# E  j: q0 y1 W% `现在主要是,谁告诉我们MAC和SN的地址?( D* M6 t4 V- G7 z; X+ I: C
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37 7 u3 J+ \% s0 i0 i0 U+ m
一直想找到运程修改MAC和SN的办法,苦于无解啊

- O  S' G: ^' m3 y! F: R/ I源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 ' t4 g' Q. [4 p9 _' [5 K5 [
& D" j& ]; c3 G0 ^2 G
修改的代码早有了。到今天不会编译。* ?2 ]# {; c( B) Z7 Z/ n. r
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>) _0 r3 {  }# w9 y9 P  ]
  2. #include <malloc.h>
    : K  p" {' y3 J% g, W, n+ ^
  3. #include <sys/types.h>; h& U; u2 M& n+ m
  4. #include <sys/stat.h>$ t# h' F: D6 Y. B" g; M
  5. #include <sys/ioctl.h>
    " b' @" q- ~; {* x1 e+ V/ T' L$ z2 x
  6. #include <stdio.h>4 J& ^" z- B7 v4 a6 c
  7. #include <string.h>  R- b9 W  Y2 S8 S+ R

  8. 6 S8 R: x! W& l) s2 d( V; N! i; h- Z3 m
  9. typedef struct {& L+ U+ M2 ^. G
  10.         unsigned int        e2prom_cmd_sub_addr;/ Y) _* r$ |$ l- Y6 @. C5 g
  11.         unsigned int        sub_addr_count;
    # b" h6 W+ ]9 b. t2 y8 J0 ]
  12.         unsigned char*        e2prom_cmd_data;
    * }, w/ [3 h7 d2 a" e9 P
  13.         unsigned int        data_count;4 N# j* l: L" A: D, L; @' p5 H5 Q
  14. } e2prom_s_cmd;
    ( o  _7 Y9 i! P* A

  15. 5 C/ O6 U/ ?6 {1 g" Q% u
  16. #define E2PROM_CMD_READ 1
    3 t( t' f, k1 \
  17. #define E2PROM_CMD_WRITE 20 r2 t! n* f& F8 {
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    2 C9 f; g2 [' k4 x# t
  19. 0 l" [9 b: N  j' e8 o0 ?' {  U
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    * W8 C# W3 g9 @8 |9 T1 g
  21. {3 c( E! p- N4 G1 z- }) t# L
  22.         int fd, ret;
    2 r+ D& b+ I0 B! s6 V* |
  23.         e2prom_s_cmd arg;5 b+ `( e+ B7 q/ F8 T! Q& [
  24.         unsigned char buf[0x18];0 u# M8 ~( U5 H1 R! m2 E
  25. 2 P1 g" }2 [& f1 q2 z, S
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    % v, n: Y( y* l' H  o* c
  27.         if (fd  < 0) {
    + o* A& p* `5 d$ k- \: U
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ; l9 T6 V9 x/ l3 H1 g2 n
  29.                 return -1;
      p0 f& Z, W) l6 W: U+ {
  30.         }
    % b4 {- Z7 q2 G; T: @, P- D& x. Z7 u
  31.         arg.sub_addr_count      = 2;5 M9 g! h& b* P
  32.         arg.data_count          = 0x18;# q3 Q+ ]: a' Q7 h" P1 V
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    4 |, F' c. B2 C# H
  34.         arg.e2prom_cmd_data     = buf;8 L( D8 X: X* S$ Q
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    - r, g5 h$ b1 r% d- Z* c* y3 _
  36.         if (ret != 0) {- G; K2 `2 n9 P7 h
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    9 M( V# ]9 T3 ]# k  y+ x% @4 @
  38.                 return -1;
    : }( O7 B: z1 i: m$ y
  39.         }- c+ d$ {5 X! O; ~8 J; z. B2 L
  40.         memcpy(mac, buf, 6);' n; c4 c; L! j( C& X5 A. q
  41.         memcpy(stbid, &buf[6], 18);
    $ a" C9 _& r/ T* Q& U% B
  42.         stbid[18] = '\0';
    8 S' W9 I" [" V

  43. ; m% F) G) e$ n- T! x) H2 E+ m5 p
  44.         return 0;, n1 |7 {# ?3 i/ G* g. N
  45. }5 ?% {. g1 x/ c
  46. + h: ?' }. J% a1 p" w7 U6 Z% z
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    - l5 k3 \3 w. \: P0 s
  48. {2 }- w5 P1 X4 W$ q0 d& E& Q4 f
  49.         int fd, ret;7 u: I  ^6 x4 O# k/ Y1 [
  50.         e2prom_s_cmd arg;
    : l, V7 ]  a% |6 z, t. U
  51.         unsigned char buf[0x18];" h# x- R+ p# }0 s$ z% Q9 S

  52. ! ]; I9 b* l8 b
  53.         memcpy(buf, mac, 6);
    - Y" X6 y: D+ O& }% ~0 M
  54.         memcpy(&buf[6], stbid, 18);
    $ m9 c8 ^% ^1 j6 {; d  G5 ^/ u
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    7 q) U- I# ~3 ?9 @
  56.         if (fd  < 0) {% @% e: b" w& l) h
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);  R+ h1 F$ j: E+ t" t7 I
  58.                 return -1;
    0 \, d& T: P8 T2 P2 F6 I( U0 _
  59.         }$ q  f9 D' u4 H; j5 W0 }
  60.         arg.sub_addr_count      = 2;* f( y3 a# u# b/ v. s  l0 Y5 ~
  61.         arg.data_count          = 0x18;# M: G# N: l1 Y" `0 q! B0 ^
  62.         arg.e2prom_cmd_sub_addr = 0x290;' t8 R  O/ L7 k& m2 T+ e: W
  63.         arg.e2prom_cmd_data     = buf;
    4 |, N3 l+ U, ?5 _) }: s  g" b
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    # ~' n5 C: I7 c- ^% @: Z
  65.         if (ret != 0) {
    # L2 w) l1 {' E
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    ; m2 Q. @  }% c8 Z6 h
  67.                 return -1;
    6 U% @" ]0 }9 @9 F% l
  68.         }
    , @, K# r3 E7 G. C
  69.   Q/ m9 d& ]$ p
  70.         return 0;$ ], i2 ?, e  ~3 F: {' R
  71. }
    9 c& _5 y0 Q# K. J3 A) S' {

  72. ) i& k. `8 O+ t2 G
  73. int main()
    / \$ X3 `+ W0 Q9 v
  74. {" D4 y8 J- F: \. E( K2 E; v; H
  75.         char c;
    * x. c# B* c4 I2 D0 o5 g$ G8 D% o
  76.         int i, macs[6];" u* B, E) ~$ F; X& L
  77.         unsigned char mac[6];
    / p; \5 W7 o' ]) W8 u1 p& u! P
  78.         unsigned char stbid[256];) ^; I9 M+ r1 m. |3 m
  79. ' R8 f# j" z. K0 C; E# p
  80.         if (readparam(mac, stbid) < 0)+ Q" ~2 j) K; y$ b& D. [% x
  81.                 return 1;# |4 V( w! \0 ]" z% H  i

  82. - ~; D+ i, I0 t' w  Y8 l
  83.         printf("Current parameters: \n");
    , v% l# J# F9 B, k1 [0 s
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    5 F6 Y6 {6 X! z% s6 ]2 W2 V
  85.         printf("  STBID: %s\n", stbid);
    # y0 F! `0 C" v! `. Q: M
  86.        
    3 V8 B4 l) S" y1 f* V
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    / `, y  o5 `5 B7 J8 Z' ^
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    7 k1 }- G7 j" [% c" j4 g
  89.                 printf("Input MAC error\n");
    , I/ w: l4 [2 Y* g% M
  90.                 return 1;+ Y" z% Z2 S) \5 v
  91.         }
    ; _8 e% z7 K5 H9 l" R
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    0 Y+ @0 }6 Y! t) Z
  93.         printf("\nPlease input new STBID: ");, a# n0 g1 i2 l& d3 q8 F; t& X
  94.         scanf("%s", stbid);
      d  `4 b9 `6 w/ s
  95.         if (strlen(stbid) != 18) {
    3 z9 H/ R1 {, w+ w  O% ?
  96.                 printf("Invalid stbid\n");4 n4 Z' H0 I4 d5 [$ e  q
  97.                 return 1;! [! B7 a; ~1 F, ]
  98.         }3 _. G4 D/ \5 e" Z4 B- \
  99.         printf("\nNew parameters: \n");
    0 v  f  _* M+ p; ]( E
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);$ m. w+ h$ f. P- L: ?8 U
  101.         printf("  STBID: %s\n", stbid);
    - y. _2 g" f5 e) D0 T6 I
  102. & f6 t* R* [! d# V8 Y9 {
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    * n7 n+ E" M  Z% j# H
  104.         for (;;) {
    7 _$ t+ T+ G) R6 I" q* B3 s; \
  105.                 c = getchar();
    8 Y% N% o9 W' Z8 Q' E
  106.                 if (c == 'y' || c == 'Y')% c$ R. @4 n' k: N
  107.                         break;  q0 v1 ~- u! E
  108.                 if (c == 'n' || c == 'N') {6 W; ^- m) s# J+ e. A
  109.                         printf("\nAborted.\n");
    2 l  ]4 s( _+ H1 f4 h- O$ ~
  110.                         return 1;
    . X4 |5 X' `* f: ^  Y$ p
  111.                 }/ ^# U6 H6 m& H2 t
  112.         }* z* [8 M3 x; |( X# u
  113.         if (writeparam(mac, stbid) == 0) # E1 ]4 P4 M' d6 ~* ^
  114.                 printf("Parameters changed.\n");0 F+ T7 i9 F4 k

  115. 1 V$ B: c3 P7 X/ r$ h. F6 d' f" b
  116.         return 0;
    / o& x* U$ {; W7 X4 z* t$ ?, K
  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 + y/ M+ @3 y: @. E& X
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

2 T: l5 A/ k* c  e3 w( }: D你用的编译命令行格式是什么?0 f% P7 H: C; 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客服返回顶部