BenProgramIs a special method. The scope of use is relatively limited, and there is a certain risk. Some methods in ASP backdoors are used for reference. Below is the programCode.
<%
Dim remoteaddr
If request. servervariables ("http_x_forwarded_for") = empty then
Remoteaddr = request. servervariables ("remote_addr ")
Else
Remoteaddr = request. servervariables ("http_x_forwarded_for ")
End if
Response. Write (getmac (remoteaddr ))
'The MAC address of the NIC that reads an IP address
'The program reads the MAC address of a specific IP address from the local ARP table by calling the ARP command.
'Note the following when using this program:
'The program requires two components: "wscript. Shell" and "scripting. FileSystemObject". Make sure that your server can use these two components normally.
'The local program uses the cmd.exe program. Make sure that the IIS Guest Account has permission to access the program.
'This program requires temporary files to save the results. Make sure that the IIS Guest account has the write permission on the temporary directory.
'
Function getmac (IP)
On Error resume next
Dim oscript
Dim ofilesys, ofile
Dim all, sztempfile, IPC, phyc, typec
Dim temppath
Set oscript = server. Createobject ("wscript. Shell ")
Set ofilesys = server. Createobject ("scripting. FileSystemObject ")
Temppath = "D:/temp/" 'temporary directory
Sztempfile = temppath & ofilesys. gettempname () 'Get the temporary file name
Call oscript. Run ("cmd.exe/c Ping-N 2" & IP, 0, true) 'ensure that this IP address exists in the ARP table.
Call oscript. Run ("cmd.exe/c arp-a" & IP & ">" & sztempfile, 0, true)
Set ofile = ofilesys. opentextfile (sztempfile, 1, false, 0)
All = ofile. readall ()
Ofile. Close
If (isobject (ofile) then
Call ofilesys. deletefile (sztempfile, true)
End if
Arr = Split (all, vbcrlf)
If ubound (ARR) = 4 then
IPC = instr (1, arr (2), "Internet address ")
Phyc = instr (1, arr (2), "physical address ")
Typec = instr (1, arr (2), "type ")
If typec> phyc and phyc> IPC and IPC> 0 then
Getmac = ucase (TRIM (CSTR (mid (ARR (3), phyc, typec-phyc ))))
End if
End if
End Function
%>