查看: 16846|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 |福建| 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr, W' v- K1 h8 W/ _8 F
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig' u. h/ a/ ?; J' C  e# Z/ y
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:0 D  J! {* m: o# k" J) S
usage: himr <address> <value>. sample: himr 0x80040000 0x0- C% h3 v" M: L  R; N
) e+ F- H& r* z, D2 n3 C7 h

0 ]9 ^5 D8 S) B+ m, h& g' Y* D不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
- Q* y& U: [; r1 d
- M- d' _- c- g1 _; T# b& N补充内容 (2012-3-8 09:42):
. H6 A9 Q) H8 L: d1 g+ W! Nhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数8 D# B% f! p6 R2 N, `
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 |福建| 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 |湖北| 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 |福建| 显示全部楼层
估计就是执行这个命令。& G/ ~6 _: L! t( a6 I  H

& y  W2 p- K! l. o' \himr <address> <value>. sample: himr 0x80040000 0x0
2 T# F) ^5 g$ D$ M" e& `& m7 a- z5 h8 A: g
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。3 U$ J/ N! ^# D1 x6 ]
himr 0x80040000 0x00
. e# J+ o3 t0 D- U& fhimr 0x80040001 0x11
3 u7 C. S; ]+ R' Ghimr 0x80040002 0x22( `4 `4 j2 F9 {) Y1 M6 e
himr 0x80040003 0x330 S# [/ q9 X" R" n% h4 q# X  F' |
himr 0x80040004 0x44
$ C4 ?$ x7 L. d4 h9 s/ _0 u7 I# A, n/ v/ shimr 0x80040005 0x55) g4 c4 ?. T9 [/ }

$ Z7 e/ S" w( B9 I8 d6 r& v) lSN也是类似。
5 u" X; X" G+ s* T5 m- V# g9 i) y5 n7 |
现在主要是,谁告诉我们MAC和SN的地址?
; f2 d; Y1 T" P- U& U3 H' A8 |
发表于 2012-3-10 11:37:46 |湖北| 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 |福建| 显示全部楼层
wowocom 发表于 2012-3-10 11:37 1 J7 }9 U- Z! V) Q1 M5 I* a
一直想找到运程修改MAC和SN的办法,苦于无解啊
. D' ?7 }: K! G1 f1 C4 T3 p$ E
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 |福建| 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
0 {! r1 o0 B. t! D, m# I5 Q' O1 g; k* ?
修改的代码早有了。到今天不会编译。
' d0 Y/ ]- j( }需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>  i  B  X7 u# T/ w! L* o3 u
  2. #include <malloc.h>2 d. c& D$ A+ s& Q; C1 N  ^
  3. #include <sys/types.h>
    ( m- y' j. I9 E0 [: {' U
  4. #include <sys/stat.h>
    8 P4 S; I7 B8 o# O( C
  5. #include <sys/ioctl.h>
    : T1 X7 f# \" f. _6 b/ W6 a! ~; f2 f
  6. #include <stdio.h>
    + \* Y  J! z6 ~$ @$ [0 {
  7. #include <string.h>
    ! p/ H- o. }7 q  ]

  8. * a& k3 D  R8 m! A9 H7 h3 e0 J$ E
  9. typedef struct {
    - A" Q5 B' A" ~  [' ^- E- H" y
  10.         unsigned int        e2prom_cmd_sub_addr;" A3 @) b/ k" f# C  U% r; O
  11.         unsigned int        sub_addr_count;
    , d  T, o9 O' y0 t# r5 a0 Y4 t
  12.         unsigned char*        e2prom_cmd_data;
    & H4 F3 }0 _1 K  O+ E* P+ g0 J) m
  13.         unsigned int        data_count;
    - f3 k! ^9 F% N5 H  s
  14. } e2prom_s_cmd;
    ) n; D$ A8 U' E$ }! w" o  K

  15. 9 M! z' o- n( _+ K0 l( t
  16. #define E2PROM_CMD_READ 1
    ! ^9 d4 N, F, G; G
  17. #define E2PROM_CMD_WRITE 2  H' W, O7 ]( w2 L; I, ^3 h% N$ \
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    ) V; r5 o. x( I8 q
  19. $ {6 u7 U* F0 R/ _# e" g
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    ! J* f: Z0 l* h$ }. S  Y  [6 b
  21. {$ c" R  E: a4 W2 @( @( g) p
  22.         int fd, ret;2 X  w7 i* L' y3 U) H* N( A
  23.         e2prom_s_cmd arg;0 O% J+ m8 ?) L
  24.         unsigned char buf[0x18];
    ; E) `9 f2 j: z5 Y+ P' P' {; y
  25.   F) [' J/ a: t
  26.         fd = open(E2PROM_DEVICE, O_RDWR);0 J9 Z+ C/ R: z8 D4 m
  27.         if (fd  < 0) {
    * i, Z/ Y; c) w
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);. e6 Q. A  w! N, `7 I* e. @
  29.                 return -1;
    4 N: m5 \7 ~& k7 t& P% E
  30.         }
    , X( U+ B9 b4 b- [: z
  31.         arg.sub_addr_count      = 2;; V0 u7 r; b3 x" t
  32.         arg.data_count          = 0x18;
    1 K1 ^" |: M0 n" C, ^/ f
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    " T! E3 V( ^& H9 m" a* k$ t7 R" d
  34.         arg.e2prom_cmd_data     = buf;
    1 ~; m1 P8 m2 l
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    " Z% C& z0 c, p5 J) K9 U
  36.         if (ret != 0) {
    6 O( d* D6 v9 h9 ?8 j. i
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);! j: M, J2 M; g2 I2 g5 o7 t: V
  38.                 return -1;- q# m: D! _& H& X
  39.         }+ m$ U# ?5 U( m0 M- t  E8 _) O
  40.         memcpy(mac, buf, 6);
    1 x% a  h; t/ t( A* _
  41.         memcpy(stbid, &buf[6], 18);; q, y  B" L. U" b: P2 z
  42.         stbid[18] = '\0';/ z$ @" A$ n$ U) q

  43. 8 A0 ^3 X: Y3 y2 `8 ~- N0 A
  44.         return 0;! P) U+ U- W  b$ p
  45. }# k. R8 X6 o4 N/ t4 @
  46. 7 B8 r/ ~) ?2 S! B* o
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)& _5 J; v7 x: \
  48. {
    # ~' v4 u% h, y- M! X
  49.         int fd, ret;0 m: h4 L5 `* [" k, S
  50.         e2prom_s_cmd arg;
    2 _9 z4 Y4 @# b" U# {! H
  51.         unsigned char buf[0x18];
    % u" ?" W& t( ^( n0 p
  52. 5 T+ W, ]1 d4 @1 W5 I- j; d) U
  53.         memcpy(buf, mac, 6);
    . U/ @! }3 `+ Y3 L4 {0 e
  54.         memcpy(&buf[6], stbid, 18);
    . D6 l0 P( ?, V7 t& y; ^  D
  55.         fd = open(E2PROM_DEVICE, O_RDWR);# q# E4 u7 R% Q' g8 Y/ L1 w, F
  56.         if (fd  < 0) {/ o) h5 y& O+ d
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    + v0 i; k1 @$ P* l
  58.                 return -1;5 R+ l  b$ J( P& O" M
  59.         }5 s) O1 B1 r9 b  b% O
  60.         arg.sub_addr_count      = 2;
    7 n8 p0 Q% g% @& {: N7 H; x+ y" M  `  X
  61.         arg.data_count          = 0x18;
      U! Q% }  m4 l4 U# f
  62.         arg.e2prom_cmd_sub_addr = 0x290;. F. T: X! T2 |& R
  63.         arg.e2prom_cmd_data     = buf;  |5 K3 I  ?5 a2 y( h/ j
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);5 m) F; d6 p# D$ o- C! O. Q4 V4 _
  65.         if (ret != 0) {
      x, E  k: k  c
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    6 w$ J4 O/ ~0 Q# N9 m1 U
  67.                 return -1;
    / T4 j; d- J/ M0 J$ C
  68.         }& S& S: L' m" x
  69. 3 ?$ E) t9 b! p+ A! \
  70.         return 0;' q% [0 i) @; t4 P
  71. }
    / s9 a2 b1 ?. n* W( {
  72. 8 W- v, V) x, T/ L
  73. int main()
    . O4 u+ |/ J( ~1 R. _
  74. {
    8 z+ }1 C" ?; M4 h( e$ ~4 G
  75.         char c;; ?7 D1 _, \7 h4 `
  76.         int i, macs[6];) x0 B  x$ g' i
  77.         unsigned char mac[6];7 J' [% F+ e+ O+ e, C
  78.         unsigned char stbid[256];$ l4 q3 Z" w2 ^' J" P! s! v* w
  79. ! r% i4 e9 u1 m" J9 x# A# R6 P
  80.         if (readparam(mac, stbid) < 0)' B% ]0 v' o1 i2 J
  81.                 return 1;* t  V% b8 t0 F$ ]! x
  82. ( D" W- H& i* \
  83.         printf("Current parameters: \n");
    7 h( c, ^) B& Q
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
      ~  _) l1 n  q: C. f/ T5 ^
  85.         printf("  STBID: %s\n", stbid);
    / ~% K8 v' A0 D/ B+ \1 i0 W
  86.        
    ( s4 w; n6 V+ m& B( c
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    6 Q* W! T% u0 c' j  s% n
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    2 x$ B% _2 F2 o' Z0 l" @
  89.                 printf("Input MAC error\n");
    2 K8 i( i: a' j" d( Z
  90.                 return 1;( I* k  d7 D2 n3 o& \! g- g( Y% r
  91.         }$ [* }& _  k& F0 `6 @4 v
  92.         for (i=0; i<6; i++)mac[i] = macs[i];* w# U) d0 g$ Z. R7 W" o
  93.         printf("\nPlease input new STBID: ");
    1 {# g2 Y5 ~% ?' T( v3 S3 G6 {, p  s
  94.         scanf("%s", stbid);8 w& X" s4 M3 `$ V" t
  95.         if (strlen(stbid) != 18) {
    ! X# R9 a# d. U( T. h4 ?
  96.                 printf("Invalid stbid\n");
    " m# d0 `- X1 |7 d
  97.                 return 1;
    1 Y2 P  f4 y$ w& A7 H& i$ a
  98.         }
    6 u4 M+ C6 l" ]" l8 j! Q- ?: D
  99.         printf("\nNew parameters: \n");
    $ T4 L. y" J/ F9 Q' N  D  M
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    $ }( b+ V' a5 J) Q& _3 g+ Y
  101.         printf("  STBID: %s\n", stbid);
    7 H4 M2 b3 f. [

  102. 7 G. ^0 J8 w, z
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    9 k* J7 p2 `- L3 ~* X8 g2 t
  104.         for (;;) {
    / X- _/ A' J$ {- K
  105.                 c = getchar();4 z1 k1 f8 i$ T0 ^) ^& z
  106.                 if (c == 'y' || c == 'Y')
    2 T: \+ r$ o$ T+ k. v
  107.                         break;% a& y2 a2 M. G/ d
  108.                 if (c == 'n' || c == 'N') {
    9 _0 c  G7 y4 H$ y6 C* V
  109.                         printf("\nAborted.\n");' j( P$ d6 t6 R! u
  110.                         return 1;
    ) U6 K1 I' j- {' d: X3 T! g8 i: c$ W
  111.                 }
    , D1 K5 O2 m$ G. D' L9 V
  112.         }
    1 d( a+ l' u1 x
  113.         if (writeparam(mac, stbid) == 0) : h# y( Y2 H1 ^' X2 G- A6 J
  114.                 printf("Parameters changed.\n");
    7 a9 @5 y4 x* E; s5 r3 \

  115. # b. i5 Y  {" p( J2 K
  116.         return 0;
    $ h1 T: C5 s: Q9 u2 Y9 n
  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
5 b6 G$ W7 S3 L) n% g在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

- ]* t  r1 F7 T( J7 s你用的编译命令行格式是什么?: j" \$ x4 b, q* y
发表于 2012-5-26 19:45:12 |新疆| 显示全部楼层
已经编译出修改文件,并且修改成功
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

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

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