查看: 16715|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    $ j7 J( q5 n( z+ Y6 V& X+ Z* q
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    ' h3 V+ B" {) k
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:8 O% Z& ^0 ]- @" Z9 q+ p' _
usage: himr <address> <value>. sample: himr 0x80040000 0x0
9 l- w2 Q  ~  z3 K. M: k9 K. c8 U" A7 V8 `5 \& F
" g2 O+ }9 B* V2 n; [
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
+ y$ c1 B$ w: q6 `; m- `' L% T- P
6 Y9 O- [, p5 N; |1 Z" h7 P$ z补充内容 (2012-3-8 09:42):
: L: C. q) A3 j# ?$ Fhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
8 Z8 R6 r7 c0 g( y  N这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。5 y+ f. D# r& x) K! r4 r5 x- E' F. s" C
, p! O3 y9 s, Y6 t# ~. u$ G  d
himr <address> <value>. sample: himr 0x80040000 0x0
. u: t1 [/ g3 L: t' W- o
& W- k: P. o4 e0 N0 }: ^5 J+ U0 H例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
# L: e% Q% U! ]: a# h% L; ehimr 0x80040000 0x00
: E% H2 i0 ?7 zhimr 0x80040001 0x11
- G9 j7 j0 V; |1 e  m# W' g' Mhimr 0x80040002 0x22
. }. B  X0 S5 T7 |himr 0x80040003 0x333 i7 Z0 W$ t' \( ]$ o, {$ w
himr 0x80040004 0x44
& @" }7 w4 S0 O6 ]himr 0x80040005 0x55
5 D& ?; |6 u. P( _; b$ R( ^% [
/ _# C( I  G; V1 J3 H$ d8 KSN也是类似。7 c+ j) b, A! T
. w' y% x# p" n! S
现在主要是,谁告诉我们MAC和SN的地址?5 D% a- T) r* w, U
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
1 z: L2 ]/ D- O% s. M) w( l. b8 ^5 l8 }一直想找到运程修改MAC和SN的办法,苦于无解啊

& G0 h% c% u( m1 h3 A  G- e源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 , H# u8 `) X% J4 o' m; l% V

" R1 x1 S& \4 y/ m8 A修改的代码早有了。到今天不会编译。
( t  I+ Y: T9 n: x5 U0 |需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>8 O' P5 T" ~5 {( F* [" h6 {
  2. #include <malloc.h>
    ) x' D+ t0 d3 Z5 ]( z
  3. #include <sys/types.h>( A7 q9 Z7 R+ i' K& P8 l% T
  4. #include <sys/stat.h>
    5 D" M9 M! A* r0 }
  5. #include <sys/ioctl.h>+ @8 |" {/ Y3 [
  6. #include <stdio.h>+ K' w+ N  Y' S& H
  7. #include <string.h>
    4 ^. m) `+ G; g8 s5 {& n" C  Z& a

  8. 1 T% ~5 [8 |# @5 H. t  ^
  9. typedef struct {; {& J! V5 b: O; a9 \
  10.         unsigned int        e2prom_cmd_sub_addr;) [  L# W6 M7 p
  11.         unsigned int        sub_addr_count;6 @3 g  ^* y% D  I3 i" \: q' n
  12.         unsigned char*        e2prom_cmd_data;, D6 x5 r8 R* |5 D# [2 }  m
  13.         unsigned int        data_count;9 b% Y8 j. \# S* Z) Q  V8 v7 J! ^
  14. } e2prom_s_cmd;
    7 u' y/ r) P% X

  15. $ O" m. S. w- A) V! `* W
  16. #define E2PROM_CMD_READ 1
    5 D: z$ d, l" ^1 g  z" ~( g
  17. #define E2PROM_CMD_WRITE 2' m2 k$ Z( D9 @8 r
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"0 \# ^( Z) F0 b; ]+ [4 M  n$ Y
  19. 1 N7 ?, |' |! o  j: X
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    " P& F6 _* {8 i& u
  21. {
    $ ^: S1 b7 q1 ^3 c$ H( v
  22.         int fd, ret;; @- V4 O* r0 X: y/ o' u" W
  23.         e2prom_s_cmd arg;
    1 Y( t5 I! c) u3 b$ I
  24.         unsigned char buf[0x18];
    # R( W3 _- B6 |; M) W$ U

  25. + I2 M; c" V+ ?* R
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    ; G0 }3 A" ?2 k
  27.         if (fd  < 0) {$ u5 O' S+ n, p3 ], v2 M! s6 r
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);! L+ |" [0 a+ H* S3 ?* o
  29.                 return -1;- m4 Z' F7 \% E' _4 u5 X+ F
  30.         }
    # L5 V4 R) o0 b& Y; E; {: {9 @
  31.         arg.sub_addr_count      = 2;
    2 k8 `5 ~- G% U  i# I
  32.         arg.data_count          = 0x18;/ y- G8 l( ]2 Y
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    ) f' o. s5 E$ S8 z' _: g3 X
  34.         arg.e2prom_cmd_data     = buf;
    * [' B. u6 p6 P4 ^! k
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    " e3 w" _+ @7 }$ l
  36.         if (ret != 0) {# U9 B+ Q' \! _3 {. W7 l# f
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);% y& j8 {, G  |. f: }1 P
  38.                 return -1;
    - b: L* C2 s6 e: j3 I
  39.         }
    4 v: k' ]& Z6 r1 W
  40.         memcpy(mac, buf, 6);
    % ~$ N' s& [& q( A% `% t3 Y
  41.         memcpy(stbid, &buf[6], 18);
    8 O2 M/ c+ e! b3 s. U7 d
  42.         stbid[18] = '\0';5 p9 N% U+ a" Y: G+ {2 e4 a
  43. . I/ r  q: q- @7 n% p  Y5 x
  44.         return 0;& y$ A5 Q' f/ u' k  U
  45. }$ V% |# t  d8 f% t
  46. 9 d# P! k. u, w0 {7 o
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    & U2 J- `+ w" R5 I
  48. {
    % t. h$ g' ~9 U$ j
  49.         int fd, ret;; b; p2 k0 J" P5 E9 Y
  50.         e2prom_s_cmd arg;
    3 ]7 [2 ?  ^1 W# \
  51.         unsigned char buf[0x18];
    " l3 d2 _" {6 a* q: Y% \. e8 X
  52. % s1 m: r3 i: \$ ^& K' U
  53.         memcpy(buf, mac, 6);
    5 U0 X$ v, {0 J7 S
  54.         memcpy(&buf[6], stbid, 18);
    - }" \( a$ A8 B$ f4 e/ Q, j  T( f" i
  55.         fd = open(E2PROM_DEVICE, O_RDWR);" |" t: R4 z+ a9 b
  56.         if (fd  < 0) {* O; R3 g' A- P
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    , ?& c  I0 ?2 N& M9 [
  58.                 return -1;1 O: l( b+ s# W
  59.         }
    : u( R1 F! r# y% ]
  60.         arg.sub_addr_count      = 2;, k. h- I* {8 x8 M
  61.         arg.data_count          = 0x18;
    ; J+ t# D- [& \8 J) j+ `) `; Z7 n+ d# h
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    8 Y8 M3 Q& t  Z1 B: p) M4 K- {6 p
  63.         arg.e2prom_cmd_data     = buf;
    6 O6 z, [. ?5 O  b9 X
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);! J  t8 K% }: c, L& ~$ \2 ^- a
  65.         if (ret != 0) {
    * M6 ]- C7 {$ `3 l6 h
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    2 r: u) M- D* Y$ `
  67.                 return -1;
      F" @% t8 u9 V/ U0 X
  68.         }
    + `7 S0 d7 A8 M7 G& |* x
  69. $ R2 G, O2 z+ W
  70.         return 0;
    ( {' G, _/ I6 z7 f9 ?! T% q, B, [
  71. }
    " ?) s0 Z+ Z' v: z+ x

  72. " z$ R; C* |5 F: l% S8 F  _* @9 q2 o
  73. int main()- h5 L0 c$ x; x/ K- C( y
  74. {% e4 A0 \! h; w" @! K" o, e
  75.         char c;
    , O$ ]: `! }: k8 K! u+ B3 e# h3 J
  76.         int i, macs[6];
    4 _$ j! w$ p# {3 s: y
  77.         unsigned char mac[6];, c# r! o3 h& B$ b& V; R
  78.         unsigned char stbid[256];" l1 l8 U% @, V' H7 U. s
  79. 9 X; ~8 g- a, k; @! @* J( q
  80.         if (readparam(mac, stbid) < 0)
    6 q- k+ L; x6 T# Y
  81.                 return 1;; `9 A3 t: }- W2 l
  82. $ ^! r! B$ ]% i& o5 t9 o
  83.         printf("Current parameters: \n");9 h& {/ Z, D3 I+ _
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);& A" F3 A6 n4 s3 |3 ?# p2 L
  85.         printf("  STBID: %s\n", stbid);
    9 x7 z8 a0 G- ^: Z$ N5 M
  86.        
    / X. M. J# H3 C  Q
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");4 s: d, m) `# }% L% I& @& O
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {2 {& N% C3 W- W9 A& |
  89.                 printf("Input MAC error\n");; d6 `1 Q2 W" ^  _6 P# s
  90.                 return 1;9 U' f8 K8 F  P" d
  91.         }
    ( M  R' p% M2 J7 J: b7 B2 t- N
  92.         for (i=0; i<6; i++)mac[i] = macs[i];" K9 s9 m9 h# ~" I; L6 j
  93.         printf("\nPlease input new STBID: ");
    4 X- y/ G; q% u8 X0 Y2 u
  94.         scanf("%s", stbid);
    & l3 \5 F1 w& a7 Q; X3 i0 G
  95.         if (strlen(stbid) != 18) {* l5 a+ E! V9 F; ~' _5 l1 B
  96.                 printf("Invalid stbid\n");
    ( y& @( J4 p1 Q- b  D: a
  97.                 return 1;0 r- e# S7 G2 J
  98.         }
    1 @' x- \( j6 s. L& |
  99.         printf("\nNew parameters: \n");
    + H! @. G$ m4 _+ ~( s2 k
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    , W8 [3 z6 ^/ s9 A
  101.         printf("  STBID: %s\n", stbid);
    5 M9 o7 _6 ?/ U7 q5 d. k

  102. 6 l# Q; d8 T/ O
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    / w. s0 M/ t2 y; t% K' O2 g
  104.         for (;;) {& W' T' D' s4 j+ {1 K* u3 L) T
  105.                 c = getchar();" }7 D2 ]% w/ n* {) C6 n
  106.                 if (c == 'y' || c == 'Y')
    & k6 h. ^. @+ d* @9 o" \+ @
  107.                         break;( a" J) j+ h% v- D
  108.                 if (c == 'n' || c == 'N') {
    # w6 b& s1 f( H: s$ h
  109.                         printf("\nAborted.\n");
    5 ?* T- @& _+ X- U2 l* x
  110.                         return 1;% B4 W9 Q1 l4 T
  111.                 }
    6 O: N. C. _6 e
  112.         }7 f0 C( r/ k& r5 `: V' W
  113.         if (writeparam(mac, stbid) == 0) 6 ~$ F* q  L8 a
  114.                 printf("Parameters changed.\n");( u. \- ]( v" u
  115. + g: f  @/ S* |! M
  116.         return 0;3 |' e" ?$ v. t" 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
& l8 O. P& K* P在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
6 M1 A7 j6 x8 s
你用的编译命令行格式是什么?
, f9 B2 l/ k$ @& E; z8 q
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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