查看: 17220|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr: {" c) [4 N8 c& {8 N& ^
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig. l5 i0 ~1 l0 ?+ o' l+ {) ?
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
" d' j# _9 n5 c8 C5 _usage: himr <address> <value>. sample: himr 0x80040000 0x0  @7 ]2 P1 @' z8 _7 G1 l/ ]
# v  Y' V- i4 q
% t& g0 ~3 {4 C
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
4 ], u8 V* h' m2 Y2 [$ G
) h# F* ]3 ^+ c, f# `5 z  ]4 ]8 W补充内容 (2012-3-8 09:42):
! t$ q0 E1 B6 M; o+ Zhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数! o. d. M" |/ F. r/ C# q3 ~
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。/ [; `4 l( \% J4 r* ], Y" @

! f- `; z4 c* ?8 F( P" I+ f  nhimr <address> <value>. sample: himr 0x80040000 0x0
7 g+ `. ]5 ?% n7 X2 F. U' ?- p# c& y+ l1 L
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。$ \7 o. \! q% y5 I: N" s" C/ D
himr 0x80040000 0x00, v" n, P$ q3 E. j9 R# z
himr 0x80040001 0x11$ E5 W$ y, S5 `/ _. s9 B* o
himr 0x80040002 0x22
& C1 m" H1 W' ~  Ahimr 0x80040003 0x33
" v: j' ^3 b  f) Y+ z# r/ Whimr 0x80040004 0x44
2 L& Y: I% ?' v. u# q! D+ t. {himr 0x80040005 0x55' J4 q0 V9 E# S; Z

, t/ F- \7 E6 Y+ C4 BSN也是类似。
. P7 s" d# P, {7 h7 P1 F& N' Q$ |8 M! v* ^4 x( R
现在主要是,谁告诉我们MAC和SN的地址?
8 Y; V5 t6 d8 B
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37
. i) E7 U) g# A  P: F. I* Q; o: y一直想找到运程修改MAC和SN的办法,苦于无解啊

( Y  h% V% Z8 [* C& B( ?源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑   I" h* T( ~6 a; _" b( s) B

' G# p0 t  h+ ], \! C" A! H- X修改的代码早有了。到今天不会编译。- U4 G9 B* @/ x- D- d
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    * W/ d( p: [3 O& ]2 p
  2. #include <malloc.h>
    1 G6 f1 @* v% S
  3. #include <sys/types.h>
    ! c; k8 A: {3 F) A9 |
  4. #include <sys/stat.h>4 @4 n5 G: q. @. ]% ?; ~* Q% m+ }/ ~6 b
  5. #include <sys/ioctl.h>
    - M1 `) o% v/ A  G" `1 _3 W+ ^
  6. #include <stdio.h>
    ( }' g/ C, q1 d2 q
  7. #include <string.h>/ n% r0 e/ ]* u3 q5 C1 ~. [5 `
  8. ) v6 y. D8 L0 o
  9. typedef struct {
    8 u: l7 k+ i* [3 w( m2 F$ D+ m% `
  10.         unsigned int        e2prom_cmd_sub_addr;
    ; j* R. G1 u* Q" G/ i
  11.         unsigned int        sub_addr_count;. Q! M, }7 y/ h6 w1 p( q* [+ y. `
  12.         unsigned char*        e2prom_cmd_data;
    , f/ b, ?. m- ]/ \& d: u2 L1 C
  13.         unsigned int        data_count;; j2 X' s4 \( n4 G
  14. } e2prom_s_cmd;9 n/ s- g# L- r8 }9 t9 y4 e

  15. 2 _6 ~% a/ f* T7 A" G
  16. #define E2PROM_CMD_READ 13 d# U/ r4 c. w5 T2 A9 p
  17. #define E2PROM_CMD_WRITE 29 \7 H* f! G, K- d0 C; n
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"4 \0 J! T4 H7 R, G0 m
  19. 1 ]7 T7 R0 k8 b! O
  20. static int readparam(unsigned char *mac, unsigned char *stbid)- X) E- w5 e: P9 C; Y9 U: A
  21. {3 [" y& ?8 Q9 R. K: X" X- V$ F
  22.         int fd, ret;: l5 ^( O+ ^- E* j/ ^
  23.         e2prom_s_cmd arg;& P" c, F/ `# ?, ]% U
  24.         unsigned char buf[0x18];
    ) o% j5 G3 @( X& h: Y( k8 ?

  25. $ K  e" n! J. W
  26.         fd = open(E2PROM_DEVICE, O_RDWR);- {# _6 t# z/ o+ A
  27.         if (fd  < 0) {
    # a: F0 B  @$ [; z; v: u
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    6 k3 M! s4 N9 ^. N6 m2 x/ n7 r5 c
  29.                 return -1;# B  M1 m8 d: d! g/ I$ ]5 h
  30.         }
    # P& G+ q- H3 T5 @" B$ |* ?% D
  31.         arg.sub_addr_count      = 2;, D5 D. V2 X, ~) l! M
  32.         arg.data_count          = 0x18;
    4 @) E2 q3 N8 O! `* I: x
  33.         arg.e2prom_cmd_sub_addr = 0x290;, |5 N' e$ V! V3 m
  34.         arg.e2prom_cmd_data     = buf;9 ~; w' K" b- R- W7 h! e
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);  @( i) L- s7 `
  36.         if (ret != 0) {% l; ^8 @0 I! n# ]
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);. E2 N6 D5 ~8 F& B
  38.                 return -1;
    ( B. A3 @) Y8 ?8 i$ l
  39.         }1 V# E& k2 o' Q4 W
  40.         memcpy(mac, buf, 6);% ~; D4 n- s, z
  41.         memcpy(stbid, &buf[6], 18);: d5 x5 C" P  `: H
  42.         stbid[18] = '\0';
    + T& q/ {1 b8 D! ^" x4 D
  43. 6 ?3 V1 {: e- X- V7 @
  44.         return 0;- D$ T  g. q- K) X: y7 m
  45. }
    8 ~8 B% Z- B. j+ D- P
  46. 2 b/ z% C: U* Z
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    $ g4 |& R$ \9 g# p3 I
  48. {# g  Y$ r; N" {
  49.         int fd, ret;
    % a3 V; c% f/ O
  50.         e2prom_s_cmd arg;4 ~# [- B( u! M# X1 i
  51.         unsigned char buf[0x18];, H/ O. R( t4 V7 S7 w* L7 n' O

  52. ' f9 ]0 R$ a, B' i: g, I
  53.         memcpy(buf, mac, 6);
    / v8 \$ `8 m+ [. z1 Q' N3 s
  54.         memcpy(&buf[6], stbid, 18);
    % g, ?) B2 H+ @: f8 @
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    ) _6 x4 Q/ z0 z& ]
  56.         if (fd  < 0) {
    8 O; V; M* R" j6 |+ T% w  Q
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ' m2 I$ Q1 L# D6 }+ S! b: Q
  58.                 return -1;, J* N* G* c7 r8 w& E% T( r- |2 V5 C
  59.         }
    . _* @: L, d7 v6 q
  60.         arg.sub_addr_count      = 2;
    2 y' b( B1 Z, p1 f' B$ M! N$ x+ ~
  61.         arg.data_count          = 0x18;
    ) `( A, t$ r3 a' G. r- x
  62.         arg.e2prom_cmd_sub_addr = 0x290;; ]) }+ ~* i) c1 W% \. n# Z
  63.         arg.e2prom_cmd_data     = buf;/ r( Z" M' a2 L/ S* w5 h
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);6 b7 n5 p- u/ q' A" {/ Y
  65.         if (ret != 0) {( a2 j. K0 \" n. F: k- o
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
      v% Z, n8 }& f$ j9 p. G& y1 B
  67.                 return -1;/ t( w# f; c( r0 F# A
  68.         }
    % _+ \& d) j' [+ |# A/ F: [- t

  69. , u+ T0 k6 S+ o: @
  70.         return 0;/ x, b" U7 B" o2 ^( R* o
  71. }9 S8 ]! i* m6 k1 Y) [/ y8 p& s
  72. ; f* a2 q: q5 c: s. j( l
  73. int main()
    0 K0 X; s& c. X. C. b' P& p
  74. {9 m) U4 ~1 C5 B7 ]8 E6 A3 i6 `
  75.         char c;
    - M* w+ i) f. u) B2 V
  76.         int i, macs[6];. j- r7 i$ M, l2 n% O$ T% e! o
  77.         unsigned char mac[6];9 @: Y! f2 d7 m3 l) u6 W0 G
  78.         unsigned char stbid[256];# g) n+ C* `% w2 ]

  79. ) }' x- E- B$ l0 s/ b
  80.         if (readparam(mac, stbid) < 0)
    ; X5 Q# A7 n5 J
  81.                 return 1;+ o! o0 D$ b! L" A1 c5 \0 o+ G
  82. * V  x/ d3 ^9 K- K  v6 k8 n9 I+ j
  83.         printf("Current parameters: \n");
    ! h7 q4 B3 K8 F
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);% w+ W+ q. |; G7 o, z* q
  85.         printf("  STBID: %s\n", stbid);" m, F7 z: K3 _; X# s& b; F
  86.        
    & t. ]) B/ z  S3 ^' w4 N
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");$ e7 i7 N; O3 S) X3 O
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    0 d' L8 N' p& F2 t& X
  89.                 printf("Input MAC error\n");
    , L" ]3 Y: i2 w  D4 @/ x
  90.                 return 1;! i$ Y2 I6 n* ^( j% d- a, f
  91.         }
    + K) A! I# V7 f
  92.         for (i=0; i<6; i++)mac[i] = macs[i];) @- K5 ]+ h4 h! A/ Z) k
  93.         printf("\nPlease input new STBID: ");7 |2 ~* s- a( f; m5 I& ?
  94.         scanf("%s", stbid);+ }% l# k" i; V
  95.         if (strlen(stbid) != 18) {, Y$ |. ?1 W2 V
  96.                 printf("Invalid stbid\n");$ B. O1 O# k3 [. A% b4 i; P0 |7 N
  97.                 return 1;
    : j% T' O' V7 d* A2 s/ _4 C
  98.         }
    ' s8 m4 A* B) z% h5 E2 K4 O9 l
  99.         printf("\nNew parameters: \n");
    9 W( P( Q1 {9 X* T
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);5 T0 D, a' h5 X9 v' ^" e  c6 g6 [
  101.         printf("  STBID: %s\n", stbid);
    ( Z1 W$ q3 i/ g. v* }1 M: \7 ~5 x

  102. * `. c/ R, w% t# Q- N
  103.         printf("\nDo you want to change paramemters? (y/N) ");, n0 z7 L1 F, ?7 U: y
  104.         for (;;) {
    % j- h4 A* C; r  Q7 Z2 c
  105.                 c = getchar();
    & s4 ^3 }6 E# ^, f0 @* X- h# Q% ]" {
  106.                 if (c == 'y' || c == 'Y')
    $ q  b4 @+ R" O, F) R) Y8 u
  107.                         break;
    # r8 u6 F9 x6 }$ k# U. H
  108.                 if (c == 'n' || c == 'N') {
    ; l. D0 F- a; k# `0 V( T# ~
  109.                         printf("\nAborted.\n");1 i9 l8 |  O/ w" D
  110.                         return 1;
    9 C" ^, a( l) U, H' J) {$ h! M
  111.                 }* E3 H, V" K& w
  112.         }3 s8 q/ X. n8 S
  113.         if (writeparam(mac, stbid) == 0) 5 G- R' e2 B! I9 ^# ]
  114.                 printf("Parameters changed.\n");
    1 ^4 z9 E9 Z! v% l7 T! f' A

  115. * q. e' {& i: [, u" P
  116.         return 0;, A' \1 J$ V9 [2 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 5 D. P# g0 o' n
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

; r4 }4 Z4 _9 F/ u* \你用的编译命令行格式是什么?
' @6 @8 |& C4 x7 p. z
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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