找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15106|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    ; h2 `8 @. v7 @8 G3 a4 V0 r  i
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig8 j1 g7 N# X: i. q2 c" r
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
4 {. u+ p9 k, c0 G( c) t1 Pusage: himr <address> <value>. sample: himr 0x80040000 0x0
2 z- p# D. W6 u  \, i  O+ ~$ f! b' c- R# A- A; W! W- ]6 N

0 ~( |  H. H* Y7 F+ ?8 S/ r不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?4 R* x0 g, |- _# S$ Q

$ l! V4 _6 D  }. Q补充内容 (2012-3-8 09:42):
7 G5 L- V! R$ p6 a( chttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数( _. c7 H/ Z8 P2 l0 ]
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
8 m6 V0 E. y& F$ s) v( |9 s7 V  C, P/ i
3 n' T/ B4 x+ P) w( X; \himr <address> <value>. sample: himr 0x80040000 0x0
" U; E9 Y5 f' d. L+ _4 Q5 h8 G- _4 w5 V; s, ~
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。8 p5 T7 n8 n4 U
himr 0x80040000 0x002 W; p  M# x+ D6 j
himr 0x80040001 0x11
6 \1 D1 S0 ~- p+ k/ a! U9 Q" shimr 0x80040002 0x22$ Q5 G. J0 @3 T) Z6 k: K2 y
himr 0x80040003 0x33
( L, k- z" l, shimr 0x80040004 0x44
7 n- i7 m, X: T+ g1 V% whimr 0x80040005 0x55
- q" `8 v' H4 M% `; _! c/ {7 H5 L% B
# b; x$ R: R9 USN也是类似。
% l6 a- B3 ^* l9 |# W2 u5 D9 K) x! s" `6 j8 V
现在主要是,谁告诉我们MAC和SN的地址?
. B6 z$ n; h# t5 F0 h* Q; Z
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 - D$ A" p6 K, q" |8 P8 h9 `
一直想找到运程修改MAC和SN的办法,苦于无解啊

$ v  I7 |" N; B3 y. n; L. V+ D源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
( O8 m2 |9 D7 C: i1 |: g- s2 l: s. m3 K$ t+ B; Q( ~
修改的代码早有了。到今天不会编译。7 @1 v& H+ q# O. F+ b* H. v+ e5 ~
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>& p/ G6 R3 @8 y8 l4 w% s
  2. #include <malloc.h>, d# p8 R' f! k* j
  3. #include <sys/types.h>1 z, @4 ~& \. [% [6 L/ q' R, X
  4. #include <sys/stat.h>+ m# {5 t4 l5 O% F
  5. #include <sys/ioctl.h>
    # u& Z) Y7 e1 b) c- y& j1 h
  6. #include <stdio.h>
    ( e8 `4 F) ?  ~
  7. #include <string.h>
    1 L4 ?5 @: J' I7 N- V* l- @7 @

  8. ; Z2 }8 _  z: Q9 z' |3 d# w
  9. typedef struct {9 L3 ^) l* Y7 b/ o
  10.         unsigned int        e2prom_cmd_sub_addr;+ x" P5 \: i( r* m; }0 {$ }, F
  11.         unsigned int        sub_addr_count;
    " K: n( C+ U3 Y! [
  12.         unsigned char*        e2prom_cmd_data;, m  m, m$ W- ^6 v
  13.         unsigned int        data_count;4 z- N+ j' a* M* l& f8 D5 m7 W
  14. } e2prom_s_cmd;  W' t' L3 N0 D# K& p* |2 \* }
  15. 3 j3 ?/ X& O. z5 e, D
  16. #define E2PROM_CMD_READ 1" b5 s$ ^, l$ Z1 ]% |) r
  17. #define E2PROM_CMD_WRITE 2* _) I9 a( ?& h6 q% Q. _6 o( j
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    : a) c. H% ~- l# m+ V
  19. 0 t0 U6 P, ^, `. l+ y
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    3 D' U! ^8 V. n& G5 G
  21. {# i7 F  _9 q1 u* t6 R; y: b5 V
  22.         int fd, ret;* @5 g" J& h: P" N" v
  23.         e2prom_s_cmd arg;! m7 Y( h0 C" _, u! i. ~
  24.         unsigned char buf[0x18];- Q" s( q( O, G) ~4 c
  25. 1 Z9 x+ _# n7 A
  26.         fd = open(E2PROM_DEVICE, O_RDWR);- y! q, j( s1 R
  27.         if (fd  < 0) {: o. Q" k* L% ~1 K6 i
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);* k: a& |: q; Z. B
  29.                 return -1;6 @  y  O1 F# ]& \
  30.         }
    , w' [+ l% D- A, @1 I7 {. ~
  31.         arg.sub_addr_count      = 2;7 o. k" V1 l# R; k8 M1 [: K+ H% M
  32.         arg.data_count          = 0x18;
    : f3 a. L/ Z9 G( `4 ]
  33.         arg.e2prom_cmd_sub_addr = 0x290;2 o( M0 ?5 {- i% f0 J
  34.         arg.e2prom_cmd_data     = buf;
    : b' O  v3 f0 C* W& ?& p! Y! Q% I
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    ! T& S# U; c. o2 g9 [" z1 r
  36.         if (ret != 0) {* U8 J+ d4 y/ i+ h" t- \
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    ' l3 u: q- U; F/ H- F9 F
  38.                 return -1;
    * |  G4 S2 ~# @0 g
  39.         }, }9 V; f' F4 _4 S0 _" b
  40.         memcpy(mac, buf, 6);7 r# x( U3 h: k. Z
  41.         memcpy(stbid, &buf[6], 18);) E8 y% F+ X: C
  42.         stbid[18] = '\0';. a9 ]; b, P7 m9 e* f8 p2 G; R
  43. & R5 g) g; G- ^: g0 H
  44.         return 0;
    7 H# ]- }! N! k3 y! `
  45. }1 [. ]- u( ]# X' @4 l" M! X: E
  46. ( q' ]0 F. V5 ~4 {* F5 K% x
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    + e* \3 Y5 b9 [- r) |0 K2 W
  48. {
    5 Q; ~" [' o, I8 s
  49.         int fd, ret;
    8 K+ [4 s; o/ v' V
  50.         e2prom_s_cmd arg;
    4 d5 \2 l, m( V" e0 I
  51.         unsigned char buf[0x18];
    1 X# Q0 ]# o+ o" Q1 H
  52. 2 L5 a. h8 j$ e6 H( Y* t1 f6 g
  53.         memcpy(buf, mac, 6);3 W+ p3 l; _  I
  54.         memcpy(&buf[6], stbid, 18);2 B& u! ]$ a% T
  55.         fd = open(E2PROM_DEVICE, O_RDWR);) b3 y8 G$ i, D! x' y- \
  56.         if (fd  < 0) {
    & J% [  J# ?; C5 k( G- k
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    7 @# Y  P! X! N7 q$ G: ?* P
  58.                 return -1;
    + f* s5 p  o# P& X' X6 a
  59.         }
    " C% h7 J0 [) H! `
  60.         arg.sub_addr_count      = 2;, a* n3 X0 M5 N4 C; U
  61.         arg.data_count          = 0x18;
    1 [- u/ }% v6 \8 y
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    7 x3 H! m6 ^1 c7 M
  63.         arg.e2prom_cmd_data     = buf;9 S" x% @  I, F$ M0 A: X
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    1 D+ ^- l+ V+ Y+ I
  65.         if (ret != 0) {0 q: G3 L3 L, v$ \2 B
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    * P; C" r2 m; P3 U% y- c
  67.                 return -1;
    3 T* u$ u$ K: c% J' [9 T  t
  68.         }
    0 {) C9 I  K% `: V/ {5 z
  69. ' v( k! i4 p. u
  70.         return 0;  D5 J: y, E1 N. d& Q0 R
  71. }* i9 j0 n& d2 T9 L+ T

  72. & t/ z( Y6 A9 f6 P6 F3 J7 f
  73. int main(). k; c2 p6 E; X) s7 N6 y
  74. {
    1 Q7 P4 X/ D6 s5 u5 z8 M
  75.         char c;
    . w; I: h% _/ R3 F' L( a
  76.         int i, macs[6];4 d) Y9 j" m6 `" f1 M  x- Q
  77.         unsigned char mac[6];
    ; b3 w% W" L3 x/ e4 T! {: x
  78.         unsigned char stbid[256];# V9 }+ _) K% `- W1 h

  79. $ I. H* n' m1 A( {) ]
  80.         if (readparam(mac, stbid) < 0)
    + [! E, j1 k3 V* L5 w
  81.                 return 1;
    4 g. ^# y+ _4 p! B1 p) r  q
  82. + i. J  u1 `& o+ f' P, _: m# R3 }6 g
  83.         printf("Current parameters: \n");
      j+ U6 }; c0 _* j# X7 A
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    % A: w7 Y: ?5 W$ L/ v
  85.         printf("  STBID: %s\n", stbid);
    ' q6 t  ~/ \% q, x7 ?* V
  86.         / G! S' M" F7 Z; z
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    ) x& v) ?3 v) [% H) G" U
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    & {) x7 i+ I9 e! w7 u: u
  89.                 printf("Input MAC error\n");* e: P' c" m) S/ |2 w
  90.                 return 1;
    6 @9 `! n1 P" j
  91.         }
    ( W5 T; p6 ~  z4 \! g$ u( Q
  92.         for (i=0; i<6; i++)mac[i] = macs[i];% X: |" O4 z  w5 f2 T
  93.         printf("\nPlease input new STBID: ");* h6 {$ h& g6 J" h, q' a# R* v* X
  94.         scanf("%s", stbid);
    . Q8 J, b5 ^) X
  95.         if (strlen(stbid) != 18) {
    9 A* F5 k" V$ f' H: g
  96.                 printf("Invalid stbid\n");6 d  F' |; \. d2 x9 s1 L
  97.                 return 1;8 ~# x/ t; H- U2 x9 p4 o
  98.         }3 g( t7 {) m1 V: l: w. x8 I, r
  99.         printf("\nNew parameters: \n");2 j& q! {# z; z: H
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);" T4 M! f+ _; l! S" i
  101.         printf("  STBID: %s\n", stbid);
      K1 x9 A% h  r6 G
  102. 1 W! G1 |- q8 g; M  ]
  103.         printf("\nDo you want to change paramemters? (y/N) ");1 v7 ^' t  K/ h' E5 `/ i+ W
  104.         for (;;) {
    + E: L. G! A5 Z" ^9 e( e: y
  105.                 c = getchar();8 J4 t; |9 S  q' [% g8 u" X
  106.                 if (c == 'y' || c == 'Y')
    ! x) P8 |$ z! b# k3 d
  107.                         break;
    9 D1 W; f8 ?8 P
  108.                 if (c == 'n' || c == 'N') {# ]9 F( a2 }" i8 i& o5 _
  109.                         printf("\nAborted.\n");7 k1 |, m2 Q6 p( U
  110.                         return 1;1 d0 \" M& c+ I3 d: K
  111.                 }
    7 u  Z  C5 }0 Y9 r
  112.         }$ X8 p: G4 M) t
  113.         if (writeparam(mac, stbid) == 0) & p, g* E5 X3 F& u6 o) S7 o
  114.                 printf("Parameters changed.\n");
    8 W5 L0 ^' u) x* y; u2 _5 Z

  115. 1 k( H" [1 I7 ~" R" J+ f. M
  116.         return 0;
    3 _3 Z+ j' l3 T" B! {
  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 h; h/ c2 d6 J: t8 o在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

2 V  u' n9 g' S+ @你用的编译命令行格式是什么?
. ^& M* y  P! ~! L. `
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|小黑屋|宽带技术网 |网站地图 粤公网安备44152102000001号

GMT+8, 2025-12-22 04:04 , Processed in 0.032587 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表