找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15739|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    : C. |& ^9 s3 t* }) D. ?6 {/ F
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig9 d$ V% }3 j- `; t) w$ U% O- Y% S& M
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:: g$ Y/ Q" ~' Y
usage: himr <address> <value>. sample: himr 0x80040000 0x0
- a, x2 q( U, r/ L% o
& y' O6 |5 `7 P: Q* `4 y
. U3 R3 Z- V' ?' q+ V' R不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
+ P! z7 w& A8 t$ N7 \5 G5 Q6 [# |* H+ V8 z$ Q: `
补充内容 (2012-3-8 09:42):: C  |$ L( z. x  V
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数, e, }: g0 a4 y  r1 f+ s5 e
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。2 v$ F5 w  F" r+ }

3 n6 O0 ]/ L" |+ h! Y" Ihimr <address> <value>. sample: himr 0x80040000 0x0
; X6 ^8 B3 r  D. {0 S) V& U; G! T
9 _! J5 A' T& T# z5 X例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。+ V6 H1 i9 w8 B
himr 0x80040000 0x00& D  U9 G1 M4 \* k9 Z; o1 z5 C1 p
himr 0x80040001 0x11
: e& y1 s2 p6 G: |2 g4 T4 Dhimr 0x80040002 0x22) `1 C' Z1 ~8 j6 p: I( w
himr 0x80040003 0x33
" P4 a# \/ E0 F/ t. D% \himr 0x80040004 0x44' q8 Z2 D7 d/ R- T* I; P/ Z# J0 h
himr 0x80040005 0x553 |& s  F1 R' s, s, C' W7 A
; E9 f4 M) U$ C/ U; ]
SN也是类似。8 X$ x6 p! k" f6 M& g3 y$ Z) Y
; N4 H( |# F* s* \2 p- j! b9 p
现在主要是,谁告诉我们MAC和SN的地址?
! k# s4 D. i) S8 P7 `
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
3 ^: ~  s& o( N! T# d* V一直想找到运程修改MAC和SN的办法,苦于无解啊
. {* j, D1 Z8 Q& G
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 4 N9 |, a. J' {% p0 D' k

' n+ F/ g5 I  c9 |/ v; k修改的代码早有了。到今天不会编译。' S! L7 y( l4 o) t$ J/ X9 D2 I
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>5 e4 t4 t2 X9 y4 z! O' _
  2. #include <malloc.h>- F, r2 S5 f6 B( m$ a& s2 }( G
  3. #include <sys/types.h>* Z; ]  P8 k# S/ K7 |1 v5 H
  4. #include <sys/stat.h>: g+ M2 I2 v) F! D  @. O7 `. o
  5. #include <sys/ioctl.h>) `) r& y. \" n) _( B
  6. #include <stdio.h>1 p; Q- j! i# k9 m+ ~
  7. #include <string.h>' X! h+ \7 z4 k# i
  8. + K$ S: v. }; Y. J0 o
  9. typedef struct {
    + m5 D  T% j, D) I4 }% e0 A
  10.         unsigned int        e2prom_cmd_sub_addr;, U# T7 ~4 H( e# N' b6 b+ B* O
  11.         unsigned int        sub_addr_count;
    9 R) r, _  B% U/ w! P  F
  12.         unsigned char*        e2prom_cmd_data;( j. Y4 b7 w) |0 O* m
  13.         unsigned int        data_count;' ^* D9 Y* f8 V0 m4 }! P3 N; m, A
  14. } e2prom_s_cmd;7 l/ `. S1 _9 L5 D/ w
  15. ) ^' _2 ]4 l! K1 K; A2 `8 L6 u# ~
  16. #define E2PROM_CMD_READ 13 p5 z. X* Q: l6 Q
  17. #define E2PROM_CMD_WRITE 24 Q7 u! }8 b. j! i0 ~; a. I( \
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    5 `  M" ^* o3 v$ C% W
  19. ' L2 R7 r, _4 Q5 M% s" d  P
  20. static int readparam(unsigned char *mac, unsigned char *stbid)" j8 f6 ?( G. H! m& X! P6 U
  21. {
      z9 o' }) i0 @; {- t0 F
  22.         int fd, ret;' {% N9 @. [# E5 s7 x2 O
  23.         e2prom_s_cmd arg;: Q- H1 b5 F6 k' @" d* Z/ d8 |; l
  24.         unsigned char buf[0x18];
    7 _0 _* U0 f0 R. ?' H' f. E
  25. 4 m+ U% Q9 u6 j0 S3 k
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    ) w! `2 p. P5 ?, u$ ~3 [9 }7 |
  27.         if (fd  < 0) {! ?- M+ q6 ?. T: s4 v8 L( D8 L" ]
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);6 E: z4 K7 S7 P* X
  29.                 return -1;
    % h! L1 [1 g; Q' m! j9 w* h
  30.         }  {  u) ]  M$ t* l
  31.         arg.sub_addr_count      = 2;
      _* e. A5 Z- q! o
  32.         arg.data_count          = 0x18;
    + ^) {  }' P( ^! t; p) Y+ V
  33.         arg.e2prom_cmd_sub_addr = 0x290;5 q2 H% f; a# R1 \% d9 c7 d
  34.         arg.e2prom_cmd_data     = buf;
    3 X  @, K1 k- W  Q- S$ f4 O/ U9 b6 ]6 v
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);2 c9 q# F& v1 n2 m/ h; v
  36.         if (ret != 0) {
    # l& ~" }$ S& P
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);' l& d9 i. T3 Z: z; b6 i+ ~2 L" C3 W
  38.                 return -1;
    2 y! Z. `, L) c+ V6 _4 s
  39.         }& V$ R" I4 Q) `' c0 `. L% }
  40.         memcpy(mac, buf, 6);
    " l; }& w: i/ z9 X/ r
  41.         memcpy(stbid, &buf[6], 18);
      y4 C  v; H$ n
  42.         stbid[18] = '\0';
    + k3 C7 N1 P1 U

  43. 1 W1 X0 C) j) h. }
  44.         return 0;' s5 A+ n2 X6 S% m
  45. }* i4 i" a5 l7 d/ P9 q: v/ I3 F/ J
  46. , q# C; Z) m6 D% B) o$ W+ x7 R
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    + [4 N! u5 Z, z; ], K+ r$ b
  48. {
    $ P* ^7 Z6 {, x& `  f1 O$ |4 I
  49.         int fd, ret;
    0 Q7 c7 G1 }' z' I- {+ R6 B
  50.         e2prom_s_cmd arg;1 `( h( _2 c( ^+ _' [% ], j& I4 w
  51.         unsigned char buf[0x18];
    + ]! j3 P5 N9 h: w( h2 j

  52. * f7 G* Z" p" y( O8 Y
  53.         memcpy(buf, mac, 6);
    5 t( r$ _- D1 r4 g7 i( `; @9 Q! y
  54.         memcpy(&buf[6], stbid, 18);! o' m0 O2 ~& r3 D0 r
  55.         fd = open(E2PROM_DEVICE, O_RDWR);  N. m6 ~  X: ]8 C" x
  56.         if (fd  < 0) {# D' C# J+ a  a1 f; Y3 R+ J5 n
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);) \, o* J3 \4 `7 n
  58.                 return -1;( X  k" P7 V% W% t# n. e4 {, @9 a/ H) p
  59.         }! t8 _/ s& L# m9 }6 b5 @0 a! ^
  60.         arg.sub_addr_count      = 2;2 }* A4 T: T& @7 q' a
  61.         arg.data_count          = 0x18;3 F# R. C* {; b, z' z: r5 B& M9 n5 x
  62.         arg.e2prom_cmd_sub_addr = 0x290;8 M6 I( `) A0 D7 r. D1 W
  63.         arg.e2prom_cmd_data     = buf;
    6 e: x  [0 a; ?) N6 v: k5 u  }$ ]
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);# b  I+ T: O9 P& S7 ~
  65.         if (ret != 0) {
    ' a! w' ^8 m* y- X# S, i
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    " u' \# {  u" S- `# A
  67.                 return -1;
    . P; V$ Y( j: x( B
  68.         }( ?1 `$ Y' @- ~6 [( U, _/ Y
  69. + ?% H. k" q: J0 r
  70.         return 0;
    9 ~0 d$ u! W) E8 {* i  Z. P
  71. }
    % B" ~% x5 S' H4 [# g

  72. " H* g: k! Z8 {7 c) ]  Y
  73. int main()
    . Z" D( Q6 R8 ]5 A  d$ n6 g
  74. {+ I3 W+ B( {2 Y. Q9 \( ^
  75.         char c;& m9 F' V3 A3 x1 R) g9 l; x
  76.         int i, macs[6];
    1 g5 V9 X: P( O
  77.         unsigned char mac[6];
    % o  T. e% a- ~7 v$ _
  78.         unsigned char stbid[256];6 S% J) x' f% [$ X6 F1 u5 F
  79. 5 U5 ^% i' N8 g0 d3 ]
  80.         if (readparam(mac, stbid) < 0)! ]! H8 j  d- {, K5 b
  81.                 return 1;2 O% B, l$ }+ B# K5 t
  82. ! T% f) U+ g, g3 Z& w) s& C' ^
  83.         printf("Current parameters: \n");
    0 Q  ]3 C8 |3 k. q6 e' H- B
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);  W# n( R  C7 C
  85.         printf("  STBID: %s\n", stbid);
    2 k% j' c0 f7 T2 p9 V+ ?
  86.        
    # i5 K! W. H9 I# B/ o
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");/ s2 e3 F$ ~7 z- r' a% w1 C
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {5 ^$ h7 D. G; R' T9 S, u0 ^) p
  89.                 printf("Input MAC error\n");, X" d& D3 H& V# B- E! \' l
  90.                 return 1;+ J- Y7 L2 M' w  y* p
  91.         }+ ?( P2 Z  _% d% J
  92.         for (i=0; i<6; i++)mac[i] = macs[i];, h: C; `3 E  W1 G
  93.         printf("\nPlease input new STBID: ");5 ?& i2 B& V: p+ T/ ~. k
  94.         scanf("%s", stbid);( x- ~) {% M6 @9 Z
  95.         if (strlen(stbid) != 18) {
      L& f% m; l; w' y
  96.                 printf("Invalid stbid\n");  l8 c5 \, n9 i* y2 A
  97.                 return 1;& T0 C& d8 b: J4 S! U% _
  98.         }
    / D# @0 P6 [+ C! P6 ~
  99.         printf("\nNew parameters: \n");
    1 d; J/ h% V; A) ?. ^
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);: }9 G& k& O4 {; i1 z' h
  101.         printf("  STBID: %s\n", stbid);
    # r  r% Q3 N# p, n0 F! \
  102. $ \8 t4 d/ A( @2 `* W
  103.         printf("\nDo you want to change paramemters? (y/N) ");" D0 k6 }- J: ~+ ~$ U
  104.         for (;;) {
    ! W% x1 T# y6 A& A( w( T
  105.                 c = getchar();/ a5 R) \* x3 R
  106.                 if (c == 'y' || c == 'Y')( y0 P# p8 O1 X" J
  107.                         break;
    # N6 i6 ^, @9 D+ C0 S" {; s
  108.                 if (c == 'n' || c == 'N') {9 f. L8 Y5 @6 O0 `' X3 ]
  109.                         printf("\nAborted.\n");/ T) I/ N8 B! a1 _
  110.                         return 1;  L5 [4 |2 J" X
  111.                 }" u0 P% l# G+ @! d! m; F( T* {3 N( l
  112.         }
    . N( e( B. W& X8 I
  113.         if (writeparam(mac, stbid) == 0)
    5 \4 v3 L* c3 v  H0 C
  114.                 printf("Parameters changed.\n");
    3 e4 {! O- ?" a8 z2 e) I8 \4 C
  115. 7 Y' S, t1 z1 E* R" |& [/ Z) ~+ M
  116.         return 0;' y) D& c) M) C4 I
  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
! ^1 X# P& {0 k在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
7 q, A6 K5 \" p7 I( A. k9 M
你用的编译命令行格式是什么?: ]! p" S. `4 _: j
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

GMT+8, 2026-3-7 18:16 , Processed in 0.024134 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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