#include <inet.au3>
$myname=""
;~ $_filename="E:\维护管理\安信工具\tools\ipset.ini"
$_filename="ipset.ini"
FileOpen ( $_filename, 1)
$_ip=IniRead ( $_filename, "改名信息", "ip", "192.168.1." )
ProgressOn("网吧MAC扫描", "Increments every second", "0 percent")
for $i=1 to 254
$mymac=_API_Get_NetworkAdapterMAC($_ip&$i)
ProgressSet( int($i/254*100),"扫描MAC: "&$_ip&$i ,"稍后就好.....")
if $mymac<>"00:00:00:00:00:00" then
IniWrite( $_filename, "MAC信息", "A"&$I,$mymac&" "&$myname )
EndIf
Next
FileClose( $_filename)
ProgressSet(100 ,"扫描: ", "扫描完成")
sleep(2000)
Func _API_Get_NetworkAdapterMAC($sIp)
Local $MAC, $MACSize
Local $i, $s, $r, $iIP
$MAC = DllStructCreate("byte[6]")
$MACSize = DllStructCreate("int")
DllStructSetData($MACSize, 1, 6)
$r = DllCall("Ws2_32.dll", "int", "inet_addr", "str", $sIp)
$iIP = $r[0]
$r = DllCall("iphlpapi.dll", "int", "SendARP", "int", $iIP, "int", 0, "ptr", DllStructGetPtr($MAC), "ptr", DllStructGetPtr($MACSize))
$s = ""
For $i = 0 To 5
If $i Then $s = $s & ":"
$s = $s & Hex(DllStructGetData($MAC, 1, $i + 1), 2)
Next
If $s = "00:00:00:00:00:00" Then SetError(1)
Return $s
EndFunc ;==>_API_Get_NetworkAdapterMAC
|