查看: 17245|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    3 F  g" u7 N% G2 u
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    . E- x: S2 Y$ K  V
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:# e/ c- L- q. K: P
usage: himr <address> <value>. sample: himr 0x80040000 0x0
8 d( @7 _6 z4 q8 C6 [% S. g/ v5 U1 A) V4 A* h4 C; h
& c" u/ t, s' k: ^" D0 ~& H  s1 A/ F4 o
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
2 \! k; R1 H  F" z7 N) k6 B4 w8 e
补充内容 (2012-3-8 09:42):+ ]( C4 ]. c7 }+ o
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数; d7 t. n" f: U# b4 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 |福建| 显示全部楼层
估计就是执行这个命令。1 S( p7 e1 f: o  |$ O6 g

1 l( h4 J5 ?0 T. @2 Q$ ihimr <address> <value>. sample: himr 0x80040000 0x0
5 Q; a: y  e7 ^, C# \+ {8 M' Z7 K* k& }! T9 T/ ^/ W; K
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
' j0 J. I+ x( J2 ]: e' U* Thimr 0x80040000 0x003 F# G( f$ P7 b) A2 m
himr 0x80040001 0x11
6 P% O5 ]8 V# `8 w& T: a) Q# Q3 k5 bhimr 0x80040002 0x22
; x) U5 t, C; Q$ a5 z" \himr 0x80040003 0x33+ f) N0 d' {  _
himr 0x80040004 0x44# w9 t9 Q( V' p) U6 t
himr 0x80040005 0x557 t' E9 s, z: [, j* H, s
6 Q3 `; U9 M! c+ d6 ~  W
SN也是类似。
' w# A- n( r$ T3 ~9 D8 A9 Y, `8 J7 n- [( K- w1 F/ Z
现在主要是,谁告诉我们MAC和SN的地址?' V( r, a+ f2 E, K8 _
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37
5 Y, H8 v! D6 B* Q8 P一直想找到运程修改MAC和SN的办法,苦于无解啊
/ ]* R; Y! N1 U" s( m; p, w5 j
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
! E* r  w  \) c* d( I' z/ X6 U% M/ u
. u, ]/ Y6 w. V6 t# |9 s修改的代码早有了。到今天不会编译。' j' O  E+ K5 T9 L9 ]! G+ c, A: A
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
      {" K# _6 a) @! v. ]3 h
  2. #include <malloc.h>
    $ {6 J7 m: m' v: k! |/ m" j1 p2 b
  3. #include <sys/types.h>4 i, c, m8 Q5 A" ^: R0 ~3 l
  4. #include <sys/stat.h>
    . X0 f% R3 O: B  C" M3 n
  5. #include <sys/ioctl.h>
    ' E8 h* Z6 `& s0 w& J7 _. Z
  6. #include <stdio.h>
    & q) s2 b6 B2 k: Y$ A7 \! F3 a
  7. #include <string.h>
    6 O7 U0 E% F* S; n
  8. / Y( Y6 ^5 x; w) A
  9. typedef struct {4 Y0 [% B, ^# X; n( z# [8 a$ f
  10.         unsigned int        e2prom_cmd_sub_addr;1 H$ d; `) w2 c/ L) {/ H
  11.         unsigned int        sub_addr_count;( J6 h& e9 j3 s' n; b8 U
  12.         unsigned char*        e2prom_cmd_data;! i- y5 k4 w4 `; {
  13.         unsigned int        data_count;
    0 R5 Y) \9 ?9 m' |, c8 B" B
  14. } e2prom_s_cmd;- M" g1 a) a: s- i% S& e, F8 m

  15. 8 T4 I$ ~% |" ?9 m# ~
  16. #define E2PROM_CMD_READ 11 X# z: G" b4 g) L9 ^' d5 g
  17. #define E2PROM_CMD_WRITE 29 }: z5 `. H- O1 v  |  q
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    ! S0 q+ L) m1 r

  19. % I9 P8 b1 b1 B; N2 [; }
  20. static int readparam(unsigned char *mac, unsigned char *stbid)& j1 Y$ L9 V* X% u! c! h, p
  21. {6 b) {# K  i7 ]2 p3 j) H' e# }
  22.         int fd, ret;! D/ q3 g- j* N$ p& X5 ^
  23.         e2prom_s_cmd arg;2 g1 }. ^5 ^" X! I
  24.         unsigned char buf[0x18];7 i; d! t4 b- n% ]
  25. - X4 [5 L0 U4 `7 R# A2 q
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
      Q% W4 R! y' ]- g0 `1 c* I7 \
  27.         if (fd  < 0) {' Y- g$ A, [- K) }4 A$ w
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    0 x# w" }" X; K% ~' x
  29.                 return -1;
    8 X/ Q7 k7 k& {  L; }
  30.         }$ v; ^. n  M9 ^; Y  L
  31.         arg.sub_addr_count      = 2;& t4 v/ f- Y2 o. [$ Y: c( e6 n
  32.         arg.data_count          = 0x18;
    3 ]6 o  O4 a0 J6 g3 _5 P0 b
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    : d! `) U' V* l' A
  34.         arg.e2prom_cmd_data     = buf;
    : H: |# y3 u8 e
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);  w2 Q; G+ m0 s. m: y: w( T/ W
  36.         if (ret != 0) {: y5 T% U1 J" O0 X% b0 c5 K% ~
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);/ _; H+ C) }5 A( R3 E
  38.                 return -1;  T4 q0 N8 M, L* e) i% ]% u
  39.         }. e2 U( t2 l* q) G3 L
  40.         memcpy(mac, buf, 6);/ h: F0 [1 I% H4 M
  41.         memcpy(stbid, &buf[6], 18);7 I4 U" f& b2 `# e
  42.         stbid[18] = '\0';, ]8 Y! x- ~: \9 e1 D9 }: n  q5 g" Z
  43. % X2 s* }& K" Y2 p- P4 f: L
  44.         return 0;, O/ g3 U( B, a( b: \3 _, K8 u
  45. }+ t4 X9 }% ]3 R. `2 Q, f8 \, Z( _

  46. 8 L/ d9 }. M5 T4 d' g: E
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)1 k6 t2 z, n  q+ P8 f6 G
  48. {. D: E0 X9 {* ?4 Q$ y; ]
  49.         int fd, ret;
    ' F8 M6 {9 |' @- [6 [4 [/ z; C
  50.         e2prom_s_cmd arg;
    + n( T  y' N& ?, t- j2 X
  51.         unsigned char buf[0x18];) r: R0 V) C! @
  52. " G0 |$ D2 [, F
  53.         memcpy(buf, mac, 6);7 D. S/ |' I6 X4 |1 q
  54.         memcpy(&buf[6], stbid, 18);6 j6 M# g: U4 R8 N1 o
  55.         fd = open(E2PROM_DEVICE, O_RDWR);" R5 I% N' w0 y& j+ a  I
  56.         if (fd  < 0) {
    1 I6 O$ D  z; N  B3 ~% y3 [
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    8 n# D* h0 z$ `  v% ]' ?
  58.                 return -1;' [) C* [: k. V$ u. n2 b2 }# ?  }
  59.         }
    3 y! k3 r8 l* j# W
  60.         arg.sub_addr_count      = 2;1 C. Z" H  y5 |1 Q4 F
  61.         arg.data_count          = 0x18;
    : R) t- ^. u9 {- r/ d1 b# Z
  62.         arg.e2prom_cmd_sub_addr = 0x290;7 F  s% R6 G1 W# @8 G, h
  63.         arg.e2prom_cmd_data     = buf;, _- w* w$ ]: T3 k' E
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);; ~* J% i0 @6 p" q. n
  65.         if (ret != 0) {
    1 f( w( ~4 @( M* b9 K1 k
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    - I* u: T: h; h( P* q
  67.                 return -1;
    ' `$ a+ ~, A, L
  68.         }
    " r  @0 w* p! G2 @7 x0 M- u0 u

  69. 1 i7 |3 f; N9 Q7 v2 t
  70.         return 0;
    ; M% r5 q2 m7 v- h9 \
  71. }
    / R% y. w  c* Q$ g, ~0 e
  72. 2 _8 h! l1 j! \5 c$ g6 O1 w2 H# |# V
  73. int main()( i* r8 e7 L3 K, m4 b7 w  {
  74. {3 o" e) ^4 U) j3 |! S
  75.         char c;( }5 U/ U5 z; j2 s. i8 H
  76.         int i, macs[6];
    : A* \( F. p' ~3 y' @
  77.         unsigned char mac[6];0 M$ [+ E$ B- H$ a
  78.         unsigned char stbid[256];
    % w2 n. z; H$ M5 J

  79. + g, J2 Q$ J8 d) R) H; c; @
  80.         if (readparam(mac, stbid) < 0)  @' j. t, Q) Y0 W& Q8 D
  81.                 return 1;
    9 c) \/ T* r: T7 I5 F

  82. + L( t1 J" m& P* f5 h# c& C4 p
  83.         printf("Current parameters: \n");5 D- d& F9 a1 A7 t% \
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);7 z1 `  B9 B7 N9 ?! P
  85.         printf("  STBID: %s\n", stbid);) y2 i" d$ N7 n
  86.        
    $ l/ _* u; ^. b6 C* y; `
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");, _- W! i+ c$ u) A6 t& L( \
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    ! ?1 ]) J( [- F  Z8 v4 @6 u
  89.                 printf("Input MAC error\n");) _7 z" a5 C' r2 ~" U4 V
  90.                 return 1;) G" i; `' e8 U6 X! p; ^" A
  91.         }
    $ [; l3 a, e4 q: `# L& O
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    * t' \, ^) S+ H* C
  93.         printf("\nPlease input new STBID: ");
    4 Z& [. {7 M( N
  94.         scanf("%s", stbid);) f. p. d) d; z7 h9 i* i9 a6 t1 D
  95.         if (strlen(stbid) != 18) {
    7 j- C& f0 a4 ]* O8 Y' Y
  96.                 printf("Invalid stbid\n");3 o9 k) e6 D% |6 P  n) u
  97.                 return 1;
    / @1 B9 J* g* n! q6 R  T% I
  98.         }
    1 w5 v' l1 h" W+ N
  99.         printf("\nNew parameters: \n");1 c; _0 Y* [( y+ o; d; ~- Q5 Z& z
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    , [6 X3 u( X( v7 a0 x5 g# b3 @8 H) \
  101.         printf("  STBID: %s\n", stbid);
    / f2 X2 e( {- i) ^0 ]' ?- p
  102. 9 G$ B! M5 z0 D0 a& t0 y
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    $ N+ P" |! z) H
  104.         for (;;) {. D$ |: G- Q6 T8 l) J
  105.                 c = getchar();! n% @6 @# p5 X7 W5 i1 k. G
  106.                 if (c == 'y' || c == 'Y'). u8 k% R$ O1 y8 M' v
  107.                         break;/ [# L" q  b  r* A' ^
  108.                 if (c == 'n' || c == 'N') {
    - O: }" c& H' C; Y  u$ y% n
  109.                         printf("\nAborted.\n");
    ( m! [& ~9 @4 G) ^  h% w2 Q
  110.                         return 1;
    4 t' x4 J5 s: v: h; T
  111.                 }
    " a3 x6 E) H& k5 A8 k9 y( V6 H( p
  112.         }9 j+ X/ ?4 ~. y1 ]+ G; i2 P" F9 G$ Y
  113.         if (writeparam(mac, stbid) == 0) & L; g* e- w. A+ d$ |
  114.                 printf("Parameters changed.\n");3 x" P" g& }5 N6 w3 J  V
  115. 5 q3 I. L8 m) G3 y; B$ h
  116.         return 0;
      a2 T1 c& h# A7 i# y  ?
  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
" Z- p# F5 ]5 g$ w  M2 d在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

, ?& h) A7 ^) \1 \4 ]2 I你用的编译命令行格式是什么?
/ o: L& b8 e: ~" D# p
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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