查看: 17184|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    ' k/ @: N" L( [0 i& o: I
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    , z4 x: \, p  ]; h3 D6 l4 L
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
, |+ E* d& Q& Z% R! Kusage: himr <address> <value>. sample: himr 0x80040000 0x0
" @4 Y: |4 l' \, F7 B
) X/ `1 k- S) j  k% O
" L3 z# _5 t2 i; T不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
: e, U& b$ I. R; o& |) d5 Z& x' S4 g1 k
补充内容 (2012-3-8 09:42):$ c6 Y# a& D; X: g- c, ^8 t$ z6 T
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
; g5 h& i0 B. l* V2 |4 I这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。# `1 v. s0 c8 m5 C" g( `. i( i. @
+ }( C4 C& Y  D' U
himr <address> <value>. sample: himr 0x80040000 0x0
' w" a! l  A. Z& g  M# W& Q* p
. L5 R1 `; v; F1 X, Q# z$ z例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。9 A% C/ V( g6 L& l% r& I
himr 0x80040000 0x00# A# b* W3 o) v' e: P% J) k
himr 0x80040001 0x11
0 u0 T- I* l/ p1 U. T- j" s& L' Vhimr 0x80040002 0x22
; f( \8 b, R% |& ghimr 0x80040003 0x33
3 u" N0 A! |5 t# uhimr 0x80040004 0x44
' x  D9 r& d: Z$ d% A$ khimr 0x80040005 0x55
) ]$ `! N' n! D- c
0 v- h2 n. {, q$ g( ISN也是类似。
$ W9 U# [/ c0 S9 F+ b  N
5 e) V5 A" q* f! H& E* H7 x现在主要是,谁告诉我们MAC和SN的地址?
( P% s. P7 [/ I) E6 q
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37
& ]' M" R% c% Z一直想找到运程修改MAC和SN的办法,苦于无解啊

0 C& R  t5 _  L& L6 r; `2 L9 Q源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
& D, F2 B  j' t( O/ F1 E, ^* g+ V/ r# F: y7 R
修改的代码早有了。到今天不会编译。
, ?2 S  ?" M6 g; c5 }! p需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>. S" z- n5 I% Y5 ]2 ~
  2. #include <malloc.h>% Q. j+ R) p) S4 A
  3. #include <sys/types.h>1 Y% `  v9 v& x& Z8 R! `$ ^
  4. #include <sys/stat.h>
    8 `1 a9 |/ i* O' v) q
  5. #include <sys/ioctl.h>- a$ K3 s/ c2 c& f: h1 Y; h) y1 ~! g
  6. #include <stdio.h>
    % l: [6 |3 v7 [4 q* F9 \% I5 [3 m" @
  7. #include <string.h>' w7 X3 X& R. G% ^; R
  8. 5 D1 v# y' h% e% `" K/ A2 J+ ?
  9. typedef struct {& g5 }5 m2 w7 _4 {- X" F
  10.         unsigned int        e2prom_cmd_sub_addr;& r4 J5 Z0 Q+ s
  11.         unsigned int        sub_addr_count;
    ! L  h" V: z) C5 R. A, j8 Z3 n
  12.         unsigned char*        e2prom_cmd_data;: a' H9 Y- f' C" T
  13.         unsigned int        data_count;8 O! K( X3 W8 m  @, f' D7 K: W' _- `
  14. } e2prom_s_cmd;
    ; {6 q& I3 \. K6 ^

  15. : C; Y3 j0 H. j$ G3 s
  16. #define E2PROM_CMD_READ 1
    8 s+ \& t5 P9 l* r' ~  p3 d
  17. #define E2PROM_CMD_WRITE 2
    " F* m/ o  K6 i" d, o
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    ) \7 Z# e# }. T( h
  19. ' e7 }+ }; Z7 [& d
  20. static int readparam(unsigned char *mac, unsigned char *stbid)8 S. {5 J4 m- w, y8 X
  21. {
    ( ~8 G3 C, ]+ M/ r/ |. U$ l
  22.         int fd, ret;
    8 e( V4 J+ C* Q: A2 r4 ^: n$ x
  23.         e2prom_s_cmd arg;
    + M& U1 |1 l$ }. i
  24.         unsigned char buf[0x18];6 c# E, \% w, @% K1 D& E# Y+ S- v
  25. 4 u+ R& [( x1 J# ~9 i+ S# X
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    ' D% b  v0 T* ?# N* ^' j
  27.         if (fd  < 0) {+ w, L: y6 L+ j5 S# q* m% H4 {
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);' R% p) n% M+ @+ U2 N! f# c
  29.                 return -1;
    ' D* T: ~, l( K3 _
  30.         }8 n  f- A$ Q/ r" b7 I5 o
  31.         arg.sub_addr_count      = 2;
    1 b5 u1 F% M4 }4 M, ^" L
  32.         arg.data_count          = 0x18;+ T/ L3 X* A/ G& U2 U" c
  33.         arg.e2prom_cmd_sub_addr = 0x290;) G0 F7 B; Q  T
  34.         arg.e2prom_cmd_data     = buf;9 w8 l- Y2 n- {- y
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);! {# c5 n+ b4 ?0 o( }3 K7 G- x. Z; G* x
  36.         if (ret != 0) {
    5 S$ U; G4 U/ r' i
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    ' o. \6 |8 }1 ^# z) o
  38.                 return -1;8 D9 U6 p) [" b; Z
  39.         }
    ( P1 F8 C2 H# |' p
  40.         memcpy(mac, buf, 6);+ K. J8 U7 R1 N( @
  41.         memcpy(stbid, &buf[6], 18);; N/ T- u; s9 C1 z' S
  42.         stbid[18] = '\0';
    1 w/ l# F7 `2 M$ b) l3 t1 I
  43. ! o  B  G8 b0 {- j, b
  44.         return 0;3 H; ?! O5 _/ X
  45. }; Y3 t3 p9 T2 q3 t* ~: R. N

  46. 2 r# F# J& f5 E8 _) ^& k) Z
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    9 j- a( p. C5 H& ~- P% j
  48. {
    " Z) Z3 M8 f/ {; x4 s
  49.         int fd, ret;3 V) z, X$ g0 \5 T
  50.         e2prom_s_cmd arg;
    6 A0 ]2 `: z- \/ V2 P# K0 `
  51.         unsigned char buf[0x18];  I1 w- j/ b6 L. c) E8 @. P

  52. + a& b$ e5 K: Z; I1 |
  53.         memcpy(buf, mac, 6);
    7 v% i" J* D! S: Y; c
  54.         memcpy(&buf[6], stbid, 18);" j) L" ^* b6 v+ R: a
  55.         fd = open(E2PROM_DEVICE, O_RDWR);8 U# E7 H9 I0 b5 ?
  56.         if (fd  < 0) {8 g4 T) M+ p: u0 L
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    5 Q- ^4 q" }8 A1 U
  58.                 return -1;
    5 r9 P# u/ Q! W+ \# j9 ]' ~
  59.         }% }/ H; g% V1 w6 _2 ]; y
  60.         arg.sub_addr_count      = 2;/ G9 \/ q3 S2 h5 p
  61.         arg.data_count          = 0x18;( j: E" n2 v$ k( ?. L, m1 R
  62.         arg.e2prom_cmd_sub_addr = 0x290;. ^- h+ N/ ^4 S
  63.         arg.e2prom_cmd_data     = buf;
    2 n; j% P0 A; Y9 L% C+ a* O
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);' t8 s* S$ B$ |: c" y4 `5 d
  65.         if (ret != 0) {
    5 {8 W# M1 m# }) T0 f9 b
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    9 L, G! s. }" _( u/ |
  67.                 return -1;' d' A( S0 L8 m# k7 J
  68.         }
    9 {$ n+ V- s: C! h) I0 f; a

  69. 1 s7 J$ \- v& R* Z2 ]
  70.         return 0;# k; ]/ t/ M/ y5 ^/ y! t5 b5 I+ E7 x
  71. }2 o0 c1 z; o6 W3 N8 `) C

  72. 9 o4 t4 I, w8 I- T8 G
  73. int main()( Y8 p! k* V2 s1 d( ?2 S# X
  74. {" j2 v; Y7 n' ]- Z
  75.         char c;3 T+ w+ I( K, g" {1 T
  76.         int i, macs[6];7 S9 C* V0 |* G% T9 d3 O
  77.         unsigned char mac[6];- P5 C" |& r' m, E& o  h
  78.         unsigned char stbid[256];
    ' w+ t6 Z! a5 f0 j4 N6 A
  79. 9 G$ {- W; R9 d1 M' j$ ?: K& b
  80.         if (readparam(mac, stbid) < 0)
    1 [9 m  H" O" ?; [1 D
  81.                 return 1;! s0 }, x* b# y- Y4 Y/ ?/ G) b, s

  82. ' K" |# f. P9 n( k9 d* _& F+ S# P( Y
  83.         printf("Current parameters: \n");: p. e0 l! Y* [4 F
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    ; N8 o% T+ p, Y; q: l: t% G( g7 X
  85.         printf("  STBID: %s\n", stbid);( j7 x& O' d6 H0 D
  86.        
    + V/ E# m" U7 N0 i
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");8 ~4 t: {9 V4 O1 G& G
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {8 E; g) e/ }# O' v, C2 f( J, S2 W
  89.                 printf("Input MAC error\n");
    # G9 \6 [/ W, [7 B* z) i
  90.                 return 1;
    - K, V  k( |2 F& ?
  91.         }& C. [7 ]' Z1 ?6 z
  92.         for (i=0; i<6; i++)mac[i] = macs[i];/ t8 F$ U2 e3 k
  93.         printf("\nPlease input new STBID: ");, W7 h/ K5 C0 e! q, l5 W
  94.         scanf("%s", stbid);
    . U/ T1 G" _( v0 Y, \/ Z
  95.         if (strlen(stbid) != 18) {
    ' Q4 G" `! P; r) [. e7 `
  96.                 printf("Invalid stbid\n");
    * u& i4 ^6 \; P" N* Q/ P
  97.                 return 1;! H( k4 n- ]4 l& q, Y! S9 o
  98.         }
    7 ?( }9 F" t' T: o
  99.         printf("\nNew parameters: \n");% B, Z8 D# m5 k  C* ^' w* }
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    / E8 b+ V" V7 R! u
  101.         printf("  STBID: %s\n", stbid);
    ) Z. H; ]7 m, L8 n
  102. $ i5 V2 N. e' _7 f" `- ~/ N1 Z' c
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    + {( F+ e* s  E6 U- d5 n1 Z
  104.         for (;;) {
    ) ^# \0 v5 b3 J2 {$ a
  105.                 c = getchar();
    , K1 L$ x6 G5 i' t1 Z. Z# i
  106.                 if (c == 'y' || c == 'Y')
      L0 p. d4 I5 x' `/ A
  107.                         break;+ N% ~9 v; O0 W. ~# |0 t7 Z
  108.                 if (c == 'n' || c == 'N') {! v# c. c( n. q: M3 ?5 E' D
  109.                         printf("\nAborted.\n");
    8 O* k2 q  |, g& m
  110.                         return 1;
    1 l/ W% b; k! H, y" B/ M% n+ k
  111.                 }' O: S5 z+ g" V1 B# V' M
  112.         }. e: ~1 l' a, N7 K4 z: h5 q) C
  113.         if (writeparam(mac, stbid) == 0)
    : n" p+ t% `6 W1 n- |9 p
  114.                 printf("Parameters changed.\n");0 C9 D& Q/ c0 M' J* ~  R

  115.   [+ \3 P' R) b7 q
  116.         return 0;* F( e, Y3 G( M  W
  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 $ g* X1 F! H8 r% G
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

& K, b( \1 H0 r' C) O1 s, y0 m: K你用的编译命令行格式是什么?- b7 O9 m, ^0 f* v3 w( 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客服返回顶部