0522 发表于 2012-2-15 22:51:59

讨论EC1308修改

我用telnet登录到EC1308里。在-rwxrwxrwx    1 root   root         8657 Nov72011 himr
-rwxrwxrwx    1 root   root      89029 Nov72011 iwconfig
-rwxrwxrwx    1 root   root      83813 Nov72011 iwpriv发现这个himr的格式是:
usage: himr <address> <value>. sample: himr 0x80040000 0x0


不知道所谓的写MAC,SN是否就是在特定的地址写特定的数值?

补充内容 (2012-3-8 09:42):
http://www.iptvfans.cn/wiki/index.php/华为EC1308机顶盒改参数
这是修改源代码,可惜我不会编译。

0522 发表于 2012-2-16 22:08:26

那些远程改MAC和SN的是否就是利用这个himr程序,将MAC和SN写到特定的地址?

wowocom 发表于 2012-2-28 10:55:26

急切想知道远程是如何改的

0522 发表于 2012-3-7 09:59:55

估计就是执行这个命令。

himr <address> <value>. sample: himr 0x80040000 0x0

例如知道MAC 00-11-22-33-44-55 在地址 0x80040000 位置。
himr 0x80040000 0x00
himr 0x80040001 0x11
himr 0x80040002 0x22
himr 0x80040003 0x33
himr 0x80040004 0x44
himr 0x80040005 0x55

SN也是类似。

现在主要是,谁告诉我们MAC和SN的地址?

wowocom 发表于 2012-3-10 11:37:46

一直想找到运程修改MAC和SN的办法,苦于无解啊

0522 发表于 2012-3-12 19:15:19

wowocom 发表于 2012-3-10 11:37 static/image/common/back.gif
一直想找到运程修改MAC和SN的办法,苦于无解啊

源代码有,可惜不会编译。

0522 发表于 2012-3-21 23:00:54

本帖最后由 0522 于 2012-3-21 23:04 编辑

修改的代码早有了。到今天不会编译。
需要    交叉开发工具 cross-compiler-armv5l.tar.bz2#include <fcntl.h>
#include <malloc.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>

typedef struct {
      unsigned int        e2prom_cmd_sub_addr;
      unsigned int        sub_addr_count;
      unsigned char*        e2prom_cmd_data;
      unsigned int        data_count;
} e2prom_s_cmd;

#define E2PROM_CMD_READ 1
#define E2PROM_CMD_WRITE 2
#define E2PROM_DEVICE "/dev/misc/e2prom_24lc16"

static int readparam(unsigned char *mac, unsigned char *stbid)
{
        int fd, ret;
        e2prom_s_cmd arg;
        unsigned char buf;

        fd = open(E2PROM_DEVICE, O_RDWR);
        if (fd< 0) {
                printf("Device %s open error.\n", E2PROM_DEVICE);
                return -1;
        }
        arg.sub_addr_count      = 2;
        arg.data_count          = 0x18;
        arg.e2prom_cmd_sub_addr = 0x290;
        arg.e2prom_cmd_data   = buf;
        ret = ioctl(fd, E2PROM_CMD_READ, &arg);
        if (ret != 0) {
                printf("Device %s read error.\n", E2PROM_DEVICE);
                return -1;
        }
        memcpy(mac, buf, 6);
        memcpy(stbid, &buf, 18);
        stbid = '\0';

        return 0;
}

static int writeparam(unsigned char *mac, unsigned char *stbid)
{
        int fd, ret;
        e2prom_s_cmd arg;
        unsigned char buf;

        memcpy(buf, mac, 6);
        memcpy(&buf, stbid, 18);
        fd = open(E2PROM_DEVICE, O_RDWR);
        if (fd< 0) {
                printf("Device %s open error.\n", E2PROM_DEVICE);
                return -1;
        }
        arg.sub_addr_count      = 2;
        arg.data_count          = 0x18;
        arg.e2prom_cmd_sub_addr = 0x290;
        arg.e2prom_cmd_data   = buf;
        ret = ioctl(fd, E2PROM_CMD_WRITE, &arg);
        if (ret != 0) {
                printf("Device %s write error.\n", E2PROM_DEVICE);
                return -1;
        }

        return 0;
}

int main()
{
        char c;
        int i, macs;
        unsigned char mac;
        unsigned char stbid;

        if (readparam(mac, stbid) < 0)
                return 1;

        printf("Current parameters: \n");
        printf("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac, mac, mac, mac, mac, mac);
        printf("STBID: %s\n", stbid);
       
        printf("\nPlease input new MAC (1a:2b:3c:4d:5e:6f): ");
        if (scanf("%02x:%02x:%02x:%02x:%02x:%02x", &macs, &macs, &macs, &macs, &macs, &macs) != 6) {
                printf("Input MAC error\n");
                return 1;
        }
        for (i=0; i<6; i++)mac = macs;
        printf("\nPlease input new STBID: ");
        scanf("%s", stbid);
        if (strlen(stbid) != 18) {
                printf("Invalid stbid\n");
                return 1;
        }
        printf("\nNew parameters: \n");
        printf("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", mac, mac, mac, mac, mac, mac);
        printf("STBID: %s\n", stbid);

        printf("\nDo you want to change paramemters? (y/N) ");
        for (;;) {
                c = getchar();
                if (c == 'y' || c == 'Y')
                        break;
                if (c == 'n' || c == 'N') {
                        printf("\nAborted.\n");
                        return 1;
                }
        }
        if (writeparam(mac, stbid) == 0)
                printf("Parameters changed.\n");

        return 0;
}

0522 发表于 2012-3-23 18:24:12

在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

chinadslme 发表于 2012-5-11 11:20:03

0522 发表于 2012-3-23 18:24 static/image/common/back.gif
在ubuntu 下,释放cross-compiler-armv5l.tar.bz2文件,编译fix1308.c通过。可以修改EC1308了。

你用的编译命令行格式是什么?

zfzxb 发表于 2012-5-26 19:45:12

已经编译出修改文件,并且修改成功
页: [1] 2
查看完整版本: 讨论EC1308修改