查看: 18133|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr/ s  ~2 y; |6 g/ W' g' r/ J- b
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    0 F) u& j2 Y5 E; _# ?
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
4 g% E( D( I1 t2 o  _$ yusage: himr <address> <value>. sample: himr 0x80040000 0x0
$ x" I$ y! O& T& n: `$ p( ?/ ~( \
. d: e5 e% ^4 z# w/ ?1 Z
0 V* O( {" u- I9 b9 g, y不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
. S& M& _& F/ p& O& U. e
0 I, c& V% T; d7 |# P补充内容 (2012-3-8 09:42):* l( w$ C: A7 g( j+ b$ C5 D) {, k6 j: t
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数7 s+ U% P" S% B0 Y1 L
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。
4 b& W, l: b9 J" \4 i9 R
% y: L) U* |5 r3 ~himr <address> <value>. sample: himr 0x80040000 0x0
4 Z/ J2 @6 n$ e3 B5 t  e7 o' @! g$ Z; t
, b$ e& b$ u. M3 ^例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。1 {3 e* k. u4 |0 F7 K: ]
himr 0x80040000 0x00- M/ g5 z0 N: ^1 q& g
himr 0x80040001 0x11
9 _# ?8 b( O1 L, l& C. T7 U) Ehimr 0x80040002 0x22
2 o9 t" T- ^3 ?4 |* F6 o! ~- R& lhimr 0x80040003 0x33
2 R$ N! I: y- zhimr 0x80040004 0x44
0 M6 m+ E: z1 w, A5 F, Rhimr 0x80040005 0x553 [: ~# b9 c" }- d  M
6 A. U, W3 @4 }# e8 g8 j
SN也是类似。2 }) E8 F) m# g6 l) c; d
+ U- @* R& h% E& {  |+ d) R
现在主要是,谁告诉我们MAC和SN的地址?/ O& h$ S. Q' Z9 ~
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37 ' [6 l; `9 N# [9 L5 c
一直想找到运程修改MAC和SN的办法,苦于无解啊

) B# k" y/ s$ s5 u源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 3 m& K# b% ^  R9 E& I

% G4 y  X& \- b* f修改的代码早有了。到今天不会编译。/ R% X8 O9 U" S) l6 b7 n; n. @
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>6 u, L5 h/ u- _; h# Y; Y4 m
  2. #include <malloc.h>
    & L+ t, `, R& K
  3. #include <sys/types.h>' Z2 f, l% r4 L0 `7 U9 d
  4. #include <sys/stat.h>( c: g2 Y' e; @
  5. #include <sys/ioctl.h>
    ( m$ e' X+ G0 G3 X( g
  6. #include <stdio.h>; ?# i( B; P/ `* G- R+ Y, y
  7. #include <string.h>
    # ~( L1 I- j/ C! ?
  8. & w" I( s/ `* T# e9 a
  9. typedef struct {6 X& F4 h8 T0 H6 _
  10.         unsigned int        e2prom_cmd_sub_addr;/ a# |# S3 p3 x3 r& _$ w
  11.         unsigned int        sub_addr_count;4 W* |1 `7 x& X8 _+ |
  12.         unsigned char*        e2prom_cmd_data;7 `# @4 Z4 z3 l6 H. D
  13.         unsigned int        data_count;
    & ?. V9 ]( w. u3 L) U8 d+ N
  14. } e2prom_s_cmd;
    ( O3 S% z) C& J

  15. " Y, [/ y& u5 T' r) {$ T5 @
  16. #define E2PROM_CMD_READ 15 [- A: P8 _8 q: R
  17. #define E2PROM_CMD_WRITE 2* M& Q6 e  l2 P) S: g1 R' P
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    1 I* ~9 D3 U+ D1 H; x, v8 @

  19. ; w3 l# s1 H3 J7 n
  20. static int readparam(unsigned char *mac, unsigned char *stbid)/ f. y; g' J( i. G5 a: |! ]! e
  21. {9 h9 l; V, i0 \4 U* e3 h
  22.         int fd, ret;
    # Z" M, Z  ?/ R5 M: h. u1 y
  23.         e2prom_s_cmd arg;# K6 r# \- \/ H1 h4 D% ~' A0 B
  24.         unsigned char buf[0x18];
    3 o2 ]- G4 Q' I% j
  25. - w! r7 @& n, |0 m9 `: u% i
  26.         fd = open(E2PROM_DEVICE, O_RDWR);  n$ W% z) x$ s' w0 M) K" y
  27.         if (fd  < 0) {
    3 r3 w5 q3 j6 q7 y
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ! k) E! u- E2 i
  29.                 return -1;
    ; B( M4 v( o, @/ ]& |# O; K1 X1 o
  30.         }
    3 d: L: {, d) L9 ~
  31.         arg.sub_addr_count      = 2;
    5 g; A" t+ c4 {2 H% _- l# R0 y
  32.         arg.data_count          = 0x18;$ w! R* q# F7 P' D
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    5 W! n. x  i4 X! s
  34.         arg.e2prom_cmd_data     = buf;
    2 r! J, k4 O* H
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);& o+ M" b+ x( M/ p# V4 }
  36.         if (ret != 0) {2 \9 U! \+ G- f. E
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    + g& n( j$ E8 O9 X3 S2 X7 w
  38.                 return -1;
    ! _5 z) {9 C" R" |. i+ P
  39.         }: [3 }7 E+ p! j3 e
  40.         memcpy(mac, buf, 6);3 _/ w' N/ Q' T; a
  41.         memcpy(stbid, &buf[6], 18);
    ! e. T; t" D) k. }* @7 @
  42.         stbid[18] = '\0';
    9 d' Q- Q0 _; }6 |  ]: N8 @

  43. 8 B  X7 r- [! c; o1 m7 @5 z$ L
  44.         return 0;$ V( w4 |$ I1 l' b8 }( ~  K7 ~* L1 U
  45. }
    # g/ u; g7 J9 ~! ^1 N

  46. 0 J7 d5 V. X+ ?3 Z, I) G/ N, {0 z- @
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    8 z7 z& ~* J+ s* C  j
  48. {5 P+ |) ^# k* D  V/ i6 V
  49.         int fd, ret;  `2 F4 c4 j; W% e: B6 B" ]
  50.         e2prom_s_cmd arg;5 ]6 f0 f) h. T9 @* S* n1 r0 h
  51.         unsigned char buf[0x18];
    + G8 A# X, Q& e# I' g
  52. 4 N" ~, O# H9 j2 \9 i
  53.         memcpy(buf, mac, 6);
    # {* z$ q& u$ x" g- |! D
  54.         memcpy(&buf[6], stbid, 18);1 c( Q% d( g. R0 f$ M
  55.         fd = open(E2PROM_DEVICE, O_RDWR);6 `/ D! _; `1 ]! m8 L: l& \, Y$ C
  56.         if (fd  < 0) {7 F) W+ A1 U* Z* O' y3 ]
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);9 F1 K7 A) g1 e, W2 z0 A
  58.                 return -1;: ?" l' {) a  _$ }1 M2 j4 a
  59.         }# d% I  ]  V1 C. q" H! F
  60.         arg.sub_addr_count      = 2;2 _2 Z5 Z7 b4 g0 z3 B, _% u" i2 L! L
  61.         arg.data_count          = 0x18;4 O6 F4 w- ?8 g. D3 `% S
  62.         arg.e2prom_cmd_sub_addr = 0x290;3 l. X' ^2 M1 Y4 t' ^% B7 X
  63.         arg.e2prom_cmd_data     = buf;
      N1 [2 N/ z9 {6 w8 Q6 s
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    2 U- x4 F1 ]( K- X' M  h
  65.         if (ret != 0) {+ {; I/ W4 K) X' ~0 h
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    * N6 L! w6 Y* C
  67.                 return -1;# R9 {" m0 M1 W& H
  68.         }
      J; L) a7 Q* h! T# E
  69. 1 b7 l- P( j* s- a' B) K
  70.         return 0;4 S+ l7 Z0 y5 j& [2 D
  71. }" v% g1 e6 j  k; Y0 J! C
  72. ; {0 ?# ~; I8 a; c
  73. int main()
    - T8 ?( Q+ H. N9 ~4 V
  74. {
    6 d6 }5 u- ?5 T1 x0 r! U/ Q
  75.         char c;
      f4 [" a) g  K& o1 a
  76.         int i, macs[6];
    5 W! f/ v' F0 z, x5 G
  77.         unsigned char mac[6];& G0 f! {$ e% ]7 u
  78.         unsigned char stbid[256];4 t- ]/ z" n& [+ s7 P" `6 f6 ~5 m9 }

  79. / f$ S6 k6 E; `4 Q1 D3 y
  80.         if (readparam(mac, stbid) < 0)
    ! F& _5 i5 G0 L7 N* d9 ]# l4 T
  81.                 return 1;' i& w/ T$ w4 _

  82. ' [9 c- |# V5 k7 d6 R3 [
  83.         printf("Current parameters: \n");, P& f; D5 Q& R2 B$ [! q# k% X
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);. ^+ k- H$ ]/ m5 c3 x
  85.         printf("  STBID: %s\n", stbid);7 O1 b7 }, f, i- o
  86.        
    9 j: B$ L. v- k- K0 e1 j
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");4 t& t/ ?6 I/ T- ?
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    : d5 E7 G3 F3 U8 w/ y- _: _' l
  89.                 printf("Input MAC error\n");9 x: @* y+ |+ y$ {: H5 y6 b
  90.                 return 1;; h, y) f0 u, l1 L; T  V
  91.         }4 |4 \/ Z, |$ c
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    0 x7 K$ y7 |/ S. t- V
  93.         printf("\nPlease input new STBID: ");: E# m$ ]8 t/ p& V# S4 ~: J& d7 k4 m
  94.         scanf("%s", stbid);2 C& I) K4 L! x- S, e
  95.         if (strlen(stbid) != 18) {
    % r% X9 v+ u' a* z- _: U; ]
  96.                 printf("Invalid stbid\n");: x  {$ `2 o- m" y9 Z: F
  97.                 return 1;
    0 G6 H+ c' Q5 R$ u
  98.         }# D2 G* Z4 m8 V1 O  |8 X; W" U, w
  99.         printf("\nNew parameters: \n");
    ( V' _3 k, q+ \; f: [  \
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    1 g& I# k! j, C. |
  101.         printf("  STBID: %s\n", stbid);
    / f% ^; J3 s+ P- s) @8 p; [' @
  102. 1 |0 g( r2 w* a. ]. j9 y7 W0 Q. J# Z
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    ( }! o1 d% K# w6 P
  104.         for (;;) {( o+ l4 q- \  H6 z' X$ r+ Z
  105.                 c = getchar();
    7 N* d) L0 w: M1 m- L" ~
  106.                 if (c == 'y' || c == 'Y')$ x$ t% t8 I  Z- u! c+ R
  107.                         break;
      r& }# X; s) d" z' @
  108.                 if (c == 'n' || c == 'N') {
      s! |: o$ ^/ d( X# m0 [- x9 ]1 W
  109.                         printf("\nAborted.\n");$ _, {0 c8 h( k+ `" k
  110.                         return 1;: i1 u0 x. s; D4 N( ^8 l* p
  111.                 }
    8 i6 C. O' L* Y
  112.         }: [5 @9 k+ U/ W
  113.         if (writeparam(mac, stbid) == 0) : L  w, b) a; i( p! C( K3 ^
  114.                 printf("Parameters changed.\n");
    $ B0 p! C( R- L6 h+ U) @; o1 y
  115. 6 v" }4 ]- _" m: Y$ o6 c
  116.         return 0;( D# {* b, o! U( n
  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
- V* g8 o+ n1 W& O在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

  U( `1 Q6 Z: b4 `& W% M  b你用的编译命令行格式是什么?
# ~; {9 V& m; x
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

在本版发帖返回顶部