查看: 17175|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr/ l1 |& g+ D* F# b3 S3 g' D  r
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig- T' M- U6 Q/ p: S# H- Q6 Z! C4 c
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
! q$ X0 C/ B3 h" ^" F% f$ Nusage: himr <address> <value>. sample: himr 0x80040000 0x0
5 f+ w( D& p5 c9 `7 p& g3 _7 s. m0 U4 H, S. Q% H
# m8 {5 M4 E" ^7 h4 z4 ?
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?: u2 A$ s5 n+ R; \3 d7 V5 ^4 k

6 M+ a6 Y) U: R' e2 c" z  o补充内容 (2012-3-8 09:42):
2 H  q! N, ]; k* @( Z) Dhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数7 A7 [) m) F* V' \! e( n8 s
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。: q- w* D3 E4 J! F$ v" y3 s, F, {- z
* F6 [7 G5 i7 E
himr <address> <value>. sample: himr 0x80040000 0x0" Q' H3 e: E% u% j- Y
/ h5 [" z$ D/ w1 B; O
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。; S) o( t1 n. g  I& Q
himr 0x80040000 0x00
( x, ~; Q$ U6 ?: ehimr 0x80040001 0x11
9 g7 h0 q3 a- hhimr 0x80040002 0x22
* ^/ q7 T+ V+ e, o# Lhimr 0x80040003 0x33
3 a  M9 G1 z7 d; R- jhimr 0x80040004 0x44  K% l( D/ e& z- i
himr 0x80040005 0x55, X) K" S: a4 C+ }

! ~8 u2 I- ]; |3 OSN也是类似。7 ^. g5 L  x6 P: @& ]1 P, e! ^

0 h! c) }' \& T! M( B现在主要是,谁告诉我们MAC和SN的地址?- ?2 x9 o1 ~% Q
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37 : `, c8 z7 k4 X; |4 r" `1 g
一直想找到运程修改MAC和SN的办法,苦于无解啊

: L8 t4 z+ n. L. e/ ~源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
' Y1 ]1 e3 F5 Q9 _# o) E) w: N2 L7 _' k% d
修改的代码早有了。到今天不会编译。
. ]: y! F) P7 z9 k/ a2 d1 q需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>& c! ^  U# X& |0 v: ^* A
  2. #include <malloc.h>
    ! R; S/ J8 r0 O5 O
  3. #include <sys/types.h>" `+ k1 F0 [% o7 D) ?' j$ l1 _
  4. #include <sys/stat.h>+ K$ I3 @# J7 V# X% c
  5. #include <sys/ioctl.h>; I& ]2 l( i% l5 b  f/ L: S; l
  6. #include <stdio.h>  ~1 [, a. L1 P# G4 A; g& G
  7. #include <string.h>
    $ }! j0 A% r! b, C: i
  8. : j- d  l1 D& J" ^0 U' A
  9. typedef struct {5 _% i) c( t  _
  10.         unsigned int        e2prom_cmd_sub_addr;
    0 v- z8 }. h1 Y' W, X, z
  11.         unsigned int        sub_addr_count;$ b* r( R% h: U
  12.         unsigned char*        e2prom_cmd_data;6 o0 B2 i# S3 y4 D% L
  13.         unsigned int        data_count;. R: n+ x$ r& p2 P; b
  14. } e2prom_s_cmd;
    + `* l8 y, V6 ~  ?1 C

  15. : [; }0 G  J) n- T" d, A% R
  16. #define E2PROM_CMD_READ 1
    : R, Z. ^8 n4 c! \( u; K" K
  17. #define E2PROM_CMD_WRITE 24 J* \  H1 z5 t
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"1 e: B) E' e8 R' ?4 f0 y. p

  19. 2 C; c5 [4 Y/ H* s3 G1 j$ ?
  20. static int readparam(unsigned char *mac, unsigned char *stbid)2 Z% C3 l5 L) w$ B7 x! Y2 \$ A7 X' U
  21. {1 F& \, U! x; c: ?" `5 R) u; J( B7 U
  22.         int fd, ret;
    - }. [, i) w" {" r0 w
  23.         e2prom_s_cmd arg;
    ; k. j; B0 V" H6 D
  24.         unsigned char buf[0x18];: f/ r2 g% ]" `. M% }: M- W

  25. * F6 _1 s' v: C9 S) c
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    - K1 N4 P: u% B9 F7 W
  27.         if (fd  < 0) {
    / C% g, V( p4 u" N
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);4 q7 ^0 }/ o2 a: a. m1 C9 j2 r
  29.                 return -1;
    2 R! t% p- E8 k4 p" R6 ~/ V
  30.         }3 u4 N% P7 v0 K) h. d
  31.         arg.sub_addr_count      = 2;
    " @, E( X& p% I- `& k" h) k
  32.         arg.data_count          = 0x18;
    & {# w2 n1 ~! N* j3 l  n) p* n
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    / Y' V) w+ \* M- Z9 D3 Q8 I8 C
  34.         arg.e2prom_cmd_data     = buf;' @) H2 H* y6 ]/ j! b8 L
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);% W) P3 V6 S  E0 L1 t
  36.         if (ret != 0) {- z- V$ H6 s* r: t/ V
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);6 z3 j9 [/ m# L6 q) [( C! i
  38.                 return -1;, ]! \: h: y( [4 D( q: i+ ?
  39.         }/ g" [8 U/ S) I) m2 Y
  40.         memcpy(mac, buf, 6);
    " N6 w7 w8 ], b
  41.         memcpy(stbid, &buf[6], 18);
      S" R& L3 M; ]  W% i5 O
  42.         stbid[18] = '\0';
    # \* p7 G/ U4 M( I- d5 U1 [& ^8 g- l
  43. / |, r+ q. `7 Y* B5 S
  44.         return 0;) P: H. z5 K4 D* V" S9 I, ?
  45. }- l. @3 ]- L3 o, Y
  46. & L: R! K. O. w, i; q
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    , A% S5 f( {3 z
  48. {
    ! w7 u. V+ r+ ^5 g  b; `
  49.         int fd, ret;7 s9 k* ?0 S+ v( E3 [" C5 _  j( D
  50.         e2prom_s_cmd arg;, t4 D7 \" C7 J+ x0 i
  51.         unsigned char buf[0x18];
    . ]5 S4 Z+ o' @' ]

  52. ( y4 U( Q7 p; k4 W- ^' h
  53.         memcpy(buf, mac, 6);
    0 M- }3 f8 C( m. d7 Z( f
  54.         memcpy(&buf[6], stbid, 18);
    # N. p& t: @! f& z$ T2 `: B
  55.         fd = open(E2PROM_DEVICE, O_RDWR);, Q' v) `6 g6 V" D# w! ~, p
  56.         if (fd  < 0) {5 s& b5 ^; b  M+ L. {* z
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    / u1 J: I: `8 B% a& f( @$ m1 _
  58.                 return -1;: ]- C/ E& N7 x
  59.         }
    9 N: \1 B+ I! C# O& s: B
  60.         arg.sub_addr_count      = 2;6 @6 O- `* D' W" S( K+ g
  61.         arg.data_count          = 0x18;" E& U  V- J0 z4 V
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    2 f/ [- l" E' a# I( Y
  63.         arg.e2prom_cmd_data     = buf;
    0 d6 ~- V' n: ^4 G2 h0 T
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);+ K/ X% Y+ A  |4 \% _& V
  65.         if (ret != 0) {
    ' |+ k; J, s6 V) {1 t
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    % |# R* V5 f7 i' a
  67.                 return -1;$ R. F3 M1 D! a1 d# \! B. O' f% {
  68.         }
    6 Z- N2 ~- @( X- u, ~

  69. ( V6 `$ _6 w/ g- z! Y
  70.         return 0;% e1 D4 J: N2 G% w1 C
  71. }
    ' O/ I0 \! H  \: f3 n0 p3 b
  72. 4 C  `1 B( c/ V5 d3 V. |. x
  73. int main()# T+ Y* \5 k! G( |+ k! Z
  74. {
    9 x% s  ]2 m8 C% A
  75.         char c;
    * k  [! o1 y  b: |8 B- a1 I: O
  76.         int i, macs[6];
    1 V) x6 [" o+ o# E. P: D
  77.         unsigned char mac[6];. l! N( ?: k' R& P8 B1 K7 Z
  78.         unsigned char stbid[256];
    9 @/ Z6 g  h0 o, X! r& P8 X

  79. 9 j) U: T) h3 a( n# p3 H3 E5 ?# P
  80.         if (readparam(mac, stbid) < 0)
    ' p# q0 q' Z3 M5 Y1 {, g
  81.                 return 1;& M& {3 n& T/ v# K( e8 D( t; M

  82. ! {% Y* f" k  y" q
  83.         printf("Current parameters: \n");$ U1 s/ P$ a) e7 }4 F5 f
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    8 s2 }9 D. M' v' l
  85.         printf("  STBID: %s\n", stbid);
    & |& m" U0 r( i: X
  86.        
    - U; R/ F; P# r+ v0 T- b8 F
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");$ X0 ^* I% W( Y8 P6 n
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {5 x0 O* @  T0 f" n( z2 {
  89.                 printf("Input MAC error\n");
      ?: Z" x% q8 D+ ~
  90.                 return 1;
    6 t# I; R: f& ~- `
  91.         }! M7 s& N" ^; W7 u9 i- U
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    6 H" m6 A& V& [) \2 ?8 e
  93.         printf("\nPlease input new STBID: ");
    ( w. @% w7 {- c4 R: g
  94.         scanf("%s", stbid);
    % Q( @! E- c$ q* M2 \" q
  95.         if (strlen(stbid) != 18) {
    8 z3 j1 r# F1 b/ e
  96.                 printf("Invalid stbid\n");
    * ~+ C3 I' o) A; ]; h$ Y% M
  97.                 return 1;/ E  [3 W/ z# c; j
  98.         }" G# S6 u$ ?8 B5 Q$ z8 n
  99.         printf("\nNew parameters: \n");
    & K- x0 m' \+ K* I& j: _
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    . k9 x" t  g4 P' r& |( g* ]
  101.         printf("  STBID: %s\n", stbid);
    $ y. N( d6 o3 q  q

  102. 1 y4 r/ o3 e# [! k" S& z
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    5 A- N$ ]) T; G( Y  ]
  104.         for (;;) {
      W( |# C) [3 T& W
  105.                 c = getchar();1 v: ]' i- I" F7 z: t% e/ r; j
  106.                 if (c == 'y' || c == 'Y')
    & x$ C( T7 f( f1 \. ?
  107.                         break;
    * Z# D2 S) K6 f& E* P
  108.                 if (c == 'n' || c == 'N') {7 Z* }; L) t; ]3 K) t6 _; Q
  109.                         printf("\nAborted.\n");
    5 B: r, }* t2 g" K3 S* s3 E5 Z
  110.                         return 1;; x( Y4 O/ d0 f2 a! i1 P
  111.                 }% R4 p5 W5 M9 ?. x9 n2 {' ?
  112.         }
    4 t3 P& O& x* v& s1 M6 M. o1 `
  113.         if (writeparam(mac, stbid) == 0) 4 L$ K) K8 w- @+ v
  114.                 printf("Parameters changed.\n");
    * ^2 _6 i% A# r! g8 E# y

  115. ) `' ^: Z/ e# V" @$ Q6 }
  116.         return 0;( y1 j$ h+ F' h3 U2 Q
  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
# `0 x" I# e; a' p  k. A7 |在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
; }6 T! |: v6 K- F* i
你用的编译命令行格式是什么?
, h- t9 @! ^& 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客服返回顶部