查看: 16457|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    ! J0 u& Q7 ]$ k; f9 K' o
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig; N; _8 h: r. f% e0 S; B0 S' j
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
5 l5 |/ u7 ?4 susage: himr <address> <value>. sample: himr 0x80040000 0x0
$ O, D+ j/ o& g3 @/ K" M
* U+ ^% e$ q8 k+ |- Y' e* U
5 v- \* G7 h4 D1 ^6 E" i3 ~不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
" K+ R/ b2 E, V6 ~
8 _9 `, p. ~' ]补充内容 (2012-3-8 09:42):
7 ]2 }! _2 G' ~4 Zhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
% U$ [1 s. @+ |- T9 N2 }这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
" K3 e1 R9 p5 K7 u3 b. r6 _7 e2 }$ S  U$ e
himr <address> <value>. sample: himr 0x80040000 0x0) X( D) |2 C! U6 l% O8 q
. @8 [$ @- ?# H% V* @" x7 }
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
4 J2 t8 Q& G5 @: S& X; `himr 0x80040000 0x00
# \: L% \' C, n$ L! O- p: Whimr 0x80040001 0x11" {  \: o5 E* k! y1 `8 S
himr 0x80040002 0x224 ^! Z) t. \3 O! R7 v+ ~' B! y
himr 0x80040003 0x33
0 U6 Y/ M8 p2 s, F- _) ghimr 0x80040004 0x44" t/ V: T& H; A5 d  i
himr 0x80040005 0x55
* u$ E0 m, F3 I; N  `
9 ^1 @  f1 J! s/ A  N- O. ^SN也是类似。
& y3 c# F1 x, N
/ M5 E0 j2 l, `' b现在主要是,谁告诉我们MAC和SN的地址?
+ C# y+ w( S5 O8 z+ u: }; u+ V
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37   @& \: i( n. Z9 ]* c( s
一直想找到运程修改MAC和SN的办法,苦于无解啊

% R. S# k- B$ u/ q源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 * b* X0 Y6 a2 \- K
% J# H9 H, b8 B, N0 `: c
修改的代码早有了。到今天不会编译。6 F) [$ U( {) z" a$ W8 E# _
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>3 d5 i* @5 l0 Z& ^! e+ b' ~
  2. #include <malloc.h>5 _: u7 Z+ l: ^7 X+ G8 i3 _3 }
  3. #include <sys/types.h>$ _$ H  ]  @' O) s) |6 b/ o
  4. #include <sys/stat.h>
      [8 j& E. P+ V0 a# @5 h
  5. #include <sys/ioctl.h>! P" g% s% S# D+ O9 d+ \1 R' r5 @
  6. #include <stdio.h>
    ( C! U3 Q1 A( P) S6 b4 t
  7. #include <string.h>- I8 @/ M( L8 g& B$ ?1 Y& Y
  8. 0 E3 X% {6 Z0 c6 d0 u
  9. typedef struct {1 D- V; a0 I! }* Q2 \+ g, ?
  10.         unsigned int        e2prom_cmd_sub_addr;0 o& Q6 m7 g* L3 {' v6 ]; d! O
  11.         unsigned int        sub_addr_count;( M& Y1 T8 b1 L8 ~: [
  12.         unsigned char*        e2prom_cmd_data;
    * C0 u% Y# ^. ^
  13.         unsigned int        data_count;. k' r! G) s4 V& a
  14. } e2prom_s_cmd;
    7 b% [5 o4 @3 c. e* ?! d
  15. 0 t3 u; a- }- j4 H5 `1 d% e
  16. #define E2PROM_CMD_READ 1* k, s+ F, l3 d) ?9 g4 D
  17. #define E2PROM_CMD_WRITE 20 @1 K$ a# |* M
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"' Z, c" g* V/ ~  p" J

  19. % L2 L) _$ j3 v
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    3 o4 ~6 B3 ]" `0 l' H- ^' \
  21. {' W2 D" I2 e; I% t
  22.         int fd, ret;5 W$ s; ?9 ^  \( \; h
  23.         e2prom_s_cmd arg;
    7 T% W# K2 u2 t% ~5 U2 J- V4 r, q
  24.         unsigned char buf[0x18];
    7 e5 F) M* P( u9 }0 G

  25. 5 j; g& g0 V0 o9 j5 f: W) j
  26.         fd = open(E2PROM_DEVICE, O_RDWR);8 R3 M' e8 _* O' c; E5 n+ P
  27.         if (fd  < 0) {
    # k1 h% v4 l9 C: w3 w" r8 s
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);0 `9 _5 d0 w2 F2 u# l
  29.                 return -1;/ ]. @' Q2 Y- ?+ o. k8 A1 [+ z
  30.         }2 M+ u$ i. W3 v5 `& o
  31.         arg.sub_addr_count      = 2;
    - {% G5 }% E5 |' d/ ]& e% l9 V
  32.         arg.data_count          = 0x18;
    - Q0 L- P4 F* D( d2 W0 ?
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    ; D* I+ b( T! O; E/ g% F
  34.         arg.e2prom_cmd_data     = buf;5 q2 W3 F, H7 F8 c( D+ i
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    % f$ w- g. n2 g* w9 a4 Y% B, }
  36.         if (ret != 0) {
    , g* ~1 O. x' K2 }: {
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    , ]2 ]+ W' L6 f5 n  ]$ X/ r
  38.                 return -1;( B. O3 i/ r5 u6 S- [. q/ j, M
  39.         }* Y2 R  X& o. S5 H& D2 x/ L
  40.         memcpy(mac, buf, 6);. l3 A6 h7 e$ G/ J5 e2 I
  41.         memcpy(stbid, &buf[6], 18);( S/ g: u8 n) ^
  42.         stbid[18] = '\0';
    ' ^+ j3 r- n) q! l2 U. a
  43. & m( `) W; |1 s% ~4 R& Z/ U
  44.         return 0;4 G7 s% I$ V; F, Z
  45. }" y% q3 q, m& g. |/ q- n( t( R! r
  46. , M! I; d0 f7 g
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    8 x3 r2 [2 O+ e, [. `! V' c
  48. {
    8 t- F9 A. U' V+ q3 L* p5 Y
  49.         int fd, ret;: D6 r9 x5 W4 C/ {" \& K
  50.         e2prom_s_cmd arg;
    - c) d0 ~8 P6 F) M9 v0 q
  51.         unsigned char buf[0x18];/ ?. f. F  u9 i6 D
  52. * J- C* [; I" H: U/ i
  53.         memcpy(buf, mac, 6);) r% `; U8 f: _' |5 F7 |. N
  54.         memcpy(&buf[6], stbid, 18);
    " t" C2 F- g* U$ F, e4 }! q4 \
  55.         fd = open(E2PROM_DEVICE, O_RDWR);6 Y& s2 c9 M/ D$ k$ X1 D! g* J
  56.         if (fd  < 0) {
    8 r, s  }5 M2 ~2 Q8 q" p/ x  o
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);! l" b/ z/ E. w" c7 \
  58.                 return -1;
    - M0 ], ]  [' ~( U! B7 C
  59.         }
    + ?  p7 x4 U' x7 h. l4 d
  60.         arg.sub_addr_count      = 2;9 |! U/ C9 g* `0 ^
  61.         arg.data_count          = 0x18;
    7 O2 G$ M0 S/ c4 V/ r( X6 Z
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    # J$ I% {0 l+ S/ u+ W
  63.         arg.e2prom_cmd_data     = buf;4 q5 b. [, i8 p1 M3 t
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    ! g, u$ C. v6 o" A* P: M% W* Y
  65.         if (ret != 0) {6 f/ x8 i6 e* B. I  {# R
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);  l2 R% k9 f7 G2 S; [  f
  67.                 return -1;
    ; D8 j: ]9 C8 l* i8 B
  68.         }& X4 C* f7 M# Y% Q- j
  69. ' ]- p* h" u- @/ E
  70.         return 0;% \9 C% v& T. N7 A
  71. }% q: k. x# C) {4 a( Y
  72. ! w9 ^' s- G( q/ k' ~
  73. int main()
    : m( X% P" j$ S0 p5 B# M$ d
  74. {
    0 a  Z- g% i7 X. b2 j8 o
  75.         char c;
    ) T  w# p' K/ ^: Z/ ~
  76.         int i, macs[6];
    ; h4 u) n3 l1 L+ X" E: ~
  77.         unsigned char mac[6];, F1 q1 G5 B0 M. S7 m
  78.         unsigned char stbid[256];% _: l8 ?8 Z4 ]* i4 w" h
  79. ' O) C, o' p, H7 `! p1 F; d
  80.         if (readparam(mac, stbid) < 0)7 Y2 k8 _0 w1 x, W7 x( F% ]
  81.                 return 1;
    ' f3 c* l) @' ^1 O, K

  82. : H+ P- d! b+ A5 ]5 \
  83.         printf("Current parameters: \n");/ R( h6 z, O' c6 a# |4 `7 s# Q
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    % d' s% m- S0 N' W" z6 w
  85.         printf("  STBID: %s\n", stbid);
    & \8 o" m( |( P; S' r  |& j
  86.        
    $ L/ x+ B) n- z4 [5 q# Z$ `5 k
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");$ s  a6 K# a) ]8 `% s
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    0 v0 Y% E: s- D
  89.                 printf("Input MAC error\n");$ w- d2 q. D! w6 y
  90.                 return 1;
    # ~# w& n8 t6 }$ R" M4 d2 y
  91.         }5 P: H3 E; \, ~* j" O3 j) d
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    / D! `9 a" i; W* Z3 e# z* |
  93.         printf("\nPlease input new STBID: ");
    * Z. H1 @0 Q4 ?  o2 l& f4 [
  94.         scanf("%s", stbid);) r+ p% w. w# w, [) ?
  95.         if (strlen(stbid) != 18) {
    5 @0 V# l$ r2 }) [
  96.                 printf("Invalid stbid\n");& R) X6 `3 q1 D1 D: h, o3 V+ g- o/ y
  97.                 return 1;
    8 Y( x2 P  [- V. S1 V6 c: {
  98.         }
    8 Z8 ~& u9 s% d& C% `. F
  99.         printf("\nNew parameters: \n");
    1 e7 D- f" L2 V3 I8 l
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);1 I7 s# J, S3 S1 x3 M" n6 X( J
  101.         printf("  STBID: %s\n", stbid);# T- X9 j( p' b

  102. * y6 [. B9 C5 P: y) p# L5 d
  103.         printf("\nDo you want to change paramemters? (y/N) ");! h( p( V) E1 U$ e
  104.         for (;;) {0 P# r& R4 n/ ?' J# [! [$ \4 \
  105.                 c = getchar();6 z9 l, a$ A  Z! Z% o, A- O
  106.                 if (c == 'y' || c == 'Y')
    4 z/ {6 X# z% H) ~- x( {
  107.                         break;
    ! g8 i1 E+ O/ A! ]" K6 G
  108.                 if (c == 'n' || c == 'N') {
    2 s2 L; V7 T% w' _  P, m- \, L
  109.                         printf("\nAborted.\n");
    7 f! \2 m, H8 Z$ {4 g# K
  110.                         return 1;4 y" o" ~% r4 s. Q" l) N
  111.                 }/ J( o+ Y2 Y1 m3 X7 u: X6 h
  112.         }
    " U+ D+ M- u  x2 k" T' D; \6 z' y3 Q- X
  113.         if (writeparam(mac, stbid) == 0) ! V* E$ r5 s, j3 ~  p$ O
  114.                 printf("Parameters changed.\n");
    ) ]4 K, P/ ?% \8 |$ A3 D* p  d9 ^; Z" y
  115. , Y' F/ Y! ?, Q
  116.         return 0;
    2 T* y2 u' c5 R* m0 j
  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 ) N; i! J4 ]- a
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
, P% q: l4 \- K& e0 ]
你用的编译命令行格式是什么?
" L5 H! M+ B- h# t* d) 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客服返回顶部