找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14989|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr% i6 k/ ^; x* p0 y, P# o
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig  Q# l- c4 m" r& U. C; ^2 p. C+ _8 m
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
& g. B. T, b: F- ?. f) `/ O# rusage: himr <address> <value>. sample: himr 0x80040000 0x0! _" M. q4 \: f& B# b3 S: f" P6 q

* v5 c& m! E7 V& |
) x1 n+ T+ A3 o! ?不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?, t! i$ R$ F1 j; |8 t
3 D, o$ m; z% Z: M. s
补充内容 (2012-3-8 09:42):/ I" b) }$ c8 Y6 o- Y7 ?
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
# j/ w9 w& }' ~这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。& R% s( g0 X% E1 y
. Y$ V9 a/ _" K& [1 a8 t
himr <address> <value>. sample: himr 0x80040000 0x0
9 h& I9 ~3 B( Y( _$ `" {3 p5 U/ H% ^6 l
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
2 g  W' k$ M* R- l9 I$ B. lhimr 0x80040000 0x00( w' e6 e# f- a% c; I. F! n: k& k
himr 0x80040001 0x11
! A3 a* f* N$ f1 k7 a$ Z) ihimr 0x80040002 0x22
5 L7 d8 R5 H" uhimr 0x80040003 0x33
. |' Z% }1 z% ^1 L% m$ N$ L1 |himr 0x80040004 0x44; W0 W$ |* T% m
himr 0x80040005 0x55
* |3 @$ Z& T: k' @" V5 d# J& }6 u/ K7 g
SN也是类似。% f  d  b$ ]5 L8 Y$ ?) J) }: N1 R

# S" b$ r% y4 D4 o6 E. X; i; U" A现在主要是,谁告诉我们MAC和SN的地址?
3 V9 U* S1 p( T. g0 y
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37   I- \5 A+ I/ s/ ^  }- R
一直想找到运程修改MAC和SN的办法,苦于无解啊
, B! P% ?' |* [; o0 \  H. ~% x6 F
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
+ `# h) c8 o6 H4 V! E0 {# ?& D4 L6 ^' k0 J4 B
修改的代码早有了。到今天不会编译。$ Z. u* M5 j& ?! K. [
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>$ y& Y' h: D" O6 I# O7 |7 S
  2. #include <malloc.h>% Z0 k$ \' Z  j' B. ]$ I
  3. #include <sys/types.h>
    1 l3 r* \9 q! i( f5 }9 o
  4. #include <sys/stat.h>4 h. P3 N" B$ O
  5. #include <sys/ioctl.h>% x& m: f2 T- f3 J' @" I. j4 y
  6. #include <stdio.h>6 \1 e( J) x2 X' |- C4 O, V
  7. #include <string.h>
    6 d+ i) ^/ g* l7 d  ~2 J
  8. ) \' c, H, t: S  c2 F% a
  9. typedef struct {
    ) F9 L; h  U! R, {
  10.         unsigned int        e2prom_cmd_sub_addr;3 j% N/ L7 ~  Y8 m5 ^
  11.         unsigned int        sub_addr_count;. w: G/ g$ C' [1 m7 C
  12.         unsigned char*        e2prom_cmd_data;
    6 n# k. ^9 u7 b8 S
  13.         unsigned int        data_count;8 d- k2 r6 F; S: Z. h* D/ I
  14. } e2prom_s_cmd;1 M, M2 h7 r3 O& R. O

  15. 0 G* Y  O& V9 u2 w0 I& C- [% v' t
  16. #define E2PROM_CMD_READ 18 D" c& K) l5 b6 I! _7 [* p4 S
  17. #define E2PROM_CMD_WRITE 2
    ) m/ e4 m' t* u; O: O+ p) O
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"8 j5 ]8 C; u; Z5 x
  19. # m  _! ?- _% G# g1 e
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    6 O2 h5 Z2 [# W7 L0 n& n# m
  21. {  Q6 ?$ a% P  {3 l
  22.         int fd, ret;" p% t$ O3 H( R, Y) K
  23.         e2prom_s_cmd arg;
    1 |0 t6 \$ ]9 G& `+ C
  24.         unsigned char buf[0x18];
    $ C& a; }, ^/ R" J! u6 q

  25. 2 ]$ U3 M& V  s( N" I
  26.         fd = open(E2PROM_DEVICE, O_RDWR);9 ?" M% K2 Z; O3 `/ A2 o2 M
  27.         if (fd  < 0) {1 a. _. `, A% |+ J; S- h, Y0 x
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    2 X9 s, J  F4 m# e2 ^5 P, v
  29.                 return -1;) @# f3 f6 |2 W0 o& G0 x3 |
  30.         }
    ) U5 b: [2 g5 ?8 b
  31.         arg.sub_addr_count      = 2;
    ( e* x# `' e/ M2 n) R
  32.         arg.data_count          = 0x18;
    # n; Y! |9 ~' e9 L# Q4 L
  33.         arg.e2prom_cmd_sub_addr = 0x290;3 D" u1 \& z/ c
  34.         arg.e2prom_cmd_data     = buf;3 G/ h/ a: \( ]( x/ r
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    $ y: V* M! o8 M2 n2 q8 S* b6 I) @
  36.         if (ret != 0) {
      v2 a( C. b( v' y3 q
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    # j" O) A$ H) x4 `+ i! E( x4 d
  38.                 return -1;& t; \4 q$ L* `- T; D" V5 |
  39.         }- y7 A5 }+ l4 I# e
  40.         memcpy(mac, buf, 6);
    7 {0 J* a% K1 b1 `, J) U
  41.         memcpy(stbid, &buf[6], 18);3 F$ j5 a0 c3 z# O# |
  42.         stbid[18] = '\0';
    + s( ?% a( h/ T% R4 X  h3 ]

  43.   n! |% g# {  R. J& L  `7 |: }  I
  44.         return 0;; X& V/ V4 I1 o* {, b4 ^4 X
  45. }
    " `6 Y* o9 Y; q5 q4 ~6 ^2 @
  46. 9 D, Q2 P! j7 W, E5 x( J# c9 z
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    & j0 t! `# J3 e$ ~1 v% k
  48. {
    * J" d6 n2 S# t+ @8 e8 a
  49.         int fd, ret;& y" M) u7 h7 v' X% p2 R" l' @
  50.         e2prom_s_cmd arg;# H6 O0 g) Y, t' ^9 F; X' o
  51.         unsigned char buf[0x18];
    % n; c5 @$ N5 r) r6 F; e
  52. 3 L# h4 h4 z* V4 R" ~/ g, `
  53.         memcpy(buf, mac, 6);* x& N# g# }& s* q/ }7 p( P
  54.         memcpy(&buf[6], stbid, 18);
    + n; x% n' N3 V: e. j& A
  55.         fd = open(E2PROM_DEVICE, O_RDWR);: `/ `" _7 ]3 E0 k4 j! o
  56.         if (fd  < 0) {: w$ C7 g9 K, N, l4 j* |
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);: Y: g# F; @$ i8 [2 x4 l- h1 U
  58.                 return -1;
    - \+ @2 O* f7 M2 w- P
  59.         }
    ' ]6 f, i: I/ U) E! B
  60.         arg.sub_addr_count      = 2;/ g* Q# o- |: I( A7 U& {9 r
  61.         arg.data_count          = 0x18;$ p2 d+ k( O% Q& z2 D
  62.         arg.e2prom_cmd_sub_addr = 0x290;2 M. c  W( c, l! g% ]) P
  63.         arg.e2prom_cmd_data     = buf;
    8 H0 f" x' H7 O1 t7 j5 ?+ r
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);$ @; ^" m) h; f. U! A, {
  65.         if (ret != 0) {2 Q# y* l. e  N! v: X2 S5 |
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);/ e$ C! z" I, _  H8 @
  67.                 return -1;  G; s5 f; D8 s2 p/ I; Y  r
  68.         }
      h" ], [; q) W2 b! |- t7 ]# F
  69. * h& y! ~# ?0 }% z" V9 C8 o+ d
  70.         return 0;
    5 u1 C: ]* d( p" Y
  71. }9 Y) Y! R: R' w0 z
  72. ! T7 g# S, n- G
  73. int main()9 Y  v& m& y8 B2 M2 N$ _
  74. {5 @, }  M) T4 j+ p/ w
  75.         char c;2 A- S5 E2 B' L; x
  76.         int i, macs[6];$ h7 u5 A4 ?& p
  77.         unsigned char mac[6];
    ) O) c+ Q  N, m7 r* J' m! R
  78.         unsigned char stbid[256];5 l4 @) N& @' Y6 X4 J' ~
  79. ' n/ |1 K# @, v, l# m7 t8 U
  80.         if (readparam(mac, stbid) < 0)
    ; y# {/ z  h7 A! h6 E' u. h1 m: e
  81.                 return 1;$ B2 S7 l: V0 O3 g

  82. ( y3 \& t5 m: \+ w% b# W
  83.         printf("Current parameters: \n");5 ^5 ~' l+ K: P5 x6 [& N, P" c, W' W
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    + z1 b2 o  u3 ?) C4 ]) y5 [
  85.         printf("  STBID: %s\n", stbid);( E" s( }2 a+ U/ X* x1 b, h
  86.        
    / ]+ U: S8 Y6 n  j
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    " N7 O0 z# y7 B2 q. @1 [
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {" v) @+ q( H: I& }3 _
  89.                 printf("Input MAC error\n");/ _! k8 s- u: H3 z" z
  90.                 return 1;
    8 `3 L$ W. H. C( q: b
  91.         }
    4 B8 i/ g: w% P& A* \5 `& u
  92.         for (i=0; i<6; i++)mac[i] = macs[i];4 j3 k5 _) m! w1 B$ O8 n
  93.         printf("\nPlease input new STBID: ");+ C; H$ m3 V% i
  94.         scanf("%s", stbid);  I" ^$ N. q0 b( `# W: d
  95.         if (strlen(stbid) != 18) {+ R  S; M) k: o1 {
  96.                 printf("Invalid stbid\n");
    ) d8 v3 ~# r$ a9 y9 K1 ^
  97.                 return 1;
    ' K1 G$ y1 a" H8 P
  98.         }" o* s  J& F7 B8 A& Q
  99.         printf("\nNew parameters: \n");9 L6 k5 G/ K" ^( v
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    6 p- d$ N0 K& Z7 P& O4 h
  101.         printf("  STBID: %s\n", stbid);
    2 M/ h: w- o' Y4 p8 z' H

  102. - l4 `# j- \$ I! O
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    ) }$ F* i8 k, k/ M! k
  104.         for (;;) {8 q, ]0 n$ }8 N  d* g8 S! d1 e
  105.                 c = getchar();+ x$ h/ m/ P' A
  106.                 if (c == 'y' || c == 'Y')
    : C" l% Q% |8 v
  107.                         break;4 U- u6 I# j' C" f& I
  108.                 if (c == 'n' || c == 'N') {7 V  _3 d  S% z! Y4 m# y
  109.                         printf("\nAborted.\n");9 ^- X8 ^% t! q+ U9 Y& Q
  110.                         return 1;
    % I' O' G9 f8 v7 g/ Q$ C0 f
  111.                 }  }* U( r: I" _3 j: x) \8 [
  112.         }4 D9 r8 X9 b" G+ J$ M
  113.         if (writeparam(mac, stbid) == 0)
    . y5 d; O" H1 c0 V
  114.                 printf("Parameters changed.\n");; U9 y3 x" r' i! C  d9 A

  115. ; A2 E5 n+ [, R( Y
  116.         return 0;4 L; Z9 a7 q$ N1 b6 p: Z
  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
8 \) w9 i  Q3 j/ Q* g在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
( ^; D! T+ o, P4 [! \$ h) I8 M8 U9 t4 I
你用的编译命令行格式是什么?
/ G& ]1 f  S+ h6 V/ U
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-12-7 15:31 , Processed in 0.021604 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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