查看: 16807|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    $ q. g" x7 e4 l7 s6 m- _" _1 U3 d
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig% j5 x( i/ J) S: [- {+ z, ^' {
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:! ^6 T* j$ y7 u, {; o
usage: himr <address> <value>. sample: himr 0x80040000 0x0# `1 P. O2 S: l' T. X; A

: ?( ^2 N" h& Z0 m2 ]2 _5 N; {
% b5 W" ^+ a1 F* V不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
+ a2 P5 ^2 q7 D2 |: X1 ^; p! D& q: W3 {9 s( C8 u/ A
补充内容 (2012-3-8 09:42):, N4 n) x) K; m( J( ^6 X
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
. N* F- ~! L# Z这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。
" G/ h, p+ A) v$ j0 z/ g- o
! I" `1 Y0 `  B) ~/ I7 ihimr <address> <value>. sample: himr 0x80040000 0x0
8 h) Q8 v- t  w0 L( w& r0 D2 S3 H& G) a( S1 ?. o4 o5 F
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
6 C: O5 Y. K7 ]3 J5 [7 F6 phimr 0x80040000 0x00
4 M4 ?2 S3 e- [% k. E  Phimr 0x80040001 0x11
! i( Q, L* x& F$ G1 D) d& @: ]  Z; Ohimr 0x80040002 0x223 `3 |* E9 K- D# H( H2 j5 Q, Q
himr 0x80040003 0x33
/ H( E& c; {7 l: }5 w7 Z) V$ x5 Dhimr 0x80040004 0x44, F( q! }- J) n$ x
himr 0x80040005 0x55
' U& l) {8 V1 O2 C- Y: r: y* @7 z( p
0 y, P% ~3 r( z0 l& t# B# z9 C7 E/ ISN也是类似。
1 b7 G7 L4 c2 A; f$ Q1 {% C! g2 d& Q9 x2 e! b- n, E
现在主要是,谁告诉我们MAC和SN的地址?
9 c% c  l' X' d/ f3 v9 `) V
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37
; L& _% l7 ]1 f8 O- f! G0 y一直想找到运程修改MAC和SN的办法,苦于无解啊

; ?5 M9 t0 |" z) T: ^& C& F' z源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 ) e1 R6 L0 O5 t+ h% ]" }: K8 b' u
# W6 U# Z. g7 Q
修改的代码早有了。到今天不会编译。
* p8 Z7 e, }6 b& _( \需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>6 P( y2 z' C# ?/ {
  2. #include <malloc.h>
    - c# X/ w; V5 k0 y9 U$ j
  3. #include <sys/types.h>
    3 J! l- `9 |2 G) {* H$ L
  4. #include <sys/stat.h>
    & k* x8 M% v; W, u! ]8 m! M5 M! b8 ^
  5. #include <sys/ioctl.h>+ e7 Z# D* h2 Y/ r
  6. #include <stdio.h>. x# c5 S! J) b1 o. G4 k
  7. #include <string.h>3 x8 ]  c! I8 N

  8. 9 f5 V: H5 m! f, c: ]4 l
  9. typedef struct {
      D6 l* i* p: L" M. ]6 D+ k
  10.         unsigned int        e2prom_cmd_sub_addr;
    4 G! C( b: C: ]9 ~" H$ x
  11.         unsigned int        sub_addr_count;
    5 t3 p4 p$ J0 I
  12.         unsigned char*        e2prom_cmd_data;
    & B- U! J' p; ^( }
  13.         unsigned int        data_count;  \3 O5 M2 h6 M: N( P
  14. } e2prom_s_cmd;
    ! L' d- [7 i8 A+ P9 E

  15. & J7 _: Q, s7 I2 X
  16. #define E2PROM_CMD_READ 16 ]1 J% [4 K% X6 O! X7 ]
  17. #define E2PROM_CMD_WRITE 2
    6 z- {1 L/ k8 s
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"! k  O( R: \6 I$ V4 v
  19. ) n7 a+ w" V, }
  20. static int readparam(unsigned char *mac, unsigned char *stbid)/ v- E! F% Y. \( }# s% d9 ]
  21. {- P* V+ G" L) V6 Q1 \( p
  22.         int fd, ret;
    # \+ o8 ~3 X2 \
  23.         e2prom_s_cmd arg;
    : F; a* l6 \2 B3 P
  24.         unsigned char buf[0x18];2 H7 s5 ?5 X2 w# q2 J, Q" a3 \5 E) v

  25. 7 R: o1 I9 i- ^8 b- e
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    ! S$ Y8 T3 ^. }3 d  }5 [
  27.         if (fd  < 0) {
    ; A& D' ^5 S# z0 k& P
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);, i7 C" @/ K7 \. s1 p: {/ V
  29.                 return -1;3 O; B0 v$ t- a1 b9 v) @" c
  30.         }5 {  C! j& w3 x8 Z: I) p; W; n
  31.         arg.sub_addr_count      = 2;& x3 t" \3 Y+ A
  32.         arg.data_count          = 0x18;0 g$ H  o6 O, V- O0 T
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    7 |9 A! w3 C. I5 M% H
  34.         arg.e2prom_cmd_data     = buf;
    ( ]2 A, M8 z* a5 K
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
      a, P0 P: E" \" ?! g2 N4 I2 k# h
  36.         if (ret != 0) {& F& W% s. p: {) ]) v5 S. A
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    : i. q- B; k' z
  38.                 return -1;
    # ]6 X3 H& H- O3 I1 Z. Z; n
  39.         }/ {8 e. d4 u/ q/ A/ D4 L
  40.         memcpy(mac, buf, 6);  V9 B) d. n1 u; H  m  d  Y
  41.         memcpy(stbid, &buf[6], 18);! c1 g, J; x/ S: Y; {" d6 y; i
  42.         stbid[18] = '\0';& D  G1 t% [$ }1 k. _- n. ~

  43. 2 k/ z) g0 D2 ^+ m- r
  44.         return 0;
    + u$ V& h$ P8 M: G' C4 `
  45. }/ V" h" V, w$ n. D

  46. " S. f7 E' e, E2 T( C8 y) A) }
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)5 Z1 A$ b8 U* u8 I% e# H6 V4 ~. M
  48. {
    + L$ ^- K) c1 T& W% ?/ U: \
  49.         int fd, ret;
    1 X# j1 [! r1 H9 w
  50.         e2prom_s_cmd arg;- T  i/ b+ o& I2 r0 T" x/ H% h4 K
  51.         unsigned char buf[0x18];# X) `" m; D' F: _2 _  G4 b6 k
  52. & y) U) J; j6 ~' y* o) v
  53.         memcpy(buf, mac, 6);
    * K, X' U1 o$ [: X, [% w7 D9 ?
  54.         memcpy(&buf[6], stbid, 18);+ i: i9 ^0 O, d1 r
  55.         fd = open(E2PROM_DEVICE, O_RDWR);" o+ b7 N$ A3 C0 p* B
  56.         if (fd  < 0) {
    ; D5 g3 A8 |+ c' z+ D& E2 P" H$ E
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    * n; ]1 d, b1 j! R, |
  58.                 return -1;
    ' C/ [/ C: W5 S! V1 ~! R
  59.         }& {9 ?& P, l0 `  Z# ?6 G
  60.         arg.sub_addr_count      = 2;9 d! e' }* Y9 s  Q8 \8 X( E
  61.         arg.data_count          = 0x18;6 ^( A  k# T% {- H. V  H" X6 E
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    * }  b- t5 H7 c# v
  63.         arg.e2prom_cmd_data     = buf;
    9 F) q& D( J6 h3 X! _/ j6 ^/ d
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    5 d0 T5 E/ v8 x; {9 o" V
  65.         if (ret != 0) {
    $ d) O4 l0 C0 @4 i4 {/ u& A
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);, m! Q: m8 f4 \/ G. z! T
  67.                 return -1;
    & @& m* L" q- {; j. ^- @3 k7 ~
  68.         }# H0 U% O& a) s" |- g/ u

  69. + ]7 j$ V& z% ^
  70.         return 0;
    ' y) n$ C9 k% S& c) J2 T6 e
  71. }6 m& o  Q+ E) {# q3 ^  g3 g) ^

  72. 8 h; g6 r" X# B3 j& j
  73. int main()
      \/ R3 T8 M7 y7 N/ [: C% n
  74. {5 q. }/ W' e- q. e- |( Z
  75.         char c;" `, }, w7 M" [) Q
  76.         int i, macs[6];
    % f4 s; E' W4 m  [9 S9 H1 B
  77.         unsigned char mac[6];" R! ~  G" W; G) h. ^: v3 J1 y
  78.         unsigned char stbid[256];* u; y& Y; C: S* w: {/ X' L
  79. + q6 P/ A1 U9 X0 C3 ^- B  t
  80.         if (readparam(mac, stbid) < 0)0 K4 U. H. G; r6 ^" H9 b
  81.                 return 1;" f. j0 O* {) a. c+ I/ x( t

  82.   u6 {- W/ j, b  E5 E7 |
  83.         printf("Current parameters: \n");, \% C, T4 I1 g) I3 `$ y& X
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);) a. s' B- f8 f' s% K9 k7 X. d+ F
  85.         printf("  STBID: %s\n", stbid);. s6 F8 h+ O) s+ c! `1 V
  86.         & o0 e+ {7 g8 c2 E/ `5 N
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");8 J, n& Q$ O6 c- Q
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {. ^+ [3 p" J3 \+ ^/ j
  89.                 printf("Input MAC error\n");
    + f, o# S5 c  {
  90.                 return 1;
      J; Y3 B( C* N, A2 i, M; s5 C1 B
  91.         }
    - q$ a& z. E* z: E* [' x
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    $ a: b! i3 Z" V0 S; b& i3 k
  93.         printf("\nPlease input new STBID: ");
    " K6 b% V/ T7 W4 G- P
  94.         scanf("%s", stbid);
    & `) j$ g, T) L/ Q7 l' Y
  95.         if (strlen(stbid) != 18) {# q  |$ Q9 X4 y
  96.                 printf("Invalid stbid\n");
    2 V% N7 f7 X' x8 i7 i& A0 j, o0 r
  97.                 return 1;+ M1 N- A4 a5 l5 c
  98.         }
    + F! e& S/ @3 A' v7 N, K
  99.         printf("\nNew parameters: \n");
    8 s9 C* i0 k% e( B  M- `
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);  j/ k; h' ^/ n3 D4 V
  101.         printf("  STBID: %s\n", stbid);3 s; g% @$ F1 K( A% V
  102. * [( e: K) J! s3 Q( ]& D
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    ) `7 l! v1 G4 A
  104.         for (;;) {
    - ^$ r! q5 [2 g4 P2 l
  105.                 c = getchar();
    & G% I3 f4 D. z8 f6 G# C
  106.                 if (c == 'y' || c == 'Y')% t! i8 X  P- L
  107.                         break;% i5 \8 r7 U' [6 M3 I3 R
  108.                 if (c == 'n' || c == 'N') {
    6 P4 P" U$ ^5 c8 z% |5 l
  109.                         printf("\nAborted.\n");
    ; h/ r, ?( K" p& y3 w( A
  110.                         return 1;
    $ i/ {- n9 ^( T) F& O
  111.                 }
    6 K$ g+ `+ F9 f' k; k0 O, w/ g
  112.         }3 G' J! }# w2 \: u6 f
  113.         if (writeparam(mac, stbid) == 0)
    8 n5 S& s4 \% w% }9 ?- p8 `6 |' e
  114.                 printf("Parameters changed.\n");# O$ Q3 `  k$ b8 V) g7 }; I

  115. 2 \; L) {  j( x3 y: s
  116.         return 0;3 k( W: W1 h; _+ S7 m: C. J. d5 e
  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 h3 r* X) c  z7 X! q" D! [6 Y
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
1 ]- V6 \1 \* L; r+ M* x
你用的编译命令行格式是什么?
- k4 u1 K! t. p. b1 A' h1 y
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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