找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14993|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr$ a7 E/ ?2 [& g" Y/ Z. X5 \
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig" @5 ^9 K2 y3 T3 N( T- t1 B9 x
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
- i2 U3 e- {5 dusage: himr <address> <value>. sample: himr 0x80040000 0x0; v  B& X% v8 o

4 @. q6 Q9 T2 J; H4 M
/ {- c+ J' o- D* c  a- y9 |, ]不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?. q* X8 K$ N9 z- Y" K" C
, d& Q+ g( f. t& E* m
补充内容 (2012-3-8 09:42):( `2 {. `& J4 L  I/ n
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
, L2 k6 _+ c2 ^3 G3 @* h/ f" b这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。5 L3 q6 f: p5 X  l/ S' l- P
/ R) V2 {$ |) z: W7 ?5 Q0 r+ R
himr <address> <value>. sample: himr 0x80040000 0x0
: y' L9 s$ S3 m/ e& D  t5 B$ V; K
. D8 m: h) }( i例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
4 z$ E# P( t; [4 r: ?! B) Zhimr 0x80040000 0x00
  o5 S- d- Z+ x* a3 Fhimr 0x80040001 0x119 L7 z5 t# Z# ^& I
himr 0x80040002 0x22
$ D) ?6 ^8 O, O/ w# q  Ahimr 0x80040003 0x33
! H* y3 c# }- ]  ]# xhimr 0x80040004 0x44
1 ?& v. g7 H5 n2 Q+ t1 M5 Qhimr 0x80040005 0x55' f  w7 p& N( F# h
/ @* c2 j4 L! U6 Y
SN也是类似。7 O9 n: ?  S/ n- O! v* _: ^

. ]3 @9 _9 L- F. r现在主要是,谁告诉我们MAC和SN的地址?
( H: a: E+ n8 p' L
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
) U& }( s, e( M3 Z  B9 l一直想找到运程修改MAC和SN的办法,苦于无解啊

( Q3 b6 h4 E- O9 t& i( R4 v/ m! t源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑 : q6 N( `* m" X3 Y) \7 a

' V. J2 w1 f6 T% m7 t修改的代码早有了。到今天不会编译。0 i) l) Y: @8 h. U
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>
    9 H1 y4 f5 Q% q7 x8 S. E
  2. #include <malloc.h>
    ! a1 A' W/ s, D" t
  3. #include <sys/types.h>
    6 B, ?/ Q8 l% P
  4. #include <sys/stat.h>" j' ?/ h5 q" T* H
  5. #include <sys/ioctl.h>: X  I+ Y0 e& |! M
  6. #include <stdio.h>
    , Z! c; l" L& V; R/ Y2 n
  7. #include <string.h>) h# H, Y* P- ^% G
  8. , j2 |+ O* w$ G% B3 C
  9. typedef struct {
    - x% [! k1 E! N: K. v
  10.         unsigned int        e2prom_cmd_sub_addr;: c' l: m! Z+ f: ]4 p1 v4 P' J* y4 z
  11.         unsigned int        sub_addr_count;
    7 W, ~# {0 f( f/ m
  12.         unsigned char*        e2prom_cmd_data;/ V8 O0 Y5 X, e7 l" Z0 F
  13.         unsigned int        data_count;
    % v3 A* G6 ?% @; B9 f# k& G
  14. } e2prom_s_cmd;
    3 I- [+ @& [* u9 O- {

  15. 7 Z. R( P/ X- k
  16. #define E2PROM_CMD_READ 1
    $ V) u! i* r& v* ]1 M9 k
  17. #define E2PROM_CMD_WRITE 2  E9 ?1 t2 c/ @# J6 q1 r" H% u
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"9 m/ o% n7 m8 H1 `( m

  19. 7 `/ l8 {! n& O: u4 h! c
  20. static int readparam(unsigned char *mac, unsigned char *stbid)- Q$ Y  m' ^9 M. w$ V* P
  21. {
    ' {( e) |% Z2 _. Z
  22.         int fd, ret;
    . S' }' l2 [0 z* \
  23.         e2prom_s_cmd arg;
    0 n; y* Y. o2 b, m. r8 p
  24.         unsigned char buf[0x18];, `" a+ ]# o! F* M  @/ ]

  25.   e2 v8 P( y7 U7 U$ Z5 A
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    # X( }  e3 e4 o9 W3 J( i
  27.         if (fd  < 0) {% {; T) W3 ]& s1 R4 e# A5 M( U1 z" {
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);( W! K1 y  @9 E2 p" g4 H5 A8 L
  29.                 return -1;
    6 r% ~4 K! T' ?! b3 N. }
  30.         }! ]& ~" j* S+ Q5 L9 ~0 }0 H- V
  31.         arg.sub_addr_count      = 2;2 `- G  \9 ~& _; i  w
  32.         arg.data_count          = 0x18;* V$ z( a6 h1 T
  33.         arg.e2prom_cmd_sub_addr = 0x290;; P, r+ ^2 V! K: L+ A' a
  34.         arg.e2prom_cmd_data     = buf;, R- h; M' ?% k! C2 r! p
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);( C6 m4 Y& s# }9 E1 t0 l
  36.         if (ret != 0) {
    2 v& ~7 G6 T9 F( G
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    7 G" r3 B; z; s
  38.                 return -1;5 J5 o  A0 H# K2 M) U! i
  39.         }
    2 F9 R9 H8 X; m8 I$ `( C! {, Q
  40.         memcpy(mac, buf, 6);3 [, e- U! |/ O( ^0 x( m# n# V
  41.         memcpy(stbid, &buf[6], 18);
    / B+ A5 i4 u, n4 @* {) t
  42.         stbid[18] = '\0';3 [7 Y- D# Y- J4 e6 s( H

  43. : o. G" j/ i# _8 P! q' Q+ H
  44.         return 0;- u5 O2 A/ |& {: w0 W6 R
  45. }
    0 [  `* w- ]5 x4 @3 B9 V/ [
  46. 7 _" r* i# O$ S6 _$ c$ ?
  47. static int writeparam(unsigned char *mac, unsigned char *stbid); o8 B) i! X, X+ D8 p( m
  48. {2 n0 j* V  |  N
  49.         int fd, ret;$ f. |' l: z* H) w/ g# M3 _6 `  K5 C
  50.         e2prom_s_cmd arg;
    ; D$ J- ~* a  O6 a; f" c' K7 @# g
  51.         unsigned char buf[0x18];
    7 S$ N0 b2 d$ d2 x+ @# K3 c# ~

  52. / t# q5 k" X2 g- ^
  53.         memcpy(buf, mac, 6);+ s7 d* i- z. t0 T, H
  54.         memcpy(&buf[6], stbid, 18);
    & ^. R0 E/ ?: D$ R9 i+ ?1 j
  55.         fd = open(E2PROM_DEVICE, O_RDWR);
    5 T* J: z1 v8 `7 I8 A! ~" M( Y# v
  56.         if (fd  < 0) {! G8 @) o7 a0 P( \% _: b3 W6 X
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    1 L4 \3 B" t4 \1 W' U: U
  58.                 return -1;
    9 U  w7 _7 o' \: v/ s* r& T
  59.         }, N0 s( T# }$ H
  60.         arg.sub_addr_count      = 2;! l0 y. i  a1 @. i6 X9 ]" y* o
  61.         arg.data_count          = 0x18;! r- m+ c7 L* C  I
  62.         arg.e2prom_cmd_sub_addr = 0x290;
    " P' Y9 M- P. I/ C
  63.         arg.e2prom_cmd_data     = buf;
    , `6 K* Z  u! x0 q) A: m: T- a- I. K
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    5 t9 _7 Q( {; Q; t3 c5 H2 }
  65.         if (ret != 0) {
    & {8 p6 D0 R6 R' I  y- Z8 Q% X
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    & A/ d6 A( W; K
  67.                 return -1;
    2 K  w' U% c. I1 h
  68.         }
    8 y% d0 h7 G8 c- G
  69. ; z; ]7 R0 G& I. }. f* }# b) X
  70.         return 0;
    # Y+ F3 d- D/ Y2 K
  71. }
    $ M' G4 X; H- E0 S. m% c

  72. ' A1 X& m. b% t
  73. int main()/ P  s" W: Y  F. D6 n% z
  74. {9 N: `' x3 F6 B5 O* W# G
  75.         char c;8 a1 H0 B: z9 J: h# `% a
  76.         int i, macs[6];
    ! |4 A' y/ ^, u
  77.         unsigned char mac[6];
      F! Q. d% h' k7 I. V, s
  78.         unsigned char stbid[256];
    3 Z. R% n. W* F

  79. $ l5 c4 X' ^5 V- R! |/ T  f
  80.         if (readparam(mac, stbid) < 0)
    & d  ^$ n* w' K
  81.                 return 1;
    + i4 R0 u; `; D1 N" l/ `
  82.   ~1 u2 f2 a+ N1 h0 P6 O4 q
  83.         printf("Current parameters: \n");
    : n4 \! {( }5 [0 Y* j8 [
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    / ]% Y3 a. q2 M! f$ h2 ]
  85.         printf("  STBID: %s\n", stbid);
    ; R) \. V. C. f7 i9 M- m
  86.        
    ; S6 K& H- V) [( n
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    % w; {+ Z0 N: M* I5 ]  C
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {% j" E# d# d0 K/ d5 Q; @
  89.                 printf("Input MAC error\n");. E2 [/ W+ S" }; \! L3 U
  90.                 return 1;
    / L& w2 s$ q+ z/ D
  91.         }8 T9 }0 I5 v3 C! \2 V! l: a: Q
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    % x) `/ ]! N) a/ O
  93.         printf("\nPlease input new STBID: ");
    8 P+ h% d5 u8 q- i! k$ S$ }" K
  94.         scanf("%s", stbid);
    ) b2 J% V0 ?: }6 C& h7 S
  95.         if (strlen(stbid) != 18) {
    . C( V* p& ~7 s- G! r* T0 d; j
  96.                 printf("Invalid stbid\n");# v  H/ k4 F5 z& d( ]4 N
  97.                 return 1;% A( r) l1 o: L) S, H; d/ X
  98.         }
    9 ?6 k+ }8 D1 e5 m! u; ^
  99.         printf("\nNew parameters: \n");  N' G4 P* _6 E
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    & `3 x  C: Z/ M2 B9 T3 o0 d
  101.         printf("  STBID: %s\n", stbid);
    " P, L7 V8 V( \
  102. + _& q# f, [" e5 a& Z4 o4 p$ Y
  103.         printf("\nDo you want to change paramemters? (y/N) ");' }9 J+ u+ j5 g
  104.         for (;;) {2 C- v' E3 k, }" ~  S! |1 b! g7 [
  105.                 c = getchar();2 V7 F4 ~/ C* h1 |0 ]4 T. b/ W
  106.                 if (c == 'y' || c == 'Y')
    3 ^6 q. O" N3 @3 R# b) _$ `% @$ v
  107.                         break;
    ' X/ |+ g2 c! a5 `3 n
  108.                 if (c == 'n' || c == 'N') {
    4 X/ g  P* n" _# ~
  109.                         printf("\nAborted.\n");
    ) i/ S8 O$ a! R4 r5 K
  110.                         return 1;
    % S& Q! I3 y1 R
  111.                 }- B. {: Z# i( W. R) @3 e" f0 X
  112.         }
    1 D- c6 H) |) {' {1 a
  113.         if (writeparam(mac, stbid) == 0) 5 `- x1 O' B2 T- h5 {
  114.                 printf("Parameters changed.\n");
    ; c$ ~% G& W2 t

  115. # y9 U) C3 J/ X" r
  116.         return 0;, ]6 }' Q3 U5 q
  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
0 S4 p: w+ _; S& j8 @. R4 d1 x在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。
1 H$ \% \0 w7 S1 R3 v
你用的编译命令行格式是什么?4 N6 U9 H0 J1 z1 t% ?0 D% q4 E8 ~$ a
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-12-8 04:11 , Processed in 0.029016 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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