Index du Forum » » Sécurité

Auteur

[Résolu] - bannir un PC
arnodu59
437      

  Posté : 15-10-2004 22:58

Pour récupérer l'adresse MAC de la machine en question...



function getMacAddress($ip){
// $ip au format "93.125.24.23"
  
$buffer = "";
system("ping " . $ip);
system("arp -a > arp.out");
$fileHandle = fopen ("arp.out", "r");
while (!feof($fileHandle)) {
  $buffer = $buffer . fgets($fileHandle, 4096);
}
fclose ($fileHandle);
$ip_mac = strstr($buffer, $ip);
if($ip_mac){
  $mac = substr($ip_mac, 22, 17);
  return strtolower(ltrim($mac));
}
return false;
}

// source Samuel Wollenschneider



Je n'est pas tester, donc je ne sais pas si ça fonctionne



Cet article provient de NPDS

http://www.npds.org/viewtopic.php?topic=11559&forum=12