查看: 16997|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr4 c' b. U/ f, M! B
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig' N" ?. @3 r. Z/ a" A  V
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
* _; A& W3 [" c* |% zusage: himr <address> <value>. sample: himr 0x80040000 0x0
4 @0 p% P  Y, [4 W% d. g! f. V( A+ p$ P: F4 [

8 b7 |3 C5 y) N, J9 X不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
( ~/ d0 A7 f3 N& k3 R
  }1 A% Y7 j8 v& f, i0 o' a8 H补充内容 (2012-3-8 09:42):
9 p6 T0 Z- k$ ?+ z, v# N$ Vhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数3 \1 Y, U( N( @9 {$ `6 p
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。
$ q, t. f# b% m$ U2 z- T, |; o/ z3 w/ J$ z; U9 G. N# l7 n
himr <address> <value>. sample: himr 0x80040000 0x0- Q* ~7 D; i/ p  r; ]2 n5 M
3 H- g* R3 `7 O, t! z
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。/ }! [& b) H% G* b! T
himr 0x80040000 0x005 k" B2 i# A0 X
himr 0x80040001 0x11
* Q& l. c& |, f4 ^7 a& qhimr 0x80040002 0x22
5 K* W* @5 o2 W- e  K7 ^6 C' W0 I7 Ohimr 0x80040003 0x33
, |: X6 ~  a: B3 X: Khimr 0x80040004 0x44( Q7 y+ k( z4 i# Z0 R: ~3 @
himr 0x80040005 0x55
4 m- S/ M9 I. K- i" w$ c0 a; p+ W# l% ~( C& N9 V8 l
SN也是类似。, E& e  |1 T( h/ Q, c( e
2 G# t* i& {+ X& U
现在主要是,谁告诉我们MAC和SN的地址?
% _5 ~9 }6 B7 k4 P# m! F
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37   r8 g% O  g& V+ F2 f
一直想找到运程修改MAC和SN的办法,苦于无解啊

2 S3 Q; |: n  a4 i源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
4 S3 t+ a6 W, b& V+ i
6 f: ~$ ^1 L3 c7 Q# q修改的代码早有了。到今天不会编译。- C  I6 C# B0 H, u
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>, {+ C8 b8 e& d' R
  2. #include <malloc.h>) N; A: R. A4 o. @. e5 r
  3. #include <sys/types.h>+ ^$ K1 v' Z0 l$ R' G
  4. #include <sys/stat.h>
    5 l& z/ z+ E; Y+ H5 z3 i
  5. #include <sys/ioctl.h>' y( l4 {0 [! s( Q0 Z& l
  6. #include <stdio.h>
    5 v+ M$ B; I; O  s, {6 A+ u
  7. #include <string.h>8 q8 w$ @0 {9 ^% r4 w$ d
  8. + Z% z+ u; T: T' w, w
  9. typedef struct {
    - V& J) o8 B; n5 Q# u
  10.         unsigned int        e2prom_cmd_sub_addr;
    " g* b( z" I' t& g' |
  11.         unsigned int        sub_addr_count;
    & V# B2 X+ Y# r6 ?
  12.         unsigned char*        e2prom_cmd_data;
    5 P* Z; x: Q) F- R9 o/ j$ C
  13.         unsigned int        data_count;
      {+ s, U% |+ q0 \$ E" _5 `4 j/ W
  14. } e2prom_s_cmd;
    ; W  U9 [# @$ |# `, `3 w

  15. " ^5 |1 k6 u" i9 l. v( [( Y8 [
  16. #define E2PROM_CMD_READ 1
    9 _8 s/ k$ f( H( c) q
  17. #define E2PROM_CMD_WRITE 2
    2 ^0 G8 l7 N) m; N' e
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"/ k, |. A/ d+ M0 l

  19. 6 {4 y9 c; A3 k, R$ e) Y3 b; M
  20. static int readparam(unsigned char *mac, unsigned char *stbid)* @+ y- D6 L6 H3 |, ]4 N- C
  21. {9 {) O# m; U1 s& F) k6 K8 @. s
  22.         int fd, ret;
    3 g1 d. c  ^' }2 P8 d
  23.         e2prom_s_cmd arg;
    . `& X" S6 ]; a! ]# y
  24.         unsigned char buf[0x18];
    6 t/ Y5 L  f0 E8 R6 q' |

  25. # Y' V! Y& U6 q( k  M$ m$ A# ^$ h
  26.         fd = open(E2PROM_DEVICE, O_RDWR);0 x- R! K- l* ]3 S* V- O
  27.         if (fd  < 0) {
    ( |+ q  W' I, \/ ^1 F2 z  f- W/ y
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    , X. k4 `, _& G8 {- i2 I
  29.                 return -1;
    * G1 G+ K" f: T
  30.         }) T2 E+ C+ d. y3 E
  31.         arg.sub_addr_count      = 2;
    1 e+ D* {2 L$ f7 O' K' J
  32.         arg.data_count          = 0x18;- n+ c0 ~; }' c8 f0 g2 D
  33.         arg.e2prom_cmd_sub_addr = 0x290;' L2 i- g' i7 f% {
  34.         arg.e2prom_cmd_data     = buf;7 [' i# F$ Z: H- {- I; c, w
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    5 `) A! D3 b* h, k
  36.         if (ret != 0) {
    1 q  R/ S4 q' ?# @2 @- G9 e6 w
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    - |2 w4 ~0 J* O2 j, [
  38.                 return -1;& u* ]& R/ \; p! ]
  39.         }
    3 j  [* \' B% J7 _
  40.         memcpy(mac, buf, 6);
    , _+ V2 S8 E* J" x7 }; ?1 b' J
  41.         memcpy(stbid, &buf[6], 18);0 e1 Q  a3 Y9 N9 N$ \+ _
  42.         stbid[18] = '\0';
    & r3 U1 {) u+ Q4 _

  43. 9 ^' v# ^9 }! A* L- j
  44.         return 0;
    8 |$ w6 O5 z7 t( _; \3 t
  45. }* Y" V  ]: T& e

  46. # P  K! U, B6 S
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)0 u* S- B& O3 T, I7 h  Y
  48. {4 V8 C3 b: h& G% b' g; {# k; C
  49.         int fd, ret;
    * g. I  W" c2 B/ r) J
  50.         e2prom_s_cmd arg;8 r) \- I# ]8 ?2 H9 j- E: n
  51.         unsigned char buf[0x18];
    5 a5 P" n8 R2 F2 |% t

  52. 3 h1 t. c% h6 \( ?8 {
  53.         memcpy(buf, mac, 6);
    9 U" P2 M, L; v" |% B& b
  54.         memcpy(&buf[6], stbid, 18);9 [8 ?. \# t* d6 l4 d9 j2 n
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    7 i* n6 n5 M9 t% l) c
  56.         if (fd  < 0) {
    ! U) ?% B2 c2 j1 h: l
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);/ L) F  S2 B) E- h) `2 \! _  L! P  H
  58.                 return -1;
    - M, g& Z2 e+ N" p0 ]
  59.         }
    # S4 B: [, ?  o- N( D( C
  60.         arg.sub_addr_count      = 2;: ^% a' Y6 o7 X3 a- o+ a) b# z
  61.         arg.data_count          = 0x18;
    8 t$ j" ], s& J3 `7 b; @& a
  62.         arg.e2prom_cmd_sub_addr = 0x290;: H% g+ r1 u: k8 j7 r& a
  63.         arg.e2prom_cmd_data     = buf;8 E: Z" s" q( Y1 v+ C
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    $ b* n% r4 ^2 w, P' N$ e1 \! l
  65.         if (ret != 0) {
    ) f  S% ]1 \' ?: J
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    2 F7 J' T0 t: c0 c4 Z1 d
  67.                 return -1;7 @3 m9 U' Q1 a! m
  68.         }
    " H6 K2 T! A  p3 L0 T5 j
  69. ! q% ?6 N( Y7 i
  70.         return 0;4 |# q# }1 y: K9 G. @; [* u" Z
  71. }/ I7 `1 n% C; V) g2 h5 Q; r- d

  72. & ]( e$ C/ x9 h3 P/ v8 I
  73. int main()3 m* _" Q+ V7 u! u5 H& W
  74. {
    ( k" d5 v# e' t
  75.         char c;
    5 F0 |& G$ F: S; V0 v
  76.         int i, macs[6];
    - o+ V& k, ^  ~/ y% i# S
  77.         unsigned char mac[6];
    & B" Z. Q4 |9 r, l. S3 H
  78.         unsigned char stbid[256];
    . k/ z9 L4 H. @( O+ H6 u

  79. % @- J7 Q+ v3 F  I  n
  80.         if (readparam(mac, stbid) < 0)# w1 O" W1 _3 S9 O  q# W' T
  81.                 return 1;
    : x& j' {4 u, B( q
  82. ; ]8 t6 w0 W9 S  _5 O: j& N7 p4 Z% V2 O; w
  83.         printf("Current parameters: \n");
    5 q" S4 {& l3 t- w  V
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    5 k, T9 r4 M8 `: h/ Z+ c
  85.         printf("  STBID: %s\n", stbid);
    ( A) m+ T# P/ p1 b
  86.        
    ' A! Z+ B# y/ t9 `$ y" |0 ?
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    7 h/ e6 u8 m/ T8 D. d" ]5 V+ O6 I
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    ) L  w2 h" B  X5 ]( V3 ~
  89.                 printf("Input MAC error\n");
      S; @: ~0 m% Z/ s( X  J8 t, ^
  90.                 return 1;2 v8 V- ~3 ~1 k; `  G, S. ?
  91.         }) ^2 Y. [( X: |$ B! o0 b
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    7 g: B7 E! k4 V
  93.         printf("\nPlease input new STBID: ");4 s$ z- G- L1 |2 g+ f
  94.         scanf("%s", stbid);9 r) g& p' Y; S, p/ b+ k$ |) W
  95.         if (strlen(stbid) != 18) {
    9 S8 c( g" H, Z% V
  96.                 printf("Invalid stbid\n");
    7 J$ J/ C& V& o/ x
  97.                 return 1;
    * _& y& p* Y  @7 R" Y
  98.         }  ]* q9 p! p3 g& N1 e7 t# b
  99.         printf("\nNew parameters: \n");
    ' U/ [/ C0 G2 e# o: G2 H  w4 I/ t) n
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    $ p2 h: I9 V( y: K
  101.         printf("  STBID: %s\n", stbid);$ O1 n' A$ z0 m3 N

  102. # z8 f5 ~% c- y4 p. E
  103.         printf("\nDo you want to change paramemters? (y/N) ");  N5 n) k/ i. ^, G
  104.         for (;;) {
    * P1 p3 ]" \1 w2 t. K& u
  105.                 c = getchar();
    & ~4 i, W1 h6 f( Z5 |0 X9 F' F
  106.                 if (c == 'y' || c == 'Y')! Y' S  ~1 g3 Q  x& X% s5 I) ^
  107.                         break;- L# N; Y1 V. \6 V, _- A6 Y
  108.                 if (c == 'n' || c == 'N') {; g. B2 d1 G# S' s8 g# W
  109.                         printf("\nAborted.\n");
    , V6 S% s4 m+ Y! @% c+ n$ v( s
  110.                         return 1;' r3 K" v9 c/ \% {4 w6 Z, q0 K
  111.                 }
    & i' E! T8 a' a1 S- o$ o& @; o
  112.         }" ~8 u1 }; n1 ?% s
  113.         if (writeparam(mac, stbid) == 0) 7 N  @/ j* U, {8 |' L$ J, b
  114.                 printf("Parameters changed.\n");" C/ `8 @3 X/ s

  115. $ m4 S3 }/ E% C; |
  116.         return 0;. `9 @" @8 ]) p$ u) V
  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 * [2 Y+ Z$ ]7 I3 y; |, Z
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
% E  W* G% B% Y8 F: I5 b/ a
你用的编译命令行格式是什么?
4 _# |* v: N) x1 r- v/ i. [6 x, e  N
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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