查看: 16711|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    3 ]7 Y/ U4 [  [! T* a
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig6 ^- z9 p% i- X1 n
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
- }9 f' T4 e, _9 Wusage: himr <address> <value>. sample: himr 0x80040000 0x0
4 Z) u8 T; e: W' |( D6 w4 d) C3 x9 I% V5 I9 C
* O, B, g2 i. B* h5 U/ Z6 X
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?# L) v6 {4 Z) I

9 S% }3 @; B1 X7 x. Y0 T% O补充内容 (2012-3-8 09:42):
* H4 f/ ?+ w% t0 z/ ghttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数1 F7 {; c- c8 i) ]
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
9 i: Y3 T- b8 A" r+ j
3 W& m1 Q+ z, T: V. I5 k" e+ J; Zhimr <address> <value>. sample: himr 0x80040000 0x04 X* ?9 v( D/ Q$ O- l5 `6 O

3 w! c  S5 o$ [! }0 f例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
' q+ l8 w( @3 i( U& a/ W7 W. h( V7 Fhimr 0x80040000 0x009 d- l4 `" M; ^) ~) @" c) X. M
himr 0x80040001 0x11
4 K$ j( Y3 x  I' `& C. x! hhimr 0x80040002 0x22
8 O' {0 R6 y8 Z3 X# `himr 0x80040003 0x33
# f7 u7 K; Q$ h8 ]8 _himr 0x80040004 0x44( [+ T  k3 M9 Y8 k, t
himr 0x80040005 0x55
! d: S& w. q8 l) \' I
/ b5 h% L  G+ t1 ^/ eSN也是类似。1 a/ Q3 t: z, u; a4 N  U( M

. p7 f8 Q4 ?4 {现在主要是,谁告诉我们MAC和SN的地址?4 _4 T$ V! _1 u8 _
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
& e6 ~; Y: E5 a1 u2 X! Y一直想找到运程修改MAC和SN的办法,苦于无解啊
( K8 \5 J* t. y
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
; B# b. H3 S* i9 C9 C; F4 A+ r; o% ^' C  y0 n  W) n
修改的代码早有了。到今天不会编译。
& J' G, h  V# q3 F需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>% `% W  W' t0 \. D  N
  2. #include <malloc.h>
    4 n' b7 v! K: l$ s  V' K
  3. #include <sys/types.h>
      A) t) E2 Z: p* W6 I/ H& e
  4. #include <sys/stat.h>& T1 N( M# y+ c, s" W/ N3 m
  5. #include <sys/ioctl.h>
    - k$ H% c* e* J5 F! w( h/ b. F2 p. E
  6. #include <stdio.h>
    8 k  V3 k1 E* q: @# o  b
  7. #include <string.h>
    & ^) v0 t1 {2 Q( a

  8. $ B6 A5 F& J5 W6 }1 O6 `2 V
  9. typedef struct {, o& W4 P, M1 G
  10.         unsigned int        e2prom_cmd_sub_addr;
    * K  K5 C& y) ~
  11.         unsigned int        sub_addr_count;( A1 H2 }& r9 L8 h( l; m6 |. r  e' E1 t
  12.         unsigned char*        e2prom_cmd_data;
    2 n+ Q1 r& q2 s
  13.         unsigned int        data_count;6 g2 P. l/ d8 ~% F( m# [1 O9 o
  14. } e2prom_s_cmd;* I  |( o) v: a: u
  15. ; c! a# W7 ^+ H+ b
  16. #define E2PROM_CMD_READ 1
    - E' |$ j2 O) R8 T# U
  17. #define E2PROM_CMD_WRITE 27 ]  B4 D# t5 `4 _" E5 j- }
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16") |6 z& }4 h$ A/ }0 S3 J/ B9 ]

  19. : R$ M- I. {0 c
  20. static int readparam(unsigned char *mac, unsigned char *stbid)% ?1 _  Q* @" p" W+ ]
  21. {. G1 b8 Y! X4 O$ e' h
  22.         int fd, ret;# n( d# g6 Z# q; w3 Q
  23.         e2prom_s_cmd arg;
    / P& ~; K3 }6 s0 q8 G: r
  24.         unsigned char buf[0x18];) O5 n" V( R8 G, F1 }* A$ E3 y

  25. : F- i* ~& u7 U  o$ H, \4 P% j
  26.         fd = open(E2PROM_DEVICE, O_RDWR);. e$ H" T8 @- R" P/ \6 B6 J: q0 R
  27.         if (fd  < 0) {; Q5 U! }+ G0 n% x) [
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);+ X! h) t6 v$ [: u' B5 k
  29.                 return -1;
      |- e* u# s  x9 j! W/ C3 F
  30.         }0 @; E. R3 S0 x2 k+ D8 {
  31.         arg.sub_addr_count      = 2;
    / p- ]3 [3 l7 U. \, G
  32.         arg.data_count          = 0x18;; H% ^/ C# J6 O5 q6 g
  33.         arg.e2prom_cmd_sub_addr = 0x290;9 C' y. F# I9 C( b/ p1 w5 ]0 A
  34.         arg.e2prom_cmd_data     = buf;
    $ j1 q$ z/ h/ ~( d! `5 Z( d
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);2 s; t; g/ P* _
  36.         if (ret != 0) {# ]4 W$ Y# f/ N" ?% R1 K* `
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);, s& E7 ]" {" u* ~4 S, c
  38.                 return -1;
    ' q1 H: Y& a" t2 b* z" C( q2 B! ~8 i
  39.         }
      i" l( D7 m' e7 s
  40.         memcpy(mac, buf, 6);
    ( K9 f9 p2 a  |4 p9 F/ {2 _6 ]
  41.         memcpy(stbid, &buf[6], 18);7 M( S3 `! ^; l! R2 }' h* n* K
  42.         stbid[18] = '\0';
    7 d- s8 v. L  _3 W
  43. & S/ E" l6 g( W' o
  44.         return 0;
    ! ~1 I& r4 W! `: w
  45. }
    ( l# A1 B! ^! ?1 K) b9 P) a0 X
  46. , d- k$ c( o) a- B6 C% o
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    + B) O+ x1 ~" n# S. t" b( i" N
  48. {. a3 q( V: \1 @' t0 ^4 a; c
  49.         int fd, ret;
    ; h5 Q; P5 |# U
  50.         e2prom_s_cmd arg;1 `3 M# Z+ ?4 p9 q* v! e9 c
  51.         unsigned char buf[0x18];
    ; j5 W* {( e2 d, y8 O7 H* p

  52. # D" u4 G) ~. O( ?# J& x+ d
  53.         memcpy(buf, mac, 6);
    ! ^2 e) a7 H+ N- S) j
  54.         memcpy(&buf[6], stbid, 18);
    % w( e$ z! S) @( y& Y, S% M
  55.         fd = open(E2PROM_DEVICE, O_RDWR);! N* A  c5 i3 ?' o; q' }# s( c
  56.         if (fd  < 0) {% s! b0 v5 L" G. n/ X
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);; n4 i3 D* X1 N- p# l5 y6 S0 v
  58.                 return -1;
    , T/ U1 [  h0 m6 Z5 C
  59.         }
    ' Z6 {0 s; M7 m. N$ p: a  W
  60.         arg.sub_addr_count      = 2;
    0 y. x$ p$ f. ~# i0 D4 M) K* g% v
  61.         arg.data_count          = 0x18;
    4 N/ Y5 p1 T4 G: V; [' n+ s
  62.         arg.e2prom_cmd_sub_addr = 0x290;& j6 O) @5 K& d5 e5 g  f- M  w
  63.         arg.e2prom_cmd_data     = buf;3 B# A  t1 ^; F) L: q/ E% m
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    ) \; D; v8 d: T2 }9 J" `" _
  65.         if (ret != 0) {
    , y3 h8 H. W. p5 a+ F$ B' V
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    5 o# M# a) q6 [0 K3 H& U
  67.                 return -1;* o- r, z  e0 q+ B/ C
  68.         }
    - h9 D9 Q0 m5 M* y0 o( ?2 J" r
  69. * T6 `, _; {% f; y6 ?) z& l
  70.         return 0;
    7 i* @3 A9 q) x
  71. }
    0 l1 J. w! S/ \8 I5 k

  72. 0 N  e5 c0 o% Z. p
  73. int main()
    5 g& a5 l% S" Z8 X* v- O* V
  74. {0 B! w3 l/ E9 t* k- v
  75.         char c;5 n5 e4 }! N6 C" F
  76.         int i, macs[6];
    * S1 K1 V" \1 h( W' x( b
  77.         unsigned char mac[6];1 @5 L6 j6 R: U, i6 K& n4 u
  78.         unsigned char stbid[256];
    8 J) i' A4 c6 P4 `0 M

  79. 3 _$ O: Z! G. W# ~7 @+ u
  80.         if (readparam(mac, stbid) < 0)
    $ B6 i3 v4 q+ w5 i
  81.                 return 1;
    8 o! d9 Z" k; h$ l, R- e) w
  82. , i" I# @# n+ C$ x3 [% n) M
  83.         printf("Current parameters: \n");
    9 s: t/ J( D3 S$ w
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    2 ~4 v4 `, O2 p# B" v$ ^
  85.         printf("  STBID: %s\n", stbid);- K/ x7 v0 y6 V0 w8 h" g
  86.         - N/ g# z6 V3 ^- F3 [
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");, D2 d# ?: p6 V( F" [, m
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    ' @  c% H7 C$ l& G6 g
  89.                 printf("Input MAC error\n");0 K6 K! C- ?0 _6 Q# C) ]% u" }, b
  90.                 return 1;
    : H6 Z( x0 r) X6 K+ [
  91.         }# }8 p3 Z: {& r2 m  o3 {
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    - M' U7 w# [9 ^/ s
  93.         printf("\nPlease input new STBID: ");
    5 z  P) q  _6 t. ~6 l
  94.         scanf("%s", stbid);
    * t$ h6 |9 E, H
  95.         if (strlen(stbid) != 18) {
    * [, s! C, |# Q- T+ v
  96.                 printf("Invalid stbid\n");9 W3 T. S1 R$ i9 d& W
  97.                 return 1;. @6 j% H- m" I& I5 x1 R5 e# y
  98.         }- t% \0 ^" ~/ M5 {
  99.         printf("\nNew parameters: \n");* V; P' r, m7 a! u7 h
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    6 J8 x6 h+ l. {
  101.         printf("  STBID: %s\n", stbid);
    + [' J+ K/ h- e. j! U

  102. ' f  w+ U$ j9 U- M
  103.         printf("\nDo you want to change paramemters? (y/N) ");' G, ~6 n( x( v% r% l  i
  104.         for (;;) {4 c0 Q; i( v+ M$ Z& t* E
  105.                 c = getchar();5 L/ D7 y" c5 F" c7 [4 K1 Q, l
  106.                 if (c == 'y' || c == 'Y')
    : U3 [3 D# t. c  z! B9 r2 R
  107.                         break;: \, O4 \" Z6 @; z- M" s1 v
  108.                 if (c == 'n' || c == 'N') {
    % C  p% v; k, ]' }- P
  109.                         printf("\nAborted.\n");2 A+ M+ \/ V4 V% m; C8 S
  110.                         return 1;
    $ L, {6 j0 g: D' M) h1 `$ G, X
  111.                 }
    - i2 B5 [. c) U/ T3 H
  112.         }, Q! a7 K9 F7 \6 K( Z
  113.         if (writeparam(mac, stbid) == 0)   }4 K! K, x$ N5 a
  114.                 printf("Parameters changed.\n");
    2 I) \2 `3 O* N6 ^

  115. , N& F6 \. E; }8 o8 g+ U( w4 [
  116.         return 0;# b3 I7 M( B* m" l6 Y0 d
  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
% a2 M( z! [  ~; y9 t3 t  I3 O在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

1 a4 H' H' f4 {4 \2 z$ S1 D' ^8 h你用的编译命令行格式是什么?8 b8 u2 Q" u# j/ N
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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