[COLUG] System info script
Angelo McComis
740 at sciotoreserve.org
Tue Feb 19 14:20:29 EST 2008
This is pretty creative, but as long as you realize the mac address part only applies if the user is truly local - as in same subnet. If you cross a router, you don't get the mac anymore.
-Angelo
-----Original Message-----
From: hunter <hunter at colug.net>
Date: Tue, 19 Feb 2008 12:48:13
To:colug432 at colug.net
Subject: [COLUG] System info script
> 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
_______________________________________________
colug432 mailing list colug432 at colug.net
http://www.colug.net/mailman/listinfo/colug432
More information about the colug432
mailing list