查看: 16161|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr. U+ n, `5 x9 `
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig) Q4 I+ v1 U3 y1 d' Z+ [
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
: D9 J  X# m* T+ u. U+ M" busage: himr <address> <value>. sample: himr 0x80040000 0x0
, w1 |! k0 R* ]" |8 R" S( m0 N/ F7 {
/ _3 h. |% M/ U- d& l. w" _* c! z; y2 N& Z
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
/ {, K' M9 J* w4 ?8 b4 {
% Q6 ]( t& b" `! \, h3 I& C$ |补充内容 (2012-3-8 09:42):
- y# t2 T5 n. Ehttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数' D9 z9 n# z3 Q6 C5 _; i0 |& o, ^
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。+ l" \9 @5 _, e  G. g' w0 {& {

' X% b, v, ?1 ?$ p7 v! D7 Chimr <address> <value>. sample: himr 0x80040000 0x0+ n- s; T5 \2 H* ?9 \; h
  \; W3 z# ~6 f$ A& `( N! R/ ^
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。, ^0 p$ `: \9 ~
himr 0x80040000 0x00
& k7 B6 w0 Z* Y$ mhimr 0x80040001 0x11% F8 k+ z. X4 I# W+ V" q4 r
himr 0x80040002 0x22
$ i% F5 e) U- [) y  T. rhimr 0x80040003 0x33
; Y) o8 t' a5 Fhimr 0x80040004 0x445 h/ d3 G- j7 r5 _7 j/ E
himr 0x80040005 0x550 j+ c/ y8 L6 M# F

) v' p2 ^1 M, USN也是类似。
* Z7 ?' m* e& ~# q% _) m1 Z# @9 ~4 \7 h/ W
现在主要是,谁告诉我们MAC和SN的地址?& ?6 u9 {2 @" {
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
4 M8 G5 ~$ w! v" f8 t: R一直想找到运程修改MAC和SN的办法,苦于无解啊
. i8 |% _; g6 p( z3 q! g" L
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
& b" Z, c) N" A$ q, h
- ]* ?# ?) c" G0 y修改的代码早有了。到今天不会编译。8 ?- @( h  [0 ^" T" `
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    5 A# S* e6 [* L+ h, a. b
  2. #include <malloc.h>
    . T& f. v2 d* q* K5 h' R5 ]. M
  3. #include <sys/types.h>" \9 s( n: ?% Z2 h  ?: A
  4. #include <sys/stat.h>$ j1 L* x  J* F/ x8 Z2 n
  5. #include <sys/ioctl.h>
    / m, G( j9 g9 i5 {; X4 Y5 Z
  6. #include <stdio.h>
    ; \; n" L+ W  S% o$ Q8 y# y. h( E
  7. #include <string.h>
    * r6 X, o6 B9 P. V; s2 x3 i! e5 j0 Y2 d7 b
  8. % Y3 Y$ n  [0 Q$ \& Z6 J
  9. typedef struct {3 C8 i5 A+ n- _3 s
  10.         unsigned int        e2prom_cmd_sub_addr;! a( S' s/ a; Z
  11.         unsigned int        sub_addr_count;, e5 Y3 {7 K. e1 Y1 h
  12.         unsigned char*        e2prom_cmd_data;. [) `8 _9 ]" b* g2 n5 w8 m
  13.         unsigned int        data_count;
    $ {0 j+ M  J+ O$ g- B% K. W7 b; W3 L0 [
  14. } e2prom_s_cmd;
    ' B. R8 ~+ E& M5 A

  15. * k0 @9 A: w7 Y# x& d( h9 W6 S
  16. #define E2PROM_CMD_READ 1
    , f" `( b' p) l+ D
  17. #define E2PROM_CMD_WRITE 2- [/ c6 @1 d6 Y- f+ F9 U5 ^% P) h
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    6 o% w; q4 F! i/ ?9 A

  19. / S$ F) J/ r. i* c: G. G# ?
  20. static int readparam(unsigned char *mac, unsigned char *stbid)8 G4 P7 S6 ~# @# ~
  21. {
    ) @( S) J( z9 K$ _: q8 i6 {1 V; u
  22.         int fd, ret;
    , I7 @$ a7 G% ?! I$ y. b
  23.         e2prom_s_cmd arg;$ f" u0 `# e# Q! S: h
  24.         unsigned char buf[0x18];
    1 W9 y& B0 p1 L8 z& w
  25. # R4 ^; ]9 F/ }% [! ?/ M3 D& m
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    & I$ y+ j4 i! p' _) S
  27.         if (fd  < 0) {: }- l# _- G* X6 q" y- v
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);; v8 F0 `! O& Q7 S
  29.                 return -1;
    , I6 z: R/ Y  L
  30.         }
    & m7 w' Z* [5 G1 G
  31.         arg.sub_addr_count      = 2;
    0 N5 \3 b, N6 n. L
  32.         arg.data_count          = 0x18;
    # ]- [/ T" W& T$ d9 h0 C' m
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    2 M3 S  B* N# ?+ @: y
  34.         arg.e2prom_cmd_data     = buf;% |, F3 S2 s' _2 \1 p& L. d
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);9 p6 t; C) W/ p
  36.         if (ret != 0) {
    % U+ o( h3 {/ j9 X& {" s" j' O0 G- H
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    ; V$ J1 d! t  Z) J7 w- ^  \( R+ ^  V
  38.                 return -1;
    - y0 _' T  c( v( j1 L9 e7 O* d4 C9 ^
  39.         }+ A! j# M% h% _8 }: I( W4 l) l
  40.         memcpy(mac, buf, 6);4 @8 u4 S, a, d/ u  {
  41.         memcpy(stbid, &buf[6], 18);
    % L& Y: K- b" k" C3 K
  42.         stbid[18] = '\0';! z5 J9 P5 Q9 _. D

  43. # c, X/ l0 y2 a. U- d
  44.         return 0;  ~2 F- R5 {0 Y/ q% I. N- X1 U( t
  45. }
    1 a. D7 y( t9 `, o
  46. ( B" y: O# y6 M; x8 T
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    0 H  i0 `8 W- H( w% a, q
  48. {
      V: N) U, e& _* Z+ D5 Q, k
  49.         int fd, ret;
    2 P7 D5 v; ?+ D0 N
  50.         e2prom_s_cmd arg;' u* z' \* l3 t- t
  51.         unsigned char buf[0x18];
    & G& o) K+ W1 t' [, Y+ @% }5 f0 S: N
  52. % R( ]4 z, U/ Q
  53.         memcpy(buf, mac, 6);% I8 @& m3 ~& I& ]1 k
  54.         memcpy(&buf[6], stbid, 18);$ m. L; a9 l2 e; ~% X* z& J# t
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    & K, ]4 E' C5 i
  56.         if (fd  < 0) {7 H4 A2 c! O! F) H6 U4 X- L
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    0 S9 v5 ?0 }, M8 y7 r5 J
  58.                 return -1;3 {5 T5 o% O( n
  59.         }
    : B2 J# f5 ]: v3 l
  60.         arg.sub_addr_count      = 2;1 U6 J' R2 V5 d2 y% `* `
  61.         arg.data_count          = 0x18;
    1 ^; ?  H  D/ G0 [9 P
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    5 u/ a$ Y" G" x) c' y7 C
  63.         arg.e2prom_cmd_data     = buf;
    ( Y4 L. @% Y1 z, B" E. k
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);5 }  j# m3 H0 V* E
  65.         if (ret != 0) {! q+ R/ ~" J( B2 F" i& `/ v8 D% {
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);# J; s9 t5 F$ B% u7 e. _9 L
  67.                 return -1;
    0 @* @' F9 ]- M+ X  `  [6 G# f4 `
  68.         }
    . B) M# I/ [# H9 U8 }% Z' d+ l
  69. 5 ?- W$ u$ ^) t2 {
  70.         return 0;
    7 L* a% b& y/ d% O9 j; W
  71. }
    8 U- f4 ^! U/ W1 ]2 B

  72. 2 u# e; t' S5 L$ q. d% m6 D% c4 ^
  73. int main()4 I8 B5 g$ }% P# j
  74. {( ~. i8 z4 P. O  r7 R/ ?
  75.         char c;
    ) z! a3 P8 \+ O2 a
  76.         int i, macs[6];0 [% V* v4 d! t" m. j
  77.         unsigned char mac[6];8 t% E5 W4 N' R$ g, r$ K
  78.         unsigned char stbid[256];! t+ e! ]; o  j1 m6 V7 O

  79. , v' V) q* F! [7 o
  80.         if (readparam(mac, stbid) < 0)' s0 z% D, t$ {9 Y4 \
  81.                 return 1;
    # \( A, ]+ q/ g: M+ `3 V

  82. ; A" k2 a0 e- f8 U
  83.         printf("Current parameters: \n");+ h, a# E: s& S) C
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);; C' x) J1 I% w
  85.         printf("  STBID: %s\n", stbid);2 I2 u9 d0 h7 M+ [0 L, j
  86.        
      t  j4 F* [+ M, y" ]- n
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
      C# T( S7 R' f% h5 R3 |
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {) H3 A: K' d# ^! I( c' R" `
  89.                 printf("Input MAC error\n");% `& W# y' `+ T8 {  o' F; v
  90.                 return 1;" d) J  z2 }, Y3 A
  91.         }% M  P- V6 b: r
  92.         for (i=0; i<6; i++)mac[i] = macs[i];/ }8 h1 G7 A: |
  93.         printf("\nPlease input new STBID: ");
      O! b+ U! |: A$ Y8 A
  94.         scanf("%s", stbid);) X& w4 c$ @: u
  95.         if (strlen(stbid) != 18) {
    ) _: B/ ^9 T) V
  96.                 printf("Invalid stbid\n");
    9 z" X$ f# A' t) x8 B6 S# \
  97.                 return 1;
    : Z6 |) f* z' k0 V, i0 X
  98.         }0 |9 u8 s. d3 y% k: b+ B8 D
  99.         printf("\nNew parameters: \n");
    . q& |5 h! @% k1 u8 N/ ^6 e
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);1 G. I7 ^" z1 t
  101.         printf("  STBID: %s\n", stbid);
    4 T! N9 n9 h3 K6 a
  102. 0 G. l0 m. X8 {5 ^! I% \
  103.         printf("\nDo you want to change paramemters? (y/N) ");9 E) b# y; P4 X# i. x& z3 @& n$ E
  104.         for (;;) {2 X" d3 [0 i, j# c2 a9 g: R
  105.                 c = getchar();1 ~" y- o' W# _# W" T8 `" H
  106.                 if (c == 'y' || c == 'Y')* q4 B4 X- d- L3 C& h
  107.                         break;) y$ T+ A; L# q! t
  108.                 if (c == 'n' || c == 'N') {
    2 O7 C/ ?# m! C0 t& ~
  109.                         printf("\nAborted.\n");
    5 M% ^3 x4 s' x: B) T
  110.                         return 1;, e( N$ J: u* p$ p  z
  111.                 }  Z0 F2 I; M5 L! G% M& H7 ]  V
  112.         }4 A. W; P4 L! e5 J* b
  113.         if (writeparam(mac, stbid) == 0) . K( w9 n) ?4 [$ f* _* B
  114.                 printf("Parameters changed.\n");
    9 t9 ?' S5 G' C, \+ Z+ s
  115. / Q- C& q4 g) a8 G" u- W
  116.         return 0;, H+ H2 X) q, [2 z6 \- }' i
  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 / M( @8 H4 |' z5 L
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
8 {; M' f! n1 i3 _) g- i* e
你用的编译命令行格式是什么?
+ M1 x. y0 e" T5 ?; k
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

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