public function valuesepr(byval rawstring as string, byval sepchar as string) as string
if instr(1, rawstring, sepchar) <> 0 then
valuesepr = microsoft.visualbasic.right(rawstring,len(rawstring) - instr(1, rawstring, sepchar))
else
valuesepr = rawstring
end if
end function
public function getmac(byval ip as string) as string
try
dim dirresults as string
dim psi as system.diagnostics.processstartinfo = new system.diagnostics.processstartinfo()
dim proc as new system.diagnostics.process()
psi.filename = "nbtstat"
psi.redirectstandardinput = false
psi.redirectstandardoutput = true
psi.arguments = "-a " & ip
psi.useshellexecute = false
proc = system.diagnostics.process.start(psi)
dim x as integer = -1
do until x > -1
if dirresults <> nothing then
x = dirresults.trim.tolower.indexof("mac address", 0)
if x > -1 then
exit do
end if
end if
dirresults = proc.standardoutput.readline
loop
proc.waitforexit()
getmac = valuesepr(dirresults.trim, "=").trim
catch err as exception
response.write(err.message & err.stacktrace)
end try
end function
闽公网安备 35060202000074号