查看: 16620|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    9 `: Y1 J6 _- h7 t! J+ ~
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig/ C5 P* W4 Y( e/ ?& b7 p" W+ M
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:% N$ _0 i0 e5 r9 F9 q& K  |
usage: himr <address> <value>. sample: himr 0x80040000 0x0+ O8 U2 Q0 M$ p- q# h- y: }/ o1 x

* l' q* y; X& ^9 b; n6 a, J8 L; Y9 `1 \
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
: w  N5 R8 ^( d& o6 ?) s( k
7 R0 @; g+ f0 }2 k  w( N补充内容 (2012-3-8 09:42):
) G4 [* y# z9 x$ Ehttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数% g2 r# ?1 v3 v$ a/ K+ I7 R0 p
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
0 H$ B1 Z( ^: I; Z; e' c. e" A) C+ j; Y) R) H  c4 E( a6 `" ^
himr <address> <value>. sample: himr 0x80040000 0x0
' v: G; v4 k: }* q  x* y5 G/ f9 Q% g4 H% t8 v, V- P* x4 a* V: N: W
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。6 U6 d; h) l& b
himr 0x80040000 0x00
1 f4 {' V- S- r! p* K$ h1 uhimr 0x80040001 0x11
' s& B8 P8 Y' q% e/ i0 X8 Chimr 0x80040002 0x22' _$ s$ T( d- y" y; y2 [$ Y
himr 0x80040003 0x33
. w: y) Q/ w1 O1 {& r% Whimr 0x80040004 0x44
1 x3 i9 C$ c' z& u4 qhimr 0x80040005 0x55! V# g$ l/ D* V  F' |

7 J6 \' F5 P/ f0 @SN也是类似。
+ R" n& M8 _& r  n. g" ^4 W1 B1 b& `7 ^% V4 n, h. X* N
现在主要是,谁告诉我们MAC和SN的地址?. h* P! `% J6 f& \9 o+ @- {
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
4 v! ^7 f; @5 c* _' l+ u4 K% n一直想找到运程修改MAC和SN的办法,苦于无解啊
$ ?7 e: p4 b0 _5 N' }8 k; ~, C) m
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 " J9 G8 o7 E% Y- {2 a2 S
+ ~, W; z" E8 W! P' ?6 l& F
修改的代码早有了。到今天不会编译。
" F. E9 D9 A$ [需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    5 n- \' _0 Y! j7 }9 Z
  2. #include <malloc.h>
    . m0 d, a, s3 m1 C6 b
  3. #include <sys/types.h>
    8 L( H% ~- s  f2 s/ N% e# o: ?
  4. #include <sys/stat.h>5 O9 w  @6 [+ N) S9 {4 l
  5. #include <sys/ioctl.h>) Q# i7 Z5 |* t8 @/ B* l" ~2 _
  6. #include <stdio.h>4 U% G8 c: [5 d2 g  A
  7. #include <string.h>- W! i' t1 G3 h

  8. % X+ f: _+ B# k: B, j9 |& P7 j
  9. typedef struct {4 F9 c$ J; r2 W
  10.         unsigned int        e2prom_cmd_sub_addr;
    7 \3 n( V: I6 o: A: }* Y2 a# A
  11.         unsigned int        sub_addr_count;
    ) ?9 T# \* a6 l1 G; e
  12.         unsigned char*        e2prom_cmd_data;
    1 T* [/ }9 u3 K% e
  13.         unsigned int        data_count;
    / ?% V% g; D' e9 _
  14. } e2prom_s_cmd;
    7 s. M- o7 Z3 N/ Q# z
  15. 3 H* l  X/ L: @
  16. #define E2PROM_CMD_READ 1/ j# W# b: r3 P/ k
  17. #define E2PROM_CMD_WRITE 2
    . d% Q; x4 a7 ^, b9 ?
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16": T0 t, ~& j+ E' \$ v+ B# Z) O

  19. - v/ K0 S' F! k8 K' H2 q
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    ( P5 s* M! p3 n8 R, W5 u2 o  u, x
  21. {
    ' O' J* x, ?2 Z7 |' s3 ?4 m
  22.         int fd, ret;
    5 O0 H+ R) Z" |0 @6 o( ]
  23.         e2prom_s_cmd arg;% q4 b7 {2 ]: N: S
  24.         unsigned char buf[0x18];
    + I2 w! a" |5 K* E( e

  25. 1 v5 L# [: Z# o, S/ G
  26.         fd = open(E2PROM_DEVICE, O_RDWR);" k) M6 O! A! G7 C: M
  27.         if (fd  < 0) {$ N$ p0 f$ h0 x1 l5 @3 V, M5 O
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    / o) e& R; E2 Y: A8 _
  29.                 return -1;7 V6 s' ?9 p2 `0 k* V. Y
  30.         }1 ]! }/ k9 a* R4 o
  31.         arg.sub_addr_count      = 2;+ t$ F! i2 v. t' i- P
  32.         arg.data_count          = 0x18;
    0 K0 b5 w! A: g. ~' {  @
  33.         arg.e2prom_cmd_sub_addr = 0x290;' ~- U5 `4 y+ t5 a# c0 h4 r; A+ r
  34.         arg.e2prom_cmd_data     = buf;
    ) [+ S! V, t2 H7 N
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);/ R8 U7 A0 Q! y) f) |
  36.         if (ret != 0) {
    ' R/ q5 J: V6 u5 o
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    * h- k" H0 k# W7 B$ u) }" k
  38.                 return -1;  |7 ~5 f1 K" s2 W/ _3 D
  39.         }
    0 }7 O9 z1 x' y0 I+ K  Q( R1 l- o+ x; [
  40.         memcpy(mac, buf, 6);
    6 A* D  l! Y. Q: Q6 b; Y" v( ?
  41.         memcpy(stbid, &buf[6], 18);1 O$ e5 T/ @: `* q
  42.         stbid[18] = '\0';& [+ Q" w! O3 V" s( W" {

  43. * u+ `( w. N( c2 z' J# q
  44.         return 0;& K; \5 f5 ~  e1 u5 m: y
  45. }! Z) W4 j7 b7 U4 ?4 B/ V" R

  46. # R) D# @( X4 d. K  p/ X
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    + Y2 a7 z7 a+ U  ?8 a; k9 }/ q
  48. {
    / s. G5 s% p% A8 w
  49.         int fd, ret;5 ~1 ]( I: G7 h0 E9 z8 b: |9 F
  50.         e2prom_s_cmd arg;
    : _8 C  g2 ^# b5 A! d7 \( Q. n- y0 j& a
  51.         unsigned char buf[0x18];: g) K6 v; R6 Z. ?1 j( e8 x! ^. y  ?

  52. ' Q8 j: i: ~1 X! e+ |* U
  53.         memcpy(buf, mac, 6);0 L# D1 q* \" q7 P/ u
  54.         memcpy(&buf[6], stbid, 18);9 f0 V& }! a" j* I: q" C5 d
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    2 `, [- n- a6 W0 s7 `: r8 H& {
  56.         if (fd  < 0) {4 f6 H  y! p$ ]! a) b& O9 O9 i
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    / k: H* M2 `5 n8 j1 A; [7 _
  58.                 return -1;
    4 w* L0 z* ]  t5 m  h4 k
  59.         }' `; \  l; D- s; z2 i' A$ U7 c
  60.         arg.sub_addr_count      = 2;
    . ~: Z5 z7 }/ e0 }8 J# R- P
  61.         arg.data_count          = 0x18;0 ^9 [- o: t6 c" O+ j: W5 p3 w& I
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    6 y% ^0 \" A& \, k3 v! u- P# m
  63.         arg.e2prom_cmd_data     = buf;
    4 M- V0 j. K7 \3 [) ~
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    5 Q, d# e! \: f/ S& _4 B
  65.         if (ret != 0) {
    & k5 f- \, Y: J/ e9 e
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    : z8 T  l0 d' e* S9 [0 w" m
  67.                 return -1;
    / s" K. ^; ?/ G* L2 j+ F
  68.         }
    2 M( C. @. C5 u. o
  69. 0 }7 ]1 j/ _) q% X2 {
  70.         return 0;! [+ e' V# q; v5 C* Y2 p; r  ~
  71. }: M: U4 |; _1 B; M2 h- R" n

  72. , b: K* D! K9 B4 K) j2 `1 z4 w0 X
  73. int main()  A) D; r0 o# w" l# t% h
  74. {
    . K. U+ J+ G) M: R2 \7 K
  75.         char c;3 S9 p# r& w- z. L
  76.         int i, macs[6];
    8 ^) Z+ Y$ m8 c0 Q/ I; m7 B/ e
  77.         unsigned char mac[6];
    , R3 \4 j* b5 p. J+ g
  78.         unsigned char stbid[256];
    $ E/ i" ]) s% `8 g1 a4 C: b; @
  79. 7 O! I: A  o: p) T0 g
  80.         if (readparam(mac, stbid) < 0)
    7 |! w8 ^2 p, q4 F
  81.                 return 1;
    " E. G! x9 s( `

  82. $ S. v9 E# o6 Z2 Y
  83.         printf("Current parameters: \n");5 H' \1 }$ o4 g' O6 j
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);. L3 ^' a4 H. {& P" c# g% I0 z
  85.         printf("  STBID: %s\n", stbid);
    & A8 x# D' d" B7 ^! u: w2 o  L7 w9 M
  86.        
    / V3 Q8 r' K0 h* Z
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    ) D, V( z2 r/ J$ J# X% x* w
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {- o) x) D6 {& `* d* t
  89.                 printf("Input MAC error\n");
    ' u& }, @* o: j0 ]; w
  90.                 return 1;
    6 m6 P0 P7 R5 @6 w* h" _
  91.         }( S& f# o7 m% l+ E- r
  92.         for (i=0; i<6; i++)mac[i] = macs[i];( {) ]7 B: ^  f% P2 e" ~
  93.         printf("\nPlease input new STBID: ");
    6 |& ~& X. _$ h9 N. R9 Q
  94.         scanf("%s", stbid);: j3 Q6 o7 i$ f
  95.         if (strlen(stbid) != 18) {. ^7 q+ B+ z# o1 |2 r6 p
  96.                 printf("Invalid stbid\n");% w; V( X0 C% U# A# X" ^4 E3 B
  97.                 return 1;
    * ~# S! s4 x7 i% g
  98.         }/ e  s8 V) y' F: N- U5 c" K8 O
  99.         printf("\nNew parameters: \n");9 ?. ?8 \6 D8 l2 j
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);# U/ y3 F6 B! i5 t
  101.         printf("  STBID: %s\n", stbid);
    : @* z+ F& r2 S9 B; r
  102. $ G1 o; j+ h& F7 E$ k: x
  103.         printf("\nDo you want to change paramemters? (y/N) ");7 L* v0 w' Q5 o3 }
  104.         for (;;) {2 E8 x/ {6 U! l6 f0 s
  105.                 c = getchar();
    7 R% a0 J$ L7 [* C6 w: J
  106.                 if (c == 'y' || c == 'Y')* ~9 M# h+ Y  ]* S  b2 \0 B' w) X* i
  107.                         break;
    2 M, ~+ V1 K+ ?* z9 U
  108.                 if (c == 'n' || c == 'N') {
    # _8 V: b  ]+ m# T3 l
  109.                         printf("\nAborted.\n");
    ( V7 Q$ o5 o3 l3 Z! m2 n
  110.                         return 1;
    3 X* |, k3 H8 x: H# W+ R% Z' X
  111.                 }1 P/ h4 F; u: G. K) G6 Z7 o
  112.         }0 Z9 ?$ Q+ y. S+ f5 }: M
  113.         if (writeparam(mac, stbid) == 0)
    2 X1 T) _. w3 M
  114.                 printf("Parameters changed.\n");
    6 J. o: C3 S( {2 F! [$ x
  115. 8 V' M; O# Y7 S8 ~
  116.         return 0;) Y1 l) [" e1 K8 e" ^0 _
  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
& D0 _. W. n# L- E: u在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
" k3 T0 i% b, C9 }. o! l
你用的编译命令行格式是什么?/ |$ A. F  ?+ H& X3 L
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

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