找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14950|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr" f$ z, x% P* ]/ B# g5 a+ p" J3 A
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    7 c0 A% y7 ?& {, B, F0 ~3 ?
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
9 Z, b$ m* w; ^: }# pusage: himr <address> <value>. sample: himr 0x80040000 0x0
$ Q0 Y3 L: \! c' a$ x! b' ^3 G$ U; [8 _, V7 q( N/ M2 Q  y
2 K9 v1 _: Q; i" k7 E3 Z7 [
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
/ B3 K, B3 n% F& P- t6 ?0 S$ n3 S1 Z+ S! ]: o  {
补充内容 (2012-3-8 09:42):7 W( J% I0 n3 k; W
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
+ `# d# X! B+ U2 |% E这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
5 r( ^0 x+ W1 L2 r" k
; c3 L: [: J+ o1 f/ P' `himr <address> <value>. sample: himr 0x80040000 0x0
  \0 x/ v  L+ K4 o1 _5 z5 T7 ]8 m7 v3 v. w$ C; j$ u* B3 C& l0 b
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。" g9 C5 O; I: }; }+ H( F
himr 0x80040000 0x00) n9 ?6 `( }# E3 U' n) W! i* K
himr 0x80040001 0x113 O0 U/ u/ w- z1 J7 |9 }, }
himr 0x80040002 0x22+ F$ e/ ~5 q9 d) T- \' K
himr 0x80040003 0x33
6 U* S) d/ U" b$ T# b1 k# q' uhimr 0x80040004 0x44
4 ^+ W# Q7 {+ W: q  l  J+ w# I9 @himr 0x80040005 0x55
. T/ o- Y* v' D9 Y: }( j: K1 `: {; x" f. W
SN也是类似。
4 \, P) R5 p7 y! o
, ]5 E+ `" G$ ~+ t8 t+ u现在主要是,谁告诉我们MAC和SN的地址?
5 j/ N' u. `* e" T" G9 a+ ^8 g8 G9 B
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
0 B& R5 D2 F2 Z3 w; h9 q一直想找到运程修改MAC和SN的办法,苦于无解啊

$ M& a7 |; K: v源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 9 R* w  S1 r0 c+ L- C3 `

, C3 c# E( ?! m$ e* a! B2 P, v修改的代码早有了。到今天不会编译。
7 [( ]3 `& m1 n3 v( d/ H- k需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>4 {) H0 d% p" U8 ~0 _, ~+ s
  2. #include <malloc.h>
    , g3 K* Q; m  k
  3. #include <sys/types.h>  x7 V! }, t) T, o6 U1 X/ k
  4. #include <sys/stat.h>" I9 D& q" ~0 R0 s5 J1 v
  5. #include <sys/ioctl.h>$ k; a# y# V& ^  h' v  T! Y
  6. #include <stdio.h>
    0 I; p, Z1 N& Y- D4 O  d
  7. #include <string.h>8 ~& D$ ?3 z' r" R3 ]
  8. / }9 k% A. ]+ m; X
  9. typedef struct {2 F) q3 ]2 W1 w: C4 q; a
  10.         unsigned int        e2prom_cmd_sub_addr;; i! `5 }6 x  n* L, Z4 E8 M; ^. M
  11.         unsigned int        sub_addr_count;
    / t: B0 C& H) u5 e5 o1 A
  12.         unsigned char*        e2prom_cmd_data;4 D1 h5 p4 u( P" C! X2 n, y
  13.         unsigned int        data_count;
    0 h9 E7 K1 b2 l) w" K% m
  14. } e2prom_s_cmd;. K) x4 w2 w% T

  15. # ^+ m+ B; y, F& i! }
  16. #define E2PROM_CMD_READ 15 o2 B5 T5 U: ^* l/ \3 |( A
  17. #define E2PROM_CMD_WRITE 2
    , J3 z2 V6 y4 k9 ?) L9 x
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"3 L' e" [& Y" a' o
  19. , o5 n' S1 K! T1 u* n. X
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    - `9 b- ?  n0 t/ Z% z, ]9 h8 y4 I+ Y% I
  21. {4 {: k  w9 Q; h! z  v& C2 q
  22.         int fd, ret;/ N7 G9 x  t  C. a
  23.         e2prom_s_cmd arg;
    7 d: W) f+ u' s: r, U4 Y6 @; T1 q
  24.         unsigned char buf[0x18];- b# M5 D6 v. M6 p/ z

  25. ' |; ]* B3 h. k' O" G
  26.         fd = open(E2PROM_DEVICE, O_RDWR);2 m+ O) R( ^) s# ]5 R# w
  27.         if (fd  < 0) {
    # l5 j" |: o2 g7 A! h
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    4 O, i5 H  O+ Q; Y9 X- I
  29.                 return -1;- }. n% K$ K5 |7 l/ r; r% w
  30.         }
    # i  B0 ?; |  K' [' D
  31.         arg.sub_addr_count      = 2;
    - @- D$ I( \  I" |# ?6 y
  32.         arg.data_count          = 0x18;, g1 i0 M1 G9 l- K% y& v
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    6 H  y7 L$ n$ p
  34.         arg.e2prom_cmd_data     = buf;# T3 t0 m0 a- M& |$ r
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    " s5 w8 f1 G& l) N) b2 f! k
  36.         if (ret != 0) {
    5 d$ k: [) G% Z) A+ u+ K
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);0 S8 e* ~6 m  @! k4 k
  38.                 return -1;$ A6 W# H  k  ^! n
  39.         }! F( J5 j$ O! E* ?! f7 C1 F2 o  d4 Y
  40.         memcpy(mac, buf, 6);9 l" M- B1 f: P! D3 R+ f" k
  41.         memcpy(stbid, &buf[6], 18);: p+ |% l4 I& @' |
  42.         stbid[18] = '\0';
      @  p% M0 T+ {4 d9 X6 s

  43.   D% o. k2 p8 T8 Q. R2 l+ o# d' k$ E
  44.         return 0;
    / R! ?$ I3 T: k) B6 x' j
  45. }
    2 y5 O$ ~2 X8 ^2 i" d- _

  46. . O) N- K/ G& s# y/ g5 W
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)4 e2 k2 I$ Z7 k7 D$ x
  48. {
    ) B' t5 F2 I% ?0 h% ?- ~7 w
  49.         int fd, ret;' \( m( W& g( j6 f1 Z: e/ M
  50.         e2prom_s_cmd arg;1 m# L3 R$ j5 y6 r1 J7 O+ h
  51.         unsigned char buf[0x18];8 J7 g/ t: p, K) N3 B$ a; \

  52. + |) s2 m; A+ n" ^! N% q7 A
  53.         memcpy(buf, mac, 6);
    2 s" n) L  L# _2 t! _: W! e
  54.         memcpy(&buf[6], stbid, 18);
    9 Z  }4 T+ S, j
  55.         fd = open(E2PROM_DEVICE, O_RDWR);! u" b8 X( F1 C* U
  56.         if (fd  < 0) {. g1 y- [  ?% W# h- @
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    # V( F$ ^/ _) d; y# p* w
  58.                 return -1;
    ) P" Q  A. o% d; s0 p
  59.         }! u5 P8 c) r4 H& i7 `2 T
  60.         arg.sub_addr_count      = 2;
    . c/ H. |7 y( \8 X5 ~& C- P
  61.         arg.data_count          = 0x18;( d& T2 M; X; x+ j" z
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    , g0 W! N) ]/ R# w1 Q
  63.         arg.e2prom_cmd_data     = buf;
    : @+ ]0 V5 {3 k+ q/ ^
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);* t  J6 u) p  m" F. h+ l. y
  65.         if (ret != 0) {
    * j' `! F8 Y* V3 w+ L
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);9 o5 y) J6 y7 i+ I! Q
  67.                 return -1;- Y4 o. g. v+ ]
  68.         }
    7 W- t" O, M8 L4 y

  69. 6 p/ f* w- V/ |4 p
  70.         return 0;, t3 N$ [% ?0 G# E. B; S- W1 U. u
  71. }
    + B3 M% a% G: F0 J# v

  72. 8 k8 |, U- g7 E# ]$ h/ `
  73. int main()
    , p, P/ ?: k. G/ \
  74. {
    4 s: t* |- Y7 `8 T7 v
  75.         char c;2 e; C5 H2 I3 r
  76.         int i, macs[6];( p6 R- |0 C  w% b0 z# ]. h
  77.         unsigned char mac[6];) E9 g" X& M5 h- s
  78.         unsigned char stbid[256];/ i9 ^) K% S! d3 e5 ^; ]
  79. ; _  q- f$ R3 Y2 V. i) J! G
  80.         if (readparam(mac, stbid) < 0)8 `' g  R# A" I$ f
  81.                 return 1;0 Y  g; x- C+ _- G: X; W
  82. % z* G4 Z0 L2 @# m8 S: ], ^
  83.         printf("Current parameters: \n");# k0 h3 [0 s4 {2 j4 \: T
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    ( z5 V+ K  d2 b4 ~5 Y4 ?2 K/ m
  85.         printf("  STBID: %s\n", stbid);
    : |7 N. S" f  O, l$ I5 O
  86.        
    6 `% \; a* [, f& e" w$ H8 S
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");5 f. A4 `( v$ f/ X
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    + C% ?5 w3 i. I3 X# X) ^, _' o$ A- [
  89.                 printf("Input MAC error\n");- y* l( C2 X0 D  W# T1 K5 k# b
  90.                 return 1;
    / E1 q! n- P' y
  91.         }
    - i% v5 I; H- H2 Y3 E
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    % @$ g1 B2 [" X2 X& E
  93.         printf("\nPlease input new STBID: ");
    7 }& \! c. {( l
  94.         scanf("%s", stbid);; z! c& |% s0 {- M2 \% H+ t
  95.         if (strlen(stbid) != 18) {
    7 i8 B  I) S! m. A. p
  96.                 printf("Invalid stbid\n");' r) F+ U1 d2 s3 j0 z" T$ X+ A+ ?
  97.                 return 1;7 T1 q! a, }4 a$ L, k$ d
  98.         }) B! H) s; p. l# B' Q
  99.         printf("\nNew parameters: \n");
    * ~3 d2 m3 i- A5 U' ~" V
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    7 G% P: x# }" o* i0 H
  101.         printf("  STBID: %s\n", stbid);6 r# W  K% e- ~. i' G' B( n3 h

  102. ' |# R! b3 j! Q: y, c) h0 o
  103.         printf("\nDo you want to change paramemters? (y/N) ");6 _7 q5 S5 }8 [" B7 l
  104.         for (;;) {: v$ L' `5 U# v4 B
  105.                 c = getchar();
    , A; e  ~6 j: I; |! Q. [, o  x
  106.                 if (c == 'y' || c == 'Y')
    ( k4 a! ^; t8 l  `1 ~; i
  107.                         break;
    0 n, w; M3 h. o7 K0 k
  108.                 if (c == 'n' || c == 'N') {
    - ?* Y2 ]+ C/ `6 _
  109.                         printf("\nAborted.\n");
    # U* H& j$ R' v3 D
  110.                         return 1;
    1 |% W5 Z" X2 A2 m( u: j+ Q1 d
  111.                 }
    5 D; ?. a! l7 S6 m/ b! {* U
  112.         }# m, _, A4 r8 X) r. T1 M
  113.         if (writeparam(mac, stbid) == 0) 2 H. M, p- u. b
  114.                 printf("Parameters changed.\n");
    ' ]. u/ b* E& x4 k0 B* |6 a+ q

  115.   e/ q9 Z3 c6 W: d' q. w
  116.         return 0;
    ' M1 I* m6 `! ~; A+ t% ?0 j
  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
6 W4 d7 N/ P& W1 s+ @% S; w; D; p+ Y在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
) h( ^+ d( \+ S1 S! C) y
你用的编译命令行格式是什么?; E7 P/ A+ J  e: k1 g  T- s
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-12-3 12:31 , Processed in 0.048923 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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