查看: 16491|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    2 {, B1 s4 \6 W* O" A+ ^( ^- i
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig7 P6 B( H+ s3 ]9 j
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
0 h; i9 {, Q  [* S+ ~: ~usage: himr <address> <value>. sample: himr 0x80040000 0x0
% n3 v$ Z; t# c8 {/ M! V( C  j3 q: y2 P$ R0 L( u8 N
% F. w' |2 P5 F3 J/ v, R! x8 m" u1 ~
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
* k2 `0 [6 I$ O) i3 Q# X( K- Y9 t
8 k- z' M% V. v3 V5 w补充内容 (2012-3-8 09:42):
8 Q. W8 |) @8 N3 i7 d, L* {( ~, Ihttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
9 _5 u# l4 z: [" ]" N9 Q这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
4 ?9 g, m) y# r9 R/ q
: t- z" Y$ f& I  |/ d1 xhimr <address> <value>. sample: himr 0x80040000 0x0
8 i% Z4 A9 a5 a2 Z2 K; r9 }
: V' f/ I- a2 v2 T例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。& y6 D7 ]: F! Z" q( Z
himr 0x80040000 0x00
9 u3 q, W. E+ E" C& a# b! W+ Fhimr 0x80040001 0x118 `( I, Q' X2 z
himr 0x80040002 0x22
# {; y- ~8 s9 A8 l$ h0 Jhimr 0x80040003 0x33
& j( d# J' [8 R' ]/ Whimr 0x80040004 0x443 F# D2 g+ I2 }, y
himr 0x80040005 0x55$ d. S. j$ L2 J& u  n1 ]
6 Z7 R. @/ x6 t7 G0 h+ Y4 y7 b
SN也是类似。
8 R/ M5 Q" m" y, P* v
7 v) V  j# z7 K7 H2 b5 d& K, `现在主要是,谁告诉我们MAC和SN的地址?
6 G" ]. z+ P0 U6 P; E
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
0 d/ l, z$ _9 t. h5 _9 K一直想找到运程修改MAC和SN的办法,苦于无解啊
; Y: `/ M9 E7 ^6 X
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 $ P7 ?6 ?3 H5 T2 @- [. m
" L; a& j& u$ m% A
修改的代码早有了。到今天不会编译。
: g$ L  m1 ^. t8 H, r需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>: D  G" q6 g/ L' G1 ^
  2. #include <malloc.h>8 h" _* a2 v1 f1 Z; b7 f9 e
  3. #include <sys/types.h>
    7 k" g) R& ]4 K
  4. #include <sys/stat.h>2 u( g' \4 V2 M# \4 ?- G
  5. #include <sys/ioctl.h>
    " ?; i2 ?6 G. @& I5 v
  6. #include <stdio.h>/ ~5 S$ L& w0 {# I- ^" Y. N
  7. #include <string.h>& x* l. O! {" H7 j0 a, e- Z* c
  8. 3 G! e2 f  R7 m
  9. typedef struct {: ^1 c2 t1 C+ [. Z7 r- e
  10.         unsigned int        e2prom_cmd_sub_addr;
      J  R/ Q) a4 @9 H- I+ Z4 O
  11.         unsigned int        sub_addr_count;
    7 C( n+ d9 A  m6 M4 E+ F: }- z) w
  12.         unsigned char*        e2prom_cmd_data;! S- D$ Q1 K  c( k1 E3 x7 c4 {
  13.         unsigned int        data_count;  d8 y/ |1 h" @+ m9 h
  14. } e2prom_s_cmd;9 Z0 s: B/ u9 G: Q4 z; T! q
  15. / X7 V# A, e+ ~9 t5 b# M" B
  16. #define E2PROM_CMD_READ 1
    8 s1 G. K' j; q6 H+ M& h  O; n
  17. #define E2PROM_CMD_WRITE 2' c+ z0 L1 p# t! y2 P2 A% h' c+ m. d
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"9 x* Q( W! U& @5 ]6 G5 R5 `
  19. 4 |, y; E  B  s, M2 U+ q2 N
  20. static int readparam(unsigned char *mac, unsigned char *stbid)2 k! T9 `7 {4 o
  21. {+ Z; c( e8 h& y4 A
  22.         int fd, ret;3 R& P' W' M7 A" I
  23.         e2prom_s_cmd arg;
    . Q0 W/ ^  y: `5 M
  24.         unsigned char buf[0x18];
    1 n$ w; Q1 T5 t: ^0 s4 H& f  T

  25. " `6 r$ ~. b! _
  26.         fd = open(E2PROM_DEVICE, O_RDWR);, N+ ?- a% X  o( |% a
  27.         if (fd  < 0) {
    + Q4 K2 u6 q% Y( l7 k6 P  u5 Q- P; m
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);8 B# Z; M9 ~( B9 V
  29.                 return -1;
    7 e) @. g1 O4 }
  30.         }, F9 Z5 w  S2 T- _* f
  31.         arg.sub_addr_count      = 2;
    * Y3 U' C2 w; E7 {; u% z# T+ ]# t9 |
  32.         arg.data_count          = 0x18;
    : N# s3 T3 u. X! `5 \) o& H
  33.         arg.e2prom_cmd_sub_addr = 0x290;- ?+ P7 Z4 \2 a7 k" R4 F3 _
  34.         arg.e2prom_cmd_data     = buf;
    ) o7 K4 P/ ]9 i6 C
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);6 I# M# N; c9 m  W
  36.         if (ret != 0) {
    9 o) K8 e( \6 ~6 ]
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    8 c9 l$ k5 c$ P* J. V- w
  38.                 return -1;: D' j. y8 n% }# Q: Z. G3 _% e; H
  39.         }
    / I! p6 m4 [" ]$ j% F+ R
  40.         memcpy(mac, buf, 6);
    " p6 E, i, g1 k& R; a1 G, a! z
  41.         memcpy(stbid, &buf[6], 18);
    : \/ Y. V8 J8 p, ]/ ]
  42.         stbid[18] = '\0';0 A1 h7 @( Q' P: Y4 \& g& U

  43. * k8 s# L3 F6 t+ \
  44.         return 0;6 G* X) {( k8 [) O3 i7 y4 j; j2 L
  45. }' ~# ~/ }5 l1 J
  46. " W8 p- X9 P; q3 d$ U
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    ' `/ L- F' O* \
  48. {
    : @: Q& _8 O: L3 m8 a6 {
  49.         int fd, ret;- k! H( h2 a# @+ i  ~
  50.         e2prom_s_cmd arg;: L8 E1 R4 {  Z& j" l
  51.         unsigned char buf[0x18];
    & |$ x7 n$ l3 @

  52. - p) @1 B1 Z( {3 g2 j2 B
  53.         memcpy(buf, mac, 6);, F7 s% y8 m0 Q  I) _& t( Z
  54.         memcpy(&buf[6], stbid, 18);
    - S4 I/ y3 [( |# R) E* v! f
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    3 ?/ C& Q: J: ^
  56.         if (fd  < 0) {2 w+ j! H3 h7 ?1 a0 q
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    1 o; y# Z6 ~3 M1 V& b( o
  58.                 return -1;7 c# H9 p( |+ X
  59.         }
    , |9 q# p# m/ q( X* r9 h! S
  60.         arg.sub_addr_count      = 2;
    8 i3 l& R0 _2 B. ]/ ?3 v
  61.         arg.data_count          = 0x18;& j2 \% @# H: q! I7 A
  62.         arg.e2prom_cmd_sub_addr = 0x290;; v7 |4 b1 C; I: t9 w
  63.         arg.e2prom_cmd_data     = buf;' R  K4 N: w* X! B9 ^1 {
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    ! j! Q6 s7 {* K: M
  65.         if (ret != 0) {
    , w9 \! D; T% x, z
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);. o( R. i; R/ B! n
  67.                 return -1;
    ! Y  K/ p( {* \9 f& m) B
  68.         }) R2 G7 C; ]1 w6 {' y& k+ L1 C# _$ E3 P

  69. 7 m# V/ [0 q  y( a# p
  70.         return 0;
    & q. l" y! @% o# O' n
  71. }
    % H  o  Z* ^1 F* o& Q

  72. # p7 A& r2 M# u- v$ p0 o0 x
  73. int main()3 ]9 r3 t! }4 {; A
  74. {
    1 v# o( S  j+ I* f8 g
  75.         char c;
    ' s$ i) K; M1 M& M8 R
  76.         int i, macs[6];
    3 z+ G* I; I2 X8 ^( w2 e
  77.         unsigned char mac[6];
    * u' U# J0 S0 I( N
  78.         unsigned char stbid[256];
    $ v* ?* ]2 t# B* q) F0 q- a3 H
  79. 1 Y' c* J& x8 q1 S' b8 i) G( w
  80.         if (readparam(mac, stbid) < 0)* m, R8 h+ b7 Z7 d: w
  81.                 return 1;- `) E* L" ?8 d9 i6 n& ^* \' J( {

  82. $ {4 r1 P7 j2 ~" G6 J6 J
  83.         printf("Current parameters: \n");
    ' c% `; R3 E% Y& s# @' G- v; }
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);9 Q, V4 f; n! f8 J4 s' T2 J
  85.         printf("  STBID: %s\n", stbid);
    : C2 T/ T6 \& @
  86.         ( w. ]# R  ?/ N, D# x
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    . g# ~3 w3 y7 |& V( I
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {" a! Q1 i# c6 |
  89.                 printf("Input MAC error\n");
    1 J' `5 S; x  \6 P' u8 f. C( [
  90.                 return 1;7 u9 {% ^. T6 q7 f. w- H
  91.         }4 }3 }( E2 n0 }: b6 }# a3 q
  92.         for (i=0; i<6; i++)mac[i] = macs[i];  g  N! E5 i3 V+ c6 x
  93.         printf("\nPlease input new STBID: ");
    + B6 f+ i, Q4 K  `  _6 ]
  94.         scanf("%s", stbid);
    $ V( {; M, f& [* o& a
  95.         if (strlen(stbid) != 18) {2 E" o5 d; [# O) \3 j" L
  96.                 printf("Invalid stbid\n");
    % f) m& S% H& n8 y1 y7 o
  97.                 return 1;
    ' g" D: |/ [* }8 s2 R- ]
  98.         }
    - o, \/ b2 }& @# S
  99.         printf("\nNew parameters: \n");2 ?/ h" G, I# n, k" z! t, T
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);8 P+ b- P2 w; T' G
  101.         printf("  STBID: %s\n", stbid);) @! E2 I7 o, Q4 c, T2 o3 [

  102. 7 H# N. T0 c4 t2 i% `; d7 j* e4 }
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    * k' O9 F$ U5 ^
  104.         for (;;) {
    4 j; F# i$ h. R- j4 }# P
  105.                 c = getchar();
    6 L- h. h/ m& L6 A* K9 l8 M! n
  106.                 if (c == 'y' || c == 'Y'), B  z( }' E/ `% _( T
  107.                         break;$ ?! ^& M7 W  t# m
  108.                 if (c == 'n' || c == 'N') {1 c7 I' ~  g, z2 x' X  O6 A: {1 G
  109.                         printf("\nAborted.\n");
    4 H; f: H: o8 s# ]+ b
  110.                         return 1;1 x6 @) `  l0 |# p% \
  111.                 }5 {& j3 ?0 {, X) Q# u
  112.         }
    : y0 ~& |0 G/ q4 u5 ^7 Q
  113.         if (writeparam(mac, stbid) == 0) ! @/ ^( J8 D. N5 q' [* u
  114.                 printf("Parameters changed.\n");
    . b+ f; l) M% y$ D5 n" q- N1 T
  115. 2 l/ \/ x# V9 h8 H
  116.         return 0;
    . Y9 g# B8 b! K: ~
  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
4 A+ k; F2 m. b, W在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

2 S+ L  K! ^+ y你用的编译命令行格式是什么?. ~# z/ ]/ M# d6 g
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

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

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