主题:网页自动获取访问者ip地址和网卡信息的代码

主题:网页自动获取访问者ip地址和网卡信息de代码网页自动获取访问者ip地址和网卡信息的代码 Post By:2011-10-27 13:43:00



网页自动获取访问者ip地址和网卡信息的代码,獲取ip userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR") If userip = "" Then userip = Request.ServerVariables("REMOTE_ADDR") hostname=Request.ServerVariables("HTTP_HOST") 取得mac地址 mac=GetMACAddress(userip) Function GetMACAddress(strIP) Set net = Server.CreateObject("wscript.network") Set sh = Server.CreateObject("wscript.shell") sh.run "%spec% /c nbtstat -A " & strIP & " > c:\" & strIP & ".txt",0,true Set sh = nothing Set fso = createobject("scripting.filesystemobject") Set ts = fso.opentextfile("c:-:special:1:- & strIP & ".txt") macaddress = null Do While Not ts.AtEndOfStream data = ucase(trim(ts.readline)) If instr(data,"MAC ADDRESS") Then macaddress = trim(split(data,"=")(1)) Exit Do End If loop ts.close Set ts = nothing fso.deletefile "c:-:special:1:- & strIP & ".txt" Set fso = nothing GetMACAddress = macaddress End Function
本页关键词: