查看: 17010|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    3 ~8 t! j) N+ v' T4 V' e  Y
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig! E! L  K+ _: f* K) q( h
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:$ D* a( |$ }/ j$ Y1 \1 y
usage: himr <address> <value>. sample: himr 0x80040000 0x0; a, h, y8 p" n# c. n8 v
" {# I; v# G- _9 ]  U/ }2 P  s6 b

; N# {) f4 ^/ {# r3 T不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?' O  m4 D7 w0 b8 n8 L2 G, y
6 }, r/ d/ M3 B3 w. R% M
补充内容 (2012-3-8 09:42):, U5 k! h' `$ G( v; d0 D  Q2 z$ f
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
; {. j1 |1 P2 j' g, f. z这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。
4 G4 l1 U  l  o: s
3 x) O5 X5 E, Z& ahimr <address> <value>. sample: himr 0x80040000 0x0
9 n) S0 R' n1 T8 ^: ]* {7 ?  D0 C3 n' t& h
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。& l9 p* T& v1 a* r$ z
himr 0x80040000 0x00- b9 |1 }/ Y8 v( K) {0 B  H" u
himr 0x80040001 0x11; g/ x: Z! S( i9 ~* |5 _& z
himr 0x80040002 0x22( x0 m' C& s4 M! f  v
himr 0x80040003 0x33
" |; n; e: @- Ihimr 0x80040004 0x44
/ D# o" ~& e3 I% E: U& k" Whimr 0x80040005 0x555 V; }9 Y; I* A2 |; }4 j
4 g+ H8 G3 W0 W; X, @
SN也是类似。
/ e0 R+ J9 \4 I  [' |9 \1 m6 w# \1 M0 o! I/ X% c
现在主要是,谁告诉我们MAC和SN的地址?
8 r1 a! R/ F* U3 _5 k' s
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37 8 Z3 C9 ~9 ]" k: S7 P) x
一直想找到运程修改MAC和SN的办法,苦于无解啊

- U' _( w6 M4 D* n2 }( E源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
0 ^* A  k, ^! E( j; T* n
  }5 m0 D& O5 w修改的代码早有了。到今天不会编译。
* Z6 H: b1 `" W% ]% y. F; V需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>. V: U, s& l4 Z- m
  2. #include <malloc.h>
      u5 H. L6 a0 C6 j
  3. #include <sys/types.h>
    % o; P" @. B' _8 I0 C
  4. #include <sys/stat.h>7 G( ^; x8 @4 I9 d) O, @
  5. #include <sys/ioctl.h>3 b, ]2 Z5 {6 G
  6. #include <stdio.h>  U" d1 G& q2 e. _: o
  7. #include <string.h>' s7 g3 O2 H8 r' R# [+ E& P% X

  8. / S+ y2 F6 |4 O. D
  9. typedef struct {) i' Q' z$ `; t7 E
  10.         unsigned int        e2prom_cmd_sub_addr;7 a5 b1 A6 [* ?1 E* H% a+ ]' D
  11.         unsigned int        sub_addr_count;/ D+ D8 T. ]  D& e- I: K7 k
  12.         unsigned char*        e2prom_cmd_data;! w& s5 A" n0 F+ }! ^
  13.         unsigned int        data_count;
    # M1 O0 H. {  i; y
  14. } e2prom_s_cmd;
    ) C" h, e1 D" X0 S7 J3 r
  15. 9 R; P5 I2 Y: b
  16. #define E2PROM_CMD_READ 1
    ; P- R  }. H( U
  17. #define E2PROM_CMD_WRITE 2" B2 ~$ S/ c% r
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    " s  I9 V- L6 R) `3 R/ c. a
  19. ; e; A$ F0 Q. `5 i8 @8 Z( P
  20. static int readparam(unsigned char *mac, unsigned char *stbid)0 X( I! J! P4 ]
  21. {8 B4 n: ?; ~/ |5 V
  22.         int fd, ret;! [2 A% _2 E5 k/ G0 n: i- ^
  23.         e2prom_s_cmd arg;
    3 C. `8 E3 {* g6 n; n8 v
  24.         unsigned char buf[0x18];
    4 P0 A' e- o8 Z2 P
  25. 0 O1 R- [" N- d7 @& |2 G/ `! t
  26.         fd = open(E2PROM_DEVICE, O_RDWR);  M, V' T+ \, ?0 Y& i
  27.         if (fd  < 0) {
    6 x% Y% I3 ?, G
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);6 ]  B8 H5 m; y& ]5 g
  29.                 return -1;
    6 X! A+ K3 n9 K7 @- a" g! Q( ^
  30.         }8 q/ F' ]' L$ n% C0 d- q
  31.         arg.sub_addr_count      = 2;
    3 Q" J7 A, M$ h' W  h! l0 X" h. z
  32.         arg.data_count          = 0x18;
    # Y9 J  v" }- _" Z% N4 V# s9 L2 C
  33.         arg.e2prom_cmd_sub_addr = 0x290;( ^" w, y2 }% \2 w4 L# e4 T
  34.         arg.e2prom_cmd_data     = buf;
    - [3 r( ?( t- a2 e: O6 w
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);) r# a9 R* \& N5 K8 d$ Z0 h
  36.         if (ret != 0) {( N- I4 P' k# x8 F4 N$ q, i2 m
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);# q& z. w- T+ [: V  F
  38.                 return -1;
    ; p& V0 C# H4 r, {3 W
  39.         }; V" ^: J& X4 F2 ^7 c9 a2 q: l
  40.         memcpy(mac, buf, 6);
    9 W' i" ?, J9 q7 d5 }  d
  41.         memcpy(stbid, &buf[6], 18);
    7 M1 b, ^- R/ ]- d0 [
  42.         stbid[18] = '\0';' n  q- h1 Y1 L' [; v
  43. " g1 f, [: ]. @- g7 \4 S
  44.         return 0;
    6 f" [; d, H* E
  45. }+ {% G# a: l3 c9 A4 Z7 p& t6 S3 V" w
  46. 2 L5 L  ]5 f) q. Z  ?: ?( c
  47. static int writeparam(unsigned char *mac, unsigned char *stbid); l. a6 t" i" `3 E- c
  48. {9 ?) D1 @5 Y6 m! F. \: l$ J+ H
  49.         int fd, ret;* D) D9 x. Y- ^1 @# m! r! z8 l- T4 s% w
  50.         e2prom_s_cmd arg;
    8 g8 N7 X( C, M) d$ O
  51.         unsigned char buf[0x18];' U( w+ ?9 K7 \; m0 C

  52. * P7 `, Z1 {: s" G
  53.         memcpy(buf, mac, 6);
      b  ]; i' L7 H+ V$ X5 ]5 O
  54.         memcpy(&buf[6], stbid, 18);
    4 a+ H  l& q5 q$ a8 r0 k% G7 E
  55.         fd = open(E2PROM_DEVICE, O_RDWR);) H5 n3 L! ]' m! U* f
  56.         if (fd  < 0) {
    - `, ^( Q) }1 M) u
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);# T9 P0 Q: g0 ]! U# J
  58.                 return -1;. t& F* P5 [: M
  59.         }0 U! Q9 a$ O$ P
  60.         arg.sub_addr_count      = 2;
    ! H' e5 R# ]1 K! O9 V0 A( Y" S2 P3 ]
  61.         arg.data_count          = 0x18;/ p+ q0 W0 y9 |5 J0 \
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    0 b& k/ E6 K; k3 K6 N
  63.         arg.e2prom_cmd_data     = buf;/ ^% S/ f& ]# M9 v8 K
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);4 N! a  o5 s! |3 a+ n6 A4 Z
  65.         if (ret != 0) {- v$ O7 K; n' P: L" Q
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);9 }6 B' n2 @( J5 e* [: W/ u
  67.                 return -1;5 v; i8 ?# h8 i" h. b. ?+ V; u# k' M
  68.         }
    ; a0 C0 o  |$ B. }  R

  69. ( [* B% c: x+ ^. p0 a' d
  70.         return 0;9 W$ ~3 n0 j( X& h
  71. }  \! s( X! G) u) g8 _

  72. ' ?* r, {1 b( p8 }
  73. int main()5 X8 t8 W* }+ h0 j5 }* E5 s( r1 C
  74. {9 V* ~5 ?! m% i1 G
  75.         char c;
    % R# q* W+ S4 o9 Y) ]) R' u
  76.         int i, macs[6];9 [; A$ G3 z: x  V- R2 S* Y$ Y
  77.         unsigned char mac[6];7 A5 ]$ @/ @4 z6 \4 i: p
  78.         unsigned char stbid[256];
    7 o9 S1 H; m" w) A) A- e
  79. 4 T  L1 q8 L( N' K$ P. Y
  80.         if (readparam(mac, stbid) < 0)
    7 \% n: c- h$ ]; A
  81.                 return 1;$ z' t" Y) ^1 P) w' I# `7 d1 Z6 H% R

  82. 1 d/ J# a. g. t5 ~# O
  83.         printf("Current parameters: \n");2 @" A0 P+ @9 g' A
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);# u6 o* h) M; c  I2 {& u* a
  85.         printf("  STBID: %s\n", stbid);6 Y% a# R9 E$ {' ?2 ~' b5 _% n  r
  86.        
    # o! D- p; I, y8 V, \9 [
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    / ?; T' \' u6 }, ]
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {) O$ d* r' k, K. G
  89.                 printf("Input MAC error\n");
    # p; {' p& ]% {4 U3 X
  90.                 return 1;0 z' I  B+ R3 E. |3 ?  l
  91.         }
    . x7 J4 u, {( U' y
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    . q6 \4 v: t9 E/ z" Q- i% ]
  93.         printf("\nPlease input new STBID: ");
    2 y' T+ I* w. R3 Y/ C5 M
  94.         scanf("%s", stbid);
    # z# ?  u. p% c* t' L
  95.         if (strlen(stbid) != 18) {
    " g9 S4 n8 x  t  {( T% u
  96.                 printf("Invalid stbid\n");
    8 c* e9 I1 W) d. E( Y! Y0 B; }
  97.                 return 1;
    0 C0 P; W+ P! ^/ G. f* Q9 A
  98.         }
    ) Y, @4 u; j; J& C. V
  99.         printf("\nNew parameters: \n");* c2 y2 m/ m: z/ R& b( X
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);) J4 I' r% H4 C' o; h" M' g
  101.         printf("  STBID: %s\n", stbid);
      r( B- \8 G% B$ m$ i0 a6 r

  102. 8 y4 v$ z: D% n; v0 A# g
  103.         printf("\nDo you want to change paramemters? (y/N) ");( a7 [) R& W  V5 ]
  104.         for (;;) {4 [" [& u" h' v( [2 H
  105.                 c = getchar();% H- Z( I6 e( v. Q' E1 ~: C
  106.                 if (c == 'y' || c == 'Y')
    7 h! ]( S% B6 ^
  107.                         break;
    8 x6 }( u8 U& |5 Z  T* Y; ]
  108.                 if (c == 'n' || c == 'N') {% u  x6 i  w1 O+ z
  109.                         printf("\nAborted.\n");
    7 m+ V& ~) _9 C- P9 ?
  110.                         return 1;/ k6 g$ G4 d6 e7 `  k' }
  111.                 }
    0 Q8 Z  B3 n( n* W
  112.         }# t( _3 _/ S' M) Y5 l0 i
  113.         if (writeparam(mac, stbid) == 0) " X+ g% {. `- J8 h
  114.                 printf("Parameters changed.\n");
    2 c: _+ g) B) f7 g" k* k) C
  115. 0 d+ Z: e7 G8 J( V' h
  116.         return 0;
    # f/ M3 i' G' y$ W0 c% c( Y
  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 % b! F$ {. F* H3 w
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

2 ^2 N3 Z7 |# l# }) a! |, z# M你用的编译命令行格式是什么?0 ?& c: |* n  A9 O
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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