查看: 15855|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr4 G1 m/ a- D" c) A2 I: I/ D& Y
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig: s* b3 i" z5 I: m2 q% b! E" o
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
2 ^* f& [! |7 X8 I9 N' z. Cusage: himr <address> <value>. sample: himr 0x80040000 0x0" ^( }' U2 j3 R; F# ~* ~% d  }; ^

9 |  G; h3 B. F# b- K* j
/ H, ?. w* R- J" \9 Z& e1 @不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?/ Q; I# {% S- K# I3 j9 S

; B6 O6 d7 V( L补充内容 (2012-3-8 09:42):. y- g/ U5 P7 [% y3 u
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数$ b5 b7 C7 C, N. Z. ]
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
% A5 R& f2 K9 l6 E1 T3 o- V
" N/ r. ?5 z3 fhimr <address> <value>. sample: himr 0x80040000 0x09 n0 X9 p$ m0 }% J+ }# o& ?, r8 {

1 K+ Z# t; Y  v5 n4 ?例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
& _# B; b' U& c# X& Dhimr 0x80040000 0x00% o9 G( j- d' `# |+ o0 f& y
himr 0x80040001 0x11# J0 u% P& a9 B/ w( v  q) L6 {
himr 0x80040002 0x221 j% n$ b: u6 h
himr 0x80040003 0x33
# p  e8 X5 m% `% khimr 0x80040004 0x44
7 y1 E- T% l2 Yhimr 0x80040005 0x55+ }% z. g, N: `2 J0 l

$ ^3 y* g5 d3 BSN也是类似。
8 g; o# s1 }4 F& k" b# x/ e! p
) N$ R4 L2 }. ^8 ?1 L. U" l8 g6 L) L现在主要是,谁告诉我们MAC和SN的地址?
) {6 g1 x" t6 o- C
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 ! q0 {6 s1 w* s& Z) ?& D
一直想找到运程修改MAC和SN的办法,苦于无解啊
: r8 _, J& u6 o
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 1 K0 o% T$ c8 W# {

& m* H( C# R; l$ R  Z0 g6 o修改的代码早有了。到今天不会编译。
0 T; ~  T4 d  X  `需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    . U* v! N/ }3 G5 t4 I. ?
  2. #include <malloc.h>
    2 Q" k4 y$ S/ m" a) ?' F- i
  3. #include <sys/types.h>
    5 t2 H' u2 t, \4 Z
  4. #include <sys/stat.h>
    - j8 j2 _8 c! |
  5. #include <sys/ioctl.h>* ?) q+ c2 [. P9 d3 S9 Z( R) _
  6. #include <stdio.h>
    & ~" z3 W' y# ~2 _
  7. #include <string.h>$ ^% g% a6 R) ~

  8. & |9 ]/ h3 |* ~
  9. typedef struct {; W  D% T1 l& D2 P, f* V
  10.         unsigned int        e2prom_cmd_sub_addr;
    1 j4 g. D; g2 O! B% L
  11.         unsigned int        sub_addr_count;& n) m. U! ]/ a& r. |
  12.         unsigned char*        e2prom_cmd_data;
    4 Y: q8 r1 n2 k! _+ D8 m; L
  13.         unsigned int        data_count;, |0 J  U9 P$ H* }: J! e9 ?
  14. } e2prom_s_cmd;- Q2 d1 Z* m# e# _

  15. 1 ?' |! J6 u! ]& `) X6 p( p
  16. #define E2PROM_CMD_READ 1
    ; K5 A/ Q" f' p9 u' ]3 k  Z% e' Y! w
  17. #define E2PROM_CMD_WRITE 2
    , y+ O. G5 M$ c2 y
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    4 j* e+ N0 m  }& ~

  19. * ]- R5 M1 V% L3 ~3 K  C# X  o
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    6 O# }" c6 U! P- Y  A! P
  21. {6 ^. s/ s# ]  O. `9 i) {
  22.         int fd, ret;* I7 m! u7 [* Q( t
  23.         e2prom_s_cmd arg;
      e+ S, z0 E  S7 ]. R
  24.         unsigned char buf[0x18];
    1 Z7 b5 b; x6 V5 E  N& o# s) K" S- y

  25. ; O2 J5 @" ]/ g
  26.         fd = open(E2PROM_DEVICE, O_RDWR);" R" s& [7 W/ R: }
  27.         if (fd  < 0) {- q3 }; f) k2 r
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    7 M4 K6 x" g9 H8 l
  29.                 return -1;, d( k& @$ B  l# _4 u7 X# A; Q
  30.         }) d& q% U' X: M% I2 F( ]
  31.         arg.sub_addr_count      = 2;
    ! w) [" [, e6 |  l. h+ z0 y$ L- T
  32.         arg.data_count          = 0x18;
    1 `1 p" ~. \2 B# E. }0 J
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    0 O/ O5 ^3 n8 f( N# K- v5 v- O
  34.         arg.e2prom_cmd_data     = buf;! y' ?" V0 r: O3 v" F2 {4 p
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    ( `1 X, k9 d! ~- Z* j& ^- A
  36.         if (ret != 0) {5 Q4 i7 e, w; y: o( H3 z4 l
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);& o: @  Y- o1 s4 D
  38.                 return -1;; k; w0 r' w- Y
  39.         }4 J% b* Y4 g3 E4 R- i# p2 a/ M5 R  t& [
  40.         memcpy(mac, buf, 6);" g7 a( M# z, B
  41.         memcpy(stbid, &buf[6], 18);
    1 i+ Q5 i: m; @& l6 j" E. a* @0 H6 h. @! b
  42.         stbid[18] = '\0';
    : o' y$ E. a: O4 ?! ]( s8 s

  43. ( z" A  c( e6 U7 u9 Z
  44.         return 0;
    3 z4 p8 A& |9 i+ ^! o
  45. }
    + g7 a. k1 E1 V0 ~6 m! @5 }  E
  46. 0 R- c0 L1 }& e! z. R
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)/ f. a5 W3 n0 i4 L8 s) R; l! G4 }: K
  48. {- b/ i1 @0 `7 R1 |! ?
  49.         int fd, ret;
    5 m% h7 j6 F" n% K8 |2 o: [
  50.         e2prom_s_cmd arg;
    ! M4 o$ M9 Y9 P
  51.         unsigned char buf[0x18];; B5 |0 o3 I+ ]! k
  52. . }; M+ M" H7 g/ n. W
  53.         memcpy(buf, mac, 6);5 H' z% F; x2 A( g( K4 K% O. c* \
  54.         memcpy(&buf[6], stbid, 18);, J; e' Y+ J: `) o8 W  G0 Z
  55.         fd = open(E2PROM_DEVICE, O_RDWR);4 [8 t2 I3 L$ b- B2 O) X
  56.         if (fd  < 0) {
    ) H( t7 A  k6 H, n( a
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);' {6 c5 c' \2 x# a+ z
  58.                 return -1;
    / |9 y  W- U9 _8 a" m
  59.         }( q) C* j# I9 d# Z* [3 W! l) n! C6 _  H( R
  60.         arg.sub_addr_count      = 2;8 G' Z, M$ f  e. ]; m
  61.         arg.data_count          = 0x18;+ f3 a$ ~. Q8 k6 r) Z
  62.         arg.e2prom_cmd_sub_addr = 0x290;+ T( o$ {6 Y/ C, |8 i, A
  63.         arg.e2prom_cmd_data     = buf;3 p9 j, A5 l. k/ V7 [/ n
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);/ f8 N: ^* T* [. j& f! N
  65.         if (ret != 0) {
    4 @, x& I3 s) Z( N& s. ^2 N7 Q* {
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    ( x- n4 L/ f) a+ {- O. G
  67.                 return -1;/ w9 i7 \6 r9 \( e' T& l6 k7 N& g
  68.         }
    ; \! \" G. G2 k# V: R, d: u

  69. ; v- i3 X; \" w2 n2 H! O- y, W0 l6 ]
  70.         return 0;
    # ^! u( f" k) H2 P" c
  71. }+ g* G1 V- A6 r% y, Y+ H& K
  72. * I9 b/ [' A9 j- d& H1 _
  73. int main()
    9 v6 _+ Q# i: ]' O! u8 e
  74. {
    ! e( i- ~- i8 n: a9 X/ r2 ?/ C
  75.         char c;& Y7 s4 e) V) m
  76.         int i, macs[6];
    - P+ H8 I' r' a1 n3 J6 Z5 ~
  77.         unsigned char mac[6];3 X' \7 a: |$ m$ o% k) l7 }; h
  78.         unsigned char stbid[256];1 B# V6 {& B. A/ G

  79. / a; }6 d# s( A: B* t, K$ t
  80.         if (readparam(mac, stbid) < 0)
    3 y6 z2 c' }  [" n
  81.                 return 1;4 C. x! X; [+ F# `  M/ P+ T$ ~6 K7 k9 o
  82. ' q. C: {' Z( G$ @1 f# n
  83.         printf("Current parameters: \n");
    ; Y6 d7 ?. m6 g
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    1 W0 U. s3 n! p7 _3 N
  85.         printf("  STBID: %s\n", stbid);8 b5 U, \6 r5 O5 h8 @2 X/ k- g; S; |
  86.        
    $ X% @5 w5 p$ ?1 @7 c. C4 f6 `$ ~
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    ; ?0 }+ G, f3 p8 j: {
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    " t* T1 X! a9 }$ N6 f- O! S
  89.                 printf("Input MAC error\n");3 ?( |$ q- d" _( t  S8 W
  90.                 return 1;
    : c6 S; J8 ~, X& C7 s* t
  91.         }
    ( B4 r' x& l+ b5 `7 n+ u
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    + Z/ \" T3 \6 r7 @: p2 e
  93.         printf("\nPlease input new STBID: ");
    ( L# F, _1 a7 Y% V& u# K
  94.         scanf("%s", stbid);
      G& D6 m5 D) @5 ?' x$ B7 p& y8 y
  95.         if (strlen(stbid) != 18) {: h5 M3 P1 G( \
  96.                 printf("Invalid stbid\n");8 T) n" m$ ?0 ~3 m( P
  97.                 return 1;/ z- n* E+ R& G  ^. X
  98.         }% X4 B, F$ p: o* o) L  t! ^& o; M
  99.         printf("\nNew parameters: \n");4 D6 w/ @6 P; R
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);$ `& |. D+ g" q1 k8 T4 b4 r
  101.         printf("  STBID: %s\n", stbid);4 a/ h# r  a* d3 _

  102. ' P* a) S" f4 m: Z$ }& i
  103.         printf("\nDo you want to change paramemters? (y/N) ");  ^: v8 d# S6 a! W& k6 Y% ?
  104.         for (;;) {4 k, ]$ n* [% n; L. b/ e
  105.                 c = getchar();$ z& K8 o2 ~" c5 l2 P8 L% x
  106.                 if (c == 'y' || c == 'Y')
    7 k5 U1 r4 R& {! q6 n4 d  j2 }
  107.                         break;
    % e5 p) [0 i) p! c  o
  108.                 if (c == 'n' || c == 'N') {
      n( N2 U- ]% [  M
  109.                         printf("\nAborted.\n");
    9 @( v/ g. j( j: D; r" Z
  110.                         return 1;
    . t. |2 d. E4 U5 l7 Q+ T4 u, d
  111.                 }
    # P# P* X) n% k: q
  112.         }
    % Y% A0 j! o/ W% g6 i0 E. P+ [: C
  113.         if (writeparam(mac, stbid) == 0) ! @& i0 z1 l5 U/ X
  114.                 printf("Parameters changed.\n");- {: n# E9 T$ ?1 }) W' H  I
  115. 7 ^' E  @% s1 z, _
  116.         return 0;+ Z: l1 d7 `/ x/ @0 F
  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
( V# g' D, u1 ^  x在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

) [5 c3 h& @& D/ l( ~# V. V. V你用的编译命令行格式是什么?
2 ^- z( }: ^3 J7 E8 d7 V& D7 ?+ t
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

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

在本版发帖
关注公众号
QQ客服返回顶部