找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15698|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr  P+ Z( q( _3 N) w* O$ b1 L2 \
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    & m& I# ]  [/ f) v% {
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
) d/ A+ g7 f# O$ uusage: himr <address> <value>. sample: himr 0x80040000 0x0
. {4 c, Z" Q9 v0 G
, m% G  b) b/ w2 C9 G% a
8 k" K6 @3 j4 P+ k( d6 D) s不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?/ J- L0 s: b( s& t* \4 g

* P8 U5 j$ h2 g; X4 M, I1 Z6 L% d补充内容 (2012-3-8 09:42):: H6 Y, T' a! @" f$ E3 W
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
2 g9 f( m- C" \1 u这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。: ^5 n- h$ \, V

& ]0 ]* E. P' R8 ~# a* Yhimr <address> <value>. sample: himr 0x80040000 0x0, j3 b! n: N# T: i' N
$ E/ L9 O; P& I1 o( [0 Y% V
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。: O) j' q3 O6 `. C  W* f) @
himr 0x80040000 0x00
9 g3 i- ~3 O3 m9 O# O/ q. shimr 0x80040001 0x11& S. S: B7 z9 \
himr 0x80040002 0x22+ m* C0 Y  \& o9 V# [" a
himr 0x80040003 0x339 t! d0 T( ^7 W- k
himr 0x80040004 0x44
* ?1 w, v2 ?% B5 P9 H9 F, U1 Xhimr 0x80040005 0x55
9 s& |# x: |' R7 Q9 X% |& i: z0 c  T3 d; E- r3 x% x3 ^
SN也是类似。8 k3 m' Z" }& J% L, Q
: o% z/ @- N- t1 M; r2 v
现在主要是,谁告诉我们MAC和SN的地址?5 n$ f+ W" B" F* E8 ~, N0 T
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37   g' W$ [1 k9 K% m4 ]
一直想找到运程修改MAC和SN的办法,苦于无解啊
# q3 u7 g% W- P, Q) ?' X- ^
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 % p9 }7 x' C& j7 n3 o

$ m5 I8 b" ]; t# B9 Z0 a' a修改的代码早有了。到今天不会编译。( N8 n' b8 c; N2 g0 C
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    + j, I( b! a7 v0 t4 H! E
  2. #include <malloc.h>
      S5 ^4 X  ?- P4 y
  3. #include <sys/types.h>* r: o( [% `" M4 ^* q
  4. #include <sys/stat.h>
    7 t9 t* d! M- R
  5. #include <sys/ioctl.h>
    6 M/ t- b. f3 X3 ~
  6. #include <stdio.h>
    & D3 [0 \2 d6 F  j6 r/ @9 n% ^/ e% E
  7. #include <string.h>
    6 |2 D1 l; a! v( s- Z, L; u
  8. 0 L+ p& ?, x" W  S1 y" Q  ?; X
  9. typedef struct {+ c+ z: {  x/ ~, e8 I- p
  10.         unsigned int        e2prom_cmd_sub_addr;
    * K# `, k8 ], ^+ V
  11.         unsigned int        sub_addr_count;; {& W1 `2 S6 F8 g
  12.         unsigned char*        e2prom_cmd_data;, J4 a9 l! I: m$ T  |) G" H: ?- w
  13.         unsigned int        data_count;  O8 [: h' N& V" j! _% W4 ^- T
  14. } e2prom_s_cmd;
    : l4 `( t1 r$ Z+ ?, C2 n8 W  x
  15. 8 a, O6 G2 g; \( N0 d. [2 @9 b- K
  16. #define E2PROM_CMD_READ 1* [0 I1 \$ y# Z2 x" A/ I
  17. #define E2PROM_CMD_WRITE 29 q0 q% A. V" q% I3 e/ B
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    " b2 J. \& ~1 {- |

  19. , ^7 g5 n7 L* D7 h+ z
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    , `, s# Y; k6 Q  v0 f" y' `
  21. {
    1 i- e9 a0 F+ `+ g
  22.         int fd, ret;' G" J& E  U8 O/ Z5 T3 T+ i
  23.         e2prom_s_cmd arg;6 g9 A* o: R  b$ q' o2 b+ k
  24.         unsigned char buf[0x18];
    ( x. }! G' K+ L0 h; }
  25. / G: ~( `$ q6 w; t4 g
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    " p9 u+ G! N' [: M7 {
  27.         if (fd  < 0) {3 ~" C4 o8 j' i4 B2 i' a, S
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);1 S( E4 B% ?8 `8 }
  29.                 return -1;
    4 ]# C4 a+ J' u; F
  30.         }/ r; D& ?) ^% E9 z9 B
  31.         arg.sub_addr_count      = 2;
    $ s' O9 A4 d! i  n, v# F9 Y* g
  32.         arg.data_count          = 0x18;6 B: U# M6 ~1 {# k
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    ; d) a8 i5 C+ v! ^
  34.         arg.e2prom_cmd_data     = buf;
    8 U) G2 j5 m7 {& @# m
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);- ^. v5 x! ~$ b" l5 a' I4 J
  36.         if (ret != 0) {
    5 ]# F  Z% X# s# D" T* g
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);! P( V: n6 b8 `1 b0 B( e+ |: H; c
  38.                 return -1;* a0 q/ D- T' K# M& G% [  Y$ J1 J
  39.         }" P+ R) b0 }0 K2 A: n1 N$ h: N7 h. }
  40.         memcpy(mac, buf, 6);2 p* U" y. y& p8 |7 [/ J/ Y
  41.         memcpy(stbid, &buf[6], 18);
    * F$ T$ `9 n7 @; z) i
  42.         stbid[18] = '\0';+ X: a5 K$ d& x' k
  43. 8 V# G# h2 V: ?5 W" I8 i1 g
  44.         return 0;) T! Q5 B# y, o- r
  45. }8 \6 }) ]; r$ H

  46. % R1 y  r/ d  Y# A
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    $ \3 B7 F1 S- ?  M8 @! j. m
  48. {
    ! ?+ F. z' V$ Y) l+ C" `
  49.         int fd, ret;
      q7 a2 y6 r; U" a1 R: \
  50.         e2prom_s_cmd arg;
    9 \. q8 D7 \4 s3 \6 o: T
  51.         unsigned char buf[0x18];$ ]" P7 [. z5 ~5 q( x- D, A1 S
  52. 5 D# H- j7 x9 T3 L$ t. i
  53.         memcpy(buf, mac, 6);* F0 _: M; F, ]( |5 k) ^6 M' U% s
  54.         memcpy(&buf[6], stbid, 18);/ U; f# T5 _8 F( L$ h, D
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
      \4 K# x0 R- n* Z$ e7 H
  56.         if (fd  < 0) {
    , N) \$ r& b' l( L9 x. W- y
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    / \- U  o* j0 [7 a0 ]+ R4 m3 f; h
  58.                 return -1;
    3 C! f. X% _. s+ v- t. S
  59.         }- ]! ~: b8 Q, c. z! i+ Z9 W
  60.         arg.sub_addr_count      = 2;
    3 C3 x! M% }; I8 I0 z
  61.         arg.data_count          = 0x18;% p7 ^( M, W: v. N
  62.         arg.e2prom_cmd_sub_addr = 0x290;6 C! V* C) c2 `6 y6 t
  63.         arg.e2prom_cmd_data     = buf;
    " I+ c; _# m  n9 O3 S" _# W
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    + m" Y# k( j2 c: }7 v. W  P- H3 a
  65.         if (ret != 0) {+ Z0 e5 X( t# ^( ~) R6 G4 q
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);+ v9 r. C5 c% P9 g3 g( N4 R: |
  67.                 return -1;9 f9 X: N+ Y* {* ~+ K" @3 @! q
  68.         }  R' _% s% W9 s+ c- a: |
  69. 5 A2 D# W# ~1 g, s2 ^6 I0 \
  70.         return 0;/ a9 ]( f* x$ F3 h& T0 k  Y* ^1 s; ^
  71. }& x5 M4 ~' @7 _6 i' {4 ]- H3 x

  72. 0 {% i' f6 o3 w. P
  73. int main()
    & z% H# s7 b5 R' _5 P
  74. {
    ' ?3 J* |% n4 }2 ]
  75.         char c;, I  Y1 v  A2 [4 R/ M
  76.         int i, macs[6];
      T7 G" m) X  ~  e) @6 @6 a. q
  77.         unsigned char mac[6];
    ! m( I% {; \1 E1 H' U+ C* x( ?
  78.         unsigned char stbid[256];4 z" a2 l4 j  A! g/ ]
  79. 6 @  m2 L) l0 L1 `9 N
  80.         if (readparam(mac, stbid) < 0)
      R: e/ B6 \, [% @5 Z: [6 Y
  81.                 return 1;! b1 B" }6 A, V5 {! S' `
  82. : `( m- n0 _+ k  @/ K) f) |
  83.         printf("Current parameters: \n");
    - D& X" r$ k- \- j" S+ }  n/ t3 D0 S
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
      H3 e: T$ z6 w6 O
  85.         printf("  STBID: %s\n", stbid);
    " I' _5 D) B1 |
  86.         * D  b' H  R$ L$ s; K' D. p
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    ' a4 [, S( {) I+ X& R, G- k* P
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {/ w6 J9 g# x9 y* B- @2 o, ]
  89.                 printf("Input MAC error\n");' s8 j/ E5 y+ _( v7 |. g0 h, t
  90.                 return 1;
    ( }; j  a. [* c9 Q" n
  91.         }* y- P, i% L; C/ E; I; L
  92.         for (i=0; i<6; i++)mac[i] = macs[i];( m' C& r& ]! ?- J
  93.         printf("\nPlease input new STBID: ");, v$ a% e& k- e6 c1 [7 z/ z
  94.         scanf("%s", stbid);
    ) b) A8 L- {1 _/ i- E
  95.         if (strlen(stbid) != 18) {+ B4 ?# A9 _  b; {
  96.                 printf("Invalid stbid\n");
    1 A+ X" X0 q% s9 z* K
  97.                 return 1;
    - n( S5 s: R# i& `* @0 B7 j
  98.         }
    1 k0 Y, ?' M  `8 e) E, p* Q
  99.         printf("\nNew parameters: \n");6 T! j, O  Z2 J6 o: i8 ?
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    2 W4 k6 g3 v1 W5 w. J  A) i
  101.         printf("  STBID: %s\n", stbid);; i. G0 F3 y  a" p( J

  102. ; o9 d  b- q& @+ _
  103.         printf("\nDo you want to change paramemters? (y/N) ");/ c3 S- l3 x! a, X/ E6 X
  104.         for (;;) {% ^6 k' L/ k" i, C; o+ X7 U
  105.                 c = getchar();
    / A0 @& ~% y) Z& Z! q  h0 h
  106.                 if (c == 'y' || c == 'Y')
    3 R0 I& h1 S( r% C/ {
  107.                         break;' _% \3 w, K" Q% V
  108.                 if (c == 'n' || c == 'N') {
    ( V! j- {8 N4 G1 A4 g% R& n
  109.                         printf("\nAborted.\n");
    & `6 J$ N7 \" L% k" [- a
  110.                         return 1;
    + s/ V! M" H2 R3 V$ G3 |
  111.                 }
    % b/ X, G( f/ C7 }& p0 Z
  112.         }& H- J$ b& y) w$ k! q
  113.         if (writeparam(mac, stbid) == 0) 8 a5 C& b) s2 v% q2 E( X' H
  114.                 printf("Parameters changed.\n");
    . X: z8 L6 ?" [! x" [

  115. + {: T! F4 W4 @4 G4 y: U, V8 u
  116.         return 0;
    & X$ L, c' v& ~" `5 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
3 _4 K& A/ e. R* _在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
6 }4 E3 F: j0 b, Z
你用的编译命令行格式是什么?( d$ e, e. R% L& {# _4 B( W$ {! P9 V" I
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

GMT+8, 2026-3-1 03:50 , Processed in 0.027298 second(s), 5 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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