查看: 17116|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr
    1 h% E6 Y" Q/ O9 `5 M
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig1 e7 U. f+ H( M! i
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:, F, ~7 K8 t6 e& i2 l
usage: himr <address> <value>. sample: himr 0x80040000 0x0
( e2 b& v( ^; A; {* p
; w! s& M/ s( J% j" v7 }% K
, K  o4 ~  ~1 R, t4 g- n6 w' P不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
4 |, e% B& _, C7 }0 q0 V4 }9 D; r+ s% [! b, h0 D& ~
补充内容 (2012-3-8 09:42):( }! k3 f8 Z" _7 |* ?
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
9 m- y6 q  L& m) E  C. U* `& p4 T这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。
2 t9 ]  E4 N7 G: `1 i& K8 F( C' a  C5 S
himr <address> <value>. sample: himr 0x80040000 0x0
( j! `5 U" n, C, W
9 g7 t+ p0 O3 e! m" d例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。* }" v% h3 ~1 G2 l. Y0 {3 i
himr 0x80040000 0x00
6 ~! i) C* q, |9 l% Y' _: w9 [himr 0x80040001 0x114 y$ G' M6 e: H& A
himr 0x80040002 0x22
: e" q5 r( X: c1 P7 @0 Xhimr 0x80040003 0x33. Y6 X2 _: r* `4 |  p3 A
himr 0x80040004 0x44
- S$ m$ ]: T5 _8 ]5 }: L# Ihimr 0x80040005 0x55
6 o1 J: X* e. s* u9 ?/ I) [+ r) h: V) x8 e7 x5 g4 j# d+ Q% h4 l9 _
SN也是类似。
" m9 W; l4 {8 c+ Y0 Y4 x- U$ x) W$ x. ]% J/ O2 u. t4 U
现在主要是,谁告诉我们MAC和SN的地址?
. C2 H0 e% e0 K  p$ X' G
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37
- B# m# @; {* x  c& g4 m5 g一直想找到运程修改MAC和SN的办法,苦于无解啊
" @, Z" c# s8 A9 v8 O
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
: u( S3 m" s: w# o
! R6 P. }" R& \+ s修改的代码早有了。到今天不会编译。
0 }8 \' ~) h0 j# R需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>& J5 W1 O, l2 m& I; G. C0 `
  2. #include <malloc.h>
    & f8 p( `: A4 q& w2 \, e
  3. #include <sys/types.h>
    - k3 ^: C2 h4 O- Z# u+ T
  4. #include <sys/stat.h>
    ( c8 a7 V9 ~. @% ~. i6 d# S
  5. #include <sys/ioctl.h>1 l! e4 A: u# n; E# Y  p8 ^
  6. #include <stdio.h>
    1 K% n. `' I, ?9 l" b6 j
  7. #include <string.h>$ \; r1 ~$ L  W/ U  J! s1 U& W
  8. ' C  r6 s) O( U7 p3 G& ?! p
  9. typedef struct {  d- z( D; C+ [( A; L! z( D$ T
  10.         unsigned int        e2prom_cmd_sub_addr;; s! j4 y; z7 r0 F$ p) e3 r; \
  11.         unsigned int        sub_addr_count;7 g, r% y) z. e( q5 W0 B4 r
  12.         unsigned char*        e2prom_cmd_data;/ O6 {+ _6 H$ h0 O& \
  13.         unsigned int        data_count;& g5 H- O- [" U4 [; j& [# y
  14. } e2prom_s_cmd;& V+ \/ i) ^% U) ~. L* h# L% b
  15. & w; g9 N: i+ i0 y7 W7 C7 m, |5 ~
  16. #define E2PROM_CMD_READ 1  k+ z+ H5 M/ Y- O& o
  17. #define E2PROM_CMD_WRITE 2
    , {$ {$ P6 n0 b& B. h
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    " d0 S& o2 w7 h5 `

  19. 8 n) W- t7 U) H4 O2 p' `, [
  20. static int readparam(unsigned char *mac, unsigned char *stbid)3 G2 Z% W9 }5 ^, i
  21. {9 G5 e, J2 J3 @0 Q
  22.         int fd, ret;3 h0 [. v; b: k/ S' v0 l
  23.         e2prom_s_cmd arg;; U- o' ^4 V4 L7 O
  24.         unsigned char buf[0x18];% l: m3 O2 o' g8 d  @9 p

  25. 5 o) {! c# _* w; J
  26.         fd = open(E2PROM_DEVICE, O_RDWR);% P: H4 Z- c! e7 P0 ^/ m1 ?
  27.         if (fd  < 0) {
    $ f) S* o: T$ M7 L, h" E3 Z
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);' k/ n- |/ p. J2 a5 [2 b) k
  29.                 return -1;) {. u  k- U  q/ [) v0 k
  30.         }! S8 M8 N7 |" `% ~2 f4 F$ B
  31.         arg.sub_addr_count      = 2;* b( |. M$ \, J6 [
  32.         arg.data_count          = 0x18;2 j3 c1 o7 I: G2 `, \
  33.         arg.e2prom_cmd_sub_addr = 0x290;6 {; V8 d% Z# y% A
  34.         arg.e2prom_cmd_data     = buf;1 H- s  v3 G* z8 X0 z
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);# `6 M9 q* q: {
  36.         if (ret != 0) {
    $ j4 y# F9 i' x, H( A/ u1 |/ k
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);4 ]5 G. t: f4 p: W' y
  38.                 return -1;
    1 c( V. O8 ?, ?2 \" U& ]& u
  39.         }8 c7 i9 C6 G: w: H4 v
  40.         memcpy(mac, buf, 6);7 \  P  P/ l8 f4 u; t  C4 k1 u( N/ V( k" k
  41.         memcpy(stbid, &buf[6], 18);( A$ _3 h0 F# `9 K  M) \) ]  A
  42.         stbid[18] = '\0';
    3 s9 S( P9 J$ j/ ~0 Z$ o) Z, h
  43. . G$ A9 U" L" v1 u0 ^
  44.         return 0;
    1 d; j2 d& N& g4 j  z
  45. }
    9 u  @4 C. u" E' l
  46. ! ^/ }1 [2 k0 ]9 R
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    . m- x6 b# d0 T& V8 m5 X9 X) T% V
  48. {
    8 @& \, R" v! y1 v# u
  49.         int fd, ret;
    & V; u# b; E( \! ?8 Q& R
  50.         e2prom_s_cmd arg;
    * g+ e" Q' D" J
  51.         unsigned char buf[0x18];
    6 H* l+ ?& d- P3 E4 C: _- w- J
  52. / m0 Q, a. q% Y. K5 z2 {
  53.         memcpy(buf, mac, 6);; t  }% V8 f! {3 b/ R
  54.         memcpy(&buf[6], stbid, 18);
    7 s$ r; C2 w2 p4 Q! i
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    6 }3 @* S) M) x$ W0 h' |8 }! k2 F
  56.         if (fd  < 0) {0 f0 }9 p2 n& k8 U& R1 _
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    $ q, i. D7 g% V, m, J. q
  58.                 return -1;8 [( A, ]4 `' m7 y  {/ S; ~7 u) ~+ R
  59.         }
    * U% o, e7 D- ]$ ~
  60.         arg.sub_addr_count      = 2;
    ) W# b+ f, T, I$ x# Y
  61.         arg.data_count          = 0x18;
    7 C& P7 w0 c+ d  u& K  {) _
  62.         arg.e2prom_cmd_sub_addr = 0x290;  f! F; j, s7 y6 j. B( M
  63.         arg.e2prom_cmd_data     = buf;$ ?2 }, ?+ s. Z) ~- _( V
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);* y8 ^& C2 n# R. O
  65.         if (ret != 0) {# v/ @( Z8 j& O# o' F4 l+ \
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    4 Q" {% Y: c/ N3 G7 I
  67.                 return -1;
    * Z0 z4 `0 b) g% N6 t5 X" ^) ~
  68.         }
    5 }! G; t$ T( u& I( }
  69. # m  V2 X! m* X& A4 [! Y# n( C
  70.         return 0;9 g3 A$ c( m1 l4 z3 q
  71. }
    3 }2 R" ?; Y6 |% _+ i
  72. ; r- ?' C7 }9 Q% g. L7 C
  73. int main()
    & _; l. I, I) G- r' j& I
  74. {8 [4 I' W9 A' T
  75.         char c;
    " L9 L7 W1 U& S- F7 V# ^
  76.         int i, macs[6];- t, w& c+ W( g: }" [
  77.         unsigned char mac[6];( t. \' z: Z' W* A
  78.         unsigned char stbid[256];$ G+ F7 Y$ ]9 y

  79. 8 X" D+ z0 z/ s5 @; g- U0 R
  80.         if (readparam(mac, stbid) < 0)7 Q. l5 ~, d; m. e# R
  81.                 return 1;
    9 X( X' b4 N$ {; ~/ K+ \% W

  82. & b' L( E" \. q4 _' E
  83.         printf("Current parameters: \n");- M1 z; h4 b- @$ j3 d* |
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    8 p0 q; \0 `0 ^- h, y
  85.         printf("  STBID: %s\n", stbid);
      R# w, X, C: i: k( }0 U: S
  86.         % l4 i0 X: i3 V0 ^
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");- }! x0 `4 i; y
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {2 J) E- o4 l, b0 q0 _
  89.                 printf("Input MAC error\n");  c# o2 j  C8 c+ H
  90.                 return 1;( _5 y; S7 c' z( {$ {5 b5 _. u
  91.         }2 ]$ }+ i# r# i, ~
  92.         for (i=0; i<6; i++)mac[i] = macs[i];; j% L& J0 [7 j5 j( t/ I
  93.         printf("\nPlease input new STBID: ");
      K7 j5 L( r* f9 N* O' o! @# V
  94.         scanf("%s", stbid);! y  n2 F2 X, f6 M- b
  95.         if (strlen(stbid) != 18) {
    * [' L6 b% F1 A. Q1 J" G. U) M7 |
  96.                 printf("Invalid stbid\n");
    5 l2 ~8 {6 c5 G: `) n
  97.                 return 1;
    ' [, a; |' B. R" R3 p4 U
  98.         }
    ! k1 u1 e* j5 V% k
  99.         printf("\nNew parameters: \n");
    - @- x- X; d$ g/ G0 A0 D1 u
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);8 e/ Q9 E( _- a; D* u3 p
  101.         printf("  STBID: %s\n", stbid);; }: T/ T) r8 ~5 A+ G" k. S7 S4 Q
  102. 9 y2 }6 i* l! }
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    / T, C, B9 Q! C: i% ]
  104.         for (;;) {
    " }' _, N! R7 ~* ?  A4 Y
  105.                 c = getchar();
    3 l) y7 E! b* m+ |
  106.                 if (c == 'y' || c == 'Y')6 B. B. [  C/ S# `% r& ?0 Z& x
  107.                         break;
    6 c! R* Z& g* J! T8 a
  108.                 if (c == 'n' || c == 'N') {8 z. [. j& t# G# j9 L1 S5 V) ]# e$ C
  109.                         printf("\nAborted.\n");
    ) f, t/ B, H3 R
  110.                         return 1;
    4 d; U0 k  q; C( B9 b
  111.                 }9 ~5 F8 V- U' V- d
  112.         }: i" Q. G9 R4 I& p7 G" \8 ~( T' a
  113.         if (writeparam(mac, stbid) == 0)
    7 W( ~0 ~  u' c
  114.                 printf("Parameters changed.\n");) i( b" x3 X' V$ b* N
  115. , W0 \5 n: s* H+ a& p
  116.         return 0;
    * {* K2 }7 f3 c! o3 Z
  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
/ A3 D2 o) l2 K在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
2 j# k3 ]8 l6 m
你用的编译命令行格式是什么?! X5 l/ B5 ~, v7 x& k" R
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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