ASP Get Client MAC Address

xiaoxiao2021-03-06  34

This program belongs to a special method. The range of use is limited and there is a risk. Draw some methods in the back door of the ASP. Below is the program code.

<% Dim remoteaddrif Request.ServerVariables ( "HTTP_X_FORWARDED_FOR") = empty thenremoteaddr = Request.ServerVariables ( "REMOTE_ADDR") elseremoteaddr = Request.ServerVariables ( "HTTP_X_FORWARDED_FOR") end if

Response.write (getMac (RemoteAddr)) 'Since the NIC MAC address by reading an IP' This program is written by querying the ARP command by querying the MAC address of this ARP table. The following matters should be aware of the following: ' The program requires "wscript.shell" and "scripting.filesystemObject" two components, make sure your server can use these two components normally 'This program needs to call the cmd.exe program, make sure the IIS guest account has access to the program. 'This program requires a temporary file save result, make sure the IIS guest account is written to the temporary directory. 'Function GetMac (IP) On Error Resume NextDim oScriptDim oFileSys, oFileDim All, szTempFile, ipc, phyc, typecDim TempPathSet oScript = Server.CreateObject ( "WSCRIPT.SHELL") Set oFileSys = Server.CreateObject ( "Scripting.FileSystemObject") TempPath = "D: / TEMP /" 'Temporary Directory SztempFile = Temppath & OfileSys.getTempName ()' Get temporary file name Call Oscript.Run ("cmd.exe / c ping -n 2" & ip, 0, true) 'guarantee In the ARP table, there is this IPCall Oscript.Run ("cmd.exe / c arp -a" & ip & "> & sztempfile, 0, true) set ofile = ofilessys.opentextfile (sztempfile, 1, false, 0) all = Ofile.readall () OFLE.Closeif (isobject (ofile) Then Call OfileSys.deletefile (Sztempfile, True) endiffr = split (all, vbcrlf) if Ubound (arr) = 4 kil = instruction (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 ThengetMac = UCase (TRIM (CSTR (MID (Arr (3), PHYC, TYPEC - PHYC))) End IFend IFEnd Function%>

转载请注明原文地址:https://www.9cbs.com/read-59033.html

New Post(0)