查看: 18001|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
      C" X& x9 |& r$ q% ?3 B: _( r
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    + k: b+ a3 x  |5 p) b& h
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
1 q  i8 j3 E3 Z1 musage: himr <address> <value>. sample: himr 0x80040000 0x0
6 R4 |8 ~$ i% F! ~/ G0 [7 Z. u7 }. S+ k. W9 U# x( S

9 J. {  f$ ~6 s, [) T" z5 e不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
% k& x2 M! A& Z* F* C
3 g1 Y+ M# R/ f+ u, M8 f& W0 \补充内容 (2012-3-8 09:42):# ~) W+ s3 L& w$ }! g
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数+ G" z6 R4 C8 ]. y+ h) c* `
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。8 N" {' e2 _/ _
3 o9 K7 K" [7 O5 V: f) g: _
himr <address> <value>. sample: himr 0x80040000 0x0; s, q' i% b) T/ g( i! _. {9 C

9 I$ ?7 g8 s% r+ g  _1 r7 _例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。' ~$ X* X* Y; Z" t  T
himr 0x80040000 0x009 c( S. G- U+ n2 o7 z2 H
himr 0x80040001 0x11
3 O4 @& y+ c# [. n' U& Khimr 0x80040002 0x22" I  D0 l! }, [/ Y) F3 g, b  y
himr 0x80040003 0x33
0 R$ W. B! {  T" Z8 q$ C8 t4 Ihimr 0x80040004 0x44
  _) y" ]  \  t0 s# U/ V8 whimr 0x80040005 0x55" R+ @  }2 D# @' Y9 t
) x: a( {8 U' G8 N6 {3 w: \! l
SN也是类似。7 G% C$ V1 V* \- `$ d

! D7 S3 u0 ~! ]7 W3 Q. g4 d现在主要是,谁告诉我们MAC和SN的地址?5 b; s, P* a( c/ S
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37 ' W4 y: ^5 b/ {; N
一直想找到运程修改MAC和SN的办法,苦于无解啊
8 v4 z* ^5 T8 S% r
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 $ x, V: H5 H1 T, c" |

. x  w3 n8 P; N" x# H修改的代码早有了。到今天不会编译。6 g+ o- P6 ?9 T/ |  C
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    7 R# j( _' C  U8 u) k
  2. #include <malloc.h>
    & m9 i. f# x/ s7 F7 F+ D& w
  3. #include <sys/types.h>
    . K. @) @- L: n
  4. #include <sys/stat.h>1 @. X% M1 A2 l' G% c1 h
  5. #include <sys/ioctl.h>
    ) H7 P: w( ^5 T
  6. #include <stdio.h>
    # `) X4 }+ O6 ?+ W( a8 A  M
  7. #include <string.h>
    4 H9 h* s: p$ W& J# K

  8. % n, E1 v" j, d# h* W7 A8 G7 }0 k
  9. typedef struct {( E" X: F9 n4 t( |2 n
  10.         unsigned int        e2prom_cmd_sub_addr;( ]! H( Z) |3 `# Z, ~& p1 m4 N
  11.         unsigned int        sub_addr_count;* y8 {, A$ b+ k. U
  12.         unsigned char*        e2prom_cmd_data;
    8 ?+ g9 J9 u. n* Y
  13.         unsigned int        data_count;, W- L! g+ L9 a  Q
  14. } e2prom_s_cmd;
    ; [& U4 s' K& J* n3 m. `

  15. 6 p: T2 H' X$ @
  16. #define E2PROM_CMD_READ 1" j* q0 n9 c/ j7 K. g/ q! E
  17. #define E2PROM_CMD_WRITE 2: ~# t, o9 e) |" F+ G! @
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"- M4 \2 ]0 Q# N5 w' @* ]) \
  19. ; u+ P5 R3 Y. e2 O1 C; E
  20. static int readparam(unsigned char *mac, unsigned char *stbid)' w& E2 H/ `; W+ S( X: ~
  21. {$ ?- y1 q5 L" M$ @
  22.         int fd, ret;
    5 w5 Y9 @7 G- t" o% c
  23.         e2prom_s_cmd arg;$ d6 X0 l3 e; R  L7 G  V' H4 U
  24.         unsigned char buf[0x18];
    1 Z/ ~* r' \$ ]  M0 t' x
  25. 1 r' s4 |, o; X* {+ a! m3 _
  26.         fd = open(E2PROM_DEVICE, O_RDWR);5 G5 s! V/ T) @
  27.         if (fd  < 0) {( b/ d% E# ?0 c' _$ r
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    : }- A. J0 m# O: O1 B8 l& x
  29.                 return -1;
    # l0 ]0 k/ x" C0 a. Q' r& P: y, D5 m7 U
  30.         }8 d( S. b$ _0 i2 X& A
  31.         arg.sub_addr_count      = 2;
    9 e0 ^8 J0 w, v7 B1 M
  32.         arg.data_count          = 0x18;
    1 j& O3 ^5 F6 V2 b" Q9 E
  33.         arg.e2prom_cmd_sub_addr = 0x290;, x2 U+ E& i6 _, B
  34.         arg.e2prom_cmd_data     = buf;
    4 C+ p: V( q# e! \
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);: z4 K5 s& g% q: @- m
  36.         if (ret != 0) {1 g9 Y5 y! @, \# b
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);& [' ~& C4 J. i1 G
  38.                 return -1;: }5 \6 Q* J  l" _( G
  39.         }' {" Y6 T: o5 ?" k* P8 |9 P0 ^/ M- R
  40.         memcpy(mac, buf, 6);
    / p, w( Q7 M2 H; R8 f
  41.         memcpy(stbid, &buf[6], 18);
    + i# B, w6 B7 D; u% e
  42.         stbid[18] = '\0';
    + u0 D- a) N' H* c7 T) O
  43. ) F8 n6 j. Z# Y& E4 I' I) l( x: U: e* d
  44.         return 0;5 F" g* A. Y- K
  45. }& `' _1 a+ e4 F1 ]! K* f  S! Q

  46. + N. M4 J5 H5 c' `, k
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)4 s2 ~- ~1 T$ ^8 f" e! b+ S
  48. {( M; s6 `& J6 w# ]
  49.         int fd, ret;! M0 a! e) Q* T% e, A
  50.         e2prom_s_cmd arg;/ w& K( y/ ?% {9 R/ _$ y) J( d: x
  51.         unsigned char buf[0x18];
    / Y$ A) k' L' [1 v: i

  52. 0 F" P  L2 @% `
  53.         memcpy(buf, mac, 6);/ e$ |' p7 x9 E. W0 L- e$ L6 @
  54.         memcpy(&buf[6], stbid, 18);6 v; [  ]& d1 b
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    # L8 x* K6 ?$ Q0 }
  56.         if (fd  < 0) {' j4 `) W# h- l
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    1 j. X7 V# W, \7 t, _5 t  v
  58.                 return -1;
    % A1 v7 s& o: i' S, x3 j
  59.         }
    9 n, a: u2 m( B
  60.         arg.sub_addr_count      = 2;# \7 s. V9 |( o% p; X# D
  61.         arg.data_count          = 0x18;
    ' q4 Z( m* F/ z, {5 s
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    9 ?* |; P2 L* ^1 a
  63.         arg.e2prom_cmd_data     = buf;
      h9 I9 `' K! a" e2 i3 ]0 q& x
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    * @! ~0 Z/ X* b. d; v
  65.         if (ret != 0) {( a' v6 T; q7 ^# y/ k; w4 H7 h
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    ' `! d2 m! v) H3 y7 V
  67.                 return -1;' \3 M# P+ W$ H& X9 i) ]
  68.         }* u* |: u+ }! L- S# l

  69. - R) ?) ]" M* F, K! a& S% S, W
  70.         return 0;7 d8 ~) y9 |4 p! K  v/ O8 p
  71. }
    1 S% Y+ R/ O( W0 T- w- l2 i

  72. * j9 q7 q+ d  q9 \/ A, [; d
  73. int main()8 w/ f* D% M) q* X  h% J$ M
  74. {
    . ~# r% g! r2 V1 d
  75.         char c;" I5 ~! ~. v1 K; B' |5 F
  76.         int i, macs[6];% |1 q0 ~7 ~6 }0 \
  77.         unsigned char mac[6];+ }) O" c8 i# L3 ?7 j; j+ G: c
  78.         unsigned char stbid[256];
    % I! G0 U2 q  S# W- x

  79. 2 `+ J! c4 w! I5 D+ M+ F1 N
  80.         if (readparam(mac, stbid) < 0)1 y7 o0 b' ~& |# ^
  81.                 return 1;4 \) `& ]  ?4 h, M1 x2 J  s

  82. 1 F# r1 q9 [9 q2 l" s7 f
  83.         printf("Current parameters: \n");
    " M! o- [' m. g5 I
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    : X7 L; V# @8 d
  85.         printf("  STBID: %s\n", stbid);+ Q6 e% i  f: @
  86.         ' s2 p* ]- @) c; e1 q. ^5 {
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");6 z  x/ Z* ^7 t5 e
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    ; G  y& Y1 I1 m6 m+ z  f8 K' c! r
  89.                 printf("Input MAC error\n");
    ; I  I2 p) D; ]& a$ o3 R
  90.                 return 1;
    0 `0 @& R4 k( I3 G1 a/ c3 J9 F
  91.         }
    9 ~- O  [4 ~  y  q+ G
  92.         for (i=0; i<6; i++)mac[i] = macs[i];& B0 B' @& R, u2 N8 f
  93.         printf("\nPlease input new STBID: ");, W) w1 o9 X! Y  Z7 }' q
  94.         scanf("%s", stbid);
    ! R% s: U9 ]6 M3 u/ X
  95.         if (strlen(stbid) != 18) {
    3 Q0 A" {. R3 Q# U
  96.                 printf("Invalid stbid\n");5 r1 w& z& D  a( a0 G# K
  97.                 return 1;
    ' u; J( y0 ?: a
  98.         }) j" b# `" n# r+ J. b
  99.         printf("\nNew parameters: \n");" t: t: w% s$ L4 ~4 I9 X7 F! B
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    ' P) Z3 Q$ p* N8 e4 n
  101.         printf("  STBID: %s\n", stbid);1 x7 }4 o! C0 U7 m0 x

  102. 7 O5 j% w2 H+ n
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    1 I( W# g! I! U
  104.         for (;;) {
    6 G6 U9 ?% `1 m- A7 L$ j
  105.                 c = getchar();7 u4 R9 S$ |3 z1 c' s
  106.                 if (c == 'y' || c == 'Y'); M# y2 |- x/ u
  107.                         break;5 j+ M- R) N, ~5 Z% ^1 n
  108.                 if (c == 'n' || c == 'N') {; y& d4 ]* m# k/ Z, }8 K
  109.                         printf("\nAborted.\n");
    " L1 Y$ Q% h/ j, J) c$ E
  110.                         return 1;2 F+ y* R4 t5 u8 u- W2 |
  111.                 }9 N% s  h- |1 T
  112.         }
    ' B8 i- Y' l, p+ W- C/ }4 S
  113.         if (writeparam(mac, stbid) == 0)
    & E  p9 D! X& C8 }
  114.                 printf("Parameters changed.\n");5 V! S! T; f+ ?+ _/ A8 r2 u

  115. . @$ u) h# |6 b# n7 N
  116.         return 0;
    $ {$ b* V9 a1 O8 {( {/ l! Y# g
  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
; {2 d0 W7 o, {' P: P在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
$ D$ _$ I& s) d, t: R1 y
你用的编译命令行格式是什么?
% G5 I# s0 [- h) Y( ?, z. _
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

在本版发帖返回顶部