查看: 18079|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    ) X7 i) v. p5 }* d# L+ [! Z
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    6 F+ g, Z$ w7 N# l. ]
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
5 |: J9 h: Y- H2 i) N; ]; Xusage: himr <address> <value>. sample: himr 0x80040000 0x04 q# C; M3 u9 I' k4 J8 R) u. C

8 I0 F8 {8 x6 c; {1 p/ B/ g# y/ Y( y' O4 M( v
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
6 ?$ M; M3 n3 Z2 u! t( C8 \' F3 N/ P5 k" {7 ~2 |% M5 C6 c) A
补充内容 (2012-3-8 09:42):
+ _) N3 U8 h6 @5 y+ b2 t: hhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
! R! m) W: w* f6 J* e  {7 d这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。. s0 H$ A# r6 P' b

. s  O5 m9 t: X7 @/ Bhimr <address> <value>. sample: himr 0x80040000 0x0
  l+ I) j7 m# H  y
! ?6 {4 \' j* P  |/ }* D5 L: r例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。! V6 W  q% E- V  {1 R
himr 0x80040000 0x00
; i; Q8 ]- }& Z, G6 dhimr 0x80040001 0x11
( x" H0 {9 {+ u, ]0 fhimr 0x80040002 0x22
! B. P7 s- |' C* Y5 k- z5 Thimr 0x80040003 0x33
! G) u7 Y* D, f, c4 ?himr 0x80040004 0x44
- U/ u6 F* ^  rhimr 0x80040005 0x55
% R; O7 n7 O, o( u2 T/ g1 H, t5 ^5 k2 i$ ?( j: ?
SN也是类似。/ v7 t5 O& C* {* S! c# m3 a

( T0 K- g# r6 A" ^' X2 Z9 ~现在主要是,谁告诉我们MAC和SN的地址?
* ~: _: L+ J6 u0 S4 q. b
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37
1 L: y. q1 O; g) n$ F5 \; Z一直想找到运程修改MAC和SN的办法,苦于无解啊
# F' j) {, g/ Z! U
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
$ t8 |7 j$ [+ i8 a3 k
: o( S8 Q0 A$ L# ]* M0 }" V! q修改的代码早有了。到今天不会编译。5 Y4 A) E1 q. P5 K( A* O
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>7 W/ B% X' }9 y! q# g- |
  2. #include <malloc.h>6 f; _4 T( c! ?* K4 n9 Q0 R
  3. #include <sys/types.h>
    : S. w9 z) n* @" m2 s0 E
  4. #include <sys/stat.h>6 Z* \; |. g, @2 e
  5. #include <sys/ioctl.h>
    ' {' M: T! d; o3 j9 d/ z
  6. #include <stdio.h>
    6 D4 G4 B( f& e: V; q
  7. #include <string.h>
    & h9 w6 Z* S/ x$ r) v( C. s5 f
  8. $ R8 I1 P4 d3 g5 Y& H! \! x' _- o$ O
  9. typedef struct {
    ' k, k- b2 i: v! b( M4 Y. v
  10.         unsigned int        e2prom_cmd_sub_addr;, z7 ?, Q6 \' L( i! L' q5 r
  11.         unsigned int        sub_addr_count;, K, r+ E4 c' A" Z' L& t. {
  12.         unsigned char*        e2prom_cmd_data;4 k/ d; ~& Q% M) S+ c6 n8 f  x" M$ }
  13.         unsigned int        data_count;& U: ^& ]/ h0 f
  14. } e2prom_s_cmd;
    " V4 {4 S* |; r
  15. , x  S5 `& d0 i1 w9 h
  16. #define E2PROM_CMD_READ 1* K5 Z, N. ?; T9 n3 }
  17. #define E2PROM_CMD_WRITE 2# e/ X4 P* m8 l+ l4 W- |# z
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    1 K" A/ y  ^5 E/ F" N

  19. & E; l0 A' u+ m+ J4 {. O
  20. static int readparam(unsigned char *mac, unsigned char *stbid)* T9 Q) L" g3 i& ]+ f: e4 S$ q
  21. {
    9 Q2 u! w& ]7 E% r( Q2 @  ?
  22.         int fd, ret;1 P) \  Y3 x& a
  23.         e2prom_s_cmd arg;1 n+ v6 j8 l. B1 j6 H  A1 Y
  24.         unsigned char buf[0x18];
    0 i/ c3 o3 S! b7 B, C

  25. 6 k! q" _* z- }" Z' H$ d7 P
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    ; H8 f) p, o2 I
  27.         if (fd  < 0) {
    9 U' y4 B9 q& L0 Z" u0 I- k
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ' |, D" S6 w* t: G+ Q
  29.                 return -1;% \- P0 o2 f) x) z$ x" Q/ N
  30.         }- c/ ^2 v& r1 f
  31.         arg.sub_addr_count      = 2;3 H# P6 n4 W7 `) e
  32.         arg.data_count          = 0x18;
    9 c7 K9 X7 b0 ?$ ^1 D# y
  33.         arg.e2prom_cmd_sub_addr = 0x290;# l0 f% z" L9 {: S, q9 k# M4 c
  34.         arg.e2prom_cmd_data     = buf;
    ! K2 q9 j8 f1 [) {, m7 O
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    * I& ~# }+ H9 T6 Q: B
  36.         if (ret != 0) {. L% [2 r: M* I+ \4 z0 H" w' y2 n
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    # r1 K7 z2 x' i( B( x
  38.                 return -1;
    5 C0 t8 A( H5 ~2 Z: p' R
  39.         }
    9 h6 I% s" k0 q4 Y) h- H
  40.         memcpy(mac, buf, 6);
    3 q8 Y' S; Z$ D- O& V. Z
  41.         memcpy(stbid, &buf[6], 18);& O6 K& D& H  n- j1 q& A6 f. R5 p
  42.         stbid[18] = '\0';
    2 K& W2 E3 }8 B
  43. : x4 w5 S' v8 w/ H
  44.         return 0;
    # _8 s, ^% p- }, q: w7 M7 C! }
  45. }
    2 D9 N  u: k( I) r+ _7 N" Y
  46. 1 P; d8 Z. ?' @, h
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)' J: p1 U& v& s* ]; p) B
  48. {# d4 T" A* @& P0 g! ^7 L" b
  49.         int fd, ret;
    4 F2 r: L+ M* F6 i* `- }& b1 D
  50.         e2prom_s_cmd arg;
    " D! l  E6 ~- i. w% p- I& i. _
  51.         unsigned char buf[0x18];% @- N! l" q' l8 \& K% I
  52. 5 E& [# K  A2 `3 |
  53.         memcpy(buf, mac, 6);: F& b0 p6 u* e* O- ^
  54.         memcpy(&buf[6], stbid, 18);
    5 R: R: a9 w. F2 a) R& ?# O+ |- S+ Z* w5 G
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    * M4 X8 M+ {7 `( b* h  Y
  56.         if (fd  < 0) {
    ! ?2 C! Z+ |8 L) \1 c
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);5 n& `- S( s% y7 j
  58.                 return -1;; Z: B- g+ }- X- o* M
  59.         }
    + h0 \+ ?4 j7 B, Z6 o2 m2 c1 a1 w
  60.         arg.sub_addr_count      = 2;
    ! S& s% v2 M" K7 J9 w
  61.         arg.data_count          = 0x18;0 F+ f( U( E( c3 L5 P
  62.         arg.e2prom_cmd_sub_addr = 0x290;4 t' o4 @+ C. k
  63.         arg.e2prom_cmd_data     = buf;# m" ?( k) a8 L- @" p: ]7 f$ ]: o
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    9 y7 R+ G5 k8 m2 r; b6 ?
  65.         if (ret != 0) {
    0 x: L5 h2 I. R- q
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    - y( \' h9 E. |( g
  67.                 return -1;' w! ^5 z! A$ `7 {, H1 W
  68.         }
    & s5 X" P) ~6 c
  69. / ?+ c% w- q3 m  \1 q) K/ r( Z" [
  70.         return 0;" Q9 h0 J2 U- u# s, s+ p
  71. }$ V/ e. W8 K7 C  j  L1 M

  72. * m" |+ Y: |" p1 ~# v
  73. int main()# u3 V# c7 C) e4 W
  74. {
    ; {6 |9 b+ Z3 G6 ^, f
  75.         char c;
    1 x; t/ U' l  }! A5 {
  76.         int i, macs[6];2 m4 V3 |9 R' y
  77.         unsigned char mac[6];; @( @( U4 I. X$ g, R& C; S
  78.         unsigned char stbid[256];5 Z- ~# o; G' |6 R( v9 {' T' r# p
  79. ; T8 C' Z. e4 U* V: H3 \
  80.         if (readparam(mac, stbid) < 0)
    % t( u' T, R6 W6 U9 i4 J
  81.                 return 1;- m/ |- T; V0 R# s, G. @% `' I# p  O
  82. 3 n+ D) s; l2 m) |6 _2 x) H
  83.         printf("Current parameters: \n");
    * T( z9 ~" |4 C2 w7 m6 Y& `
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    9 f% M/ g" y' C4 f: H: P/ A) F
  85.         printf("  STBID: %s\n", stbid);- }0 I# f' \; F- Z& J! d2 x8 r
  86.        
    . g$ F- k. ?5 ?/ c" ^
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");: n$ Y5 W2 \5 C8 \+ |- ^% c
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {5 W+ ]( |; M" Y7 ^/ _7 _. h
  89.                 printf("Input MAC error\n");( d& h7 v' G# p# H, m- i: u( N5 h
  90.                 return 1;
    + ?7 C( n; _$ \% i8 U7 k
  91.         }2 q2 e# f( o# X$ ]! w/ I" M2 Z1 s
  92.         for (i=0; i<6; i++)mac[i] = macs[i];0 m4 v- S3 l* n7 Y0 d3 d# h
  93.         printf("\nPlease input new STBID: ");
    & y6 D2 S, d+ Z! L; W# s) X
  94.         scanf("%s", stbid);
      g* w* V+ M3 f! w! S+ S
  95.         if (strlen(stbid) != 18) {" W0 I) T* W, S. |3 X
  96.                 printf("Invalid stbid\n");
    $ D. b1 ^% C5 N$ y; j+ C
  97.                 return 1;6 p3 q- j, _/ t( _2 ?  E
  98.         }
    1 W3 l$ J  ~, E# J
  99.         printf("\nNew parameters: \n");
    6 x, ~& `/ C) e$ k4 {8 Z
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    & m$ [, r1 c3 B% Q. L" ^) C5 s
  101.         printf("  STBID: %s\n", stbid);
    8 Q  n- F" s! N- E

  102. + P+ Q( O' i0 i2 {5 U
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    " Y0 V) `% E# `. u! D
  104.         for (;;) {5 O3 i3 {3 i% }  \$ c
  105.                 c = getchar();
    ; B1 h" A1 j) U7 l& }* j( d
  106.                 if (c == 'y' || c == 'Y')
    ( ?) A: [" C5 O! U
  107.                         break;
    0 b7 F$ g1 e7 A) d- k2 F
  108.                 if (c == 'n' || c == 'N') {
    , `% A$ @0 T! \) M
  109.                         printf("\nAborted.\n");5 s: z! E1 e: H: d0 l3 K7 ~
  110.                         return 1;" M' i+ f. }8 |- j, L0 f; {9 j
  111.                 }
    ; D- y( X6 X& O2 N) g: i6 i
  112.         }
    6 |6 c8 I# O: J. g
  113.         if (writeparam(mac, stbid) == 0) * v! y9 i% P# J' k$ m6 j4 }0 [
  114.                 printf("Parameters changed.\n");
    7 j3 t8 }& P; y- }, ?1 L! ?* g) {

  115. 3 R- N- Y7 [1 }2 R
  116.         return 0;
    ( K: X# ?: P$ |4 k; B
  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 q8 ]" `1 Q8 c- p' e7 M9 w
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
8 T; F! y8 z1 o6 |7 U) Q* M3 i
你用的编译命令行格式是什么?
6 M3 A( Y  H7 I8 c' }: _1 t
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

在本版发帖返回顶部