找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15717|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr' z* I( Z' O$ h5 z9 |
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    ! r/ a9 M# c7 W- f' U
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:0 X5 F5 a# a6 @2 G' p/ |) N
usage: himr <address> <value>. sample: himr 0x80040000 0x0
! a+ {2 o3 w) C
7 q' g* v7 M$ i9 X+ W  |5 u
! x5 V$ I4 Y* y- y7 u, t不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?$ s6 {  {6 R& a" a/ q* i) O: T

  ?. T! p9 l! J补充内容 (2012-3-8 09:42):# [- n9 a) L2 h6 w- F; a
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数* V- o7 ?5 @6 T' p' R
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
' m% W/ C. Y- l5 t* `3 n2 H2 y1 P0 r- E$ H* e
himr <address> <value>. sample: himr 0x80040000 0x0* V" \- n/ Z/ M4 Z3 ~1 [: H& w

1 l) y* v: Y9 X& V例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。8 F$ G$ ~) d* I% x. ^/ {7 i
himr 0x80040000 0x004 {: }0 `% l1 c$ \) z
himr 0x80040001 0x11
& t& X, T; T5 f' ]5 [himr 0x80040002 0x22
. m' E! c5 j( ~8 k8 v4 thimr 0x80040003 0x33
1 ^1 w6 e. l4 t8 i! khimr 0x80040004 0x44
  z  l$ g( L, z6 g  D5 h! s. F" Bhimr 0x80040005 0x55
% g$ |/ J, t8 i- i# N! Z. U  [- E7 |3 [, u% K; Z3 z
SN也是类似。& f* }( F' c; b  z' i. ~6 `

+ W) n+ y' r( s8 {7 J6 k现在主要是,谁告诉我们MAC和SN的地址?
5 D! B1 `6 d$ l& T
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 9 P( R& g; r/ \
一直想找到运程修改MAC和SN的办法,苦于无解啊
& D& t) \8 x3 \
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 " r) D& y, G0 R' {+ X. s3 X
$ n% z  R+ J1 s/ Q' a- v' c9 p
修改的代码早有了。到今天不会编译。# p+ L/ _1 U& Y) f8 t
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>" ~! \  o* m7 u
  2. #include <malloc.h>& M; v1 p2 U" d4 j9 U( E- w# L
  3. #include <sys/types.h>
    " {% ~$ B+ M6 c+ Z8 B1 r
  4. #include <sys/stat.h>
    % }" y$ O1 Z9 x: {
  5. #include <sys/ioctl.h>
    ; I/ \: `' W4 A7 {9 p
  6. #include <stdio.h>' {# O/ Y1 {. }
  7. #include <string.h>  o0 w3 M3 Z- C" ?6 U+ }
  8. " V6 |9 R) s+ e$ A* X3 t
  9. typedef struct {$ _5 {9 @! B) ?+ e3 }) p
  10.         unsigned int        e2prom_cmd_sub_addr;/ ~/ b* S1 E7 _& M/ N% z* n7 Q
  11.         unsigned int        sub_addr_count;
    2 s4 \+ p% y+ P* `* D% N4 N
  12.         unsigned char*        e2prom_cmd_data;0 p# q) W7 C; ^, k6 A! H) W# e' j  t
  13.         unsigned int        data_count;
    6 ~' J, `9 ^4 f1 c% P. y  x
  14. } e2prom_s_cmd;3 _" V+ k9 X% Q% M8 M% q
  15. 3 n' w1 u. |- A- m! k. [( ^
  16. #define E2PROM_CMD_READ 1
    ) P+ ^+ b, ]. ?+ K. n
  17. #define E2PROM_CMD_WRITE 2# B) _% y3 m7 j- t  s
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    8 _( j! q6 Y7 ]# F7 D* h! k
  19. + D2 H5 p* i$ P. y9 t* b! b# J8 C9 S
  20. static int readparam(unsigned char *mac, unsigned char *stbid); _$ z; o$ K2 M; P. s) K) A
  21. {
    8 x% g, T% b( L% o: z
  22.         int fd, ret;
    0 P3 m2 q0 u9 t$ g
  23.         e2prom_s_cmd arg;& H' N2 ]/ E) x. \; S. @
  24.         unsigned char buf[0x18];8 A- o9 X" x6 ^

  25. ( _9 v% M; X+ Q9 J
  26.         fd = open(E2PROM_DEVICE, O_RDWR);* v3 `  Y" q- S4 M/ n7 I
  27.         if (fd  < 0) {
    ' d/ w1 i! e; d. N5 g
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);+ L& S0 r% G" _. h" M! |
  29.                 return -1;' K# j& `) v4 X/ F* B2 @
  30.         }
    + Z, R' r5 D/ ^) }
  31.         arg.sub_addr_count      = 2;
    * @7 g% @6 z$ m* V
  32.         arg.data_count          = 0x18;" Y4 S6 G# i+ d' L$ t1 I
  33.         arg.e2prom_cmd_sub_addr = 0x290;6 x9 Z; }2 a' D
  34.         arg.e2prom_cmd_data     = buf;
    . O" ~1 K; J- r- B
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);4 n) Y  \- _( g$ h. g  y
  36.         if (ret != 0) {
    , s, Q9 P& K+ t
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    $ s8 z5 B  E- \3 |" Z) w% d1 u
  38.                 return -1;
    , X+ h! W) |; \
  39.         }
    ( w0 I* `/ V, ^. q
  40.         memcpy(mac, buf, 6);1 F& y2 m6 J* y( T: Y& d
  41.         memcpy(stbid, &buf[6], 18);9 m, S! V% g0 q
  42.         stbid[18] = '\0';1 A8 e! C% W2 ?0 h+ d4 o
  43. / e0 U2 R- K" A$ b
  44.         return 0;2 Z6 A, U( |6 A
  45. }5 Y2 s' K2 d/ p( c9 C5 D* K
  46. 4 Z5 k1 L% q- H( o3 a2 T
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    * [/ V+ T8 |5 @, \! P
  48. {
    3 G" @. P" Z) J$ \2 G% t1 p) f
  49.         int fd, ret;
    1 I4 l7 L1 A! e! R, [
  50.         e2prom_s_cmd arg;: d0 s1 t" c; e. e/ \
  51.         unsigned char buf[0x18];+ c  H2 r2 G: P6 G8 E7 D
  52. % H+ f9 Z* d9 A; h1 z7 Y
  53.         memcpy(buf, mac, 6);
    - l6 I9 L( v, A6 N$ J( {/ _: y( ?
  54.         memcpy(&buf[6], stbid, 18);
    , H. I" `7 `" I9 ~
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    & d2 y3 @! ?% G7 Z* B
  56.         if (fd  < 0) {2 y; J* {# A  ?1 M8 n+ W
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    9 L4 m, C5 u/ D
  58.                 return -1;6 ?, R% f0 v4 S' ?
  59.         }
    . H1 o1 M5 n/ m1 _: m5 V8 W
  60.         arg.sub_addr_count      = 2;0 X% `+ {* h  y9 @0 S% }  u' Q
  61.         arg.data_count          = 0x18;
    6 S, [3 H0 n0 B$ p1 x* P
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    . V/ X) Q' ?4 H. m# ^) k& o
  63.         arg.e2prom_cmd_data     = buf;9 |/ e7 j7 B+ U  @
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    * B" \3 w4 e' o4 M% n/ t2 G
  65.         if (ret != 0) {
    $ ~4 d( ]- O9 ?9 I
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    % x6 A* ?9 j7 |" N8 `; c! u
  67.                 return -1;& W8 _4 _$ p: t2 |
  68.         }
    7 k2 J$ k1 h: m- }- D
  69. ' F' g2 l0 D2 v6 Y3 @8 r1 M- l
  70.         return 0;
    8 P+ q& T3 A" S- K+ F9 {0 M& C
  71. }1 n- j$ E/ @, m

  72. 9 S" c% k( L7 S4 E% K7 B! X
  73. int main()6 i2 s. X- j2 |1 B3 l9 A2 S+ F3 B# S
  74. {/ J5 R: s; C& V9 y9 D# `) E5 K
  75.         char c;$ g" b0 c. ]! U
  76.         int i, macs[6];( p/ [( {" j& B5 h7 {& T/ u: W0 s
  77.         unsigned char mac[6];- y) F; V/ \- Z/ x5 _( }5 s
  78.         unsigned char stbid[256];1 f. i; A9 x4 y0 i9 j& ~, v

  79. 3 Y+ B7 {9 K+ z. L* j, D' S4 C
  80.         if (readparam(mac, stbid) < 0)
    ! g, Y) Q/ N& _' p
  81.                 return 1;' h% r/ e: q& l" |9 Q, i' M

  82. 4 f9 ?6 r; Q7 k$ c4 H
  83.         printf("Current parameters: \n");
    . {( b/ B3 f' \# }: Z* ^
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    8 }, {- ^* V& q+ O# x9 Q
  85.         printf("  STBID: %s\n", stbid);/ H0 V1 b7 b( c2 M7 _4 {
  86.         " b2 ~: ~7 o2 v
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    # n3 e1 R. M% p. s% C# _2 j
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {# G5 v( w8 F& o% l: c
  89.                 printf("Input MAC error\n");
    9 ^- p9 Q8 r  f7 u0 Z! o
  90.                 return 1;0 m7 N/ V) V( K8 z, G2 h; K- w' c
  91.         }
    , f1 O, }  d; T
  92.         for (i=0; i<6; i++)mac[i] = macs[i];' e3 Q  L8 K, X3 S8 i9 Q; s
  93.         printf("\nPlease input new STBID: ");
    ; I% b$ S! L8 u
  94.         scanf("%s", stbid);4 O* x! q9 J7 ~/ ?
  95.         if (strlen(stbid) != 18) {% Z1 B: b% y! Z; n5 M
  96.                 printf("Invalid stbid\n");' x5 {! O+ h' z1 q7 T# A& d; Y
  97.                 return 1;
    8 M6 g0 ]% U2 l; M) i9 u9 R& D  s
  98.         }
    7 k; L& }! R. A; U, S1 E4 r
  99.         printf("\nNew parameters: \n");2 Z) f" N1 m3 v  M7 W4 q
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);1 Q: `7 S- \1 R; T0 [1 ^( c# q
  101.         printf("  STBID: %s\n", stbid);1 X* a0 d9 W" O* _! w7 t
  102. 7 f( m) D& V2 k3 z+ P! Y" A4 t* B
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    ' U$ x1 t1 c1 w. S& P3 D1 L
  104.         for (;;) {
    ' k: P) L* a" ^% O2 j
  105.                 c = getchar();
    / j3 y" j3 ^% U8 \# U1 D
  106.                 if (c == 'y' || c == 'Y')! q% z/ P% [( n6 J9 A
  107.                         break;
    & \" X' p8 b/ [/ Z
  108.                 if (c == 'n' || c == 'N') {; S# C$ X& n9 G- Y. S9 S4 E* Y1 [
  109.                         printf("\nAborted.\n");
    9 S% M6 g4 f1 u! k, U( L
  110.                         return 1;3 U: i# L5 `1 v1 ~7 p: G* }
  111.                 }! \0 \% l- k  a
  112.         }3 F( W' Y  @/ x& `! x# q4 e
  113.         if (writeparam(mac, stbid) == 0)
    2 _0 U3 `1 r& f8 ?" w5 y
  114.                 printf("Parameters changed.\n");9 R: C8 E- h% @1 `# |( Z$ `
  115. / x: v0 r5 u- f  `5 a
  116.         return 0;
    & M9 c/ Z* f, m/ D2 \6 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
0 H6 m) M$ _& v! c在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

9 Y8 Z" Y+ v* W# Y+ d4 a6 V你用的编译命令行格式是什么?
7 E8 p0 I0 b3 Z/ l5 V1 I
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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