查看: 16915|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    0 b8 j% Q' I' d! A  ?$ v" i
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig. t( H: J; M/ N  y
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:% {: F; x* X! h: D2 P. ~
usage: himr <address> <value>. sample: himr 0x80040000 0x0
( y4 r8 a" Y/ u0 t
8 W  {/ A, R- j3 s& w7 K. N; U+ i/ o! W
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?9 }. w  T; z- P0 y: r0 V

- M9 r" {! Y/ I8 y! P' e补充内容 (2012-3-8 09:42):
6 }8 z4 L! _6 G9 rhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数/ \, X9 M* ~% [
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。  b9 m+ ?! |8 K- ?3 |  x5 m
. V  `  w$ D) |, M+ m7 L8 \: |
himr <address> <value>. sample: himr 0x80040000 0x0/ W% i' m. m, m& y" g$ I- n0 E
9 y, V1 T* R* B' ~3 P) X& U" N
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
4 T4 i5 f. U, b% Nhimr 0x80040000 0x00' A" f. S- f8 ?4 W  K0 W: R" o
himr 0x80040001 0x11( e$ Z7 ]' |" P! d) Q
himr 0x80040002 0x22
! Y" Z! c  x, _" m' e9 D5 Nhimr 0x80040003 0x33: P) E8 C  y; C3 k6 S5 |
himr 0x80040004 0x447 @9 ^7 }" K& m1 S0 O4 r
himr 0x80040005 0x55
) `6 c  R# s1 _. U0 S
6 b6 o9 S6 L7 ]# ?  KSN也是类似。: K2 y! `8 }& p/ R& h
" |  Z' g1 N- C
现在主要是,谁告诉我们MAC和SN的地址?
* U( A, _2 v1 K; v% A' R9 L1 s
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37
" j, j  |6 B+ |1 M2 A一直想找到运程修改MAC和SN的办法,苦于无解啊
6 g" x6 z, m7 ^( ~3 a8 ^/ X
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
# S# |0 O' p& Z- l/ ~1 f
! h' b8 l. \" I修改的代码早有了。到今天不会编译。
5 V) G' {+ M3 J! ]& M需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    6 I. e7 j& ]. A# Z5 \) i2 N
  2. #include <malloc.h>
    2 G7 @+ z0 {' B8 ^) C' d# R! H
  3. #include <sys/types.h>
    + D# s5 R# C9 L7 N. l7 D  M8 L7 l
  4. #include <sys/stat.h>
    7 e3 K6 y; R. L6 T  z& j) k+ L
  5. #include <sys/ioctl.h>
    $ Z+ i+ L4 \' {& Q' R, H
  6. #include <stdio.h>0 D$ @1 j6 a5 w7 h6 I8 Y& l) x
  7. #include <string.h>% Q! r8 G" m$ e0 o, U
  8. . k- U9 |+ s6 [. r# H
  9. typedef struct {
    8 }6 K, z8 D3 {! L
  10.         unsigned int        e2prom_cmd_sub_addr;7 ~* q1 q! v4 H& l/ d: R
  11.         unsigned int        sub_addr_count;# ]6 M) V( ?$ z8 Z! j4 |  Q
  12.         unsigned char*        e2prom_cmd_data;
    1 C# h$ ~6 j9 S# M, h
  13.         unsigned int        data_count;
    9 d( C2 V2 [: x# i
  14. } e2prom_s_cmd;- T+ m9 i9 D- o; m: W( I6 y
  15. 7 a/ ~, G6 ~- H1 \$ T
  16. #define E2PROM_CMD_READ 1
    3 D3 U3 M" q' c
  17. #define E2PROM_CMD_WRITE 2
      p7 {0 n$ R  p' M# m  j- p
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    5 B7 W0 F: H3 H3 g# L( _4 y
  19. ! m2 m8 w3 b9 \5 d/ |" Y3 l  L' ^
  20. static int readparam(unsigned char *mac, unsigned char *stbid)1 Z9 u. [) h' r3 N0 w" D
  21. {
    ! E* N0 ]8 Y0 x7 g3 t
  22.         int fd, ret;
    7 g$ t- ~, b5 j+ g
  23.         e2prom_s_cmd arg;
    : B* ^; g" W; l8 G. i, _) ]& J' P
  24.         unsigned char buf[0x18];5 F7 p8 A& s2 P5 R! Q# o
  25. . K! f, B9 z7 I" l' Q6 \' ^
  26.         fd = open(E2PROM_DEVICE, O_RDWR);8 k( n& F4 m# e$ Z
  27.         if (fd  < 0) {
      d' k' W4 B% F
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);0 {6 a9 c* q# W/ i3 m2 x) |
  29.                 return -1;; s, }! k2 p# E1 x: ^+ z
  30.         }
    + ^3 W# b" ~5 _. b
  31.         arg.sub_addr_count      = 2;( ^3 e* ?) l& r; ?. g
  32.         arg.data_count          = 0x18;3 X& R& g/ W4 B* B9 l
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    ) X+ w6 p3 s9 s" S' Y6 _3 @
  34.         arg.e2prom_cmd_data     = buf;9 G8 S/ K* F2 r0 g6 V3 f- s4 g
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    . z; Q1 |+ _: m2 i. t5 @' m
  36.         if (ret != 0) {
    $ }& P, ?; Y) p3 g
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);$ q6 M: z3 N! O
  38.                 return -1;
    ' D. r6 }- I' P- C
  39.         }# Z: z! h4 h7 k- w! X( u( x3 V5 `% |
  40.         memcpy(mac, buf, 6);1 c  G: x* g7 t1 u: s3 t$ N& ^
  41.         memcpy(stbid, &buf[6], 18);
    " p) U2 R1 R5 k
  42.         stbid[18] = '\0';' p5 z2 Y: S7 j1 r+ l$ K
  43. ) t# T' m+ B$ M3 Y
  44.         return 0;
    & @, m1 p/ J) l! F+ V
  45. }9 O. D1 V1 Z' j
  46. / h+ h  a9 P2 G1 R
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    ! M& l( n' w( w+ a& W* O
  48. {+ \+ Y- G' G9 j$ D; Z
  49.         int fd, ret;0 t; e( W2 n. V% V- W
  50.         e2prom_s_cmd arg;" j+ N+ B3 [- o6 S5 }6 `0 C
  51.         unsigned char buf[0x18];
    9 r& z$ R" h3 d: y- Z! o5 N
  52. ; v  N; [: S6 M  N* S1 [8 {
  53.         memcpy(buf, mac, 6);
    ) r& H; ]8 V: C* ?( z9 P. ~* g
  54.         memcpy(&buf[6], stbid, 18);
    2 A: L8 M% X; O- j3 s2 p/ p
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    ! W) f$ x5 u8 r/ a5 l3 E, G/ T/ U
  56.         if (fd  < 0) {2 P- \& t/ _3 |0 _/ T
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);+ }% o& f3 I, {1 H
  58.                 return -1;8 i9 s$ a9 Y2 o
  59.         }
    0 Y; J( A" p4 K' f: t9 w0 D
  60.         arg.sub_addr_count      = 2;; G8 Q0 s- M+ E2 E% B
  61.         arg.data_count          = 0x18;
    9 O5 y% a- L, z7 a3 f+ l4 b
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    ' B6 v' V. }& h
  63.         arg.e2prom_cmd_data     = buf;
    7 K! n$ S2 Z2 s/ W; F" l
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);4 X7 c9 }& w; @, R1 Q  B% R
  65.         if (ret != 0) {! H# t# F7 _6 U  A0 L8 n
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);! d. B( b4 u7 \& i' c! {7 C
  67.                 return -1;# G* J% d9 \: E' y
  68.         }! y4 a" t5 B1 L  \2 g
  69. 6 d. N% a4 ^% d! s' \2 d% v
  70.         return 0;
    5 ~& K+ a4 u: G& v+ s/ V
  71. }% x' n% I# M8 n% B4 N2 X& g

  72. ; ?/ W- Y$ ?% W) B; C' A7 g" p
  73. int main()- V2 S" O/ _8 L+ }' j! k5 X  I
  74. {
    8 ^8 |& F. U3 J% k! X
  75.         char c;; V: h% _' B) _7 P+ f
  76.         int i, macs[6];1 C1 L* G0 |5 c5 j
  77.         unsigned char mac[6];& ?9 U+ I9 `6 s
  78.         unsigned char stbid[256];7 v0 N6 D! y; [0 A- y8 G5 M* I. v

  79. ; K' @8 c8 e' I7 N4 y, c: J$ s+ ]
  80.         if (readparam(mac, stbid) < 0)
      J4 Z: _; \8 Z1 H
  81.                 return 1;! Y4 w3 W2 c( G6 u! H9 J; O' S+ W

  82. , l+ p* A2 Z7 @( Q5 J3 A
  83.         printf("Current parameters: \n");
    # I7 e7 }' s( m' m, |1 q
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);+ }2 D2 f. t% X) p: q! C3 V
  85.         printf("  STBID: %s\n", stbid);- p& h9 Q8 I4 ?' c2 \5 e) B
  86.        
    & _- n% k7 C" f1 O6 Q
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    & ]6 s. }1 X0 `7 x7 n, P, e7 g
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {6 j( d8 v9 T0 f6 g, {
  89.                 printf("Input MAC error\n");, ^) z7 {% e$ V0 t" {, G9 F
  90.                 return 1;
    4 P! c8 h  k' v! h
  91.         }9 W( `: r2 I6 U- U* W
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    5 n! r# R/ ~9 s  |9 R( P3 x
  93.         printf("\nPlease input new STBID: ");( z- c( K. h' Q5 c" |
  94.         scanf("%s", stbid);
    : L& h7 q3 d( _) W8 ?
  95.         if (strlen(stbid) != 18) {
    $ ~& a0 m  S8 o3 W) P( a% B
  96.                 printf("Invalid stbid\n");
    ' l3 C6 P. W) ~; j# }
  97.                 return 1;) m4 f+ s  O0 `: s. S- n
  98.         }' g& ?! u! t* i
  99.         printf("\nNew parameters: \n");; E1 h' O* L2 `6 F) p
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    * s3 o) \$ l" E; V
  101.         printf("  STBID: %s\n", stbid);& a1 K! ]9 k. K" a3 \# {
  102. 6 [# \+ _) R- M& Z. J' @9 z7 n% S% X# v
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    ' J6 t. |" Y3 U& V) Z
  104.         for (;;) {
    8 V# u# @. F0 x5 `  e2 ~6 V
  105.                 c = getchar();8 H, z3 G1 t& e8 v
  106.                 if (c == 'y' || c == 'Y')
    4 r  x: c/ T  ~# ]/ `, _
  107.                         break;
    6 Z% F1 T$ Y, T
  108.                 if (c == 'n' || c == 'N') {" V, z, |9 i9 q+ s( d+ G" j
  109.                         printf("\nAborted.\n");
    7 S, u9 m& Y6 K
  110.                         return 1;
    " T# `2 E! k7 |* ^- z2 W; {- Z
  111.                 }. g0 l5 w2 Q2 `' E) M; @
  112.         }9 E3 h, `% L3 i' g, J5 r5 _
  113.         if (writeparam(mac, stbid) == 0) ' M0 N* V8 L+ b* g. {) p/ Y) H
  114.                 printf("Parameters changed.\n");; s, d7 _" c* V0 d9 k- h6 o! I  E

  115. % Q% _7 U& D' _, t
  116.         return 0;; \' x3 ]! L7 ?0 H9 F* l  o  v" C
  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 * H+ L3 E# R* ]9 ?( w
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

$ Y- }$ K* T2 t2 {! x. ?8 g" x你用的编译命令行格式是什么?
/ P- S  Z# ?; {
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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