查看: 16526|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    ; Q8 s8 U! a8 A3 p4 A
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig5 k% _1 U" t$ @
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
% o  ?; S/ _2 O, Uusage: himr <address> <value>. sample: himr 0x80040000 0x0
% L. O) X- k0 V! `
& h: M' d8 k5 [. J$ ~; G3 ?, A- E
. M$ `( o( L! {' {# m8 K- {9 A" G不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?9 u; V+ F7 V8 t. H( Z0 u( l/ [

' J1 M2 Z3 ^$ t2 Q补充内容 (2012-3-8 09:42):
# i2 U% i+ R7 u& Fhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数: r6 N  j6 X: a9 H1 Z
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
+ {9 K. {+ {6 J  P! b% d! f/ w' p2 G+ E  x9 \$ A& r7 A2 O9 U
himr <address> <value>. sample: himr 0x80040000 0x0/ X& h5 j. w. n6 O3 K8 N' y  Z/ C: U

, T" B8 h' H0 V0 x, a# T例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
! i" h8 _, z6 a& Whimr 0x80040000 0x00
2 N% ~# W! \! g9 \himr 0x80040001 0x11
8 X8 C0 L/ n7 v! u! E; C: g& m2 Mhimr 0x80040002 0x22
! z/ d) E' i2 E: Qhimr 0x80040003 0x337 f; E% x& S3 _( n" B+ {
himr 0x80040004 0x44. D; a& P6 I( c/ [+ j8 n6 }9 @' x
himr 0x80040005 0x55/ ?. k5 G* a4 k0 {

6 ^7 h3 V! O2 S' b( D+ r% aSN也是类似。: f) O/ j) i' `4 W4 E

/ z" V9 l: g- ^$ p现在主要是,谁告诉我们MAC和SN的地址?9 R' O7 ?0 G+ F- `3 n5 y
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
6 k* _% H" _& {9 @' S- w一直想找到运程修改MAC和SN的办法,苦于无解啊
, Y0 x2 x& R3 K( I
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 5 B3 R- i  |2 A* e/ S

8 R4 `; P' x% ]- o4 g: q修改的代码早有了。到今天不会编译。- a% K5 F2 X& ~& X; p
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    / F& _5 @# G( B7 T7 S
  2. #include <malloc.h>! L% c& U. I# I& M! l4 {
  3. #include <sys/types.h># m% s, P2 a& s6 ~1 _' A# [- t
  4. #include <sys/stat.h>
    ( T4 h5 P2 B4 ]( b' i4 q
  5. #include <sys/ioctl.h>: l& p2 Z% {' Z( X
  6. #include <stdio.h>/ n* u4 A8 U% X# c# H0 n7 K5 ?
  7. #include <string.h>+ I& S) D4 y7 K8 W
  8. & s- h6 {. f, @6 ]
  9. typedef struct {
    - ?: w/ Y- w" Q: h1 c( ^# F
  10.         unsigned int        e2prom_cmd_sub_addr;
    * V1 j! W' ~. [
  11.         unsigned int        sub_addr_count;
    6 A' D7 _, W& c& X
  12.         unsigned char*        e2prom_cmd_data;( i: V7 P0 h8 C. n/ \  S/ i
  13.         unsigned int        data_count;* E  z2 S3 T  c. S3 s  u. s: y% c  U
  14. } e2prom_s_cmd;" o* i+ Q! _) [& r5 |

  15. 0 l1 h! I# v, H/ Z" G4 I( h# Q
  16. #define E2PROM_CMD_READ 1
    5 I6 u5 V3 e8 M& n4 E8 I. p: Y
  17. #define E2PROM_CMD_WRITE 2* W& `1 Z7 V; s3 @
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"% |4 Q0 Q1 j! V6 |! O5 A, b
  19. 9 \8 s* T' `. C6 v4 p
  20. static int readparam(unsigned char *mac, unsigned char *stbid)3 V; u8 S2 u& f3 j4 c
  21. {
    $ b( C* O' \+ M" f4 |! ?& a: ]. M
  22.         int fd, ret;, s. V* ]$ z5 \% X
  23.         e2prom_s_cmd arg;
    ! ?: W6 t8 s: L5 T7 m
  24.         unsigned char buf[0x18];
    - y2 P! d! s; F. B1 U$ F
  25. / [- S, F6 d# I" Y$ l" L$ c" N1 L
  26.         fd = open(E2PROM_DEVICE, O_RDWR);  k. G! n# t' L% a  u7 u
  27.         if (fd  < 0) {
    " a& s) |' j1 P4 x& l' x4 p
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);) x* `, i* ^: ~8 _
  29.                 return -1;+ ^/ L1 m0 c1 A# H% b/ d) M! l! p8 v
  30.         }
    5 ~" n. s, F- J5 u+ b  d7 C" E; i
  31.         arg.sub_addr_count      = 2;
    ( b6 r/ @9 O" ^6 w6 F2 ~
  32.         arg.data_count          = 0x18;" X& }& l& k' z) P+ u2 t  c, X
  33.         arg.e2prom_cmd_sub_addr = 0x290;9 a( a$ k0 V2 u6 w& D% L( I4 c
  34.         arg.e2prom_cmd_data     = buf;/ i6 m0 s) o5 Q4 l2 c
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);& ]' u' d' Q! {5 l% t, M5 Q
  36.         if (ret != 0) {
    2 F9 h* o2 [0 b( e$ R6 J/ `, p
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    ' ^2 ]: {' w2 a5 p0 Q
  38.                 return -1;  ~4 I$ S2 p$ f# {# [
  39.         }
    ( p* w: E+ @: l
  40.         memcpy(mac, buf, 6);
    3 R% u" Q- `; Z2 a
  41.         memcpy(stbid, &buf[6], 18);
    ; m' @+ d9 c8 ^6 D: |& {7 Y
  42.         stbid[18] = '\0';
    . R0 d5 l+ S, n2 o
  43. + I( E* |# L6 U0 s9 z' ]
  44.         return 0;
    2 n1 u; B: ~3 v1 R- z. [* A  x
  45. }
    6 b  J% y& z/ W: w. ?$ L! H7 D
  46. ; w3 B! t& p8 ^* j( _9 u' W' j
  47. static int writeparam(unsigned char *mac, unsigned char *stbid); X2 p$ d8 i/ Y4 i# Q% f. x
  48. {
    3 U0 H& A/ G$ E; B+ u- c  {* \4 p4 Q+ |9 m
  49.         int fd, ret;
    5 r& {: _& c6 P9 q& h: v( V
  50.         e2prom_s_cmd arg;
    2 |6 d* |, b0 P: R
  51.         unsigned char buf[0x18];
    - ?  |8 X  w; o0 {

  52. ( _  E$ O- z$ }+ s$ f
  53.         memcpy(buf, mac, 6);
    ; \8 j( `' k5 _5 M
  54.         memcpy(&buf[6], stbid, 18);
    ; n- D# W& P6 |' x, i' E
  55.         fd = open(E2PROM_DEVICE, O_RDWR);5 a4 ]7 N" `9 ^! n3 \% i! [
  56.         if (fd  < 0) {
    4 }% q+ k/ M# [
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    - K, |* `" |6 m2 ^& v7 _
  58.                 return -1;  m, n# y7 L# }/ W4 ~  Y0 e
  59.         }: B' ~* z% b- d7 Z( {# i' m
  60.         arg.sub_addr_count      = 2;2 V1 K# A# C" e7 H0 H. `
  61.         arg.data_count          = 0x18;
    " l( u, v6 j, p  H7 C1 ^
  62.         arg.e2prom_cmd_sub_addr = 0x290;5 {( ?0 a% o7 d- v
  63.         arg.e2prom_cmd_data     = buf;
    $ P& |! V# d- z4 m
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);! }6 y5 o3 S. d- ?* r" P; e
  65.         if (ret != 0) {
      [0 e9 S( E! h4 F1 S5 `( t( M
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    - R& O8 V3 E- v- t# b
  67.                 return -1;0 R  x9 p" T4 R# [( L, C% \
  68.         }
    & x5 M6 Q( c5 ?& L$ S% M  O

  69. 4 K/ S% F& `' i3 w$ B7 B
  70.         return 0;
    7 K- x1 V) f  W4 D% y
  71. }0 B5 }4 A- U- A  u' c4 e
  72. & A3 _6 v2 ^: }5 u* |  s! Q  C
  73. int main()" ~+ |' }  V9 `" h' e# a
  74. {9 Q7 J. n& a, y2 L
  75.         char c;8 }2 h9 d5 l6 j5 {" |" B" N2 c! h
  76.         int i, macs[6];# ^$ Q+ q+ \' O
  77.         unsigned char mac[6];# N) c4 w" G, c7 }
  78.         unsigned char stbid[256];, f. t. L; O8 x

  79. % K# N% H3 ?! ]& P3 _
  80.         if (readparam(mac, stbid) < 0)/ T6 G1 r) ~- q8 c  R6 d
  81.                 return 1;
    ) q4 B. V+ u3 m6 d$ k% G/ \# |# o

  82. + ~5 j1 |# A/ g% l/ d/ @: U# @
  83.         printf("Current parameters: \n");
    . S  p$ P2 W: T; {1 A! P7 F
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);) O1 W: {( q0 f) Z6 w
  85.         printf("  STBID: %s\n", stbid);
    ) n$ F) X; _/ ?% G. c8 c' g$ e( m) l( y
  86.         3 ]7 h4 Z; z# M% g+ {* @5 W* l. e
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");4 B7 `( x4 D* _& ?$ k3 y
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    6 I4 b: L4 `3 C, ~% b1 }) k8 R
  89.                 printf("Input MAC error\n");' a9 y' o2 r5 q8 [$ g5 Q
  90.                 return 1;
      d2 ]  p& e; S& X. O
  91.         }( }' t8 p$ P/ @4 V0 L3 s
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    6 ]6 c% K$ b" @' {
  93.         printf("\nPlease input new STBID: ");
    6 M3 `8 q- ~6 h) S
  94.         scanf("%s", stbid);
    + H% N8 f; f1 ]8 l' @8 ~
  95.         if (strlen(stbid) != 18) {* C6 F2 `6 v% H( q/ e$ e
  96.                 printf("Invalid stbid\n");
    / Q% s* X" P8 n( T; k) [8 T/ V
  97.                 return 1;
    9 G9 K  J' D* W8 x  A) U. |! i
  98.         }1 A* o7 z2 c* J3 P! j
  99.         printf("\nNew parameters: \n");8 p, X  B$ l' `3 z
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    # b! A" p- V( X
  101.         printf("  STBID: %s\n", stbid);) r% s5 W+ @+ h3 J

  102. , Y* X& N* d- T  o9 O, Y, g% ^
  103.         printf("\nDo you want to change paramemters? (y/N) ");: n1 s9 k% N5 e+ a
  104.         for (;;) {
    * G& P0 R3 {/ S* d0 h) G( l. c+ H
  105.                 c = getchar();5 [) H( F3 n( O6 i3 o8 o' H
  106.                 if (c == 'y' || c == 'Y')
    ' s; x/ O( U4 K4 V# }
  107.                         break;
    2 F$ a2 D, J% i( t" X9 @5 b6 O4 ?2 J
  108.                 if (c == 'n' || c == 'N') {: z0 [6 N) n. V  e
  109.                         printf("\nAborted.\n");
    $ W. o7 O% L* j2 d
  110.                         return 1;1 Y# {" r; p, [! ?
  111.                 }
    & i" m9 l+ T' N; U" d
  112.         }/ {6 Y5 Z1 S  i1 k# c3 t' G2 V
  113.         if (writeparam(mac, stbid) == 0) 2 s9 y) y! d* @8 [' n
  114.                 printf("Parameters changed.\n");% C5 |  v9 R# @* h+ h

  115. ; z' R3 G, H$ }, h
  116.         return 0;
      {! B2 n) x4 _5 c- 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
7 `* I$ m1 \/ f2 p9 j在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

& v: A0 f6 g) Y# ~  Z$ n& n你用的编译命令行格式是什么?- N; l2 ?5 y$ t/ H. p) Y1 I
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

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