<% Dim RemoteAddrif Request.ServerVariables ( "HTTP_X_FORWARDED_FOR") = Empty then remoteaddr = Request.ServerVariables ( "REMOTE_ADDR") else RemoteAddr = Request.ServerVariables ( "HTTP_X_FORWARDED_FOR") end ifIf GetMac (RemoteAddr) <> "" then session ( " Mac ") = getMac (RemoteAddr) end ifsql =" select * from macaddress where mac_address = '"& getmac (remoteaddr) &"' "set RST = Server.createObject (" AdoDb.Recordset ") Rst.Open SQL, CONN, 1 3Set RST = NothingResponse.write (getMac (RemoteAddr))
'Due to read a network card MAC address of an IP
'This program calls the ARP command to read the MAC address of a specific IP by querying this machine ARP table.
'This program requires "wscript.shell" and "scripting.filesystemObject" two components,
'Please make sure your server can use these two components normally
'This program needs to call the cmd.exe program, and the temporary file saves the result, make sure the IIS guest account has access to the program,