#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#define TRYLENGTH 100
int try_mac (unsigned char *str)
{
char buf[256];
unsigned char *p, *q;
int i;
for (i=0, p=str; i < TRYLENGTH; ++i, ++p)
{
if (isxdigit (p[0]) && isxdigit (p[1]) &&
(p[2] == ':') && isxdigit (p[3]) && isxdigit (p[4]) &&
(p[5] == ':') && isxdigit (p[6]) && isxdigit (p[7]) &&
(p[8] == ':') && isxdigit (p[9]) && isxdigit (p[10]) &&
(p[11] == ':') && isxdigit (p[12]) && isxdigit (p[13]) &&
(p[14] == ':') && isxdigit (p[15]) && isxdigit (p[16]))
{
sprintf (buf, "/usr/local/bin/macchanger -m %c%c:%c%c:%c%c:%c%c:%c%c:%c%c eth0",
toupper (p[0]), toupper (p[1]), toupper (p[3]), toupper (p[4]),
toupper (p[6]), toupper (p[7]), toupper (p[9]), toupper (p[10]),
toupper (p[12]), toupper (p[13]), toupper (p[15]), toupper (p[16]));
system (buf);
exit (0);
}
}
}
int main (int argc, char *argv[])
{
char pattern[] = { "Eth" };
unsigned char buf[4096 + 200], *p;
unsigned char c;
int i, len, patlen;
patlen = 3;
for (len=4096; len; )
{
len = read (0, buf, 4096);
for (p=buf, i=len-patlen; i>0; ++p, --i)
if (strncmp (p, pattern, patlen) == 0)
try_mac (p);
}
return 0;
}#!/bin/sh
if [ -f "/var/run/macset" ]
then
echo -n ""
else
/usr/sbin/nanddump /dev/mtd2 2>/dev/null | /home/meteohub/dc01mac >/var/run/mac
set
cat /var/run/macset
fi/sbin/devmem2 0x44100014 w 0x00030000 > /dev/null
/sbin/devmem2 0x44100018 w 0x00020000 > /dev/null/sbin/devmem2 0x44000000 | grep Value | awk '{if (and (strtonum ($6), 0x02000000) > 0) print "0"; else print "1"}'Return to Community-Supported Devices
Users browsing this forum: krrishnarraj and 2 guests