[COLUG] System info script
hunter
hunter at colug.net
Tue Feb 19 12:48:13 EST 2008
> I seem to recall some script that Phil provided to take system info from
> visitors to an intranet web site from my time at Team America. This
> information included the MAC address of the client machine. I need to
> gather the MAC address, OS, and system specs from a large number of
> machines on a network. Is that script still around? Could it handle
> this?
I an not sure I like the code very much any more (it dates from Jan 2000,
and uses a system call -- but uses a non-sanitized return [which SHOULD
not be subject to spoofing, but ...] ), but for a PHP enabled webserver,
sitting within a local network segment, this was the essence of the code:
//VER="0.02-001208"
//
// read the ARP table
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
// ***
$output = exec(" arp -a | grep $REMOTE_ADDR | head -1 ");
$rDNS = exec(" echo \"$output\" | awk {'print $1'} ");
$MAC = exec(" echo \"$output\" | awk {'print $4'} ");
I think if writing it now I would add the following de-taint where I
just put the '***':
// IP address digits and seperator only ...
$REMOTE_ADDR = preg_replace("/[^0-9\.]/","",$REMOTE_ADDR);
Those variables were then used to populate a form, for additional
anotation. In later versions, I have also stuffed the MAC, IP, phone
extension next to the PC, and user name into a company directory MySQL
backend database.
- P
More information about the colug432
mailing list