找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15683|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr' y# [+ Y1 X6 L: Z
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig
    ) k/ x  _( W6 U) U/ Z  |! E
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
& \& I  z: P9 S6 C4 x% B1 Pusage: himr <address> <value>. sample: himr 0x80040000 0x0, S) w% q8 s$ l+ d* j" C
5 Z7 T. O& O5 I0 k) v  D  V) ~, r
% K7 V$ y7 z; D4 z( h! Y
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
0 A, @$ B( ?- s! E9 ^7 @: Z
4 w+ Q6 |, i$ m6 S补充内容 (2012-3-8 09:42):# P% n2 r9 T  t, T( Q! J
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数) @( P% a; W& H# i+ 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 X7 X( c. ~) q
! C/ M. u; @9 X2 a: Dhimr <address> <value>. sample: himr 0x80040000 0x0
* x  r6 [8 `6 \) k3 Q$ K% Z! j5 M0 Q
例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
; Z5 d) c! L( r* j' t4 Chimr 0x80040000 0x00
( K) V0 y8 O5 D: x/ c4 `himr 0x80040001 0x11
0 t0 O' e/ T6 c  Q- m( E0 g) m4 jhimr 0x80040002 0x22
: m% g) `( J+ Dhimr 0x80040003 0x33+ Q& U9 K. a1 V; g4 T! n: `) Q4 t
himr 0x80040004 0x444 s& C3 b/ u& p" l4 c: J
himr 0x80040005 0x55& Q0 k; U6 W' a* a
4 Q% t( I5 ~5 |# x# H
SN也是类似。
5 ^9 Z: z# Q1 ?, {' q# t
$ Z  ~0 C- q) Q$ ]9 ]; Q现在主要是,谁告诉我们MAC和SN的地址?
- b4 M4 t# [8 w9 i1 l
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37 - K, _3 q2 J* I1 u& W# V/ u- k( q& f+ }
一直想找到运程修改MAC和SN的办法,苦于无解啊

% p( V5 _$ {4 U; ?" W源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
  i+ R+ p4 h7 r. t' n" @
6 J- D/ L( g- d! {4 [/ ~" L修改的代码早有了。到今天不会编译。
2 |. p& g- [! ?0 {5 ^2 T需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    & m8 O! W7 {; v! `  R* Z5 E, Y  J
  2. #include <malloc.h>
    + p' f9 x4 u( L; J: Q
  3. #include <sys/types.h>3 N+ k9 p1 F% o
  4. #include <sys/stat.h>
    2 T- b8 p$ |: S1 b* t
  5. #include <sys/ioctl.h>7 t- R% j4 z6 V) o
  6. #include <stdio.h>
    # V) O- ~; N0 _& t  {& q
  7. #include <string.h>; M' a- e9 V& b2 }
  8. * S6 E' A* ]: V# y- e2 w, q
  9. typedef struct {
    1 E; N& \! [5 P" g+ K, O
  10.         unsigned int        e2prom_cmd_sub_addr;$ O6 v/ E; M, X5 l4 _) q% C0 k
  11.         unsigned int        sub_addr_count;
    4 }% _7 J6 c! M8 F' H5 P( @
  12.         unsigned char*        e2prom_cmd_data;) _+ o' c- D1 l. G
  13.         unsigned int        data_count;
    0 {7 Z% B/ U: s: ~! A( B& S: E3 P
  14. } e2prom_s_cmd;' \8 l, x( f1 U$ Y' ]4 N4 M4 N
  15. - H9 @( v$ \$ R& m7 \
  16. #define E2PROM_CMD_READ 1
    : B- n) _* t8 ?/ i! \
  17. #define E2PROM_CMD_WRITE 24 q6 t8 J( C- [" V2 I! ?
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"
    ) w0 d  }: c5 ^. n2 {0 n
  19. 1 C  a& [1 ]3 f# K
  20. static int readparam(unsigned char *mac, unsigned char *stbid)
    9 U8 z7 q8 m. H, M
  21. {% ~) M9 o. J; G1 e+ f
  22.         int fd, ret;
    5 L, J5 ]4 x" l+ j+ G8 i- `
  23.         e2prom_s_cmd arg;
    5 \/ z+ b% `! h% ]
  24.         unsigned char buf[0x18];
    . @' ?/ g1 \) g7 }) }
  25. 5 ~9 _! w- B' I2 Z8 W8 f
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    , _- v$ j# f& }& d9 W: ~
  27.         if (fd  < 0) {" C/ c4 i( w# ^; f0 x- ^6 I: o
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);+ \$ w: f" B8 X7 g
  29.                 return -1;& z) `' v$ x/ g
  30.         }
    4 y, f9 z6 ^- X& W& {# }
  31.         arg.sub_addr_count      = 2;
    * E8 ]# l) G+ c5 H- }$ |
  32.         arg.data_count          = 0x18;+ ~* O" n4 u% F/ C
  33.         arg.e2prom_cmd_sub_addr = 0x290;* }+ f& r2 ]8 U7 A" y7 {" v
  34.         arg.e2prom_cmd_data     = buf;/ J0 ^6 u9 \8 W: n9 A, E
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);& e% b/ I5 d6 a" Y. s
  36.         if (ret != 0) {
    # O. ?+ k, @  e! w5 W1 `: R; d
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    # f! w4 {# S5 y/ i# `$ J
  38.                 return -1;
    . R. F- S+ U* ~* t! \( F) Y/ F7 m7 g
  39.         }5 C  a0 F" I5 z# ]
  40.         memcpy(mac, buf, 6);# N2 E8 ~* M* u$ [
  41.         memcpy(stbid, &buf[6], 18);9 T/ I& |# Z" n- b6 n7 I
  42.         stbid[18] = '\0';- j* B% a2 j8 a0 j: M" j' [
  43. ) g1 J1 B, D1 c
  44.         return 0;
    7 `: I6 e* y( t4 L* ^
  45. }
    0 e0 j# n, F% ~( @
  46. " ~8 e9 w  H1 V2 [, J3 u
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)
    0 ?  X- k2 m; {' K/ z0 _
  48. {
    ! ?' x: `& o* y
  49.         int fd, ret;
    $ e* }# n9 e1 X8 o. l/ M7 {3 p
  50.         e2prom_s_cmd arg;9 |; Y' o7 }5 L; s( T
  51.         unsigned char buf[0x18];
    ) j5 ^& Q3 v2 ^# l  D; }9 I
  52. 0 l1 ^  e5 H" {; U: W' a+ E
  53.         memcpy(buf, mac, 6);6 p2 \0 Q7 b3 p/ T( I* L! V0 ?7 f6 m
  54.         memcpy(&buf[6], stbid, 18);6 G0 u6 I- O0 @: w5 T
  55.         fd = open(E2PROM_DEVICE, O_RDWR);! I, D9 H7 I% n( e4 i; i
  56.         if (fd  < 0) {* k8 E# L9 f5 }: V
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    + k5 ]1 U- i' ~
  58.                 return -1;/ a- I  N8 V# _4 @
  59.         }
    $ q3 R* z0 U+ d* a3 c
  60.         arg.sub_addr_count      = 2;
    . @* f3 a4 p: [) X& S
  61.         arg.data_count          = 0x18;/ u( ^& L5 p5 Q/ Y5 V9 r5 e
  62.         arg.e2prom_cmd_sub_addr = 0x290;- X/ r3 M$ \  O" r
  63.         arg.e2prom_cmd_data     = buf;2 Q' Y0 L- K4 o1 E  W1 g  }
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);1 v7 q; z. w" j1 p* A" p8 ?& y" b
  65.         if (ret != 0) {
    , Q: z" {( c* \7 E
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    # B" m1 I# O3 }; n
  67.                 return -1;
    / X7 P* q" s! a  f* O
  68.         }, R5 i! X+ ]6 t* J! }* H& i5 y. R+ B
  69. ' i! }$ C: r  \
  70.         return 0;6 Y$ _% e2 u* \* e( O  r
  71. }
    2 q' j, D7 L. E3 _% L# n

  72. + I8 ?$ A+ |( E) _# ^5 H* e
  73. int main()$ n/ P0 y% Q( J7 l; S
  74. {5 c2 {* |6 J! v/ H1 @7 y
  75.         char c;: M- w: B+ X% e  U9 a: @" E
  76.         int i, macs[6];7 k% d) ?9 I3 P# a6 N$ }" S# x
  77.         unsigned char mac[6];  P/ O" B, {' h& h
  78.         unsigned char stbid[256];
    8 Q  d6 C4 O* V; s2 G

  79. . }2 m& x5 P. J# {4 x' J
  80.         if (readparam(mac, stbid) < 0)
    6 h! c* \( h$ S2 F* l6 ^
  81.                 return 1;
    1 x6 n8 l/ M5 p% X: b  E

  82. " e4 ]  L( t9 f, O; y, r
  83.         printf("Current parameters: \n");% C# n" ]3 b/ z! Y
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);, W- S( K7 ]0 Z1 N+ i! p" _0 G: S8 N; U% q
  85.         printf("  STBID: %s\n", stbid);
    5 v2 k; M( _0 [. r& V! H$ G7 Y
  86.         , \& ~& H6 F" G7 Y, `) p; @3 i/ b
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    & D+ H  W$ z( g; h( w3 q8 o
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    5 O6 G6 d) l# z, E: h, c
  89.                 printf("Input MAC error\n");% ?8 U1 n$ c  S: U% {$ E
  90.                 return 1;
    8 o2 A9 a, E" A& y1 _
  91.         }! d! [% [" q6 ~( W* e7 a6 ?- l
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    ' X% I, v, `; @7 o9 O* m* Y- H4 u
  93.         printf("\nPlease input new STBID: ");! u% P. f9 B  b# k. {/ T
  94.         scanf("%s", stbid);* J' i6 C' k  |7 b* h7 \+ j4 _$ d
  95.         if (strlen(stbid) != 18) {
    ' c! e7 d; y8 f3 j
  96.                 printf("Invalid stbid\n");
    + E7 M$ G. D8 x3 c+ g: w# F
  97.                 return 1;; _3 L, g' r8 Q1 _' D
  98.         }  o# b- C/ I) z8 I$ Q+ C9 \8 S
  99.         printf("\nNew parameters: \n");5 g$ p( g; Y* {4 v4 Z1 u5 Q% @9 }
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);# ]9 l$ p- w- m# W; y$ ]& |
  101.         printf("  STBID: %s\n", stbid);* \0 e9 e/ f  `5 I0 {% L2 t
  102. 4 \& L! J' b- A
  103.         printf("\nDo you want to change paramemters? (y/N) ");! _: ^. k! D7 E0 F9 l% N, g* u; [& T
  104.         for (;;) {/ L! W) g  Z+ y7 y4 L
  105.                 c = getchar();1 {) m1 x# @1 e: ^; ~; ?3 [! a3 l
  106.                 if (c == 'y' || c == 'Y'). S* C+ x+ i3 B& T) b
  107.                         break;: U; [! Z$ R9 q
  108.                 if (c == 'n' || c == 'N') {
    + ]7 p) y# j6 x/ H6 M
  109.                         printf("\nAborted.\n");+ J" R8 w9 e3 H6 @% z0 p6 Y
  110.                         return 1;0 A9 l2 a; r2 c2 l- c. g$ V/ m( F1 v
  111.                 }) B: R5 N  ^' [8 |* t: G, g5 [
  112.         }5 F9 B$ I" }. j6 T6 C. g( ~
  113.         if (writeparam(mac, stbid) == 0)
    0 [7 L) |1 g8 ]0 e5 u  u( m7 L/ }
  114.                 printf("Parameters changed.\n");  {  K% W( M" @/ o' A

  115. : Y; t  g! \! \9 n
  116.         return 0;
    * g6 }5 [3 b8 q* }, O6 j* ]
  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 * m7 |& v6 \2 m. w  i# }4 D; |
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
' b. |) T: l" q+ V- F3 f  d
你用的编译命令行格式是什么?
. z2 f+ ~+ V1 W0 T% S# f# u
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

GMT+8, 2026-2-26 16:30 , Processed in 0.025565 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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