查看: 17465|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    2 F7 o8 Q, q1 L) G' |' U
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig7 \' s$ e+ h2 }0 v. {
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:* s) s, v- G5 t, S
usage: himr <address> <value>. sample: himr 0x80040000 0x0. Q2 T3 S8 I# |$ O' g, ?7 c" q+ C

( Z: h3 g7 g/ A& j8 Z
- K. P; X4 E0 ]0 \1 m8 x0 g0 u不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?7 p3 `9 Y. A& B; [5 X8 l& J: W( ]6 \& Z
# L8 s4 E# @5 u5 x  O
补充内容 (2012-3-8 09:42):) c+ @8 @0 N: n: T( r
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数" W( w+ ^- p4 N: R/ X
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。
$ Y5 C7 b; _* B0 b, \% H
! N- _8 J, x/ s/ [0 Jhimr <address> <value>. sample: himr 0x80040000 0x0
$ Q  o  ~, a% X' v8 [7 s% ^
; h! _0 O- J; w9 U+ W# x例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。& w/ p5 r' ~, \' \2 A1 v
himr 0x80040000 0x00# X- g1 Z$ X% V5 H, y
himr 0x80040001 0x11
' j* o3 l( x$ \9 Lhimr 0x80040002 0x22
7 P% Y5 m, S& I5 ~) phimr 0x80040003 0x339 X" y1 j4 V1 k. m! [/ k
himr 0x80040004 0x44: R5 m' B/ M3 @( z6 i" P9 I, X
himr 0x80040005 0x55
. w+ o" T  ^& @% d6 m# {8 s7 U& |& E8 F% C; z! F1 `2 j
SN也是类似。2 Z: `  g. s* D

8 P/ S* @3 z  ?+ g. U" l9 I" r  L3 L现在主要是,谁告诉我们MAC和SN的地址?; e/ d2 A) z& O5 y# o8 Y6 w
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37
8 C, h+ E8 R5 v5 v一直想找到运程修改MAC和SN的办法,苦于无解啊
. `3 W8 H4 ^3 ?* |/ R1 b/ q
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 ' [5 T/ `1 f" i% g7 B2 ~
1 q( g; t& |+ ]* `. g2 I
修改的代码早有了。到今天不会编译。2 g1 z' S6 q1 g" S  I* V, ^# D
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>& t; {  F) M6 `2 @
  2. #include <malloc.h>
    & U& h. |" d" k! d; G, L( b4 ]3 |; s
  3. #include <sys/types.h>6 X/ @( r3 ^! K$ {3 i" L8 D
  4. #include <sys/stat.h>2 S, ~5 d& V# h) S3 u! P# s) q
  5. #include <sys/ioctl.h>! n+ Y& L8 ?9 f7 {( T1 d2 {- n
  6. #include <stdio.h>
    7 R& |+ g: o3 ?3 l$ r9 Q& s
  7. #include <string.h>
    * `" w8 v' V2 h  [. e# a

  8. 6 B% p/ m4 b% I, B
  9. typedef struct {3 k" w' M1 }, @) a# g7 h
  10.         unsigned int        e2prom_cmd_sub_addr;" g/ c5 M0 l- O; W+ D
  11.         unsigned int        sub_addr_count;9 {4 F" [/ r* c* |* r
  12.         unsigned char*        e2prom_cmd_data;* C. `  r; j+ P) u
  13.         unsigned int        data_count;- ?6 @" l0 W. d$ L& q" |
  14. } e2prom_s_cmd;$ `! ^* ~( Q! R' r1 c8 a) [0 x

  15. 6 P) Y8 D3 ^% Y
  16. #define E2PROM_CMD_READ 1
    , }3 j/ U" s  T2 m1 ~* t
  17. #define E2PROM_CMD_WRITE 2
    9 v- f6 o$ r. \
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    8 x6 c7 u' V0 c7 n) [  Q5 ^+ c

  19. $ G$ t4 j7 T: K) A1 z+ m0 {9 \
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    ' a" @  J# n3 o
  21. {: z$ o) ]. h- _; B: r! y
  22.         int fd, ret;4 y# {5 v$ K8 t- g) v8 x
  23.         e2prom_s_cmd arg;, @* M  |7 I6 c: e. t
  24.         unsigned char buf[0x18];* j9 _) n* ^9 R0 h; S/ d

  25. % D) r7 M1 P% p0 O" d
  26.         fd = open(E2PROM_DEVICE, O_RDWR);! T" I- z5 O: Z: Z9 C
  27.         if (fd  < 0) {
    7 I( e2 c9 r* w/ \& m, S- c# N
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ( X2 w, I- Z5 {& U+ B3 I
  29.                 return -1;7 f. t- Y. L# W+ U) e" y
  30.         }7 d" O1 |5 H9 |$ d0 ]
  31.         arg.sub_addr_count      = 2;
    ' D2 F! @$ h1 J  H# F
  32.         arg.data_count          = 0x18;
    $ W7 Y2 h6 o; s6 C' @, R
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    * S1 F, K  ^' L# ^) q
  34.         arg.e2prom_cmd_data     = buf;
    2 C/ C. Q# C/ i& ~2 q% i+ A
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);6 T( s, U, M# Y/ k. y5 F" o" L
  36.         if (ret != 0) {0 J& K( U2 u# h  b8 ^# a% C
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    - J! P. p6 W- q4 f* x- O
  38.                 return -1;
    , _, K1 \1 g( P  t) e! J# G
  39.         }
    4 _8 K3 n1 z' l  e1 k" D$ h) F
  40.         memcpy(mac, buf, 6);6 {  C* x. q4 J& p& \
  41.         memcpy(stbid, &buf[6], 18);
    5 i0 [& L. R' x+ k( Q+ ~) M  W/ i5 f
  42.         stbid[18] = '\0';, \! s+ }3 I; l9 Q( H' _
  43. 4 K+ c( C# P0 _
  44.         return 0;. W% J: }+ }& x( P
  45. }
    6 x6 B, l5 o% O# L( P$ V  P  B8 m

  46. 4 S# ~6 c2 r% q$ @
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)/ k7 A( g+ f. v) `
  48. {9 Q5 S/ v4 O' X$ l
  49.         int fd, ret;
    % ?- D4 c( v# m$ M, K* m) D
  50.         e2prom_s_cmd arg;) s1 i" \# r9 e: c4 C
  51.         unsigned char buf[0x18];
    7 H3 Z# H# A. ~# g0 F7 U6 K
  52. , i  u+ A1 y; c' f* P, x* `# U( M) \
  53.         memcpy(buf, mac, 6);
    - u- t. P6 M. W! q2 N) R% R
  54.         memcpy(&buf[6], stbid, 18);
    1 [; a1 P) n: U) k! A
  55.         fd = open(E2PROM_DEVICE, O_RDWR);6 J' z# j8 Z$ k' w2 F' T/ ^
  56.         if (fd  < 0) {
      i: Z; {' n1 z8 I* n( z( ?7 O2 f
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    5 P+ z4 Q. G, q0 G: t
  58.                 return -1;" g' p; B7 E! {' _$ C
  59.         }% A$ {8 v" E9 g
  60.         arg.sub_addr_count      = 2;
    ! w' [3 Q$ z, W. T4 Q
  61.         arg.data_count          = 0x18;1 `5 Z; F# t  @5 `9 s0 j* b
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    % E, y0 Q! Z( l
  63.         arg.e2prom_cmd_data     = buf;) K- a/ A+ ^, ~
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);6 f3 Y# b+ a  b9 ], e
  65.         if (ret != 0) {* }: w0 |$ k9 b' C
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    . f% ~/ \, U. N; \5 h5 Z* I9 k5 y
  67.                 return -1;
    9 ?( a" ~# ^# P% O  L
  68.         }
    " B) W/ K0 z" V; }6 X

  69. ! a* i4 s& a- \! |
  70.         return 0;: }8 Z2 f4 D5 g, V
  71. }) A, V- C, [2 M8 p3 l
  72. 2 b) p0 t, S* i5 d/ h  ~' I
  73. int main()  w: v- ]4 f2 ^/ X( T0 `( c
  74. {
    ) {) E2 c7 y" N3 L$ [
  75.         char c;4 z2 v4 n+ L. r/ h
  76.         int i, macs[6];+ A7 b9 d# `6 B' L
  77.         unsigned char mac[6];' x6 @* b' `! w" A5 W
  78.         unsigned char stbid[256];% I2 v7 @$ c% @1 z
  79. 5 X4 M+ f$ K! l( f* H2 J
  80.         if (readparam(mac, stbid) < 0)7 b- [7 N- T. I) C1 d
  81.                 return 1;6 Z6 K: c6 f. o6 S* f+ i

  82. # x& u. d6 ^8 h/ b: e3 S
  83.         printf("Current parameters: \n");4 n7 s+ M; K) Y
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);" Q7 g4 l+ s) w+ x: H
  85.         printf("  STBID: %s\n", stbid);
    * z$ ~; f; X0 ]& `
  86.        
      Y/ s6 e6 o8 L4 |+ S* ?
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");7 {3 l+ k; t7 C3 z: s, G" M
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {# G; e* m8 a( G2 e! R# y9 n
  89.                 printf("Input MAC error\n");
    0 ~8 i5 ^5 E+ `" d! Z8 K- ?
  90.                 return 1;
    ) m# \* z, h2 a0 F% O, w# U4 ^
  91.         }
    5 A# @( B0 a1 v5 d# I+ ]* A# [
  92.         for (i=0; i<6; i++)mac[i] = macs[i];4 S' F1 M% U7 q+ E( {
  93.         printf("\nPlease input new STBID: ");
    ) A5 g3 T  F' b- A4 o* u  V+ B5 P7 u
  94.         scanf("%s", stbid);* t: ?' r- m4 p
  95.         if (strlen(stbid) != 18) {
    ' R- d5 W' I9 H" `( l! g1 H
  96.                 printf("Invalid stbid\n");$ ]0 b) U3 E& ~) Y3 E
  97.                 return 1;
    3 P* c. z$ T7 }) N7 O+ x9 R
  98.         }
    7 f& f: F3 }- q4 M
  99.         printf("\nNew parameters: \n");' C0 y& L2 s# @, L
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);* P) y9 Z9 G: t5 L9 f, l
  101.         printf("  STBID: %s\n", stbid);
    0 H7 M/ \" [& C4 j0 W+ \$ @
  102. % _( y3 @, E' c% _
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    1 A6 \. }! m" p1 }! w, @! ]
  104.         for (;;) {
    1 o5 Y' h( d# }# ?7 ?2 R( F: p
  105.                 c = getchar();
    ! m4 b% H0 V. w
  106.                 if (c == 'y' || c == 'Y')
    . Y5 f& o: F: K% |8 O
  107.                         break;
    * S; R: D0 u: a/ Z0 ?* E) `
  108.                 if (c == 'n' || c == 'N') {
    ! S/ `3 P% z' j2 F' {' k: ]
  109.                         printf("\nAborted.\n");1 I/ F  \! R4 D, q
  110.                         return 1;
    6 _0 {& ]' z4 R2 u9 f
  111.                 }
    5 f$ w) M; j6 [* R
  112.         }* S+ y8 Y+ a' v6 c0 v; [
  113.         if (writeparam(mac, stbid) == 0)
    / h$ o" G9 O0 B
  114.                 printf("Parameters changed.\n");2 |& y1 L8 p7 Q* ]; [/ i

  115. 3 o/ W9 `) U  ?) T8 Q
  116.         return 0;
    0 X; s$ }/ 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   s5 j' R; t% U0 ~
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
+ T0 `' r5 H. n+ |
你用的编译命令行格式是什么?
: V; f& n3 \. S$ A) H
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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