找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 15028|回复: 19

讨论EC1308修改

[复制链接]
发表于 2012-2-15 22:51:59 | 显示全部楼层 |阅读模式
我用telnet登录到EC1308里。在
  1. -rwxrwxrwx    1 root     root         8657 Nov  7  2011 himr- |# z1 ^0 T- h
  2. -rwxrwxrwx    1 root     root        89029 Nov  7  2011 iwconfig' Z$ k& i, H) _7 r% ~9 k
  3. -rwxrwxrwx    1 root     root        83813 Nov  7  2011 iwpriv
复制代码
发现这个himr的格式是:
/ D  I& N# e  R8 t5 Y+ K( K, r  susage: himr <address> <value>. sample: himr 0x80040000 0x0
& D% X+ {# x4 p1 [
  E2 U6 G& J  f: u) l4 D# y- y' j: a$ \. W# y, y! N- f+ u
不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?
! V2 R8 v5 B! i$ A6 Z- y- }' B4 T9 m. U  ?4 _* f
补充内容 (2012-3-8 09:42):# i3 E2 P( t1 ~& m  z6 n: v6 L" j
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
* y) t9 M$ y( i2 T# w& b这是修改源代码,可惜我不会编译。
 楼主| 发表于 2012-2-16 22:08:26 | 显示全部楼层
那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?
发表于 2012-2-28 10:55:26 | 显示全部楼层
急切想知道远程是如何改的
 楼主| 发表于 2012-3-7 09:59:55 | 显示全部楼层
估计就是执行这个命令。
% `8 V1 l* ~4 y
" [* U$ \5 c" d9 f# M, w1 d# D. Shimr <address> <value>. sample: himr 0x80040000 0x07 G) A/ H: T; R8 y. c) L& V4 |

! c/ F/ n( r8 l2 \. O例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。5 Q% y: Y! T, n' Y3 k
himr 0x80040000 0x00
5 r2 ]3 H8 u2 i  o5 hhimr 0x80040001 0x111 S/ h% q1 K4 }5 I5 s; O7 Z% X
himr 0x80040002 0x22
9 a+ {9 u0 ]) ]himr 0x80040003 0x33
+ }/ ?" B" z8 D1 {. a& Vhimr 0x80040004 0x44
! `4 H% J' G5 z+ x" |7 khimr 0x80040005 0x55
- J1 Y4 p# [8 ]$ w1 i9 m* q/ b3 W0 ]* A* T
SN也是类似。5 y7 _; V4 R. H' s% h, V& Y
0 ^# v8 ^1 r* q* v% }5 W/ Y
现在主要是,谁告诉我们MAC和SN的地址?/ N" b& C) |" U! v# W, o
发表于 2012-3-10 11:37:46 | 显示全部楼层
一直想找到运程修改MAC和SN的办法,苦于无解啊
 楼主| 发表于 2012-3-12 19:15:19 | 显示全部楼层
wowocom 发表于 2012-3-10 11:37
7 h$ I) Y, Z0 F/ M, [( h4 b一直想找到运程修改MAC和SN的办法,苦于无解啊
/ d+ V- _4 x, Y' W0 x  O# W. j
源代码有,可惜不会编译。
 楼主| 发表于 2012-3-21 23:00:54 | 显示全部楼层
本帖最后由 0522 于 2012-3-21 23:04 编辑
; H4 `1 }2 U- _$ `7 N& W9 a2 ^0 X' i, @  ]
修改的代码早有了。到今天不会编译。
& Q) W# B: \9 h% h6 w% h) B+ W( l需要    交叉开发工具 cross-compiler-armv5l.tar.bz2
  1. #include <fcntl.h>4 L1 p# S+ W$ j3 x: r0 z* l4 y/ f0 H
  2. #include <malloc.h>
    : m/ f8 C4 ?1 p% `! p6 R2 K
  3. #include <sys/types.h>4 e0 M- |: c% i$ b3 j
  4. #include <sys/stat.h>1 W7 ~4 y1 v! A5 h) H& `
  5. #include <sys/ioctl.h>
    3 B+ w( e1 m% w) o9 k/ e6 W( y
  6. #include <stdio.h>
    3 ^. q  h/ I: j' O9 Q3 Y' \
  7. #include <string.h>
    2 c) P. d& W' l4 j5 X
  8. : z& z) A/ r8 h: Z
  9. typedef struct {+ `0 O% [; O  t/ W$ C8 {4 q( h
  10.         unsigned int        e2prom_cmd_sub_addr;
    * x9 `6 Y, g5 }+ B" \
  11.         unsigned int        sub_addr_count;4 t$ P) L$ T, w# y( ]: n
  12.         unsigned char*        e2prom_cmd_data;
    : u3 e# r, s) d2 i/ `/ N
  13.         unsigned int        data_count;( C$ W$ x& p" J( S" u! c  F* Y4 H
  14. } e2prom_s_cmd;8 U+ _. ~, T( F0 D

  15. + X* b+ n% f% z2 D7 S; ~
  16. #define E2PROM_CMD_READ 1+ \3 _) [  l& m8 A+ t: U- q
  17. #define E2PROM_CMD_WRITE 2$ Z, H: `/ i" `
  18. #define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"! G# g' g: h& ^9 P# J
  19. ( M( U/ F  w1 u
  20. static int readparam(unsigned char *mac, unsigned char *stbid)) O: _4 C1 d% L
  21. {
    # R1 l" h0 I# X5 F) V0 j
  22.         int fd, ret;
    2 B& d3 J. M2 y. W
  23.         e2prom_s_cmd arg;, s5 ^8 ]. F1 G2 m- k
  24.         unsigned char buf[0x18];
    * N& ?. u& P3 P5 x( A
  25. ( F* b9 ^) V* {6 d" @# _* k1 g* N
  26.         fd = open(E2PROM_DEVICE, O_RDWR);
    9 ~$ i% N6 E8 z* ^: U4 Q$ Q7 X
  27.         if (fd  < 0) {6 ?8 ^: Z$ J- m% N
  28.                 printf("Device %s open error.\n", E2PROM_DEVICE);5 U4 E5 p* {# |9 _# ~: L* D5 }) a
  29.                 return -1;. H  A! Z' n0 i- c, q
  30.         }
    . R) x; r8 G- V/ l# e6 d, [4 e
  31.         arg.sub_addr_count      = 2;
    " i  Y5 r: C$ w4 C7 [6 f' N
  32.         arg.data_count          = 0x18;' h4 \' D3 g7 S. `* O
  33.         arg.e2prom_cmd_sub_addr = 0x290;
    8 N, v# [5 ~, n3 _* @8 m' Q' f
  34.         arg.e2prom_cmd_data     = buf;  \* V. M. W* l  Q
  35.         ret = ioctl(fd, E2PROM_CMD_READ, &arg);
    & ^4 y( n- A0 z* F& W. v
  36.         if (ret != 0) {' K$ U! b% R+ g- X
  37.                 printf("Device %s read error.\n", E2PROM_DEVICE);
    ' H$ T; A7 Q8 P  E1 \8 R
  38.                 return -1;2 j" \" d. @' O$ p& k' u- M7 a7 j- l
  39.         }9 k+ @- }" z' Z2 Z
  40.         memcpy(mac, buf, 6);
    / j4 N, N- O: P+ ~
  41.         memcpy(stbid, &buf[6], 18);
    7 E+ i; j0 K6 Y' z3 b, O
  42.         stbid[18] = '\0';
    - I4 E4 p2 i; i# F2 l
  43. ' V1 l  G4 {# X; s
  44.         return 0;
    ' i3 I; u8 a7 J
  45. }
    * {! I% j9 m: F! c5 [
  46. , ^8 i$ r, P/ y; I/ _$ E% w9 U
  47. static int writeparam(unsigned char *mac, unsigned char *stbid)% S. s0 k0 y$ f# Q) t: q" J
  48. {
    7 U4 S% y0 s+ U" v1 w  ]/ y
  49.         int fd, ret;8 X; I% b  z! W- @! L& J6 l: p/ I7 `
  50.         e2prom_s_cmd arg;
    5 A# l. t$ D% j. ^
  51.         unsigned char buf[0x18];: h6 Q: k9 d. W. s+ e

  52. , m+ _  W1 N) J# F* ?" G
  53.         memcpy(buf, mac, 6);
    ( V* |! |$ N7 B$ s' i  {+ f
  54.         memcpy(&buf[6], stbid, 18);
    5 ?, @" C- ]5 F* L4 a* e; f
  55.         fd = open(E2PROM_DEVICE, O_RDWR);$ y  z* Q- w3 n! v0 M1 ~
  56.         if (fd  < 0) {+ K3 [7 K7 a& T- p
  57.                 printf("Device %s open error.\n", E2PROM_DEVICE);
    " j8 p" U' Z' e0 D
  58.                 return -1;
    * A$ l0 Q; {& c. ~
  59.         }
    2 @3 \1 Y" C0 \. h$ S$ i6 t
  60.         arg.sub_addr_count      = 2;& Q$ I( x' I! h; @" l9 x0 g8 r+ D
  61.         arg.data_count          = 0x18;
    , }' A. |; L# R4 S5 u5 [
  62.         arg.e2prom_cmd_sub_addr = 0x290;$ Q  H! U) P" l( d- q% m( F, d0 P
  63.         arg.e2prom_cmd_data     = buf;; i9 T& r7 s  M6 S# c2 S5 X& C
  64.         ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
    " ]; X3 Q: d# g( \2 u) p, k* `
  65.         if (ret != 0) {
    , v( d& L5 [* o' ~, n6 i* @
  66.                 printf("Device %s write error.\n", E2PROM_DEVICE);
    - ?, M, U" l( C" J$ i
  67.                 return -1;
    9 j/ m/ F  u/ S. x  {" k: T9 L
  68.         }- D. e: z4 h1 O- `# u+ _

  69. $ q  D& S! ~, _8 p
  70.         return 0;
    6 g: v) ~$ j# y$ d
  71. }
    & |( _" E9 ^+ o+ r+ v9 n" M) G

  72. 2 z4 G7 Z  o8 u7 y& S( n5 I0 v& C
  73. int main()
    ) O  f$ E+ x+ Q' M/ r4 v
  74. {
    ( D0 n) N+ {$ M0 j9 A' z
  75.         char c;
    , H2 r+ [" C" ]/ j5 i) {; E& A4 A
  76.         int i, macs[6];
    ( h8 D  N# @$ C. H1 l, y; C+ ~
  77.         unsigned char mac[6];
    * {- w8 N# b# h- u. X' v
  78.         unsigned char stbid[256];
    3 y4 P7 S' S) P

  79. / U( x# r2 K/ f# H' s% R
  80.         if (readparam(mac, stbid) < 0)8 [2 f: |" q1 S: j
  81.                 return 1;' X1 [; _- Q3 J* D6 a; b/ C9 M

  82. 8 a7 F$ A" P6 _* d" p' Y3 Z
  83.         printf("Current parameters: \n");
    1 t! \4 V0 w$ z6 w
  84.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    5 u* h5 k, b1 y
  85.         printf("  STBID: %s\n", stbid);
    2 }+ u$ a2 E' T% n, M
  86.        
    / T6 {4 S5 e  F6 G  Q/ A: |
  87.         printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
    + P- D% |7 I+ D) F
  88.         if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs[0], &macs[1], &macs[2], &macs[3], &macs[4], &macs[5]) != 6) {
    . Y. y  ^7 B' U8 B; u
  89.                 printf("Input MAC error\n");
    ) {3 ?; ]. ?: V, ~$ `
  90.                 return 1;
    . z6 ]$ r. d! _+ t1 p1 i! T+ X0 b
  91.         }
    , l& T" Y5 C& R/ k7 O8 O1 D; b, @
  92.         for (i=0; i<6; i++)mac[i] = macs[i];
    / }1 N0 P" M5 d; U
  93.         printf("\nPlease input new STBID: ");
    $ {1 A6 t- I/ B4 I' u, r" T
  94.         scanf("%s", stbid);
    2 q& ^1 e9 D7 [
  95.         if (strlen(stbid) != 18) {
    / I  u% n2 \6 C5 G
  96.                 printf("Invalid stbid\n");
    , h* e; s: r1 M8 F
  97.                 return 1;
    & ?% c9 w( N, U! ]. w6 J/ D( a
  98.         }
    & t! f' E1 ^7 E4 c8 S
  99.         printf("\nNew parameters: \n");" b% N: W( k5 L1 L. y" X
  100.         printf("  MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    + b2 e  p: C' s8 k8 d# H* v
  101.         printf("  STBID: %s\n", stbid);3 f+ P# Z: r& z1 E6 s9 {- w7 \

  102.   I$ f& U2 k$ \/ G
  103.         printf("\nDo you want to change paramemters? (y/N) ");2 z: I" a, ?3 ?% }* j+ q
  104.         for (;;) {
    4 \2 R5 j3 @! w: s4 S6 A
  105.                 c = getchar();
      Q4 u$ ]4 x; D; O8 R6 e& c! B
  106.                 if (c == 'y' || c == 'Y')
    ! d) a" P( k& A
  107.                         break;
    1 t+ I: C9 l8 l# l
  108.                 if (c == 'n' || c == 'N') {
    ( d2 z) a+ W8 @: i2 o! G
  109.                         printf("\nAborted.\n");
    ; g9 e1 O/ Z( m* x
  110.                         return 1;9 \0 n$ n8 \/ U- ?+ l& \
  111.                 }0 |+ u- b" V7 h  q. `& ]
  112.         }
    * Q3 T; d5 |' D" y  q
  113.         if (writeparam(mac, stbid) == 0) / |5 V' `, B! c" ]
  114.                 printf("Parameters changed.\n");; b( |9 R# Z# V

  115. ( h2 T- ~( e9 Y& j) p
  116.         return 0;
    1 p% V7 A$ E9 F4 u- v  ^
  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
! S% p7 e8 a0 p( M& V2 t+ l, K- E在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

/ O. N0 o, ^1 Q# \) G7 d你用的编译命令行格式是什么?
' W% t  E. q% r2 j: M& ?
发表于 2012-5-26 19:45:12 | 显示全部楼层
已经编译出修改文件,并且修改成功
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

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