找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15695|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    8 h9 t% K  f* _7 n$ U
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig* K: I. b& n1 z4 p4 l
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:' W: ?2 `  J0 j- L  l. G
usage: himr <address> <value>. sample: himr 0x80040000 0x0
: W' j* E$ q- F% \2 i/ F2 O1 V- S" Z  @$ f

, R/ s3 y. B# g: ^3 \- h不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?0 ^8 \8 A* \2 c9 \8 S5 y) Q) F
: p9 @# U( N6 ]; p  L. w
补充内容 (2012-3-8 09:42):
$ p4 [; a* r) J' ^! a0 ~http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数( ]5 F/ C+ f0 O# i7 r
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。: S0 v0 q3 {( o* o& o

" J% C4 @, `( S! F( m% x3 c: nhimr <address> <value>. sample: himr 0x80040000 0x0! d4 _# ^1 [) p# x1 i, p

; K9 [  l( J7 y例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
& S) |( ?+ [# p, S. Ohimr 0x80040000 0x00
- r+ r+ v) d% Y, T% h! ]( k8 Mhimr 0x80040001 0x11
) Z3 a0 T7 m% u2 X5 {himr 0x80040002 0x22
( `. c% C! e6 O# e" r4 l9 ^3 i5 Ghimr 0x80040003 0x33
! u# @0 O; s6 w* O- qhimr 0x80040004 0x440 y/ k8 E6 w7 C5 i
himr 0x80040005 0x550 L7 |& j# h) T5 ~, D
$ W% r: B2 U5 @; p  \- [
SN也是类似。
4 X* d7 k3 I+ `  O3 O8 f$ e
0 [! ~# m& M" L5 i8 y! A) _, o现在主要是,谁告诉我们MAC和SN的地址?
5 L" i+ A6 m( a% \! J
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
& G+ g6 `; }  U$ v' e& C一直想找到运程修改MAC和SN的办法,苦于无解啊

, @9 t9 m% _/ j% u! N2 u5 h源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
& g; ?& M6 f# T. b7 ?" ^0 X
' k0 }9 _4 d' s$ G# X: |# M修改的代码早有了。到今天不会编译。
' M: ?/ O( N4 _需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    # B) b2 X0 e  j! H9 {0 a. ^9 R
  2. #include <malloc.h>
    # j4 O) @- E. A6 b5 l) M
  3. #include <sys/types.h>
    1 }  q% Y4 X, P) `7 }5 N
  4. #include <sys/stat.h>4 E- _6 B6 M( r& j& o/ R* Q
  5. #include <sys/ioctl.h>
    ; C% O6 x# b& J+ x- \, E
  6. #include <stdio.h>. f/ ?6 B8 W7 `3 `. e8 `
  7. #include <string.h>
    9 y  N. b7 {& W) u
  8. 8 q+ u* A/ M& d+ k* |$ h& J
  9. typedef struct {8 O" }! M5 J8 C8 E3 R
  10.         unsigned int        e2prom_cmd_sub_addr;! |' q2 m' \. h# R3 |
  11.         unsigned int        sub_addr_count;0 J% h9 O+ S3 T' j" T0 C
  12.         unsigned char*        e2prom_cmd_data;
    ; Q' ?; W3 V- M
  13.         unsigned int        data_count;  a4 S! p1 I1 p
  14. } e2prom_s_cmd;
    * y  |7 ?& E& n: N& o

  15. , o: _: \( B2 u# F, d1 Y3 P, q' Q
  16. #define E2PROM_CMD_READ 10 _' R: x  M9 E  u
  17. #define E2PROM_CMD_WRITE 2
    + K  W3 O8 N4 R* c! l, N
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"9 Q/ T+ z! ^6 Z" o$ F1 v
  19. 3 x+ T7 ^9 c; T7 P8 s
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    ' f, p% \7 C7 e) h% S( e
  21. {* ~- g" I: K- t9 Z
  22.         int fd, ret;; ~( S9 }) v' p# p: ~: }; U
  23.         e2prom_s_cmd arg;0 s6 n+ i3 W7 Y- b( `# ]! P
  24.         unsigned char buf[0x18];2 P9 [" _4 b& g3 O6 [; t
  25. : N! @! J, {9 y; \4 L$ e) L5 i
  26.         fd = open(E2PROM_DEVICE, O_RDWR);; m% P: a+ H3 d
  27.         if (fd  < 0) {
    9 Q% Q' d4 {  Z! B: U0 d$ G1 a, w
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    / s5 C% W5 v% [1 {- p6 `% U& g2 P
  29.                 return -1;
    9 R8 x; p7 @4 g0 m( J5 k" h
  30.         }7 \) E' F6 m/ G/ P0 }5 t
  31.         arg.sub_addr_count      = 2;
      C( C: p) {9 w( w% \4 C3 S
  32.         arg.data_count          = 0x18;
    ) `0 w, o: J( a6 C  p( h* K7 v+ J; i
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    2 L+ A5 J# S- z) `0 H/ B
  34.         arg.e2prom_cmd_data     = buf;
    1 u( R5 `" G4 C; l
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);7 `# L5 R% @4 R3 a3 _" B
  36.         if (ret != 0) {
    / g$ P3 Q% @& A; K. I8 U
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);/ f! y! o$ P/ g- |4 s7 M
  38.                 return -1;
    8 k" z% M9 P# H- o# l8 q& n
  39.         }
    ! |! i1 H- K& T# K6 y3 R
  40.         memcpy(mac, buf, 6);) h- C$ ^' q' s+ T, [% D% }
  41.         memcpy(stbid, &buf[6], 18);- b4 o: L% f. |8 j% G  ?
  42.         stbid[18] = '\0';5 Z( ~  E# F, e; T
  43. 9 N3 X3 x5 v/ q! p) U3 `
  44.         return 0;$ `7 Y5 a2 V- i/ o* H
  45. }4 h7 p# J2 E) r: t$ P' \

  46. 3 V; O& D: P0 t- c3 [3 L, j
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    . U. C9 U$ X, e+ D# Z8 E0 h0 c
  48. {
    % ?  R3 j& d7 I" @, ^
  49.         int fd, ret;
    * a3 A% f# W2 w" S, M* P
  50.         e2prom_s_cmd arg;
    . V* e# L, s- X) p1 G$ V( E- Y
  51.         unsigned char buf[0x18];. B. O* V9 y2 ^( N: `. k

  52. 1 t/ v  o' B8 \& s0 Z
  53.         memcpy(buf, mac, 6);
    2 N% o- v. K. @- ?( o3 V1 u
  54.         memcpy(&buf[6], stbid, 18);+ m) k9 D, u/ B% k) w6 }$ X
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    5 p1 l* n+ h7 O3 _! b
  56.         if (fd  < 0) {+ U! s+ b' C+ c3 S
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    3 Z! ?: d3 }7 M
  58.                 return -1;% {$ y1 d, c& [: s
  59.         }* G: q/ f* [& l* ]. M
  60.         arg.sub_addr_count      = 2;. n8 X: D' Y$ s( p
  61.         arg.data_count          = 0x18;* H, W+ i+ R3 f1 Z  n7 X1 c5 W6 C
  62.         arg.e2prom_cmd_sub_addr = 0x290;5 t4 z7 c. M4 U: V$ C3 _
  63.         arg.e2prom_cmd_data     = buf;# w, A6 D4 L2 o% c  L: J
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    . O# a- }- h& I+ l8 {$ Q" k9 _
  65.         if (ret != 0) {
    9 z# U  e' e2 K+ Z/ O& q% [5 A+ g  h
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    - ]6 [( _; E+ I3 O6 h- s; f$ h+ U
  67.                 return -1;
    # A5 a; L* _4 b! O( e0 b* ]
  68.         }
    * u7 L% ^: j4 j; t4 M) y5 P

  69. + O8 I' u  d* A# e' t
  70.         return 0;
    * [; O+ `3 @" n* @1 G# K
  71. }3 O" t) v: z& s) B+ Z

  72. ! Q9 s$ @+ @/ `9 B
  73. int main()
    # _. ]7 Y( d( V
  74. {0 T) g9 i# ]7 t9 C
  75.         char c;
    + B8 N# d0 W) ?' M* r8 q
  76.         int i, macs[6];
    - W  S  t% o& t( Q  l- N
  77.         unsigned char mac[6];
    1 ?% O9 y) t4 Z* @
  78.         unsigned char stbid[256];; X, H3 V! T+ ?# E1 y' F& Y2 _

  79. ) `% o' {$ J: G* V3 w8 Z8 c
  80.         if (readparam(mac, stbid) < 0); T! V1 A% l! R* }) k8 r$ b
  81.                 return 1;! Q: t) N9 V8 N$ W4 s1 k

  82. 6 X$ C, d2 _. a
  83.         printf("Current parameters: \n");6 t( R7 H* ]/ ?* P6 i
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    8 @* _1 P- T# c4 Y& X2 ?0 w
  85.         printf("  STBID: %s\n", stbid);
    9 Z- c1 |; w1 i3 U
  86.         5 m, W; i4 r. x9 o
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    2 U% e+ y3 p! O) G( P, i
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    # H+ v5 n* g% R- A/ n) B
  89.                 printf("Input MAC error\n");, `) r# \- u, D0 D- k
  90.                 return 1;9 z' R; n' R" ]" `2 F# O8 b
  91.         }* I( v( ~2 w: B: @, `! K1 _
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    : I( l) g, F, w: X/ q
  93.         printf("\nPlease input new STBID: ");' c* r! `: J! x* j5 w* q
  94.         scanf("%s", stbid);
    1 J+ d% s- z3 v0 f* e6 }
  95.         if (strlen(stbid) != 18) {
    ) z$ L2 l& i. v( D1 R
  96.                 printf("Invalid stbid\n");5 m* r8 f* ^( U3 D( ?$ t( }
  97.                 return 1;6 h* D: T: V( J1 x% z7 X' B
  98.         }
    ! H8 x/ b9 v# Z' D+ Y9 ~7 k
  99.         printf("\nNew parameters: \n");# K/ A8 \( M) m" t4 X6 }
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
      ^" ~. U* L. F$ J1 [* V
  101.         printf("  STBID: %s\n", stbid);' |) j7 W; [1 n/ ~0 A' B( M9 @
  102. ( a3 m1 F' }1 g
  103.         printf("\nDo you want to change paramemters? (y/N) ");9 \) m$ \0 k0 a* h9 Y8 r
  104.         for (;;) {& z( q; e& [4 w; j1 ]/ [2 Q/ l
  105.                 c = getchar();
    6 e9 z5 f9 p& T8 V8 Q; u
  106.                 if (c == 'y' || c == 'Y')
    - X" H: S4 r$ \6 ^
  107.                         break;! Q4 V+ U# {5 l4 S, s1 l$ I' S
  108.                 if (c == 'n' || c == 'N') {  f& D& X- N7 G6 I
  109.                         printf("\nAborted.\n");
      ?1 I" D2 h0 S/ c3 z/ d3 U; D
  110.                         return 1;5 X& _( o5 L: l0 r6 I+ `
  111.                 }% r- k- Q0 x& B8 D
  112.         }* c; n4 U4 H3 Q! G. `/ V; j
  113.         if (writeparam(mac, stbid) == 0) 2 K- S: {) ]+ X! H# |0 t  P
  114.                 printf("Parameters changed.\n");: m: V& n& [  `$ ?# Z  i, c6 X* U
  115. 6 G2 t) S: g# J! {9 g
  116.         return 0;
    : \* I5 B) x. R
  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' }6 k+ x/ r! s. M9 ~" G: s在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

. K' f; H& u. l3 a2 Y你用的编译命令行格式是什么?
# R; Y. V. |6 h1 }/ F9 j; e0 D
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

Archiver|小黑屋|宽带技术网 |网站地图 粤公网安备44152102000001号

GMT+8, 2026-2-28 08:26 , Processed in 0.025953 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表