查看: 17572|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr! c/ \" _! g" b- N, b" w
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    ( h. r6 g8 V7 l. k
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
6 X1 c' V( E6 O: u. N) g: \usage: himr <address> <value>. sample: himr 0x80040000 0x0! x8 ^. R% w+ f1 i* q

7 i6 S+ u7 J! q2 M+ @9 B$ K
+ F9 T& o, O* X8 D& V% q1 j" H. o不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
. @" O& u" i* z" g( S% t& I
* r* G% x7 g1 d, L+ D' t补充内容 (2012-3-8 09:42):) X7 s. O& d- @# u; K7 l1 S
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
# V' l" U: {$ Y) R5 m$ t这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。# O- n7 k5 ^$ O& P# J5 ~  U* ^9 g
9 }( I/ L4 s* x2 |7 h
himr <address> <value>. sample: himr 0x80040000 0x02 S/ k; B5 C& m6 @5 m% R+ q5 }! }

  s9 U, S! }0 B. u7 z: r例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
. Q" ~9 o# g1 F- J- ?himr 0x80040000 0x00
4 q% \. p: P  D6 Phimr 0x80040001 0x11+ N# B8 d' P0 z6 g# [
himr 0x80040002 0x22
" J5 ?2 C8 ?8 vhimr 0x80040003 0x33
: n( a" X, U) i8 `; |! @1 \, Z1 q  Vhimr 0x80040004 0x44
* H4 n" O( r: j( w7 p% Ghimr 0x80040005 0x551 g2 H& E2 T% }
+ J' |/ @+ U3 ]" [8 O; p) E6 B+ r
SN也是类似。
1 g! {- Y3 w9 z  T" d, D6 ?" m- b/ i- H- a& Q' v7 o5 E; E
现在主要是,谁告诉我们MAC和SN的地址?' D  r' ^- {  h1 B  g# V& e  t
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37
7 v* V" E  M, \) t0 n一直想找到运程修改MAC和SN的办法,苦于无解啊
. u9 B- _. A" p4 U
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
. }# D9 u7 H, @- w) X" ?' }6 S3 J- i
修改的代码早有了。到今天不会编译。4 u7 ~2 R$ ~# i! w  W
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    $ |4 o# \- A+ w* y% v. S  o
  2. #include <malloc.h>, m( x" e4 Z" ]7 U" ~6 r7 h9 |
  3. #include <sys/types.h>3 V) X& e0 y- g+ F
  4. #include <sys/stat.h>9 B4 X6 x, _+ r$ P5 N9 W
  5. #include <sys/ioctl.h>
    - s) q: a" A+ M. L( Z
  6. #include <stdio.h>
    8 p, i2 W, I' g: R+ j' S. _
  7. #include <string.h>. L; S  n+ I$ n

  8. ( T" i3 s: ^2 M3 P& {# s
  9. typedef struct {
    5 n5 f! E( a+ y$ X
  10.         unsigned int        e2prom_cmd_sub_addr;4 o; s  G! \6 S: F
  11.         unsigned int        sub_addr_count;
    - K, L/ v$ ^9 B# S2 g! a
  12.         unsigned char*        e2prom_cmd_data;
    , l' F' a: E$ _8 [4 {: n
  13.         unsigned int        data_count;3 M; O. R  y  d2 A, y: q
  14. } e2prom_s_cmd;' p$ f) q$ Q) b# f; r
  15. " B6 X7 ~/ A9 _
  16. #define E2PROM_CMD_READ 1
    & X  p! T, x, [, |1 ]& o
  17. #define E2PROM_CMD_WRITE 2
    1 o' z7 ^5 P/ {" i+ `7 A( @
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"5 j: @$ t" C/ y7 X5 p. |

  19. . A) }: Y% F' ?+ i0 C* l; p7 C7 Z
  20. static int readparam(unsigned char *mac, unsigned char *stbid)" h7 x* X/ c+ \, }: [8 R
  21. {
    9 f8 t$ p# O7 x0 k
  22.         int fd, ret;
    - L) ^7 T8 ^6 l( \
  23.         e2prom_s_cmd arg;$ f8 B7 L$ U& C, t. h2 O
  24.         unsigned char buf[0x18];; H, y& E1 l3 l' V* R" j
  25. # x7 {6 u6 A1 I% h! X
  26.         fd = open(E2PROM_DEVICE, O_RDWR);  X& m2 j: ?0 U4 ?0 j
  27.         if (fd  < 0) {7 q& t# X+ d; A$ v" ]4 e
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ( T- [4 l+ F+ S' h
  29.                 return -1;2 q* s* e, M; b2 C( |- N
  30.         }' D9 V# k7 g: M  S* A, T1 u  H* r8 M
  31.         arg.sub_addr_count      = 2;
    % i7 ~3 u0 u8 h* F- z
  32.         arg.data_count          = 0x18;
    & D) w3 `/ `! r: S
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    * L" v1 R! G$ U! ]
  34.         arg.e2prom_cmd_data     = buf;; e* E3 v7 V0 i) v+ n5 c
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);9 D8 N1 `( F. T( p  A' @
  36.         if (ret != 0) {1 y4 }2 R* o7 Z6 {7 u4 Y
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);' G" _* s; M; P1 s( v. G. a
  38.                 return -1;, C- B! h" S; j3 U- H
  39.         }
    5 g+ c- g9 M. s; o/ J% m
  40.         memcpy(mac, buf, 6);9 Y5 w' E6 r, u8 D+ Y
  41.         memcpy(stbid, &buf[6], 18);
    0 j" @- e9 v6 I  {) ?8 ^& ?8 O
  42.         stbid[18] = '\0';
    / R" h* c1 l# F, {  e& A
  43. 8 O1 ~8 x; K: j4 x8 }
  44.         return 0;
      X8 Q6 E1 ?$ f) x( I+ E6 }
  45. }/ q# [& v1 {* m+ b
  46. : @! c# M2 |' G2 e, M& d
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    / B1 ^  ~+ i; a2 F0 P
  48. {
    " W0 ^( y( Y1 k
  49.         int fd, ret;
    5 p" a4 Q( q; Z: k
  50.         e2prom_s_cmd arg;
    ! f/ X2 P* [; g3 y0 z" D* c9 r
  51.         unsigned char buf[0x18];4 b( B6 w- L( I. b( r

  52. " ?) I1 B+ Z/ |+ _- Q3 v$ m) j
  53.         memcpy(buf, mac, 6);+ B- m' X) x$ C* O! G( P9 |0 b
  54.         memcpy(&buf[6], stbid, 18);
    ) c& A% J+ X8 m& ]( f
  55.         fd = open(E2PROM_DEVICE, O_RDWR);6 G$ ^" ^' G* N- u
  56.         if (fd  < 0) {
    ( S, I3 g- r. J8 d. P
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    ! }% L9 {2 q: O8 h- h& T. j
  58.                 return -1;
    , u4 b% N- \2 [3 M
  59.         }. s/ @  L7 e' [) l% r8 h9 u
  60.         arg.sub_addr_count      = 2;
    & k& }( h+ d' r* N, H  @
  61.         arg.data_count          = 0x18;; ~) z3 K1 z# {( Q% e# G0 b
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    % v0 ]& d: w; c- B' V  J$ I
  63.         arg.e2prom_cmd_data     = buf;4 _  Z5 I; z/ l6 G1 @! @* a
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);/ @$ R( ]; m, l8 ?% D
  65.         if (ret != 0) {8 a3 ~- G$ L9 g% G; n
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);4 f6 h/ V* p# M9 A0 \
  67.                 return -1;
    # g' F% d9 i6 P6 Z
  68.         }( k% d! b; {# X6 t9 s8 r

  69. ' B; _3 ]# C9 \# _
  70.         return 0;+ ?* z. {/ s# ^# ]) K
  71. }! l1 j7 m3 M& y

  72. % ]: h" D% k: S+ b! f# l
  73. int main()
    9 K$ d- _4 i7 H
  74. {
    + N% {0 I3 S& w) t0 P3 C5 }
  75.         char c;
    $ g" R! a! E3 s  m. W) ]& w
  76.         int i, macs[6];& M5 ?0 H& g3 R- Y3 S# m
  77.         unsigned char mac[6];; z/ }/ @$ g2 O  [8 P; F
  78.         unsigned char stbid[256];; e) A, o8 o1 T+ X1 F4 u

  79. * r: B- D3 U. [# ~
  80.         if (readparam(mac, stbid) < 0)
    / T+ H. Z3 X) L/ P, O
  81.                 return 1;
    + d; ]5 ^9 _  B8 S

  82. " s- f, A( b. q8 f  d
  83.         printf("Current parameters: \n");
    4 b0 h7 S  M' r- O
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);- m& Q; X; }+ r% R. \' C1 g
  85.         printf("  STBID: %s\n", stbid);
    % M! z: ^: P$ b+ b/ p! u
  86.        
    9 p2 ]. a+ a( t/ k7 {5 X/ o8 p
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");# q5 X- v5 w( m5 L! R" s' S, c+ e6 r
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    0 q0 Q/ X& y: d) I0 f; O5 q. [
  89.                 printf("Input MAC error\n");/ m% }2 o# a$ s1 }
  90.                 return 1;: A" x, J% C6 S+ l* L
  91.         }8 z" Y5 f: k; Q9 K: f- y
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    : N0 x; Q! l0 |2 y3 X! _
  93.         printf("\nPlease input new STBID: ");
    % @6 |- w4 i8 H4 g* h. K
  94.         scanf("%s", stbid);' L+ z0 ?6 O! Q& f
  95.         if (strlen(stbid) != 18) {; w( }9 y% h+ S, J
  96.                 printf("Invalid stbid\n");
    0 |% }, a" P2 f3 E
  97.                 return 1;
      j. V( u  l4 R9 p* B
  98.         }% {, e% U/ G6 A) l: g
  99.         printf("\nNew parameters: \n");
    9 n" F. V( s3 _; S
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    6 _) Y. y0 ?; n/ O
  101.         printf("  STBID: %s\n", stbid);. ^0 U7 P3 F0 y
  102. + H+ s+ m+ ~8 r2 J
  103.         printf("\nDo you want to change paramemters? (y/N) ");- f. B  d! q) j
  104.         for (;;) {
    1 s) ^: p! U7 l+ Z- M
  105.                 c = getchar();1 C: @! {2 P5 M7 \0 i& r0 t
  106.                 if (c == 'y' || c == 'Y')/ G- P' h/ W- e3 q" u
  107.                         break;
    6 g2 G0 c+ F, [
  108.                 if (c == 'n' || c == 'N') {
    * i# X) d9 Y4 n& X* A8 {
  109.                         printf("\nAborted.\n");4 M) J) i( H9 B2 X) Y
  110.                         return 1;
    & @+ A6 _' u0 b' L# |; |$ R
  111.                 }
    . `, u6 f% u+ M9 r8 B: x$ X2 D
  112.         }. V# n2 y, v, T" @. Q
  113.         if (writeparam(mac, stbid) == 0)
    5 i7 D& K! }( T6 |' p# h; A
  114.                 printf("Parameters changed.\n");
    / p/ Q6 Q- E; _: Q- x
  115. 8 E# H- Z& C' @/ ]% T
  116.         return 0;/ B# F; H& a8 q3 b" r2 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 0 H" c" W' [: b4 e4 C3 d8 Y) F
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

: J* P% c9 r2 `" f) t! \你用的编译命令行格式是什么?3 J3 U* k- h+ G) S0 |
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

在本版发帖QQ客服返回顶部