找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15725|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr* Z9 _8 ^3 X3 k/ @1 D; }
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    8 G% T9 ?* o) d$ U. N
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
! {+ {& N0 D! y3 T8 _8 Tusage: himr <address> <value>. sample: himr 0x80040000 0x06 X  O4 I7 Q# e
9 h+ M: |- g2 P! Z$ |" Z- a! [

: Y" p" [6 ~$ a/ l) Y不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
& B3 K  @; ^; T" J( ~% |, D" S) L  @
补充内容 (2012-3-8 09:42):
4 i6 w# X1 l) j4 [& Rhttp://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数/ e3 j7 V3 o  f3 b$ h+ L
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
# Z1 b: q" P1 D# K0 o2 k9 u. W$ b/ `& Y
himr <address> <value>. sample: himr 0x80040000 0x0' R8 f/ @9 m0 H) i
! u% ?* `5 I* L5 v8 m  F
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
, t& v  Q+ {, L2 p3 g" ?9 H8 ~himr 0x80040000 0x007 R/ L0 U/ N) `" o
himr 0x80040001 0x115 L) E' @% G2 p$ k1 L( u  m
himr 0x80040002 0x227 c0 p) E; ?* E# n
himr 0x80040003 0x33' p6 _3 Y4 }/ ]+ V8 i
himr 0x80040004 0x447 }5 q& F+ u& u( ]6 B
himr 0x80040005 0x55
* Y+ _  |2 Q9 v. e1 d3 N! n( {8 Z. Q3 x
SN也是类似。
) n3 ~5 I4 ]- s: ?- l  P7 N& i; x* `/ }0 W) ?7 N5 \
现在主要是,谁告诉我们MAC和SN的地址?, q$ T5 K9 p( v& n7 U% N
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 0 ~+ p8 [5 `3 \  Y+ b
一直想找到运程修改MAC和SN的办法,苦于无解啊
4 s0 ]8 [* A8 k' f
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
* |( a2 r9 s5 \+ q  L/ o- K$ X, E6 y" V' @
修改的代码早有了。到今天不会编译。/ Q5 F5 @0 A) T! o
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    2 w! l6 S$ \1 g6 D. o9 N
  2. #include <malloc.h>* N# p( a5 S$ c2 ?" v: c0 f
  3. #include <sys/types.h>
    ! \' {( V# H5 X- ?: V4 Q1 H
  4. #include <sys/stat.h>
    7 s4 ^% ?+ G" x) q/ N; ~0 v: X
  5. #include <sys/ioctl.h>
    & Q4 W7 L7 ]' U" D+ m4 |7 t* D
  6. #include <stdio.h>% {. N% L5 G6 S* d5 q9 G
  7. #include <string.h>: c# ~- Q  ^9 ?+ ?/ R- g! P0 W3 ^

  8. ' U1 @6 \9 k2 `" `1 e* M4 t& l- ?
  9. typedef struct {
    ' {. Y; ~+ M* o2 p/ N& j3 e
  10.         unsigned int        e2prom_cmd_sub_addr;% B/ ]) `5 ?0 X0 m1 {
  11.         unsigned int        sub_addr_count;
    $ r5 D- e7 n4 I; c2 K( y
  12.         unsigned char*        e2prom_cmd_data;
    8 V: _* S, n4 X
  13.         unsigned int        data_count;
    6 h3 y: ~  l& X& y/ _7 I/ d
  14. } e2prom_s_cmd;0 n2 R+ n0 }; c4 p9 W
  15. 0 b$ D! \) ^8 N9 h9 [
  16. #define E2PROM_CMD_READ 1
    ! H' u- `! p! J/ B9 X
  17. #define E2PROM_CMD_WRITE 20 M* i# V# Q" L1 u
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    6 s& ]5 d3 Y; R# j

  19. 5 U5 H+ V$ L; S
  20. static int readparam(unsigned char *mac, unsigned char *stbid)5 T0 T! ?7 S. t2 p0 r$ L8 i
  21. {
    % I$ }) K7 S0 x( P6 o. B
  22.         int fd, ret;
    " ~4 r) l# M+ Y( g' }4 |# ]$ e& P
  23.         e2prom_s_cmd arg;
    8 H' o4 C; |0 g
  24.         unsigned char buf[0x18];
    1 D8 M# i4 [5 x8 V, p
  25. " J. u- \/ ^  W7 A* B
  26.         fd = open(E2PROM_DEVICE, O_RDWR);* z/ ?5 l6 d/ y" B# S
  27.         if (fd  < 0) {
    8 S: |. H. Y6 J6 ]1 k
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);6 q, I' a: O4 u$ j# `
  29.                 return -1;
    9 I; Q, V3 P# F* U# @: h2 }6 X7 ~
  30.         }8 B% m9 A, X9 x2 l
  31.         arg.sub_addr_count      = 2;* B# H0 J2 B* @
  32.         arg.data_count          = 0x18;
    ; T! T, D3 P* J9 L
  33.         arg.e2prom_cmd_sub_addr = 0x290;# P# m* j( ?+ D0 |2 [
  34.         arg.e2prom_cmd_data     = buf;% C/ q2 K# g- m0 \7 ^4 ^
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);+ H, {; S$ A1 q$ T& i
  36.         if (ret != 0) {" v1 G  e- A% x  \. `* p+ X3 D( b
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    $ }" e5 ~5 }& c* W3 Q, j
  38.                 return -1;
    " I  Y" O3 r/ m7 P$ ?3 r
  39.         }
    ! ?! }! q9 G7 _. V
  40.         memcpy(mac, buf, 6);
    , t* J8 `! r# X# L6 V; [* q6 D
  41.         memcpy(stbid, &buf[6], 18);3 i0 W& R7 M7 V" C
  42.         stbid[18] = '\0';( v" y+ W5 I! M# u

  43. " N( [6 j" D; R: Z+ w4 x; z" U
  44.         return 0;/ _" ~; K& G# O# D
  45. }
    3 s+ n! \4 x7 x; J1 N. p

  46. - H, e, s4 D* ?- j0 \$ @( K
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    5 {1 }3 F3 t! `8 U! w
  48. {
    5 u: B8 K( ]" n1 r7 v. F, q' t  c
  49.         int fd, ret;0 s, t& E5 Q* `' c
  50.         e2prom_s_cmd arg;
    5 ~. n0 M9 i$ L# d0 \/ k  z- s
  51.         unsigned char buf[0x18];2 U' j5 d! E5 f& P7 a+ i; V
  52. 9 I- h9 w0 ]% v" Q0 U
  53.         memcpy(buf, mac, 6);
    ; o; y6 Q: z$ k0 ~2 W: ?& R$ @+ U
  54.         memcpy(&buf[6], stbid, 18);: d5 Z7 h* L( E/ h+ L
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    ' S% N# R& o: ]  T9 ?& p
  56.         if (fd  < 0) {7 z+ I: M; }7 ^2 L
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);: u" t+ s0 w1 o* T8 r
  58.                 return -1;
    1 Y. i7 Y( E0 C4 O: V
  59.         }: j3 }$ F/ B% z; e6 s
  60.         arg.sub_addr_count      = 2;6 Q5 N2 ~# i% w% H
  61.         arg.data_count          = 0x18;, P3 A( U! s- M# ^! H9 {" x
  62.         arg.e2prom_cmd_sub_addr = 0x290;% \' I5 O( w# @( M+ u: I
  63.         arg.e2prom_cmd_data     = buf;/ w& a+ r- s3 [/ A7 a
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);  a( y7 V8 q, `- m( J' i9 \
  65.         if (ret != 0) {
    4 ?7 u+ t4 ~7 f( g
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);/ e' z5 h3 d, z
  67.                 return -1;
    % u& i6 A4 l5 K4 g# q
  68.         }, w; y9 f$ b3 a  L

  69. 5 l+ T+ k$ Y/ _. r, M0 ?* {, I9 N
  70.         return 0;& {1 _  Z, O, W, A4 x3 l1 z' W9 A1 F
  71. }
    , o- c* ^1 v4 s/ q$ F! n
  72. / `4 Z7 V9 {6 Q! g
  73. int main()- f* s# I4 Q' f8 G9 y+ a$ O1 W
  74. {2 n* D' q  b* G8 x6 Z  p( T5 V5 {
  75.         char c;
    * `* d% [7 o& N3 U3 i8 n, P2 I
  76.         int i, macs[6];
    6 w- C1 \) r- v/ M( g5 P8 l
  77.         unsigned char mac[6];
    8 I8 w' L% _$ X, O
  78.         unsigned char stbid[256];, [* C4 k1 y6 K4 ~. Y, i

  79. 0 I# T  a1 D& g3 X2 o0 h  N
  80.         if (readparam(mac, stbid) < 0)
    . K/ t* {' @" z3 h3 d+ d
  81.                 return 1;$ x3 v' e+ N0 ], F+ ^- ^1 c6 W5 Z" u

  82. * K5 S: a+ [4 B+ p: n" R. e6 i$ G
  83.         printf("Current parameters: \n");
    8 N  w5 e# x! T) N+ y
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    : Q, U& a& C! m& \( b
  85.         printf("  STBID: %s\n", stbid);
    . m$ P9 X; I3 U3 m
  86.         6 J; A4 _# z' O
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
      i1 ?& \9 M% q
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {8 |  A7 I7 ?" k4 y
  89.                 printf("Input MAC error\n");
    # y$ f+ S9 i2 P  h4 Z5 \
  90.                 return 1;* [4 ~2 |6 r8 o) l
  91.         }1 T, r/ `+ Z' L  q1 W% j
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    4 y& n- x7 e8 t6 D) M' [3 i* S8 y
  93.         printf("\nPlease input new STBID: ");
    ( a) l/ J" n. J* V8 ]
  94.         scanf("%s", stbid);
    $ q3 J3 Y1 U/ O9 e
  95.         if (strlen(stbid) != 18) {- [% p; H' ~. Z, w
  96.                 printf("Invalid stbid\n");
    ( W: `* a! R0 U9 U
  97.                 return 1;9 t$ ^7 a5 g, a9 x- k: v/ X
  98.         }
    8 {' u% U. U/ q# l$ d" X
  99.         printf("\nNew parameters: \n");  s- _/ p0 D$ J/ M2 G
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    , H" r, T5 E1 c7 y0 Q
  101.         printf("  STBID: %s\n", stbid);8 w& ^+ I2 H5 n. f/ H$ j" D
  102. $ F, v, [; J& c. C# s; X
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    3 z, i+ C) h% ]9 ]: X; p. L
  104.         for (;;) {' k% F. l3 H( R/ Q  Q$ r# P' U/ w
  105.                 c = getchar();. X& t( Z/ Q. l/ H
  106.                 if (c == 'y' || c == 'Y')8 `& F5 {% _5 Q7 M3 ]
  107.                         break;
    4 F: a3 M4 l2 P
  108.                 if (c == 'n' || c == 'N') {0 I9 O4 z4 [4 Y9 ]
  109.                         printf("\nAborted.\n");
    ! b" N; r6 H# ~$ E1 |  ]
  110.                         return 1;1 S" V. I6 ^; e+ _/ S
  111.                 }
    ( W) m# d: C, j! D' Q" ^
  112.         }( f. e4 ?' d5 \* g) i  K
  113.         if (writeparam(mac, stbid) == 0) - _1 ~" v  K& \# s* L9 S
  114.                 printf("Parameters changed.\n");; W2 n7 \: p8 y( o5 `4 V  L( T, A

  115. 6 s" H6 t+ X  V* I1 U
  116.         return 0;
    ! W4 P- q9 S. K9 o( i
  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
2 d2 ^# i8 Q1 L. e在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

; e0 v! a0 [; _7 X5 G* w. `& g你用的编译命令行格式是什么?8 j3 [5 X' e# \0 d
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

GMT+8, 2026-3-5 17:51 , Processed in 0.028505 second(s), 5 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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