找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15629|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr  O7 z- [$ [; A, L! R( X3 i- @+ a) `
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig0 v3 e  B4 V' q: O& Z. j
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:- _3 N: i; S+ `8 E: |& |
usage: himr <address> <value>. sample: himr 0x80040000 0x0
/ ^/ a9 d6 M* `6 b( p, `' B7 N$ N+ M& m  Q  ^

' N7 l4 y! H: k6 ~* r, E! ^: _不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?# V6 N- u. e7 l6 `
$ ~( c$ s0 u/ q  b9 W8 A
补充内容 (2012-3-8 09:42):! V- ]4 E! s' c5 A' l1 @  R
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
1 ]2 @+ I0 h) p7 y这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
1 F0 F) [3 o- }6 @0 f# O# ?# a1 m. H+ E6 k* V" l
himr <address> <value>. sample: himr 0x80040000 0x0+ Q" d/ k4 y7 G& S

* E$ l  j: }0 V例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
7 V, M4 K  P2 jhimr 0x80040000 0x00! o0 V) K" ?6 `
himr 0x80040001 0x11  n0 |" }6 I$ Q6 L# O! C; H% ~, V
himr 0x80040002 0x22$ F0 y' @/ h9 y0 R1 e2 H
himr 0x80040003 0x33$ i3 P! ~4 m9 j4 O: X1 ~4 n
himr 0x80040004 0x44
+ `, e! d4 J# [1 ?: s; Yhimr 0x80040005 0x55
* U% P0 M3 j- @6 O" j7 N) N' l
+ C0 @+ q  C1 a# \SN也是类似。: g% z5 f& K+ ]5 d: b
! E' E, [: \9 x$ p2 r# q7 _1 R
现在主要是,谁告诉我们MAC和SN的地址?
; L) N) ^& m5 k
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
. I" n! j0 S5 w* o% M( F3 T一直想找到运程修改MAC和SN的办法,苦于无解啊

$ O( ?1 r: o- A+ X2 X源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
: i" ~! H5 d& o; }0 B/ c" q
( L2 Z0 E7 Z; s$ t. D修改的代码早有了。到今天不会编译。$ b( J  v, y& s( s1 N2 d! h1 C
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>. z# C. q9 y0 T% Y8 g  o
  2. #include <malloc.h>
    . P1 P  s% N$ a8 u
  3. #include <sys/types.h>
    0 X: E& {  o1 T) m
  4. #include <sys/stat.h>
    . n/ {7 k# m5 F6 g1 k
  5. #include <sys/ioctl.h>
    , g' \0 F8 ?( f- o1 h+ `" k
  6. #include <stdio.h>
    3 q7 B9 f5 x* ?
  7. #include <string.h>" Q6 D# P" A6 S% @5 f+ T
  8. # L/ Z( ~2 l) q6 b
  9. typedef struct {  q6 G( i; ~: V+ y, a# N
  10.         unsigned int        e2prom_cmd_sub_addr;# {& p8 f5 B  |- ]
  11.         unsigned int        sub_addr_count;" \4 u( z4 Z# j
  12.         unsigned char*        e2prom_cmd_data;( d2 j& r  q2 H
  13.         unsigned int        data_count;
    5 Y- `! R3 U& s. E9 \+ T
  14. } e2prom_s_cmd;
    / s  W  C# E7 s" N& ~
  15. ! V/ {* e9 g# l
  16. #define E2PROM_CMD_READ 1" q$ u4 Y2 y( _/ d
  17. #define E2PROM_CMD_WRITE 2
    2 c. J1 k# m3 i: C5 F
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"1 k& n+ I2 [* R3 [* q4 x
  19. $ k& K0 l' ^3 i# N! f
  20. static int readparam(unsigned char *mac, unsigned char *stbid)( c* P$ X* v1 N3 m: h" Q: K3 r
  21. {5 M" j6 z9 Y( Z- l' \3 s. K1 v) n9 q7 u
  22.         int fd, ret;
    ! |7 ]1 i9 v2 i
  23.         e2prom_s_cmd arg;, {, h/ j- r! [6 Q+ F9 y  p0 m
  24.         unsigned char buf[0x18];  P0 {( ^) V8 V4 ?

  25. : w; E' l' {3 `8 i7 m- J, s
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    % E. u( |, ?( F- e& D' J% B( P6 e
  27.         if (fd  < 0) {
    ' X. u1 t& f: M( |$ K
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);+ n4 u4 o! e9 |
  29.                 return -1;7 k7 w. O  ?) ?( M# e) s- A8 ~, J
  30.         }* A( W/ \6 w6 H+ u$ B6 @
  31.         arg.sub_addr_count      = 2;% s4 w3 k+ D+ P
  32.         arg.data_count          = 0x18;
    $ _. o2 _/ e% y! g/ i8 r6 U, i2 T
  33.         arg.e2prom_cmd_sub_addr = 0x290;; e" T; h2 r% T2 I
  34.         arg.e2prom_cmd_data     = buf;4 Y3 l& g7 @9 g% ]; a
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);% W* I' U9 N6 A' ~
  36.         if (ret != 0) {7 P4 W  O5 _' [
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);, F$ q$ n3 m  v. i( h
  38.                 return -1;
    ! b* _. {* b1 U0 G* i3 h" p* p
  39.         }
      H7 ^. R2 ?' q
  40.         memcpy(mac, buf, 6);  G$ \7 p+ W9 v6 S2 f
  41.         memcpy(stbid, &buf[6], 18);, s, @) t; U  j- s. F) w- J
  42.         stbid[18] = '\0';0 C4 d* ~! j4 d3 }  b: m
  43. / A; C% V' j1 }7 V2 e# R
  44.         return 0;9 W+ i3 d- \! n: q6 D3 C; C
  45. }6 O7 {  F( k8 s0 ^1 w

  46. 7 ~( m1 G4 W3 t1 @" D
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)+ I2 c1 O+ A6 \; A3 }
  48. {
    - p" N& @9 q4 X8 D3 e$ ~
  49.         int fd, ret;# z/ w) J  x% |; F
  50.         e2prom_s_cmd arg;
    ' P8 A. X0 c; U) N" p7 X) L0 F9 _
  51.         unsigned char buf[0x18];
    ; Q" {4 S' B# b' N- J1 d+ Z1 \

  52. 4 l" R" n1 V1 |' Q# {9 S$ P
  53.         memcpy(buf, mac, 6);
    & t& ~! w3 ^2 K& O9 ]2 Y, d* C
  54.         memcpy(&buf[6], stbid, 18);6 A6 u' O; M( Z  f
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    ( U6 A8 C; ~) p1 ~0 |, ~7 V
  56.         if (fd  < 0) {' R, e/ A+ I/ U' ~; |' p2 I4 D, d
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);# W1 f  _+ b1 b5 T# W
  58.                 return -1;
    + R, K- `; U. @- v
  59.         }
    4 k/ V' b$ K# T
  60.         arg.sub_addr_count      = 2;
    5 ?- Q/ h- b3 Z+ f$ B* M1 m) R6 \
  61.         arg.data_count          = 0x18;
    7 ~6 [! l$ A6 t* C, l/ s
  62.         arg.e2prom_cmd_sub_addr = 0x290;% ]5 B3 @. Q9 P) |8 v
  63.         arg.e2prom_cmd_data     = buf;, r+ Y: ^1 n* f0 ]
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);- ~( h, N5 o/ |$ R6 ?% ^- \5 s/ F
  65.         if (ret != 0) {2 }; T# l- ]$ o; G. D
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);  U0 v+ L$ ?) w" g. [+ K$ X( M4 d
  67.                 return -1;  E+ @/ _* y: j
  68.         }/ q! b1 S9 ?, o( e3 Z1 f! ?

  69. 0 x' l7 ^! b, o/ P% j# v" f6 B
  70.         return 0;* p: B9 }% @! r" n2 E
  71. }
    * i7 M1 H% `5 e) B9 y

  72. : k" \. _% x: C8 N
  73. int main(). Q; H+ r! G5 m+ s# M
  74. {5 P& K; A& g2 y0 S: Q
  75.         char c;* q1 |2 Z. z7 @
  76.         int i, macs[6];  ?9 n6 T$ S" J3 X5 Q1 r3 M5 e% _# S
  77.         unsigned char mac[6];; \) N# z7 j/ f' Z, l3 f5 k$ A
  78.         unsigned char stbid[256];& Q5 U) ~# v' h0 q+ C1 @

  79. . g3 I  j* C1 q! j- A  E0 t5 |
  80.         if (readparam(mac, stbid) < 0)8 h$ N5 G) t1 j
  81.                 return 1;1 A1 m% W, Y3 p( A( Y7 U, R. {
  82. 1 y; h& k/ Z2 v3 i. @; E6 |
  83.         printf("Current parameters: \n");8 V  T* V" ]: W! b0 }3 w
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);8 ]: a; k( ]) N/ q: b/ Z4 x
  85.         printf("  STBID: %s\n", stbid);
    7 a# Z7 a# k/ ?5 U7 O
  86.         4 V/ F& @6 m$ _. Q( p8 H7 g
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    ' s& e: n+ s! z8 w+ D  {
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    * b. F: \9 R2 {* ^
  89.                 printf("Input MAC error\n");. v' [( O! w( \4 K- q8 F5 D4 ?
  90.                 return 1;
    2 d  W5 w" p$ B
  91.         }
    : a8 \/ W* K2 u
  92.         for (i=0; i<6; i++)mac[i] = macs[i];* U+ Q& b0 F$ U/ D
  93.         printf("\nPlease input new STBID: ");9 h* ^, a! T. z; |0 j/ M
  94.         scanf("%s", stbid);
    ! }1 P0 u! C% T6 `" B4 ]. L9 t
  95.         if (strlen(stbid) != 18) {4 }( `7 E6 t3 W5 @0 ]- v
  96.                 printf("Invalid stbid\n");8 c% o- f" S7 |
  97.                 return 1;" |2 b3 v; r! S  u) r. F1 N
  98.         }
    " l1 C1 d" R& [/ J
  99.         printf("\nNew parameters: \n");
    , P  V6 ~2 n% H5 n$ o
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);! a  i+ Q  U, d' P* O- Y) ]- v( M
  101.         printf("  STBID: %s\n", stbid);1 L' o) |5 s* s7 r: A3 i
  102.   ]; f; A. q7 y& Q* O
  103.         printf("\nDo you want to change paramemters? (y/N) ");1 c! d  F# X) P' V
  104.         for (;;) {6 R3 {* B9 R8 s/ L0 {' P9 {
  105.                 c = getchar();( v2 @) \0 @6 g6 _& L6 K* Y$ K, K
  106.                 if (c == 'y' || c == 'Y')2 }6 B( N) j1 P; Y3 t# o  H
  107.                         break;/ M- a& x) c- y1 v
  108.                 if (c == 'n' || c == 'N') {
    0 V1 A# n) u9 q: i
  109.                         printf("\nAborted.\n");
    + T( H6 ^% \0 y; ?, V) G, X- |. o
  110.                         return 1;
    " d) N' W7 |& L/ n
  111.                 }
    5 _' i1 @; j) l- o" }7 |, W
  112.         }6 H' U8 G9 s4 m5 W( R( G1 C
  113.         if (writeparam(mac, stbid) == 0) / q( V% k1 x) |+ ~2 \' z
  114.                 printf("Parameters changed.\n");
    8 ~! X0 C1 Y- A1 b" I( b9 o
  115. $ A+ F# i5 I, O% Z) K* s
  116.         return 0;
    9 s2 B7 \1 n$ J  _
  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 + O: t4 U& ]! Y
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

' I; s4 K; V3 e# w你用的编译命令行格式是什么?4 h0 }7 m& S, y! m
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

GMT+8, 2026-2-19 19:43 , Processed in 0.024075 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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