查看: 16296|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    . Z6 Q1 `: }+ O  l1 d% e2 b
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig; n. a* I, }9 I
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
' {4 ]1 Y! E( [. p8 Q9 Wusage: himr <address> <value>. sample: himr 0x80040000 0x09 h. F3 `8 F' ~% N0 v6 Y( K9 W" R- v/ \
! T* O8 q; z: y' }8 o; {1 p& ~

% \, e' A6 K9 o) c( B4 I不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
& R0 Q: r+ A' G) k* P+ A! _0 `- r3 Y
3 w/ y7 }# a% k补充内容 (2012-3-8 09:42):( I9 O9 x1 W. \" P8 L/ [
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
* x, s0 C' L9 Q8 z5 P) b4 S这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。3 ^5 M( c2 W5 B2 U( y

( H  U$ c/ X6 X1 u, h( Z. qhimr <address> <value>. sample: himr 0x80040000 0x0
) L, T1 a7 e5 b' E8 G. X8 t- s+ [* _9 `
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
* J1 r3 A' f8 U* ]himr 0x80040000 0x00; D3 \4 V, P" w3 o, s
himr 0x80040001 0x11. ^* a# E( n% [5 Z
himr 0x80040002 0x22
+ n4 t8 o3 z7 E) \himr 0x80040003 0x33( U3 Y8 P! j  y; w2 @2 M
himr 0x80040004 0x44
: `/ E  F1 N0 L: |8 Whimr 0x80040005 0x55/ Y$ D% T6 Z5 n

- K7 s; Y- E1 Q* ^* `  E5 SSN也是类似。- W6 y, a; o3 {! A- _$ A3 H

$ w) R* E9 X; ~; x现在主要是,谁告诉我们MAC和SN的地址?7 R8 H3 _; H! L) I- @) ]
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 8 M# S; m- D8 D+ @
一直想找到运程修改MAC和SN的办法,苦于无解啊
  t+ l+ I: v4 U2 @! z8 V3 ?
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 # p4 }: G) r$ P4 r& G  t
" q  K; p, {2 k: r; a$ }
修改的代码早有了。到今天不会编译。
) x/ `7 V3 c' D1 e6 H2 {2 P需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    8 F0 h" K6 \3 w' ?
  2. #include <malloc.h>
    5 e& c9 p& r7 o5 z" u# K
  3. #include <sys/types.h>
    / [. d- L9 w: b$ e0 x
  4. #include <sys/stat.h>% q. X  v/ _7 C
  5. #include <sys/ioctl.h>
    3 Z7 a% u: U" X% {1 w
  6. #include <stdio.h>$ c5 a& |1 u" V  Q
  7. #include <string.h>
    & p3 p& C9 r: z& D# V5 }
  8. * _2 z$ M* d% ~- q: q
  9. typedef struct {& O# C+ Z9 j/ j" A# G/ C/ `' ^, L3 T
  10.         unsigned int        e2prom_cmd_sub_addr;
    0 _# h2 T. q/ n! }
  11.         unsigned int        sub_addr_count;
    : I0 J4 k' l8 @# [2 l. p0 M' ?
  12.         unsigned char*        e2prom_cmd_data;( a3 Y; U* A% q3 r) V
  13.         unsigned int        data_count;
    ) ^* H" [" Z) k$ R! L
  14. } e2prom_s_cmd;+ I. ~) U- l% g
  15. 7 r$ u+ @5 K. e) b9 J
  16. #define E2PROM_CMD_READ 10 B: `: F6 l: n
  17. #define E2PROM_CMD_WRITE 2
    ( N1 D; W7 q* {" F
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    / j% b. l) O' A2 a$ {  g( w+ m

  19. # f) \. l' m4 j0 G0 R  B1 e* Y
  20. static int readparam(unsigned char *mac, unsigned char *stbid)+ c1 ^0 R7 i" a$ a
  21. {! o* o( _8 b6 U  T
  22.         int fd, ret;
    & ^! g4 {7 V$ j9 O$ {; |
  23.         e2prom_s_cmd arg;; M5 r0 ^- e. D. X) l: \* b1 f
  24.         unsigned char buf[0x18];
    / v/ A: N* w. N; j' P8 v/ B7 f

  25. ; R' G+ a1 u5 p- k( z0 a
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    : k7 q( Z1 n% n' X$ ^( _
  27.         if (fd  < 0) {5 c. f; [1 U6 v1 d: D) ~
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    $ R6 z9 ^/ e( m8 r' d4 V: T
  29.                 return -1;+ T" ~) d8 H" Q) M& p& n
  30.         }
    ( k$ X) K, X% i3 X
  31.         arg.sub_addr_count      = 2;5 G( A8 g" G& T! ?/ D. O$ J0 u9 I( A
  32.         arg.data_count          = 0x18;5 E! s; A" @* D( O# N  y
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    # a/ Z0 `1 [. _$ `
  34.         arg.e2prom_cmd_data     = buf;' T/ o7 o* R3 E2 _$ i4 R5 E4 b
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    . {; R, D% d" i
  36.         if (ret != 0) {
    - s1 d; y! H' T7 K
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);" O8 g" k9 i$ o$ }
  38.                 return -1;
    + s+ a: z1 M1 N3 s0 H) P+ E9 @
  39.         }
      ~+ U' C- [1 z
  40.         memcpy(mac, buf, 6);* ], O& q* ]# n$ Y4 A
  41.         memcpy(stbid, &buf[6], 18);
    / W* D2 Y, U% G! X
  42.         stbid[18] = '\0';6 ~$ ?, Z3 @) T2 K, G4 `
  43. $ Y: I" ?) s& Y, e0 C3 e( Y
  44.         return 0;  L# i' n4 @; \5 v/ B
  45. }
    $ q# S! V2 b6 F. h" {* @
  46. 4 H; h9 c) e; |. o& @) l, y
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    4 i/ S3 [0 k- G$ l4 t1 X* y
  48. {% T3 n- I4 r+ s' N, j
  49.         int fd, ret;# _2 g2 U# e7 L9 f1 b7 z, B* k& H
  50.         e2prom_s_cmd arg;% d. S7 C: b; a. V1 V
  51.         unsigned char buf[0x18];
    7 a0 W$ I; f( o/ @2 h

  52.   T) m8 F( h/ k: o
  53.         memcpy(buf, mac, 6);; t, q4 e/ ]# v# \
  54.         memcpy(&buf[6], stbid, 18);
    $ e" n" \, `0 ]. s; W! s
  55.         fd = open(E2PROM_DEVICE, O_RDWR);" E9 O2 S2 P& N
  56.         if (fd  < 0) {3 Q; c% d$ Y; k1 H+ g0 y
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);3 s1 p% R" x& f0 u- n
  58.                 return -1;" }. z4 w8 D, i  ~% {
  59.         }
    # A) M& F/ g: `1 A8 h
  60.         arg.sub_addr_count      = 2;9 m/ e5 c0 W, L7 L" Z1 W5 r$ l
  61.         arg.data_count          = 0x18;) V/ O; J. a9 P
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    6 Y- _: n  i' ^, c- `2 l. P' z
  63.         arg.e2prom_cmd_data     = buf;7 D) C4 ]6 V5 j( e# K# h4 R( s* }1 m* f
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);5 `8 q# w, L* V8 a  Z& s4 s
  65.         if (ret != 0) {
    3 v% i9 |% ?; ?' L0 f
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    " I6 f, J" T; a$ Y& l9 k9 E* X( ]
  67.                 return -1;  h5 D# Q" Q' i8 e
  68.         }; g$ R6 S& R/ C# E% j; I9 d

  69. # B5 F3 h# `7 {. t+ t7 Z
  70.         return 0;
    4 Z& j% a( J$ b: _6 ^
  71. }- p9 X1 X3 F9 F; z; [2 ^

  72. , Y8 a% K$ O) ~4 f% q
  73. int main()( _9 M7 D5 t1 A3 O. B9 }7 W; U
  74. {3 t! M! ?1 y* a
  75.         char c;
      t: D+ t" b, B
  76.         int i, macs[6];
    8 R- `$ ~( a# j/ ?. y
  77.         unsigned char mac[6];3 E3 f7 j6 K$ o4 r7 z1 `
  78.         unsigned char stbid[256];
    # X  @' }; x3 Z' l' q: v0 O

  79. 5 `2 j  s- n" l' j
  80.         if (readparam(mac, stbid) < 0)4 W7 j2 k! O* `0 v" O$ M' f
  81.                 return 1;
    6 i& {! i  a$ T- H" l
  82. 5 q; p, V, v2 R  U
  83.         printf("Current parameters: \n");6 y# R) t5 u9 P' s2 K
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);# a& f  R3 s6 S: k  U
  85.         printf("  STBID: %s\n", stbid);
    % \9 V8 w8 j& l$ b" _9 p8 q% g
  86.        
    / V% G9 N' a  X0 k
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    2 g% x, ]0 ]2 u0 A5 H% m
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {2 V$ t* G0 `$ h+ y
  89.                 printf("Input MAC error\n");" O+ {3 @9 ]" p; d7 ]. y
  90.                 return 1;
    5 b+ ^6 I3 _7 ]3 H/ J$ a
  91.         }5 ~, i" s- ^# p, H2 E0 ^
  92.         for (i=0; i<6; i++)mac[i] = macs[i];3 Y& l/ g0 H0 J/ t
  93.         printf("\nPlease input new STBID: ");# ?  x. ^9 z: B7 v/ p" d
  94.         scanf("%s", stbid);
    & V. S# Q1 d$ d. t" h
  95.         if (strlen(stbid) != 18) {5 p) W% ]: q' }  E0 L% r% i
  96.                 printf("Invalid stbid\n");
    1 x0 ~1 W9 {* L
  97.                 return 1;8 s! b; _7 ^% c3 p; g- M/ L. T
  98.         }
    : O7 D0 W6 k8 }! g8 X# _
  99.         printf("\nNew parameters: \n");
    , P& L6 N* x2 M4 D5 f
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);* K# k4 h2 p: Z+ B. y+ `4 a
  101.         printf("  STBID: %s\n", stbid);% c7 ]3 A+ E$ X, C/ g+ I% I
  102. % ?, p% v% m: x0 {; P* g7 T' x6 e
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    - {2 ~/ I$ q& |( E1 o. W  y+ l
  104.         for (;;) {
    / l' W( J5 F- F# o7 V
  105.                 c = getchar();- R2 y% s, b8 b# d; e$ d) v
  106.                 if (c == 'y' || c == 'Y')2 B, E. s; K7 K" Q
  107.                         break;4 p8 c0 u# n' p. n% y1 U9 I
  108.                 if (c == 'n' || c == 'N') {! [3 [, A- r5 _2 K- \$ M
  109.                         printf("\nAborted.\n");. G! D4 [0 k  Y( |2 H% J& K: o  J. }
  110.                         return 1;% k: J* R0 D& W  n) s. e
  111.                 }2 F2 P9 c0 y9 |4 m
  112.         }, Z4 x/ J' c7 _) T# Y. I# G
  113.         if (writeparam(mac, stbid) == 0)
    ! l5 z1 j: _4 g7 z6 {# `
  114.                 printf("Parameters changed.\n");+ J% ~5 M/ e" ^) k
  115. 2 O/ f/ D7 B  E/ L, t
  116.         return 0;
    1 D4 m7 @4 @, d" R
  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
: G; n  W! v% g) q% v- b, f; f% j在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
; W7 {# O  G8 V& p5 i+ `
你用的编译命令行格式是什么?
: V0 K! _3 r1 E# ^$ q) e3 Y
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

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