查看: 17013|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr: f( l! Y8 O4 D$ ^$ C: y
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig1 o; X2 X3 e' o9 M$ @' ~
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:6 B  V" `3 e, W$ y/ x! O0 V' d
usage: himr <address> <value>. sample: himr 0x80040000 0x0
/ Y1 Z3 Q8 n9 H- t1 o# j
, p$ D8 l7 V1 ?1 v7 s6 j+ @2 O
9 y+ x  |, f; W, |# J8 t不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
  [  B  k# ?' x5 k' B# ^" B& m/ V, d+ L& N6 d# a6 Q
补充内容 (2012-3-8 09:42):
( U4 t+ z/ Q- n/ S$ [% ?9 I" }& Lhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数* ~1 Q: z5 ]5 _, D" m7 p  ^' n
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。
0 n9 \" v! P$ K8 ]
$ ]5 C. H+ G( Z7 e: _8 |8 R8 phimr <address> <value>. sample: himr 0x80040000 0x0- k7 W7 f# D' ~$ V: Z; W
8 o; S# H1 X6 T
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。% z' ^7 r  _( I. }$ J, z
himr 0x80040000 0x00
7 V+ w8 B; c* b$ m. F0 Chimr 0x80040001 0x11. k3 B. H& M  L
himr 0x80040002 0x224 [2 d: W7 _9 X1 r8 X' s
himr 0x80040003 0x33
. `( w# F5 L6 ]2 N* d& ahimr 0x80040004 0x44) {. g4 ], R0 Z+ a7 V' d: X6 s- {) l
himr 0x80040005 0x55' ]$ b* O- D5 z* P

, A0 p9 r9 G) C5 XSN也是类似。
2 |* b9 H$ J1 T6 n" i7 _7 k6 ]8 O7 Y# Z9 k: L* {
现在主要是,谁告诉我们MAC和SN的地址?
7 V& }# N: A+ I7 ^/ F1 V
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37 ) f* ]& \- r# D/ ~* i9 C
一直想找到运程修改MAC和SN的办法,苦于无解啊

% l' r# b- u6 F0 y4 {4 Q源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 ) j& D7 Y& ?# y7 M" n
, g9 X1 p8 d2 ?6 K
修改的代码早有了。到今天不会编译。' c/ ]# K# D1 W' t. C% w  B
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    0 o& ~8 g* l+ W5 m" \% W7 h
  2. #include <malloc.h>
    8 e* w3 Z7 p  e- _2 T
  3. #include <sys/types.h>% n# p" w- h( F$ E
  4. #include <sys/stat.h>
    ) f& j; w1 L3 M) X( o  j
  5. #include <sys/ioctl.h>
    5 k# }! h& n# T% @; n
  6. #include <stdio.h>
    ; S) W% |" k, V" ]% ]9 Q) x
  7. #include <string.h>! B# l" a0 ~2 e( b
  8. 4 J( f' \. {4 C- o! ^
  9. typedef struct {
    : J- u9 n  m( K' _# O+ T
  10.         unsigned int        e2prom_cmd_sub_addr;
    4 k# G' k/ O( Q8 B5 l+ A' e! e2 U
  11.         unsigned int        sub_addr_count;
    , \. h& ^8 R1 @* i
  12.         unsigned char*        e2prom_cmd_data;' C' L1 n2 t$ s5 C: B
  13.         unsigned int        data_count;5 W/ }0 ]* f/ X# y# Z( x
  14. } e2prom_s_cmd;
    3 K7 ]) s) K+ b; Z0 f

  15. 0 t% _7 P8 I8 C/ N3 h5 q1 J
  16. #define E2PROM_CMD_READ 1
    $ E" \# [% v- U/ H
  17. #define E2PROM_CMD_WRITE 2! u$ h: B0 K: `- |2 o
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    + b! j  I9 V" V% X# O
  19. 9 J+ f. S( q' _1 ^/ m) K
  20. static int readparam(unsigned char *mac, unsigned char *stbid)) g1 @2 E% }3 \6 A) A
  21. {" A3 B9 @& v- D2 S' _
  22.         int fd, ret;* U0 G' p& ^! b0 \/ {% ?0 i
  23.         e2prom_s_cmd arg;
    ( n, Q: F; x$ Z
  24.         unsigned char buf[0x18];
    % w8 J" f3 w7 e8 L3 U' ?- m8 V2 _6 F
  25. 1 C! ~9 \  ]3 \
  26.         fd = open(E2PROM_DEVICE, O_RDWR);" Q) o5 D% ?; N
  27.         if (fd  < 0) {. H9 `' A2 E7 P& X6 J" y7 S
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    7 q, b/ `8 X3 w. ^- s5 D
  29.                 return -1;
    . \8 f! b6 j1 V; D0 A
  30.         }
    $ x8 |2 A& N' P: W7 a$ r: s
  31.         arg.sub_addr_count      = 2;
    8 Y, N% u" G! t- Y. u
  32.         arg.data_count          = 0x18;
    1 r. j! ^2 W  P9 \/ T6 J/ w
  33.         arg.e2prom_cmd_sub_addr = 0x290;
      L0 Y3 C% P  _/ r: S- w- V( ^5 \
  34.         arg.e2prom_cmd_data     = buf;
    0 U! t7 F/ T5 {$ r
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    ) K- u1 \+ I0 P5 |  h' K$ M
  36.         if (ret != 0) {
    / ?) E, @+ T0 b. Z
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    5 p! o0 _+ G* k# F7 m; S
  38.                 return -1;+ G: f* h9 L. Y2 r4 g) g4 K
  39.         }
    / x0 n' g# o8 O- Z
  40.         memcpy(mac, buf, 6);
    & u3 @+ v1 R4 v" s) J; W
  41.         memcpy(stbid, &buf[6], 18);
    ; H; ]/ x6 Q0 L. r1 z$ V9 [/ W
  42.         stbid[18] = '\0';5 K8 m7 |1 y. J. K) T' ]# O

  43. $ I3 T7 {" u; `" _
  44.         return 0;
    $ L4 l5 F& I8 P. D8 i* |
  45. }+ _: g' V7 m+ i  T  n8 Y, ~5 L
  46. 0 [# [& S# ?  T# o3 T
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    9 Z5 T* H4 M: @3 z8 B
  48. {! F: N. i+ v6 Y& a
  49.         int fd, ret;
    % N8 i4 N7 @( P& w5 z
  50.         e2prom_s_cmd arg;( F8 X1 s5 V' o9 y' X3 k
  51.         unsigned char buf[0x18];, v) i  K7 I; M9 O8 `5 S, s% i

  52. - h9 ?/ [" ~3 D0 _8 z
  53.         memcpy(buf, mac, 6);' Y* d0 q+ |( W
  54.         memcpy(&buf[6], stbid, 18);: x7 e: }* |9 h9 _, u
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    ) p# N: P) k: i% x9 ]. J
  56.         if (fd  < 0) {$ P/ w; _( a0 V: q9 \
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);3 W+ Q( l1 b8 D# `; U8 n' K+ r: _
  58.                 return -1;; d2 X' i' `+ V% m% ~! m) I6 B
  59.         }
    0 ~' A# u% ?; ^; V+ L
  60.         arg.sub_addr_count      = 2;* l/ Q! T% @" e, ?. e2 F( ~: i$ l
  61.         arg.data_count          = 0x18;
    ( B. K3 S6 g! i, `  V1 U% \5 F6 |; s
  62.         arg.e2prom_cmd_sub_addr = 0x290;) J/ C1 q: l; P% w
  63.         arg.e2prom_cmd_data     = buf;
    / U7 A# y. L1 f+ X3 B
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);0 j0 N) u. P& e
  65.         if (ret != 0) {& M  T2 l3 `, R2 [& }, n( P1 v
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);+ A" j  M7 e/ o6 d8 e
  67.                 return -1;) [- H$ o" D4 W: L2 D6 n  E1 e
  68.         }4 ^6 V+ w6 W5 |9 V/ G* U& |

  69. ! M, s7 N1 D- k* `! T
  70.         return 0;
    ) i! ^; K% G" L
  71. }
    3 @$ E& y9 [+ O' U- R
  72.   R4 E! j7 Z% y  K8 R7 D
  73. int main()
    ) K! E- }, q: M6 I4 t, L6 }! F
  74. {
    % Y7 m7 C; [6 g& v0 ?5 r7 b
  75.         char c;. ?; _: R& X# i' o, {9 {( @
  76.         int i, macs[6];" X4 n2 r/ M3 c
  77.         unsigned char mac[6];
    ) o( z7 v& g, c$ _
  78.         unsigned char stbid[256];! e# E- r6 V9 A" a8 K9 R2 h6 ~) v
  79. ' R# Z' d9 e3 O4 n6 R4 y
  80.         if (readparam(mac, stbid) < 0)  S$ Y* g9 I+ o8 Z! Y* r; |/ n
  81.                 return 1;) u( O7 t; K* o5 B) Z3 I0 }

  82. / I8 l0 a  i$ ~* `8 @
  83.         printf("Current parameters: \n");/ A3 b$ l7 N2 k
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);4 h+ [  V2 h& U
  85.         printf("  STBID: %s\n", stbid);: d/ B# Z2 o/ q& q) `6 Y- M
  86.        
    - k. e/ ?( z% N1 H# U. R
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    7 J  l0 J8 Q5 `/ ?
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    & Y& ?: g- c2 f' o4 f; s2 ^" W3 W2 k
  89.                 printf("Input MAC error\n");' S; Y. y2 x( v# E  C; |
  90.                 return 1;& m8 k5 L- R9 f
  91.         }
    * _6 d7 b1 z7 h- |* J
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    8 b- N( {, w3 o' w1 A( `
  93.         printf("\nPlease input new STBID: ");
    ( g. h0 m0 a! Q: q! U- V% i
  94.         scanf("%s", stbid);
    2 B8 [4 _& @9 q- f# o
  95.         if (strlen(stbid) != 18) {
    ) o8 h- W- r/ I3 U6 R, y
  96.                 printf("Invalid stbid\n");+ a: W  U! _0 J# Q1 G( j
  97.                 return 1;
    * E& v7 t9 z/ K5 a1 u  E4 n
  98.         }4 @3 [" H" K3 G. n1 D
  99.         printf("\nNew parameters: \n");
    4 a/ W! `+ O! N/ Y0 y
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);3 i5 k& B6 t% G1 Y0 _) N
  101.         printf("  STBID: %s\n", stbid);
    % C+ y! N1 {# K3 |
  102. ' n/ ^4 p3 `9 L1 P. g9 c
  103.         printf("\nDo you want to change paramemters? (y/N) ");% I' f) B- S+ J7 E# {+ a' \
  104.         for (;;) {; Y$ D& t+ O+ O" r3 b
  105.                 c = getchar();
    ) ~; I4 l# ^% A+ {
  106.                 if (c == 'y' || c == 'Y')
    ! Q- m; V: m  z+ X
  107.                         break;
    0 N8 V  @7 z* D# q. P
  108.                 if (c == 'n' || c == 'N') {# k+ u" F8 M0 P0 G+ K( r
  109.                         printf("\nAborted.\n");
    0 o1 g4 }+ _% u
  110.                         return 1;
    + `3 R. c5 E7 k6 _9 ^1 k6 s. o
  111.                 }
    5 I" f: t. g0 \# @" e: W. d' z
  112.         }
    ) |/ _- E- }% k
  113.         if (writeparam(mac, stbid) == 0) : C2 l2 Z1 j  a& |; ^
  114.                 printf("Parameters changed.\n");) I7 {4 D1 J+ r4 A$ T$ j
  115. ( E- \0 \& |4 t: P. g0 f' i
  116.         return 0;' H3 _- C, q/ {  ^1 M) }# [
  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 ' s) T- u* Q$ l' T9 J, |
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

; Q$ J# y( N* e' p: R, T2 H你用的编译命令行格式是什么?* `+ z  v0 p- H. W  H7 V: ]1 {8 i9 x7 x
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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