找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15295|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr& ~( S& B" _3 I& u9 `( q9 Y* Q
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig6 ^; J& P6 q- W+ E% i
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:: U; b% o! Q- S! P
usage: himr <address> <value>. sample: himr 0x80040000 0x02 D1 D' m2 X$ c! k

# Z2 u7 p9 Y" L) z8 c6 ]- W& u5 T3 {8 Q& b* ^( S! O% [/ J5 e/ j
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
/ z+ n7 K8 @0 ~1 g+ W6 ^- ]; @, W, w" \/ Y
补充内容 (2012-3-8 09:42):; o: i% |% [: k- C: |$ _+ t/ p6 G
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数3 b, `7 j7 Y& K
这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。4 f% W; j6 i9 _( `9 z4 e( _6 z+ P
; O' t3 f3 d  E  ]  D  t
himr <address> <value>. sample: himr 0x80040000 0x03 y/ Z8 u. M* O7 G7 y) K
4 D; R1 a+ c7 P/ b9 E/ d3 |8 v5 E1 E, M
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。. A! m- S, j! v3 c, }
himr 0x80040000 0x00' h% c' T: P! n3 A  e6 @
himr 0x80040001 0x11
# A! G* w: o  W' }: e7 |# ghimr 0x80040002 0x22
& K  o  }) u9 g' K; `( a- F1 Nhimr 0x80040003 0x337 G, j5 ]" a" v; G) c
himr 0x80040004 0x44
' n* m) |7 n; r: M* E% Lhimr 0x80040005 0x55: h* m' ?. D  T
' C% [# G2 p9 W7 ?, g/ B! G7 n; T
SN也是类似。
# M8 i" Z" k# y  P, D4 `- _, N) w: q! Y' g
现在主要是,谁告诉我们MAC和SN的地址?
9 n" X* \! f: K! Q
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 0 Y9 a9 v# C. N" m
一直想找到运程修改MAC和SN的办法,苦于无解啊
9 B# m5 B% u4 h; D
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 6 i0 N4 h& C( e  V. B
" G; ^# b+ _  p7 g
修改的代码早有了。到今天不会编译。
+ G( d9 o: ]/ h3 `4 e/ f需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    9 j& m5 b1 y! b2 f
  2. #include <malloc.h>4 g7 \' z6 [* z& O. Y" V* b" j# v
  3. #include <sys/types.h>% T9 h& {/ q% }# x- ^$ v% R/ H+ {
  4. #include <sys/stat.h># ^' B/ X6 E" ]$ w  N5 N
  5. #include <sys/ioctl.h>0 K9 }: m0 T" O  T* B% ~! L2 H
  6. #include <stdio.h>. y. B& ]+ J8 Y9 b8 i( P7 C
  7. #include <string.h>" {( R2 L. W1 h/ a5 f

  8. ! V/ A! n; R% D# P) t
  9. typedef struct {/ n- E" ?1 _  p4 a0 d8 F
  10.         unsigned int        e2prom_cmd_sub_addr;
    1 q0 I6 c% z, d% B5 e. x% u" m
  11.         unsigned int        sub_addr_count;. h; f9 c1 |! p! p/ C2 R! Z
  12.         unsigned char*        e2prom_cmd_data;$ r  i6 U8 B$ z6 ^6 l
  13.         unsigned int        data_count;
    " S% E' N* ]( u1 `9 M( _6 C
  14. } e2prom_s_cmd;
    8 X5 T+ s8 x1 M. b! ^- e

  15. 6 P" Z, c9 H2 \: m" l* R
  16. #define E2PROM_CMD_READ 1* A  i. R' U: e5 g6 K" l+ }! J4 s. T
  17. #define E2PROM_CMD_WRITE 24 p6 |# A9 z$ B- |! _  f4 ~2 e, C
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    , z3 t. L7 T) w4 [

  19. 2 X* P. H$ T, Q
  20. static int readparam(unsigned char *mac, unsigned char *stbid)9 z! H0 ]+ x6 G+ k6 b
  21. {
    8 R  T/ g% d; z/ G- a- ?/ d) X2 Y
  22.         int fd, ret;
      B& S$ a0 C$ s/ o7 O" |
  23.         e2prom_s_cmd arg;4 U/ t- h9 x" C4 B  D
  24.         unsigned char buf[0x18];
    3 b6 o- I2 _+ S# z# b/ T  Q$ o  R& m

  25. # u% |8 q0 w9 w* \  M
  26.         fd = open(E2PROM_DEVICE, O_RDWR);; c" t7 ~) O& K, u( ]
  27.         if (fd  < 0) {' c: g% d: A9 Q6 q9 {7 _, M! d
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    " Y. H% G% d; U% ]9 I2 Y* b
  29.                 return -1;
    0 B$ e2 e+ M) G, o# n5 v
  30.         }
    0 Y, }- K  w# x& i# g
  31.         arg.sub_addr_count      = 2;
    + |& @2 N" r5 U$ E! C
  32.         arg.data_count          = 0x18;0 u0 Z8 h' h3 e1 {, `! m2 a
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    / L: t+ c4 D" k; b7 e
  34.         arg.e2prom_cmd_data     = buf;3 W( u: G7 s' D! z9 `
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);$ I, c$ F- C  t; z& ]) b
  36.         if (ret != 0) {
    / H$ F2 ~4 B6 Y; E
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    2 F1 G$ A: j! E( a, {. \0 I3 @
  38.                 return -1;
    + h+ c2 f/ ^& i1 d1 {
  39.         }
    , {5 x6 R1 X+ t  q
  40.         memcpy(mac, buf, 6);* f- p' P5 |7 L! X
  41.         memcpy(stbid, &buf[6], 18);
    5 {3 O1 b7 s' s1 l2 F+ j- D5 F2 {
  42.         stbid[18] = '\0';
    1 [3 [8 r. b, g  B0 K% w

  43. * F' d- m( Z( T) Q" ?# ^. Q. Q
  44.         return 0;4 {  z" K& l7 D) z! ~/ o8 W/ u- u
  45. }
    ( G1 U7 n( E( ^3 C
  46. 5 w/ ?) n: q* H3 ]) u; S. U% F3 P9 z
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    9 }) N9 W/ `& L' t: G  V  E
  48. {' t* V, N6 a9 t. Z9 A/ n
  49.         int fd, ret;
    ( v5 f  y6 H" _2 K
  50.         e2prom_s_cmd arg;
    . ~0 [1 C( E. z3 O! o$ o9 I( Q
  51.         unsigned char buf[0x18];
    ! B" n( x  ]; x/ I, Y6 m, Q  Y& v$ L& ~

  52. 0 j0 q5 m2 _' ?% |( B+ ~
  53.         memcpy(buf, mac, 6);
    , o! Z3 G% x% Q' J( f; Q( B
  54.         memcpy(&buf[6], stbid, 18);
    5 \  |0 _: _/ d6 U' R
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    # d* L% S' X0 U; z2 C# h
  56.         if (fd  < 0) {
    / h( s% r" U" O4 c" }: j0 E8 e
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    4 Z: |! i. g/ L, e6 k, A
  58.                 return -1;: N$ L7 V1 h& D- T' c
  59.         }9 o( s/ y8 {8 s3 ^4 L
  60.         arg.sub_addr_count      = 2;2 T3 D0 O, o! J  J" S/ I
  61.         arg.data_count          = 0x18;- P  g  Z: x# B! `& [5 J3 [
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    1 Q' q# I0 v2 V* |# ^* X
  63.         arg.e2prom_cmd_data     = buf;
    6 w" J7 |- c# L, a( J( \- Y% {$ T9 d' B
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    5 f; k+ @9 L+ n
  65.         if (ret != 0) {& S! ?6 f' v4 {
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);4 W" P- I3 d! n- X2 w( H
  67.                 return -1;8 S" R# q& N" t8 d( @. p& ?5 p
  68.         }
    2 G; a! O( @, H* x
  69. ) V  S5 ^1 X! ^" ?9 _+ V# h5 r
  70.         return 0;
    * ?  ]2 E$ f) N1 }
  71. }# w# q" f# f& r5 \' M
  72. 5 V, j# B+ R% s( Z' a2 g
  73. int main()
    ; ]: a$ \9 A1 x+ y6 U& H
  74. {
    % K- p  q- a3 U9 Z( R
  75.         char c;
    % A/ p+ v3 H5 o
  76.         int i, macs[6];
    - O9 c6 e- Q5 }# u3 g' \
  77.         unsigned char mac[6];4 \$ s: C! A3 V
  78.         unsigned char stbid[256];- g0 p5 I3 j8 u2 {
  79. ' ^& d- |% W5 m! U( S( A
  80.         if (readparam(mac, stbid) < 0), Z& P6 O( C1 n
  81.                 return 1;
    , p0 `+ q( H: M* j6 x2 }' _' o
  82. ! s1 L3 K. u+ ?3 D. F8 R/ y) a
  83.         printf("Current parameters: \n");
    4 n7 }8 A# x- h( m9 b
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);: n/ i3 B3 W5 n/ R3 i
  85.         printf("  STBID: %s\n", stbid);
    : v) [( a8 ^5 R8 \1 V6 t
  86.        
    : h- ]/ s/ \  T3 R' `
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    * _4 ~9 K6 F. H( F
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {% h! ~; Q; L+ B7 Z3 g; ]: T6 U
  89.                 printf("Input MAC error\n");
    0 H6 `7 j# a# e* y* [
  90.                 return 1;4 N' r" g2 b' o2 T4 S
  91.         }
    2 ]0 d+ U% V# E* s" h( G
  92.         for (i=0; i<6; i++)mac[i] = macs[i];; N2 g0 F. Q; H" ~
  93.         printf("\nPlease input new STBID: ");4 Z, V6 a, t& i9 Z' L/ |  T
  94.         scanf("%s", stbid);7 Q* O- O4 o) ], K6 o4 _1 J2 g
  95.         if (strlen(stbid) != 18) {
      ~; U2 h6 `! J- X+ m! T( I: b6 ^
  96.                 printf("Invalid stbid\n");
    ) v7 a; D; A) s
  97.                 return 1;
    & H! ?/ l! }' d1 B. ~: i2 f
  98.         }
    ' C, J0 Q( Z# Z8 ~
  99.         printf("\nNew parameters: \n");
    , ^5 i# J' r! l) Y) n
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);3 `0 e1 ]0 \6 x
  101.         printf("  STBID: %s\n", stbid);
    $ A4 Q4 W0 z9 ?: R+ L! ?2 l

  102. 9 p+ X: q) p6 w  U; V
  103.         printf("\nDo you want to change paramemters? (y/N) ");
    % ?- j6 o" e. J3 W: f$ Z' d# t1 Z
  104.         for (;;) {
    3 f4 D% u4 s/ S" p
  105.                 c = getchar();# v; i6 L, t! _4 H
  106.                 if (c == 'y' || c == 'Y')
    % S! J- q% k% q8 i# a
  107.                         break;
    . t0 H5 D2 w. E9 H+ \/ [( }
  108.                 if (c == 'n' || c == 'N') {
    % [) G5 p# [, J, ]. X9 v' l( T
  109.                         printf("\nAborted.\n");& }7 e: ]5 x+ O$ _& }8 s
  110.                         return 1;2 c- S1 I$ w1 Y: w" ]2 c- o
  111.                 }! V/ @$ R7 |. X" n3 n' N2 ~# }1 B
  112.         }, ]& ^$ m& |; m4 ~, c1 h$ s+ i) B
  113.         if (writeparam(mac, stbid) == 0)
    ) E! k7 D: L" S6 d
  114.                 printf("Parameters changed.\n");+ p9 Q6 Y, Z7 d4 {. e3 ^8 m8 W

  115. 6 m9 F6 q8 K+ ~. L, ]* @
  116.         return 0;: y( j3 U) n4 q& u5 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 4 z4 F! e- q8 \4 @! T/ E, S
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

+ P9 X1 N, j' Z% m& `你用的编译命令行格式是什么?
, I3 U8 n; U/ ~% z5 j2 k* G
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

GMT+8, 2026-1-18 07:29 , Processed in 0.032579 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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