查看: 16459|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr* F! d; q) ^, m8 c! \
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    ( W# ^3 D% R/ K3 U# J- K# c
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
, f2 t& g1 d/ @0 i* w% N& vusage: himr <address> <value>. sample: himr 0x80040000 0x07 x! G- m. k; i& @8 y

. L3 m& `! k0 s" v/ `8 F
9 Z) N7 g# s: f5 Z6 c不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?  m+ [/ k" ^( u) A2 W9 k( [" ?
7 S! V1 B/ }$ h
补充内容 (2012-3-8 09:42):
  }  X1 W& m$ \) ^1 V7 hhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数8 J3 a3 g* X  r, R
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。3 J5 [8 }9 T9 N; [! U$ Z. |
# h* X1 v6 S; g0 N
himr <address> <value>. sample: himr 0x80040000 0x08 P0 g7 _% `- k3 y

! }  ?, f8 H3 D2 p: @例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
# `0 b- M; i' \himr 0x80040000 0x004 U& ]# M* x# i" J
himr 0x80040001 0x11+ W6 }2 z" X- t: a( s, ?: u, h6 [
himr 0x80040002 0x225 `! t4 b. v/ g/ B2 {" a" j- M
himr 0x80040003 0x33
) E5 Y! d+ D6 ohimr 0x80040004 0x44
- v# @# {, [- [9 dhimr 0x80040005 0x55
4 V- J: C: |/ i4 {# t4 F8 W& O8 c4 l  X3 B7 n0 z& A, u9 i
SN也是类似。
5 b, \# f1 b- n" p9 ^7 c, _! X
/ P, u7 e* j$ Y现在主要是,谁告诉我们MAC和SN的地址?
$ x+ V! m- m- p1 m
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 / z' r) k& A" `" f) [" h
一直想找到运程修改MAC和SN的办法,苦于无解啊
* C, A8 v/ Z& g7 b4 H3 P
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
3 A8 p% F7 K. u; B% D7 B' H+ a+ j5 d2 d6 l2 F( p5 ?8 A3 |" G, O
修改的代码早有了。到今天不会编译。  B* K& ^' y( K, d" [
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    8 H1 g, _+ j, |  S
  2. #include <malloc.h>
    " A- c% C! l+ V$ ?! x; W
  3. #include <sys/types.h>
    ' K( Z$ [" @5 U; g6 G* s4 R
  4. #include <sys/stat.h>5 r% ?7 q/ Y6 C
  5. #include <sys/ioctl.h>
    # F9 y& @( g& L
  6. #include <stdio.h>2 J: j, Q0 w' ?; z
  7. #include <string.h>
    ( {5 z0 m! Q+ b; W: X5 M

  8. 4 N, x6 g  q5 I
  9. typedef struct {; B1 ?2 M: l5 d4 s  ~
  10.         unsigned int        e2prom_cmd_sub_addr;
    6 `6 r, _2 d& t. J& T/ P
  11.         unsigned int        sub_addr_count;
    . F3 s9 J+ q% p, V
  12.         unsigned char*        e2prom_cmd_data;- Q& t$ g- ]2 u' n
  13.         unsigned int        data_count;
      u4 |) V( t$ I6 V
  14. } e2prom_s_cmd;( ~  @/ t4 q5 o+ \* ]8 g

  15. 7 m" `6 h. F6 V$ G
  16. #define E2PROM_CMD_READ 1
    ! I' U! d/ v5 G& ?  N3 a! `
  17. #define E2PROM_CMD_WRITE 23 j, w  D& \1 ~5 G0 {+ y
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16": q8 D. P' W8 i3 ~: [5 Q

  19. * Q2 @, B" l- |2 q" F* `
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    + F% a) ]1 \# I9 _" b$ V" P
  21. {
    , g* J0 H( n' k; g& E' {* _
  22.         int fd, ret;
    : R2 ^% M6 V: R
  23.         e2prom_s_cmd arg;) d" }' j: T- P+ ]3 A' A
  24.         unsigned char buf[0x18];% y5 \% x5 n' m. L5 \5 m
  25. ) Y6 e3 t4 j5 G% D2 S, E
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    9 r; \: e- u9 b$ }# x2 J
  27.         if (fd  < 0) {/ j9 \/ y3 |8 {8 L( F# i
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);; X8 ]7 F/ d$ t  d' F2 Z
  29.                 return -1;5 i% S! ]: ]8 j1 K" g! q0 C
  30.         }- R+ l, m5 V3 A. g8 B, i! q# G* p
  31.         arg.sub_addr_count      = 2;
    : I0 J# G0 r! B. p& R* q/ @) a
  32.         arg.data_count          = 0x18;' L/ ~8 [2 Z! @: G
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    4 [$ i' s) p4 j3 g
  34.         arg.e2prom_cmd_data     = buf;
    1 J: |, J& m7 O' C$ a
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);, m$ I2 l( Z6 M/ l. o
  36.         if (ret != 0) {3 R# D7 Q7 P: c0 p( u; K7 c
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);- W# P% t' A4 {" d' `9 X
  38.                 return -1;
    9 v, ^- Q/ B! b9 D9 D% B) i) S! p' W
  39.         }
    ' w0 E$ j" p4 ~' G$ N
  40.         memcpy(mac, buf, 6);
    / |- W& g, `  P0 T' ?) g# c( R, G
  41.         memcpy(stbid, &buf[6], 18);. z% {1 ?# K( W& ]" f& J1 {
  42.         stbid[18] = '\0';
    / A& A8 U" f  h% O! l" P; d. N3 X

  43. + m0 a( s. l# \% C+ `( X
  44.         return 0;5 @% E, F& r0 m! R2 s- t; E1 F
  45. }
    # L% L/ G' h3 M' k. a

  46.   J1 n( }) u. `8 ^3 x
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)$ ?6 p! P) N4 b# I( y
  48. {
    & f6 j( h5 s- k8 l0 O
  49.         int fd, ret;
    * {+ c# K& ]+ h& c5 H
  50.         e2prom_s_cmd arg;
      p8 ^! C2 U/ W) K0 t
  51.         unsigned char buf[0x18];2 X* R4 P1 L) M% k: S, \

  52. ; B& \, F& S4 f
  53.         memcpy(buf, mac, 6);7 r0 b" e1 R' J. p7 Z, i
  54.         memcpy(&buf[6], stbid, 18);
    3 ^) {7 h# G' C
  55.         fd = open(E2PROM_DEVICE, O_RDWR);/ C. {2 B" i) {( V7 h/ c% I
  56.         if (fd  < 0) {2 R) w7 k3 `: K- I
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);  O" h8 \' T! H. t/ F9 Z" @
  58.                 return -1;
    5 o1 |9 H! l( n' C4 T! j
  59.         }2 ]5 U6 k+ e/ C- o; n, g  G
  60.         arg.sub_addr_count      = 2;5 w" A. M2 Q0 c- z8 V# X# \
  61.         arg.data_count          = 0x18;
    ) X" e- k% \  R$ _! \/ b) u
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    , D8 V; a( A1 A4 h' y, c3 z* x! r
  63.         arg.e2prom_cmd_data     = buf;
    " G7 k: m) n9 p: U) A: N8 ~% {
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    9 k8 t- ?" \# L: Q; [; h# o
  65.         if (ret != 0) {- _+ m0 ]0 D# k6 v+ C0 M9 y; X
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    , o5 Y/ @$ Q. p- I
  67.                 return -1;
    / u  K+ v/ Z' ]# ^
  68.         }
    # B8 e; p7 q- {
  69. 5 W, U5 p" E; u; E
  70.         return 0;5 u- v' C' ?) i. z% F
  71. }; r$ |! M: Q( Q- N( o, @! _* ^

  72. / _; F4 l7 y2 a! h4 T. m) H
  73. int main()
    ! E* {) n+ Z# g/ z% @( a3 y
  74. {
    $ @5 P% r- J2 r( D  k; w+ D
  75.         char c;
    * ]0 h6 G& X, m; u% k( R
  76.         int i, macs[6];
    " g7 Y) Y& o$ ~6 @4 f6 a
  77.         unsigned char mac[6];
    2 {/ Z- k/ c6 K( T6 Z8 X
  78.         unsigned char stbid[256];; G* @" R7 }+ Y7 _

  79. # Z; c* Q5 i& ~* e. L! d( I: t6 Y
  80.         if (readparam(mac, stbid) < 0)
    + `! Q# G; ~+ Z: [, q
  81.                 return 1;
    " ^2 z. z  T6 y) y& ^+ S0 Y- O* U

  82. 7 E) s  f' w' a! N' G
  83.         printf("Current parameters: \n");! f& u. H# i$ D
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    : T# |: J0 F. H1 b
  85.         printf("  STBID: %s\n", stbid);7 W2 ^) G/ C! E" {4 q
  86.        
    ! }2 c( g4 l- ^% O) B& G  q5 @2 h9 S
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");- x" s& A* N2 j7 h
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    ; I7 v9 {! K) N5 c* t2 k/ [# U
  89.                 printf("Input MAC error\n");
    / S0 f% Z; Y- `3 K3 ]' A5 j* l
  90.                 return 1;: z+ m" `9 x1 X& [
  91.         }% k0 V5 ]5 W% |5 D% i
  92.         for (i=0; i<6; i++)mac[i] = macs[i];5 Q) k! [3 R. f( R0 g! d; Q
  93.         printf("\nPlease input new STBID: ");- e) i8 \" ]. r0 J! n, m
  94.         scanf("%s", stbid);, K! i5 R& h/ b/ O
  95.         if (strlen(stbid) != 18) {5 e5 x3 L9 {) k- \* h5 R
  96.                 printf("Invalid stbid\n");4 P$ i7 r2 U; z3 k& H* @
  97.                 return 1;
    6 r+ Y6 t; O( n4 v; ^; O! v" T% I( L+ _
  98.         }
    * {, t: I+ @/ R5 E' d1 h
  99.         printf("\nNew parameters: \n");
    ! V! @! i, ?; B
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);( g! `8 c/ i0 N/ x5 v3 R; s; X
  101.         printf("  STBID: %s\n", stbid);
    9 S% L3 R  v: F. k- Z. k
  102. $ Q1 n; f  M' n/ p. H
  103.         printf("\nDo you want to change paramemters? (y/N) ");
      x! K6 _% z. Q5 _5 c2 n
  104.         for (;;) {
    , P1 s# z: k7 N7 ?# O+ v
  105.                 c = getchar();8 X6 C, G- |7 R7 |) g" F
  106.                 if (c == 'y' || c == 'Y')) @8 X) f5 `4 q# n
  107.                         break;
    3 k( O: }" q8 I$ w
  108.                 if (c == 'n' || c == 'N') {7 l, f4 Y- a, B8 f' e  s1 M' x
  109.                         printf("\nAborted.\n");- e% L9 K6 L! k' Q
  110.                         return 1;
    / g4 z7 G8 \' y2 s7 b$ {/ |& c
  111.                 }* f5 w- l5 h' }: f
  112.         }
    $ I- h6 r  u- U5 P  G
  113.         if (writeparam(mac, stbid) == 0)
      A" ~( m9 J6 B+ {1 @
  114.                 printf("Parameters changed.\n");7 ^# e5 b' ?) \

  115. 5 n+ I. J3 Y  Q6 w0 z
  116.         return 0;
    7 k8 q. ]; O& f4 B
  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 % E2 p, }- }8 j2 h$ ^: V; W
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
" v' ~8 U# c: c) S
你用的编译命令行格式是什么?" r" I( j$ @+ \, B& |8 `
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

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