找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15686|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr4 v" v  G' @' t
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig% N0 E! V. }; ]: {3 f0 B2 K
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:5 N, |. k5 p4 D) F! _4 t# C
usage: himr <address> <value>. sample: himr 0x80040000 0x0
  C" `0 l- e* Y0 t& I0 \2 U5 f- e& x; @! f3 f: U# W0 p5 o

# h9 J- j/ E- R6 e! f: R! T+ R7 Y不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?" y+ ?5 N# T1 h8 s5 ~% W' J
( }* V8 I& b5 F& B! r% ~7 O
补充内容 (2012-3-8 09:42):
5 A1 a2 L* T5 P% b' k4 whttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数8 T' B- `) X8 V' J& w
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。! E& x8 h  A/ T& w( ]
3 E( `9 @1 u' _
himr <address> <value>. sample: himr 0x80040000 0x0
* y% q* ?2 e' s7 X, h% ~/ _' |7 W- s
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
  V/ H+ g: i. y  Y5 uhimr 0x80040000 0x00" |% }4 m$ x/ h$ \7 Q  u
himr 0x80040001 0x11
) B, v' o- \; C, G9 e1 g5 P! ~5 Y* A0 zhimr 0x80040002 0x22
# O7 z3 C# C: C/ l5 x+ X* chimr 0x80040003 0x33- Z8 S8 d7 H( q; ?- [
himr 0x80040004 0x44
5 N3 z; ?0 M6 J$ \9 L: A2 q6 Qhimr 0x80040005 0x55% r* i5 \% e" A- b3 A/ s
3 N" i2 r. q8 j& ]; q
SN也是类似。2 g4 K8 r% z9 T- F

7 y9 r5 p1 a. m- E/ w: e! z现在主要是,谁告诉我们MAC和SN的地址?
6 A4 ]" c/ {  H5 f, i$ L
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
0 @+ [! M+ R, `7 \- y4 ^% H8 S一直想找到运程修改MAC和SN的办法,苦于无解啊
4 h% E4 Z$ m" A& W% i6 R
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 ' e0 X- @% _' q8 G, _

# x$ [+ }7 W' _  b修改的代码早有了。到今天不会编译。" P2 s5 |! o% n9 _$ [4 N* p& u) H% L9 o
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>% Y3 I% P9 J0 T
  2. #include <malloc.h>
    ) x+ S1 j# [6 X. U# O8 N) [
  3. #include <sys/types.h>+ v% w2 V# h: J' A+ I- X
  4. #include <sys/stat.h>' b9 ~; W4 Q, W! C' Y+ o
  5. #include <sys/ioctl.h>, d. I, T! k# {6 y
  6. #include <stdio.h>
    9 K; ~9 S; I' V
  7. #include <string.h>
    : f% ^4 C8 a6 n: v) `  Q
  8. . i- n' j/ G2 R2 N; n0 R+ |
  9. typedef struct {
    . i7 q! M$ H9 j; Y0 I% `/ I
  10.         unsigned int        e2prom_cmd_sub_addr;* n' N8 s# k( U5 N% c. S
  11.         unsigned int        sub_addr_count;. ]. p' \6 r4 ?: R& V, u7 N- q
  12.         unsigned char*        e2prom_cmd_data;6 z- \9 y( B' h. p0 O
  13.         unsigned int        data_count;
      O" q' g* {0 q3 d" ^2 Y8 j
  14. } e2prom_s_cmd;( z3 ^# n" i9 ~' m( Y
  15. # E; z! l) t7 B. O6 d
  16. #define E2PROM_CMD_READ 1
    , n+ v  q. v3 @, P2 V" ?+ P+ n
  17. #define E2PROM_CMD_WRITE 2
    9 W2 W& \: F: }
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16": B" E7 ^" g4 A: `7 P6 ]; ^
  19. # R# U0 G2 @1 _* D! v* a" e2 s' d
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    2 ^0 f* H; g1 ]+ S1 z# ?
  21. {5 N# Y# R6 s* Q# N9 w6 W
  22.         int fd, ret;
    1 _0 s9 ^9 [7 `2 ^8 K- g
  23.         e2prom_s_cmd arg;5 Q5 p, V* n* N1 f, O# o1 M9 \6 l
  24.         unsigned char buf[0x18];
    8 {% I) U5 E$ w( h

  25. / V; m$ i% n' P5 n& r8 j6 ?
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    ) J* o$ |! ?( s1 X# J  [5 ~2 B
  27.         if (fd  < 0) {
    3 E* Z8 J( K; z8 O$ h
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);, b1 q# N3 W" _& h2 ^3 m/ Y+ J9 L
  29.                 return -1;
      H0 K- L% N3 A) T+ G+ D
  30.         }
    * ]$ B& T4 U# z
  31.         arg.sub_addr_count      = 2;+ i4 w2 V  t% O2 w+ Z
  32.         arg.data_count          = 0x18;: r" e" e7 f/ W4 q. x/ h0 }* E# R
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    . |, @$ D  g7 ?+ a9 ^! M+ D
  34.         arg.e2prom_cmd_data     = buf;2 j$ F1 P( k0 W+ F. F- v0 g
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);; ^" h$ t; o+ _
  36.         if (ret != 0) {
    ) T5 ~7 h8 H$ O, i- s( Y* l9 T
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);9 @4 d) P) g& n5 h( h! u
  38.                 return -1;
    2 d% H' T8 m5 W% O; S* q
  39.         }2 v+ d# ~/ [$ \* B( x7 A0 g
  40.         memcpy(mac, buf, 6);
    " j( M; p0 F1 |; Y
  41.         memcpy(stbid, &buf[6], 18);
    8 O0 B8 p# h7 F+ X  O9 }8 Y
  42.         stbid[18] = '\0';; O! ^* h, n5 @0 c

  43. 4 _" K8 [( n% O8 W
  44.         return 0;4 ^$ g7 `7 ~' K5 }* ]8 V9 X) C
  45. }
    - I" H$ U9 a4 H& p+ c
  46. 9 w7 v6 `3 j6 V+ ]
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    / M! V2 S( z% n1 C2 f$ o4 \* L2 l
  48. {
    * x( z% s0 ]# K
  49.         int fd, ret;- o* A) Q/ C5 \% `9 W
  50.         e2prom_s_cmd arg;7 c" m& o5 q$ \; F. l* ], Z3 m
  51.         unsigned char buf[0x18];8 R' `4 Z" s) o
  52. " t, z4 `6 _& B0 X
  53.         memcpy(buf, mac, 6);
    - f( o1 w" Y. n# Q
  54.         memcpy(&buf[6], stbid, 18);7 E  T/ s3 O% U
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    ) L# n' o( M7 U/ L% v- S$ S
  56.         if (fd  < 0) {4 E; S- V- R9 ~$ m. V, q4 I" c8 H
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);& p0 f$ P2 R2 k
  58.                 return -1;' l( D, p2 w) C5 r2 K
  59.         }
    % }) J" {6 R1 A# {2 o* j2 o* Y  q  R
  60.         arg.sub_addr_count      = 2;
    ; n' Y8 Z' j2 Y, z/ [
  61.         arg.data_count          = 0x18;9 Z9 Q2 G6 O7 U7 k5 {0 i
  62.         arg.e2prom_cmd_sub_addr = 0x290;' C  |) l7 v3 [+ E& b2 J
  63.         arg.e2prom_cmd_data     = buf;
    . }9 G) i* b+ h# N9 G
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    ; }" v. Y4 A" t5 D- H( o9 R
  65.         if (ret != 0) {
    2 h: z( a: ~, U0 V- P
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);+ J: J: E0 O* \. t* W% P
  67.                 return -1;
    : `: z1 O6 h3 X$ U. Q( `' y
  68.         }4 ]& M. L( ~2 g! G9 D
  69. % P1 f4 n5 d7 s) _. A# r
  70.         return 0;
    1 D8 q$ F% i( c' e' c" s4 {8 W  }
  71. }
    0 g) ]. K+ k/ J  b" L! @; g+ G! C
  72. + @. |: `' W% w
  73. int main()
    . u" |5 m, Q2 g
  74. {% L. ~" _  f) G
  75.         char c;
    2 g! J) y3 P1 E4 @9 N) j; p
  76.         int i, macs[6];
    . b( d5 F1 ~! y* r
  77.         unsigned char mac[6];
    / s  T0 [  a" ?. F- D# \; P: f2 ^
  78.         unsigned char stbid[256];
    ) ^' I0 N7 }$ K* U. k2 F

  79. " c& u7 Y0 z; |+ Y
  80.         if (readparam(mac, stbid) < 0)
    5 {: e# T; w; I" s4 ~6 C+ x
  81.                 return 1;! Z  W) o9 `, [" F4 y, t
  82. $ ?' M7 t+ e+ T  Z& Y6 \/ o* p9 ^
  83.         printf("Current parameters: \n");
    , x/ @0 [8 L4 ^/ Q
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);0 S9 B1 N0 t) |5 [2 i; X6 R& o
  85.         printf("  STBID: %s\n", stbid);( ]* p0 W2 o7 O
  86.         ; X0 o0 v6 H3 E& J' X/ L- e% }: Q7 [
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    0 h, Z( q  a8 K8 W4 e6 }# z
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {; G: c; E5 |/ k2 H5 N
  89.                 printf("Input MAC error\n");9 R6 Z& T+ r& a* K
  90.                 return 1;
    0 J' N/ \+ s( _% z. r" Z* }/ P! z
  91.         }
    , Y3 }: `, B6 Z! Y8 V8 {5 T3 P
  92.         for (i=0; i<6; i++)mac[i] = macs[i];1 p1 r6 S! A; {8 M
  93.         printf("\nPlease input new STBID: ");' P, W/ J& z( Q% l% f! r1 Y) s
  94.         scanf("%s", stbid);
    $ O. q# \( N2 g- |$ j
  95.         if (strlen(stbid) != 18) {
    ; L- C5 s+ x0 z
  96.                 printf("Invalid stbid\n");
    ' J# ^) o: E' `" ?# C
  97.                 return 1;: W) I: C' }7 p- b0 k+ g1 U
  98.         }7 s' `% r, {( |
  99.         printf("\nNew parameters: \n");
    ( X$ \+ |# U9 L8 w3 ^' k
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    9 r2 d- ~7 y5 S/ b2 Z( k
  101.         printf("  STBID: %s\n", stbid);
      @0 k& n+ ?! ^6 R) b# I

  102. 0 W8 _8 _5 _% K# P+ k0 o
  103.         printf("\nDo you want to change paramemters? (y/N) ");  G2 R1 j" x9 h
  104.         for (;;) {% J; o' Z0 H0 z3 i- d# X6 f
  105.                 c = getchar();7 h4 \, p& V2 ]! E0 ?
  106.                 if (c == 'y' || c == 'Y')
    % g9 [: b1 _( X/ Y6 ]: Z& X4 d, ~- V
  107.                         break;6 p- q7 m, b2 ?& P( r: K; s0 Y
  108.                 if (c == 'n' || c == 'N') {
    : x+ z7 c. y0 h) \
  109.                         printf("\nAborted.\n");
    ! `9 q1 j; R+ D$ m3 \
  110.                         return 1;
    3 t; o/ N3 t9 ?: c7 w& ~& E
  111.                 }% L0 }7 R3 f. a( d
  112.         }" E1 A* [* F6 V/ O$ o
  113.         if (writeparam(mac, stbid) == 0)
    6 r5 [9 G; I5 R
  114.                 printf("Parameters changed.\n");0 I. x8 {# h$ h6 _# B- j, h2 j

  115. + Z' O3 B. i1 k; ?
  116.         return 0;1 j1 o0 l% W3 I9 @$ ^( a9 ?5 O  ^
  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
8 H' u0 F* `9 B/ q( ]! U. z8 D. S在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
+ E( t6 l- W7 Z6 N
你用的编译命令行格式是什么?
6 P# C2 N) u% ^4 ?  B
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

GMT+8, 2026-2-27 05:41 , Processed in 0.025302 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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