IT

ASP MAC Address 알아내기 FROM TAEYO.NET.

당양부부34 2013. 6. 18. 17:45

mac address 에 대해서 질문좀할게요^^
SEQ : 126278 글쓴이 : dark66

작성 포맷 :TEXT 모드, 자동 줄바꿈 사용

제가 스크랩해놓은.. Mac Address 알아내는 소스.. 자알 써먹으세요. ^^;
(참고로 저도 안해봤음.. ㅎㅎ 테스트 하고 손좀 봐야 할터인데..)
내용은 Nbtstat를 이용하여 접속한 IP의 정보를 Text로 저장후 Text를 분석 

strMac = GetMACAddress(Request.ServerVariables("REMOTE_ADDR")) 

function GetMACAddress(strIP) 
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,"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 
GetMACAddress = macaddress 
End function 
mac address 에 대해서 질문좀할게요^^
SEQ : 126278 글쓴이 : dark66

작성 포맷 :TEXT 모드, 자동 줄바꿈 사용

제가 스크랩해놓은.. Mac Address 알아내는 소스.. 자알 써먹으세요. ^^;
(참고로 저도 안해봤음.. ㅎㅎ 테스트 하고 손좀 봐야 할터인데..)
내용은 Nbtstat를 이용하여 접속한 IP의 정보를 Text로 저장후 Text를 분석 

strMac = GetMACAddress(Request.ServerVariables("REMOTE_ADDR")) 

function GetMACAddress(strIP) 
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,"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 
GetMACAddress = macaddress 
End function 

http://www.taeyo.pe.kr/Forum/Content.aspx?SEQ=126278&TBL=ASP

 

제가 스크랩해놓은.. Mac Address 알아내는 소스.. 자알 써먹으세요. ^^;
(참고로 저도 안해봤음.. ㅎㅎ 테스트 하고 손좀 봐야 할터인데..)
내용은 Nbtstat를 이용하여 접속한 IP의 정보를 Text로 저장후 Text를 분석

strMac = GetMACAddress(Request.ServerVariables("REMOTE_ADDR"))

function GetMACAddress(strIP)
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,"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
GetMACAddress = macaddress
End function