查看: 16265|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    1 [& {: \% b% Q$ J
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    $ {; K; l' O$ N
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
) W5 `; Q/ e8 r6 s( }usage: himr <address> <value>. sample: himr 0x80040000 0x0
0 L' K) N8 e. u/ D/ g7 s: j+ V- H/ ~3 M0 D2 q5 ]

3 k$ I+ [- g  E不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
% `" W8 H! h* [
7 Q3 O, |' h$ h4 Y补充内容 (2012-3-8 09:42):# ?# N1 ?4 Y$ {  Q6 B8 I
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数9 K  |# H' b6 ?7 @5 x/ z
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
% z$ m7 \# Q# q/ o4 a7 v1 h. [6 j6 G) E* E( b
2 s. x/ r9 e2 f$ w' C) Q3 v9 L/ \) [4 Vhimr <address> <value>. sample: himr 0x80040000 0x0/ `, X' Q4 D- A

  T/ k, g- t. W) H7 t" q( o0 [( U" v例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
3 h5 J9 E& B! r' Lhimr 0x80040000 0x00( W5 U& t# e" R, P! p8 e5 X: Q
himr 0x80040001 0x11
8 I- }0 _  F: y" dhimr 0x80040002 0x22
0 e. r/ p- p$ bhimr 0x80040003 0x33
& x* F$ Z  E# j% u- R5 e/ z3 bhimr 0x80040004 0x44
9 T1 M& D& H+ _himr 0x80040005 0x55' V& N8 x( p3 T
9 ?) {% z6 u* O: T* w* {' k# u
SN也是类似。) U# G. h; I# m7 v
7 l3 j1 C, t$ O- j
现在主要是,谁告诉我们MAC和SN的地址?7 C7 ^" O) s6 ?! `; ^* N
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
: I2 S) T+ N# S& E0 {5 R一直想找到运程修改MAC和SN的办法,苦于无解啊
' ^* w1 B$ v- ]2 ?
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
) Y) c2 y1 a9 h3 z: B3 g* [$ t
  w4 e1 y7 o! m6 W6 c修改的代码早有了。到今天不会编译。6 R- q4 l# O1 F' g
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>- n! X, G. I* G/ U. ]7 z
  2. #include <malloc.h>, J8 L9 z9 C: X# `, y( U, h
  3. #include <sys/types.h>/ k- l- O& z" v$ V
  4. #include <sys/stat.h>& `* N( N+ f7 u1 _
  5. #include <sys/ioctl.h>
    0 z. t3 P) O; z" _2 ~. t
  6. #include <stdio.h>
    ' ?! \1 M  d, u/ v4 A
  7. #include <string.h>
    3 i: x' u) h2 \9 a7 [
  8. 5 Y7 j: _# S+ C
  9. typedef struct {
    8 }" A& ~6 P* g6 u/ a( X4 j( l9 y9 y! q# A
  10.         unsigned int        e2prom_cmd_sub_addr;
    " [( A8 J: z! e0 g9 @& T) u# }
  11.         unsigned int        sub_addr_count;
    ( {! J& D. d! F: t2 i9 ~1 M, W! [- M
  12.         unsigned char*        e2prom_cmd_data;
    . w, Q7 }+ \5 C& V* M
  13.         unsigned int        data_count;( e0 s$ c7 H8 `2 R. K/ ~, \
  14. } e2prom_s_cmd;
    ' C2 x3 B4 U4 u8 S4 [$ C8 T8 Q' i

  15. - t% R" G# e4 C% |: [1 T8 {; Y
  16. #define E2PROM_CMD_READ 1
    % Z# {6 o5 O; d: D5 n2 A5 [
  17. #define E2PROM_CMD_WRITE 2! @0 H. _9 ^* m1 c& X/ R
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"- S. j; H) b# D# B5 b) E* T
  19. ! @  e6 D) Y! T9 e) _; D
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    9 |7 j) G# E9 w
  21. {
    ' e2 a1 m2 b% ~. @" g
  22.         int fd, ret;
    ! T* d: `. @5 T4 p8 k
  23.         e2prom_s_cmd arg;
    ) ^! D0 x! c1 A2 ?. y" }  Y
  24.         unsigned char buf[0x18];
    * @% }  i, ?( ?9 l9 L+ G3 R
  25. $ w1 T2 Q( l! @; G
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    / D5 O8 Q( N& W! c& f" P
  27.         if (fd  < 0) {
    % ]4 W/ B* m/ K4 s0 {
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);* G& T2 S$ o% w0 C& O
  29.                 return -1;
    $ J( m7 r! _( M+ S, M% S2 c1 ~0 Q! F
  30.         }
    ( H/ t0 |% K$ `' A* g; W" Y( `
  31.         arg.sub_addr_count      = 2;
    ( J" K9 o( {" \1 G
  32.         arg.data_count          = 0x18;% I2 Y: [4 T1 u* E+ u
  33.         arg.e2prom_cmd_sub_addr = 0x290;* m/ E, E% |' Q5 f) Q" |! ?% z
  34.         arg.e2prom_cmd_data     = buf;* b% t4 j4 X6 m* W
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);' k1 w- A) P: X5 W7 _, f& |
  36.         if (ret != 0) {
    + n  I6 ~3 U7 F; k
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    3 j% a5 d' J% S
  38.                 return -1;7 M0 L/ Y2 O! Y, I
  39.         }' i, K& {' T- D/ Q5 v  i# J  J
  40.         memcpy(mac, buf, 6);: {& O. v0 J5 ?& r2 L
  41.         memcpy(stbid, &buf[6], 18);
    . w/ Y& \# C# H( e
  42.         stbid[18] = '\0';2 F9 g3 u( F! E$ _+ t
  43. / m  c: \; m1 N
  44.         return 0;
    ; ^& n" h( n6 m! s& Q, ^$ \
  45. }! D5 Q8 J' |7 y- q# j# G4 H2 @8 H4 h

  46. 0 e) v4 Y2 G6 j- J
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    / n: o8 {/ ^( @. i( F5 [& `
  48. {
    ( z8 q; c8 J6 T5 d+ C: R" L4 f
  49.         int fd, ret;
    ( s' n1 z7 e. @1 x6 o$ k7 ^. P
  50.         e2prom_s_cmd arg;4 Z* M2 X( z& h. J" ?$ r
  51.         unsigned char buf[0x18];
    ' N! m: C8 Y+ W  b
  52. ( S' ^3 q0 M7 D3 F9 `
  53.         memcpy(buf, mac, 6);
    1 g5 c& y# ]2 ?8 ]8 h
  54.         memcpy(&buf[6], stbid, 18);
    2 t9 D% _  S% G6 Y/ _* N
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    3 U* e: c9 R( P6 \& t- i# ~; s
  56.         if (fd  < 0) {# ]  O5 S9 V# u' y
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);- P2 z! s! J1 K- X7 m( d
  58.                 return -1;: ~4 T" n3 f# s3 ?. K# @
  59.         }
    + J0 D0 Y: [7 B& G. l" R- _
  60.         arg.sub_addr_count      = 2;! _" i9 _. F# R+ x9 m
  61.         arg.data_count          = 0x18;2 J. J# P! L/ i. Q& T
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    % u3 [# O  H# Q, i0 ]) t
  63.         arg.e2prom_cmd_data     = buf;
    ; v/ N. _  ~* M: e6 D/ E  s, D
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);4 D, N! y! g) C2 \) O6 ?8 J
  65.         if (ret != 0) {) @% Q% g8 `/ N9 ^2 u) N
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);6 N4 O: l7 Y/ V, P3 a
  67.                 return -1;
    7 c4 H& {+ j% g$ i- M* {
  68.         }: l4 B6 @. H4 q, l1 Z  A
  69. 8 n9 p) I1 S$ d; ?; u- W
  70.         return 0;% U/ Y. v8 K$ z# S) W# {$ O0 J# v# `
  71. }3 C' J9 q( Q  d1 P4 @
  72. 5 s9 \  T! \$ Y2 }/ H0 t: L
  73. int main()
    5 e+ U& S% L. a
  74. {
    2 M4 B; E+ i/ m: F% A  z+ X
  75.         char c;. c9 C  m2 t% _
  76.         int i, macs[6];( n2 W# Z  `& [3 Y3 }
  77.         unsigned char mac[6];
      t- h4 q7 ~  z  r! ^9 i0 ~
  78.         unsigned char stbid[256];- q( V8 e! ~/ W' ]0 o6 F
  79. 2 g7 M& e5 w. g
  80.         if (readparam(mac, stbid) < 0)4 j; b8 |' N2 G" Y' l7 Z) w
  81.                 return 1;
      x/ x! K/ Q# o: M% z  R
  82. ; c$ y$ R2 K( l$ p
  83.         printf("Current parameters: \n");( T" ~% C- P& [8 h$ n# h
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);) \) `2 |- w# A1 N/ p% t0 A
  85.         printf("  STBID: %s\n", stbid);
    + F, B0 ~" `. i1 d! i. Y
  86.         % z* O; O" I3 x
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    7 w4 v9 Z5 r; B4 A- w' J  }* I4 W9 f: V$ ^/ ~
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    $ S4 @1 |" a8 k; Q6 h+ |
  89.                 printf("Input MAC error\n");
    & N8 c/ y# L8 m; g
  90.                 return 1;
    ) B8 h2 k, j7 F" F
  91.         }8 f  V! v; P" x, Z1 ~
  92.         for (i=0; i<6; i++)mac[i] = macs[i];1 C# B! d* @/ I+ I, ?
  93.         printf("\nPlease input new STBID: ");
    6 R9 P5 C7 L# j% ~" I
  94.         scanf("%s", stbid);
    ! G; C3 t7 C7 H: d3 ~7 b' a( B) P  ?9 H
  95.         if (strlen(stbid) != 18) {
    # s5 t' J' Q; m
  96.                 printf("Invalid stbid\n");
    , s+ @( R% ]7 f7 d6 N$ {
  97.                 return 1;
    ' \$ q8 w& g% X$ k& z
  98.         }
    5 D3 D' @$ \+ x+ V6 d
  99.         printf("\nNew parameters: \n");' l$ N- Y" y. T3 L
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);, t( Q9 x) H* t& H
  101.         printf("  STBID: %s\n", stbid);
    + W' Y1 G& y; ]8 t" t9 ~/ |# @

  102. + c- m/ J- c, _) n) C
  103.         printf("\nDo you want to change paramemters? (y/N) ");2 H! i+ H7 k& w0 l
  104.         for (;;) {
    ) E) M4 G  F, g  a1 A  u
  105.                 c = getchar();1 m+ r; Y0 A7 Y& B
  106.                 if (c == 'y' || c == 'Y')
    ; x2 @6 X) D6 u$ @7 K7 B
  107.                         break;
    7 c3 Q/ l) Y4 B, o+ N( o
  108.                 if (c == 'n' || c == 'N') {
    " D( @: A: C( h% S' U
  109.                         printf("\nAborted.\n");
    $ {$ W0 \  B7 ~
  110.                         return 1;
    8 V# Z' H" ]% }! ]1 u
  111.                 }
    , [' _2 |; q6 }- d. R
  112.         }
    * C3 \) Y$ a" n
  113.         if (writeparam(mac, stbid) == 0) ( S2 u. |/ z' ^, X1 q$ `. r# H
  114.                 printf("Parameters changed.\n");
      Q7 f  V; ]' ?9 p( v

  115. 0 y* A1 [: k7 M) \9 d
  116.         return 0;. n4 O, E, Z  W* C6 R1 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
# e/ j$ u3 O. @在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

; }4 d' v  p* M; d% L6 b+ {1 D" ]& J你用的编译命令行格式是什么?
! m. N' O) ~! ?4 ?5 i, B
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

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