找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15503|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    ( p2 ]- G9 J* H+ u8 e( D
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    ; R0 A% o/ V1 Q# N, O! F) z
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:# N9 w+ P$ W1 |2 z8 v: p1 n
usage: himr <address> <value>. sample: himr 0x80040000 0x00 c6 R2 ?8 G; V4 a

' y" [( d5 Y, _, _% e0 X6 e$ [6 T3 _3 \& l3 E% {7 w, J) n) N# |9 O
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?) k8 l# n+ p" ?  r
  i2 P# S" L8 V: [/ a- ^4 w
补充内容 (2012-3-8 09:42):
: O3 @$ a4 U- b2 xhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
) S/ c( F& g1 P/ k这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
. \, z( u& o' G) k7 e% Z% s6 i- X+ J
himr <address> <value>. sample: himr 0x80040000 0x0  E$ D0 |% d( f2 ]) M6 l; d

0 C6 B( f1 r: M- ?. O1 ^例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
8 n4 }% |" O5 s: @1 h4 P3 x5 khimr 0x80040000 0x00
* v' C5 |7 y# [+ v8 n$ Rhimr 0x80040001 0x11
0 R9 T2 Z2 p( T7 w/ xhimr 0x80040002 0x22
% N7 X: v- ]  ~6 Y  O! Mhimr 0x80040003 0x33
) ~  ~* T- k2 \& M. o+ Ahimr 0x80040004 0x44
; ~: D1 W5 i) K8 @7 U) h& khimr 0x80040005 0x55; `. x' c2 V1 r. q, R

9 e- ?$ g/ T& _1 F" rSN也是类似。
- C. l- s' B( X3 `3 D, R' m* ~% p& ?7 e) g* x- g
现在主要是,谁告诉我们MAC和SN的地址?& W  N, R! x. o9 \) N
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 1 s( r' j5 P' L9 R$ n4 N
一直想找到运程修改MAC和SN的办法,苦于无解啊

. o$ N6 }- |/ F5 m" B8 }% Q+ _" ?源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
0 S% O4 {- W1 t5 [' T- \; ?( x( T. Q( A& B2 S# h
修改的代码早有了。到今天不会编译。
! K8 P5 Y% t2 g3 P9 V* N- S1 g需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>+ L: p6 ]; ]$ {5 [" ^, c
  2. #include <malloc.h>
    * A+ d/ y: f& ^4 K" E* O, ~
  3. #include <sys/types.h>
    , n3 A& g( P& j- @  @, t. p
  4. #include <sys/stat.h>+ v4 A% t8 ~, ^: a
  5. #include <sys/ioctl.h>) t% G  V& O/ |
  6. #include <stdio.h>
    + G# _. i' ?: J/ V
  7. #include <string.h>
    " Z% Z; F; Z* p

  8. ! r. q) n# x$ E6 Y$ S1 C
  9. typedef struct {
    + B4 V9 \4 L( x! a  H
  10.         unsigned int        e2prom_cmd_sub_addr;$ T' A0 o1 m9 n" I+ V
  11.         unsigned int        sub_addr_count;( p% K. E7 c8 y0 q! G- y# p/ J6 U
  12.         unsigned char*        e2prom_cmd_data;
    - L1 l8 w: y" M4 C% v  V! E
  13.         unsigned int        data_count;. h5 s: y5 ]  j" [4 `
  14. } e2prom_s_cmd;+ o% @: j) p) O" G7 P  g  D/ h

  15. 0 W9 D1 j& R# h7 U
  16. #define E2PROM_CMD_READ 1+ ]6 |6 U7 {( M& [8 n; ~
  17. #define E2PROM_CMD_WRITE 25 O. I1 I: }& C! x- [5 D0 S  b5 w
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"1 `/ j; @+ p) m) C2 Z* H% g9 ~8 d9 o

  19. ; z: A6 D0 u4 |4 H4 {* M3 V
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    6 |5 j/ L' Z$ `7 Z$ T8 t
  21. {
    6 D4 x2 |9 K- c0 A+ G8 K/ P# O; H$ W
  22.         int fd, ret;
    7 ^4 N6 ~/ g* c
  23.         e2prom_s_cmd arg;
    # O) k- F, I$ G  n6 M3 ?
  24.         unsigned char buf[0x18];; o6 f, s8 o; G$ M( {

  25. : V! t3 i# |; `, p8 P4 O* G
  26.         fd = open(E2PROM_DEVICE, O_RDWR);7 ]# P8 g5 j4 @
  27.         if (fd  < 0) {, B) e- X8 f8 o! G* @
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);& T/ T7 g; g7 L9 n2 y3 A
  29.                 return -1;
    6 t. W; w! q0 d1 ~' o) j  \
  30.         }3 m9 Q, D$ G; L/ v6 Z/ O5 c/ V
  31.         arg.sub_addr_count      = 2;
    6 }$ ]; P0 s/ ^% M" g
  32.         arg.data_count          = 0x18;7 r( K: F2 t" R$ M% z6 V
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    + q4 ]- V+ {+ Z8 W  e! S# e
  34.         arg.e2prom_cmd_data     = buf;4 l9 J6 U, T+ G) U! G* m; q
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    3 t. j( q7 d$ E+ P
  36.         if (ret != 0) {2 n$ o# T2 O7 j7 v  S! j1 ^! a
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);% k% w# a$ h8 |8 C/ w
  38.                 return -1;
    & U; w: M# p# i: _( V' ^, m0 c  C
  39.         }. }4 K. b3 o& _- Y
  40.         memcpy(mac, buf, 6);0 s) V) F: S) c! B1 c# T. O. o' h; c
  41.         memcpy(stbid, &buf[6], 18);
    " c2 Z( V* R- {, O, w
  42.         stbid[18] = '\0';
    , b2 n) a. x9 Q1 n% |% T

  43. 8 `' ^+ D; D; k8 Q8 ]
  44.         return 0;
    4 o* S- f2 r* d9 H" h
  45. }
    4 O, [- I3 F5 R. X
  46. . w7 \6 n0 U1 x: p' X4 ]  ^
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    : R1 g5 e# S+ v) f8 B
  48. {
    ! V  [1 O( k( [2 D4 j; ~
  49.         int fd, ret;
    ; x7 m% u" m! d
  50.         e2prom_s_cmd arg;
    $ k- T/ G8 r) ^( l1 b. ~3 G
  51.         unsigned char buf[0x18];3 h+ y  |& ~; A0 D' M
  52. , J0 }% o& H' W  b
  53.         memcpy(buf, mac, 6);
      r+ ^; B( }* _8 N. Y
  54.         memcpy(&buf[6], stbid, 18);/ _' e2 S# P4 W, [* e
  55.         fd = open(E2PROM_DEVICE, O_RDWR);- t2 S3 m* M; g) A4 b3 U
  56.         if (fd  < 0) {
    ' s. t, U: s# }# w$ d  r$ W. p- s
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ' [. i9 ~# p; h7 N
  58.                 return -1;& Y' ^: p- U* b3 a# P1 I1 b- `
  59.         }
    8 z  Z. U: a3 a1 H6 j* `# N3 z* y4 b
  60.         arg.sub_addr_count      = 2;6 X6 W5 Y# r: b: y% G4 h+ g1 i
  61.         arg.data_count          = 0x18;
    ! @( k4 b# f  j  [' L& Z. H4 [
  62.         arg.e2prom_cmd_sub_addr = 0x290;6 u3 _# T2 a; m% r# z
  63.         arg.e2prom_cmd_data     = buf;3 j6 h- @1 Y/ B6 K# ~
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    1 d# M7 h- l) i1 N( Q* \  P# y
  65.         if (ret != 0) {& K2 }) O9 G8 O4 {
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    0 y0 C/ h5 c% R9 b* I
  67.                 return -1;& i. {. V( B# x; W
  68.         }
    5 s1 ]0 w2 t( t6 [6 f- R3 ?

  69. : L: r: k  y1 u1 f0 v9 a
  70.         return 0;
    ; Q) P, ?  N4 ~" Q2 d# W! O6 [+ S7 ^
  71. }
    ) }% n7 x. F+ [
  72. 2 c0 c* {( @7 B4 C; x
  73. int main()
    # c" O5 v3 w3 C  J/ `7 O# X( ^
  74. {5 z3 p' @/ ?1 e5 R- ~5 p
  75.         char c;2 O; R& Y1 ^; L1 h! U
  76.         int i, macs[6];
    $ ]+ o! o5 Q2 s
  77.         unsigned char mac[6];# c3 m( S# q, @. f. c
  78.         unsigned char stbid[256];
    3 R2 L6 g" C3 D/ d
  79. 9 ?  s+ k( B8 u: \3 b: A6 a( Z0 K
  80.         if (readparam(mac, stbid) < 0)
    3 N, @, l$ N3 e2 y/ M; r! y
  81.                 return 1;& n2 `' t7 N  j8 \) S  \
  82. 9 `8 s) y8 A: W" @6 ?3 P9 g
  83.         printf("Current parameters: \n");
    4 G% U& ?9 W" B, u; U) ^$ H
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    + \3 O/ m# H& e" L( X* ?
  85.         printf("  STBID: %s\n", stbid);0 K. g+ R/ D! T9 i4 d' E( [8 h
  86.         " p2 \! K: Y3 h( ~( g; Z
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    . B9 D2 r9 F( j. a" V
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {; k! l1 q  h2 a+ ]
  89.                 printf("Input MAC error\n");
    # _3 C1 M9 E$ ~, S! E8 g+ E
  90.                 return 1;
    , m! p( t3 G: s
  91.         }2 K  O' L. |- W: r
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    6 P! {0 {4 |, R* C3 P& _3 T2 h
  93.         printf("\nPlease input new STBID: ");
    ! L. m1 x, N" f2 b& e% Y
  94.         scanf("%s", stbid);1 w8 n2 e9 ^$ d) e, R" r
  95.         if (strlen(stbid) != 18) {
    1 ^: f* W3 U; c7 D) P, B
  96.                 printf("Invalid stbid\n");
    0 t9 ]' M& R- I3 \; F  ~
  97.                 return 1;
    0 S, m- x' t% G& X
  98.         }# u6 Q& P' ]8 R( @* Q+ C9 `5 k* N
  99.         printf("\nNew parameters: \n");7 U; i7 ?! Q3 k$ w2 J; j) s
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);) U5 R) F/ \+ J
  101.         printf("  STBID: %s\n", stbid);# d3 Q3 U% b2 L6 A% b

  102. 1 A. R  h) q  c
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    2 _$ ^, |+ c+ M/ ]6 a8 v0 |$ r
  104.         for (;;) {0 }  A' O+ g5 M( A6 v, n! [% `% f
  105.                 c = getchar();
    7 K7 k3 B9 H* J7 Q; d
  106.                 if (c == 'y' || c == 'Y')
    % Q" A# z. Q3 [" e# v2 g
  107.                         break;
    ' O8 a5 A) a# D+ r: Q
  108.                 if (c == 'n' || c == 'N') {+ n4 M6 Q8 m3 a1 R( I# i$ i$ A: S" K  v
  109.                         printf("\nAborted.\n");' \6 p) W6 J' g% f& q0 [0 Y. N5 m
  110.                         return 1;
    3 {& n5 J' k& k( L1 d
  111.                 }
    3 _. U$ V3 ]" k0 c- h+ Z( n
  112.         }  v: x$ l. x# {; H
  113.         if (writeparam(mac, stbid) == 0)
      ~' c9 x6 G6 f1 Y% G+ {
  114.                 printf("Parameters changed.\n");
    / s0 {  ?3 |6 l7 S$ H
  115. - u/ \2 J# T- U+ \7 {
  116.         return 0;
    , J4 ]" R& Q* X0 Y' A
  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
: E$ W) l$ f: e, p在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

4 o" |. ?7 T+ [3 R5 z3 \3 @. u你用的编译命令行格式是什么?. p" t( u* A: d$ W. Z
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

Archiver|小黑屋|宽带技术网 |网站地图 粤公网安备44152102000001号

GMT+8, 2026-2-12 07:18 , Processed in 0.024941 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表