找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15368|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr2 C1 w" O/ M+ |* d$ A
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    / T/ t# `) P# f9 g; |0 b6 D
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:) k: R# J. ^% n- v
usage: himr <address> <value>. sample: himr 0x80040000 0x0* y3 d" |& M* e! t  B

: U; g3 h: U$ `" Q: d- e0 V% f9 |8 r3 D" {4 y/ t/ j  [8 T
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
8 f% e$ ?  q, ?& |  C
1 Y; n! e7 E5 |, a9 w! L补充内容 (2012-3-8 09:42):2 y# @. k- i2 h# _& s8 U
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数1 w) z; [) x+ s) m+ q( n
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。/ j: |8 I$ y; z3 F9 T

/ o3 L  U7 L7 L7 I$ _himr <address> <value>. sample: himr 0x80040000 0x0
/ S( G/ n! N3 [/ H. I
: [8 `8 k+ X3 }/ `例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
0 V5 l! F" {+ t" Q" thimr 0x80040000 0x00
7 y- d4 ^) j( g) Zhimr 0x80040001 0x11
9 j7 }# x# l7 B) _( K! J- @2 L% uhimr 0x80040002 0x22
" B1 e1 t5 F/ x- Z: S& ]himr 0x80040003 0x33
8 i- |4 U& w. Z  L: u) Shimr 0x80040004 0x44
3 j/ ?8 i* J& Y" Xhimr 0x80040005 0x55
- Y4 L6 F. Y- o7 I5 O) c1 X0 z6 T9 |3 U. }" P' c3 [& A
SN也是类似。" O5 t; _9 ]4 W5 H8 i

& L* r2 A! a% Y9 n0 ^: S现在主要是,谁告诉我们MAC和SN的地址?
1 j' x0 x  y6 a! Z$ m' e- g
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
+ w9 k. ]/ o7 A, N& n* g7 Q2 w( r一直想找到运程修改MAC和SN的办法,苦于无解啊
( Q% v4 @. h4 M  A4 I
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 6 I; S5 |& H0 w' ~. \3 I
: W' r( j8 T2 t2 P$ {
修改的代码早有了。到今天不会编译。
0 z% R8 t1 |# t) j9 ~" [; [4 b需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
      ^' E9 Y/ C' }/ u& E. Z
  2. #include <malloc.h>- C( w5 R4 Y- h7 K
  3. #include <sys/types.h>- {- g  d' x/ A
  4. #include <sys/stat.h>! r. `( [. v0 I% x* H, E* N3 D
  5. #include <sys/ioctl.h>; g, E8 \& {* g1 ]8 c6 O
  6. #include <stdio.h>
    + x+ a1 E  n3 c
  7. #include <string.h>" I& u. Q. a6 i2 [0 |/ T5 l# W
  8. 6 W" C- ~2 S! q! R  P. R. R# f
  9. typedef struct {
    6 {( H' L* M% O
  10.         unsigned int        e2prom_cmd_sub_addr;% z) J1 \5 F1 @5 ]5 x
  11.         unsigned int        sub_addr_count;
    % q9 Z. ^5 r1 f- M% N1 y5 Y
  12.         unsigned char*        e2prom_cmd_data;
    9 @9 @& \" w. W9 v6 ~8 k
  13.         unsigned int        data_count;
    - |! C- q6 _8 J& h; s
  14. } e2prom_s_cmd;
    1 ^. b2 _% K3 V
  15. $ B; Y) F) E( l* a. K+ E  d
  16. #define E2PROM_CMD_READ 1, p0 p$ `- C/ F8 i; j
  17. #define E2PROM_CMD_WRITE 2
    0 L/ C+ w- r1 F0 A8 L- O/ B4 Y
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"9 e# j+ u( p' P. U) G

  19. % ^9 g0 R, N8 |
  20. static int readparam(unsigned char *mac, unsigned char *stbid). P/ }& I& N% ~. N5 O! \& S
  21. {" V/ l' z2 j6 A. b
  22.         int fd, ret;: R; H3 r, z! B- X2 j& ^$ L6 z6 M: V3 S
  23.         e2prom_s_cmd arg;
    0 H+ f6 S+ ^, j% Y
  24.         unsigned char buf[0x18];
    / Q0 D# V3 N: o. H

  25. : |# M# f3 L! }; D  C9 ~
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    : F+ F3 \" a  k9 E8 f- N
  27.         if (fd  < 0) {2 c% l) u  G* a) t8 z2 }
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    # X$ I% P* @4 U* D! a8 G% t
  29.                 return -1;
    ! b; K# V5 M' j0 i' }8 \1 g
  30.         }
    ( A  k0 g  I" }3 b& B
  31.         arg.sub_addr_count      = 2;. f. q* N$ U5 J+ ?7 c* E
  32.         arg.data_count          = 0x18;( z! w, ]8 N8 b0 k8 E2 \% i
  33.         arg.e2prom_cmd_sub_addr = 0x290;( h6 Z0 P! _: W, M- D' X6 _
  34.         arg.e2prom_cmd_data     = buf;
    $ k7 A7 p8 G, T5 b
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    ; F% Q' m1 V  a+ i0 e0 D
  36.         if (ret != 0) {4 R- F% {  ~/ s7 x% y5 v  e/ I
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    5 N* r+ J5 p0 _$ H0 M8 \
  38.                 return -1;
    9 J( @$ ^1 ~7 ~+ h" U+ V
  39.         }' Y% G* y. ~. h$ N/ b8 h5 ]: I/ E
  40.         memcpy(mac, buf, 6);
    / e7 N+ A# q* E8 ?- ]
  41.         memcpy(stbid, &buf[6], 18);* \( Y9 @$ p  H7 F1 ?& Q& W$ b
  42.         stbid[18] = '\0';6 R$ |# S# a# l  ]

  43. 7 c7 H7 o4 q$ s6 k% O! w+ `
  44.         return 0;7 O( C! c$ t1 M% ?* ~1 T0 C
  45. }0 q$ f9 ^% p# ~
  46. 8 r3 r3 ~8 \1 H1 e  \% m6 ~
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    6 C0 Z& s# {& Z, S* c
  48. {
    & X, }/ K. S6 w& Y- d
  49.         int fd, ret;, ]! a2 l' g! @* w  d
  50.         e2prom_s_cmd arg;
    % k- u, `, d. ]7 G1 n1 a2 J. t
  51.         unsigned char buf[0x18];
    ) |9 ]6 j7 p! x& @5 G' h0 V

  52. ) G7 b2 g+ F0 \( a
  53.         memcpy(buf, mac, 6);3 R' U" p% g) ?0 I
  54.         memcpy(&buf[6], stbid, 18);  s; T0 w! w* I) |6 I+ |0 i
  55.         fd = open(E2PROM_DEVICE, O_RDWR);6 D: ~! {2 ~2 \6 Q2 f
  56.         if (fd  < 0) {& A* a; _* z/ y
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);1 u0 P+ K$ c& e2 s* K# Q! n. [: U
  58.                 return -1;3 E# q# G0 E3 T3 N+ X5 |: F: I
  59.         }* d' V" V" ^" J* H
  60.         arg.sub_addr_count      = 2;! S/ r. M, z3 k2 K/ n4 P  e
  61.         arg.data_count          = 0x18;1 @0 ^1 h0 H# @9 E* \% U1 t
  62.         arg.e2prom_cmd_sub_addr = 0x290;% c! _$ _0 b: f  M
  63.         arg.e2prom_cmd_data     = buf;
    . j# p7 J  ]. y- }. E
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);. d4 @* M5 A  C8 Z, U
  65.         if (ret != 0) {/ y6 I% J" p- E% C' q8 ?
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    6 S7 |1 ~$ c$ x' ?0 T
  67.                 return -1;
    ) R, a5 b$ O5 ]/ I5 ]
  68.         }' e' Q5 ~! T0 d6 I& D7 i" d
  69. % I! `7 F1 F# T0 C
  70.         return 0;
    ' Y3 M4 R2 @3 a# D4 c% M, `
  71. }& Y" n( u  G$ Y0 J" `  c

  72. 7 C4 P% P( }) t' l/ i0 [/ X, j  H
  73. int main()  W2 b: n# G4 y& d( M' D$ p
  74. {+ X- c2 X4 m: |3 b8 \' C
  75.         char c;
    0 a2 @0 W1 Z+ z7 D+ x! h
  76.         int i, macs[6];- K6 ?2 Q" {+ Z' o1 u/ ^
  77.         unsigned char mac[6];
    : z- e( |5 @; ~  [8 w3 R3 Z
  78.         unsigned char stbid[256];: d$ ^9 Q; u/ e; F- L! G5 F1 p

  79. ; D! @& `- ~6 n
  80.         if (readparam(mac, stbid) < 0); i2 R- v: u& p4 g4 B
  81.                 return 1;7 Q4 S2 |3 i2 {6 c2 j1 y9 B1 i
  82. : Q- B# M+ `* o
  83.         printf("Current parameters: \n");
    # q( S  I2 v3 t6 f7 v( R
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);0 S1 T0 X' \. {9 j8 K7 Y2 @
  85.         printf("  STBID: %s\n", stbid);7 `) A/ j( Z  X/ C: t8 `
  86.        
    - L& B; S- j; L  B% P4 _0 [
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    0 |" f  x4 Z: K! `$ l4 [7 u. t
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    + K; E6 N4 N4 n! ^
  89.                 printf("Input MAC error\n");
    9 E: c0 N+ E7 c* h! d9 G  D
  90.                 return 1;2 ^# Q" l  l, [
  91.         }
    ) E% A( Y+ t, v0 H, e' N
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    - j, z2 |. r" K6 O5 p* J' O% k
  93.         printf("\nPlease input new STBID: ");8 o7 c6 J: L7 B7 s! X
  94.         scanf("%s", stbid);4 M4 D) t  r9 J% j* v  s8 {
  95.         if (strlen(stbid) != 18) {- P, h4 ~3 S3 D; y5 r
  96.                 printf("Invalid stbid\n");
    ) U8 a: `; L2 d8 m7 B' o( g
  97.                 return 1;" R1 q* ~/ \; g4 @, z8 F" h. |
  98.         }5 M% E. e& Y$ `  n
  99.         printf("\nNew parameters: \n");
    9 C6 ^4 q( M5 A
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    2 z: Y! f2 m  O
  101.         printf("  STBID: %s\n", stbid);. a8 n1 R8 A3 }7 I! g, K% ^1 s

  102. ! w* I# t$ s: K9 l
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    % r7 `) O. N* |' C$ m/ F9 V
  104.         for (;;) {( S- e* W- K5 U5 e) w" `
  105.                 c = getchar();
    : ?- l/ p' F$ W
  106.                 if (c == 'y' || c == 'Y')" T* Z0 z" G% R8 c
  107.                         break;
    * o8 y6 S0 U) s9 ?
  108.                 if (c == 'n' || c == 'N') {, }1 e! b5 P" ]
  109.                         printf("\nAborted.\n");4 D, O0 b1 y* ?( ~. S
  110.                         return 1;- M$ ?# c, [4 q! X
  111.                 }
    ! s4 ~2 R) i+ j, k: D
  112.         }
    , m2 H5 [4 v2 d) T' s* S
  113.         if (writeparam(mac, stbid) == 0)
    6 m+ r$ M3 }# H9 o- D, s9 \4 v
  114.                 printf("Parameters changed.\n");) ?7 w6 F' E. Z/ u

  115. , q8 e( `% u% a# Q; H
  116.         return 0;
    6 {  e( @+ W" q1 ]( x4 y
  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
7 j  V7 E- ?" l3 ]在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

" s; v7 j7 ]% c9 g* E9 |% @你用的编译命令行格式是什么?* t2 n7 v" y; M3 L
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

GMT+8, 2026-1-30 01:01 , Processed in 0.023763 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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