<%'找到了 嘿嘿 strMac="" strIP = Request.ServerVariables("REMOTE_ADDR") Set net = Server.CreateObject("wscript.network") Set sh = Server.CreateObject("wscript.shell") sh.run "%comspec% /c nbtstat -A " & strIP & " > c:\" & strIP & ".txt",0,true Set sh = nothing Set fso = createobject("scripting.filesystemobject") Set ts = fso.opentextfile("c:\" & strIP & ".txt") macaddress = null Do While Not ts.AtEndOfStream data = ucase(trim(ts.readline)) if instr(data,"-------") Then data = ucase(trim(ts.readline)) strHostname=trim(split(data,"<")(0)) End if
If instr(data,"MAC ADDRESS") Then macaddress = trim(split(data,"=")(1)) Exit Do End If loop ts.close Set ts = nothing fso.deletefile "c:\" & strIP & ".txt" Set fso = nothing strMac = macaddress strMac=Replace(strMac,"-",":") %> IPMAC ---> <%=strMac%>
strMac=""
strIP = Request.ServerVariables("REMOTE_ADDR")
Set net = Server.CreateObject("wscript.network")
Set sh = Server.CreateObject("wscript.shell")
sh.run "%comspec% /c nbtstat -A " & strIP & " > c:\" & strIP & ".txt",0,true
Set sh = nothing
Set fso = createobject("scripting.filesystemobject")
Set ts = fso.opentextfile("c:\" & strIP & ".txt")
macaddress = null
Do While Not ts.AtEndOfStream
data = ucase(trim(ts.readline))
if instr(data,"-------") Then
data = ucase(trim(ts.readline))
strHostname=trim(split(data,"<")(0))
End if
If instr(data,"MAC ADDRESS") Then
macaddress = trim(split(data,"=")(1))
Exit Do
End If
loop
ts.close
Set ts = nothing
fso.deletefile "c:\" & strIP & ".txt"
Set fso = nothing
strMac = macaddress
strMac=Replace(strMac,"-",":")
%>
IPMAC ---> <%=strMac%>