查看: 16685|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr  x$ N! m0 l& {# L
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig5 D# r; S" x2 m- X  c1 Q5 A
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
3 N, Q5 X- E' |usage: himr <address> <value>. sample: himr 0x80040000 0x0
# X* R  I% z% Q
1 B3 S  E  f! N0 d' b: Q9 X/ \. g' {; ?. i  Q' O0 m7 }
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?) h4 S. l) i9 X/ Y" C0 B! V. ]0 F

7 W& `, t$ @% w+ b$ e% [补充内容 (2012-3-8 09:42):8 H% z& T5 W1 S& n4 E% z* d1 k
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数1 h! {' Z# c) n7 j5 c" i% b
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
6 Z# h9 j( F8 {1 W7 O/ L+ @: G  d
$ y; S- ?9 M2 _- Uhimr <address> <value>. sample: himr 0x80040000 0x05 ?% c8 B% j+ W; b
, R9 H% B* R% \3 E5 p
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。2 i0 k& y8 `" X6 U' |% c# n
himr 0x80040000 0x00- b( g. {0 r) M: Q; C
himr 0x80040001 0x11, g+ j6 n! h) T% T9 H
himr 0x80040002 0x22
$ [1 C. \  h. O( [5 u' mhimr 0x80040003 0x33/ _( S$ E2 y( g. Q2 i# e
himr 0x80040004 0x44
7 Y! W8 X4 g# e8 B9 S( y/ c" phimr 0x80040005 0x55
% K9 R; O7 G  {0 z3 O
  Y' v6 F: N; o/ d, z( ^; d! vSN也是类似。
+ e1 E  }8 G; X+ i* d$ ?
" I' A7 o5 g( y, P现在主要是,谁告诉我们MAC和SN的地址?
% X( o" ^. H1 R6 z; _; R9 \/ g
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
$ t1 K; K, Q1 M5 v# g8 ~  @一直想找到运程修改MAC和SN的办法,苦于无解啊

) V3 o$ R! R& q5 G源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 ( l1 s8 R% {5 V. A) m
( V3 l" p. s# U6 C
修改的代码早有了。到今天不会编译。
; a3 B! p8 Z" C' O3 m9 z需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>8 _: j1 I2 J: A+ f# H
  2. #include <malloc.h>
    3 n9 N* O0 J% `4 ]7 e9 v# M% S+ n
  3. #include <sys/types.h>& y! L, L& c) z' a
  4. #include <sys/stat.h>1 `2 d! L: Q3 F6 ~9 m" S
  5. #include <sys/ioctl.h>
    5 E* {0 I% N- S0 W: B
  6. #include <stdio.h>
    8 F8 Y+ ?7 |9 k% `
  7. #include <string.h>$ k6 s, F' Q, b5 x/ o
  8. ! j& K5 g' `) {! x" T/ n( j
  9. typedef struct {/ R: p$ b9 {& @7 p" i+ F
  10.         unsigned int        e2prom_cmd_sub_addr;
    7 f8 m  `% l: Z& ^: d
  11.         unsigned int        sub_addr_count;; d0 S" M' H0 |) u5 ~" t
  12.         unsigned char*        e2prom_cmd_data;
      b. O6 W4 D' e2 G: b% B8 Z& e
  13.         unsigned int        data_count;- X1 P3 h' c( v& X$ V
  14. } e2prom_s_cmd;
    , \: D1 x- l5 z) I; b

  15. $ A' {/ z4 s' X4 Q$ S) k0 `3 H
  16. #define E2PROM_CMD_READ 1  j1 o* ~0 f3 H# I+ J' s" n
  17. #define E2PROM_CMD_WRITE 2
    9 ~, U0 f% c9 e  {0 y. N9 r" W' i
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    / j3 \' m+ Q4 `* I7 T8 k# [

  19. 7 K. Z% Z9 q1 F, w  @; l
  20. static int readparam(unsigned char *mac, unsigned char *stbid)  \) \. P" y# c9 _9 Q
  21. {
    4 [& J, ?- D$ m4 i2 t2 v4 d
  22.         int fd, ret;' W: G# ]1 d! L6 r' j
  23.         e2prom_s_cmd arg;  Q7 k; R; A( T$ H- E/ R
  24.         unsigned char buf[0x18];$ P0 R! K9 f( a* I& \" [

  25. % ?1 _' e% ?& v" i4 X/ J# D1 T6 p
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    . D, W% y: I( m6 e; x4 U
  27.         if (fd  < 0) {7 F% s/ w3 z# M, `0 T( e* P& K
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);) d- F, t. e- r
  29.                 return -1;" K1 K' h' j, b, r$ M
  30.         }
    4 p' Y5 ?, V) B" f+ q
  31.         arg.sub_addr_count      = 2;0 T+ K8 v+ p0 R' T
  32.         arg.data_count          = 0x18;9 O' K8 r" W( u
  33.         arg.e2prom_cmd_sub_addr = 0x290;& a& U6 S3 U8 R4 ]. J
  34.         arg.e2prom_cmd_data     = buf;
    8 u. Z. W7 W$ l3 G4 Z9 d$ l: M
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);0 e! {+ k3 ]* N# b, G8 K0 Y. t
  36.         if (ret != 0) {% S7 F) ^: Y8 H* t( u0 C1 @8 m5 m+ }
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);3 s/ q7 i: h% u# A1 `+ ?. r$ Z" _
  38.                 return -1;
    9 O& @7 @( t. h7 h9 b' v* y
  39.         }
    " X+ y: ?+ t( b5 r( g+ h
  40.         memcpy(mac, buf, 6);
      K" T& ]1 [  W- o, a
  41.         memcpy(stbid, &buf[6], 18);
    : J8 S$ x8 W* i1 m% M7 U! @# t
  42.         stbid[18] = '\0';! Y9 c! L( M+ J

  43. ; Z* y0 O. H4 q) d" F  b! v
  44.         return 0;
    3 M: }& U0 L5 b7 o+ ^% [% B# ?
  45. }9 I9 b6 p! s4 D0 u

  46. : R, R/ S1 k5 G1 u% [; K
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    % E' W. T: R8 X/ ]7 i; p
  48. {3 S3 W4 |+ J/ H2 W
  49.         int fd, ret;0 M0 {" G) @# ^2 ~+ r. ^, b! q% G
  50.         e2prom_s_cmd arg;
      ]: I  \5 g8 [: Y& J
  51.         unsigned char buf[0x18];
    - j: v+ W" G/ T" R$ X& [; @( q3 d

  52. ! B  B# r1 e* p# e+ }
  53.         memcpy(buf, mac, 6);, D" |! H7 l7 o5 s1 I
  54.         memcpy(&buf[6], stbid, 18);% I0 L' w  P3 h7 o
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    + A; t7 O* o9 t  s
  56.         if (fd  < 0) {
    ( T& q7 g' J3 o3 k) J, G3 b9 ?
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);+ {+ u& q9 M, B0 M
  58.                 return -1;
    # a' f6 b2 d, o, E9 x1 d, z
  59.         }8 l1 u% T, E7 B. C* |
  60.         arg.sub_addr_count      = 2;
    1 _! P5 E& N# A
  61.         arg.data_count          = 0x18;
    ' j: R8 ^2 H0 ?
  62.         arg.e2prom_cmd_sub_addr = 0x290;( l* ~3 ^2 z/ F9 }% k6 ]& w2 H1 L
  63.         arg.e2prom_cmd_data     = buf;$ a6 O; ^2 @5 u4 v1 h! Q& d8 H
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);( p+ I4 x4 g1 y) P4 h- y6 h! Z
  65.         if (ret != 0) {+ K4 p! Z. N; J. K. F2 c
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);/ h% Z  e' M% `" f6 k6 i; A
  67.                 return -1;
    1 z5 _5 s! P: N1 Y$ O* h
  68.         }) Y$ H4 m% `$ l+ ^* b# c" z) U8 I
  69. ( c5 r; }4 z! \4 B& w
  70.         return 0;8 E) f3 h6 O# O! U8 \) @
  71. }
    ( Y3 Q% I# F% ]! o+ E. B  n( Z8 V0 h
  72. ) V5 j3 T* `" U
  73. int main()
    " C& {3 W& t9 @
  74. {
    ; j3 \  _5 {. T  f* o) m
  75.         char c;+ d; ~1 T$ `7 b5 Z0 N
  76.         int i, macs[6];" N4 U  ?4 R. g* Y4 u7 Q/ s* o5 U* y
  77.         unsigned char mac[6];
    2 \9 T1 G3 O- W1 V# k7 W& E
  78.         unsigned char stbid[256];7 ]: w7 C. t+ u& a
  79. " @7 U7 f1 m8 a' ]* g% f' U
  80.         if (readparam(mac, stbid) < 0)
    7 o8 N+ v1 D* \* x1 ]
  81.                 return 1;& y( y0 r# I' s+ b' C

  82. 0 q, k# y3 J" z
  83.         printf("Current parameters: \n");" V' [8 c2 A  O$ B( T! Z/ j
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    3 R6 X3 A; g. u9 g. A
  85.         printf("  STBID: %s\n", stbid);
    ! c5 d& d8 J; w" y8 X) X
  86.        
    # n5 X5 s4 f, _
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    ( W" I4 u0 O7 e" s& Y/ s
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    6 u3 g5 g3 q: }- t" k2 h
  89.                 printf("Input MAC error\n");3 ^: r. E+ g2 M. S
  90.                 return 1;; L, z( X6 y5 b) I8 I
  91.         }. b; T8 r2 O! e& [! X
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    $ {( \# C1 `- A# t# w
  93.         printf("\nPlease input new STBID: ");( c) V' l9 `, r/ b/ B( G
  94.         scanf("%s", stbid);
    $ X9 P# E/ E; p. C6 ]1 i1 x( B5 c
  95.         if (strlen(stbid) != 18) {/ n- a' @% t% r9 l! B# {' B+ R6 I$ R, H
  96.                 printf("Invalid stbid\n");  ]% F3 h( h! L4 ?* f
  97.                 return 1;* j; @' L% v9 J! }1 p
  98.         }
    - J; i7 l$ c! e" b
  99.         printf("\nNew parameters: \n");) H0 s. A: F$ T, [# K
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    " ^2 P, [0 R. M4 |
  101.         printf("  STBID: %s\n", stbid);' r. t/ [- ?% v

  102. ' f. F0 _+ \0 }7 o7 Y; m" B9 P
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    6 w7 S% y$ Z& F  t2 G
  104.         for (;;) {/ V+ Y* P4 f6 X( ~/ l! s, o; w
  105.                 c = getchar();
    8 `/ D- [  k6 f8 m1 W3 |4 Z+ y
  106.                 if (c == 'y' || c == 'Y')
      \% @2 k$ t9 z) L$ f
  107.                         break;) W' S0 I! I% y0 v3 ^4 a+ n' c, X: A' q
  108.                 if (c == 'n' || c == 'N') {
      W4 r( b( a* h( P& o& x
  109.                         printf("\nAborted.\n");" _( D  T* l6 H, _5 _+ p
  110.                         return 1;
    " `" v1 a  z. m4 W
  111.                 }
    2 O* J* e) @, L# S! `
  112.         }0 y7 d! Z- L$ _" W; \2 J
  113.         if (writeparam(mac, stbid) == 0)
    - e* ^0 }( M( c' k6 x
  114.                 printf("Parameters changed.\n");
    3 ^: A# n7 A$ V( A' l

  115. 1 C* R" `' x9 l
  116.         return 0;' H) `( |; G! S; `
  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 9 F8 S+ M, y+ n% m: A. H& b
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

+ P8 {% [( P4 f6 V+ H1 L6 Y你用的编译命令行格式是什么?- z2 K$ i+ a: k+ E
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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