asp获取手机mac_使用ASP获得服务器网卡的MAC地址信息

该博客介绍了一个ASP函数GetMacInfo,用于获取服务器的网卡物理地址(MAC)。通过执行命令行 Ipconfig /All 并解析输出,函数能够检索到服务器的MAC地址信息。如果系统不支持或者权限不足,则无法获取。
摘要由CSDN通过智能技术生成

使用ASP获得服务器网卡的MAC地址信息

更新时间:2007年01月10日 00:00:00   作者:

'----------------------提取所有网卡的信息--------------------'

Public Function GetMacInfo()

On Error Resume Next

Dim fso, FileStr, AspSleepThread, CmdStr, SysDir, wshshell, CmdRe, MacFileContentFile, MacFileContent

Const MacFile = "TmpYesoulSoft001.LLP"

Set fso = Server.CreateObject("Scripting.FileSystemObject")

SysDir = Split(GlobalMod.GetSysDir, ",")(1)

If InStr(LCase(SysDir), "system32") = 0 Then

GetMacInfo = "本系统只能运行在Nt、Windows 2000、Windows.Net、Windows Xp、Windows 2003等32位系统下,不支持32位以下的系统!"

Exit Function

Else

CmdStr = SysDir + "\Cmd.exe /C " + SysDir + "\Ipconfig.exe /All > " + Server.MapPath(MacFile)

End If

CmdRe = Shell(CmdStr, vbHide)

If CmdRe <> 0 Then

Set MacFileContentFile = fso.OpenTextFile(Server.MapPath(MacFile), 1, False, TristateUseDefault)

'GetMacInfo = MacFileContentFile.ReadAll()

'Response.Flush

FileStr = MacFileContentFile.ReadAll()

MacFileContentFile.Close

Set MacFileContentFile = Nothing

Set AspSleepThread = Server.CreateObject("YesoulSoft.SleepThread")

'定义线程挂起的时间,这里为毫秒

AspSleepThread.SleepTime = 500

AspSleepThread.BeginSleepThread

GetMacInfo = ExecuteOne(FileStr, "Physical Address. . . . . . . . . : (.*)")

Set AspSleepThread = Nothing

Else

GetMacInfo = "系统当前无法获取您的网络信息,请检查权限继承关系后再运行本系统!"

Exit Function

End If

DelFile MacFile

Set fso = Nothing

End Function

'------------------在字符串匹配一次结果-------------------'

Public Function ExecuteOne(inpStr, PatStr)

Dim oRe, oMatch, oMatches

Set oRe = New RegExp

oRe.Pattern = PatStr

inpStr = LCase(inpStr)

oRe.IgnoreCase = True

Set oMatches = oRe.Execute(inpStr)

Set oMatch = oMatches(0)

ExecuteOne = oMatch.SubMatches(0)

End Function

相关文章

计算两个时间之差的函数...2006-08-08

很多朋友想用SQL2000数据库的编程方法,但是却又苦于自己是学ACCESS的,对SQL只是一点点的了解而已,这里我给大家提供以下参考---将ACCESS转化成SQL2000的方法和注意事项2007-03-03

这篇文章主要介绍了asp实现获取MSSQL数据库表指定条件行数的函数的的相关资料,需要的朋友可以参考下2015-03-03

浏览文件夹下面所有图片...2006-08-08

用ASP实现分级权限控制...2007-09-09

ASP 关于动态数据显示页面得锚点...2007-09-09

LINE9的目录浏览源程序...2006-08-08

jb51生成所有页面的效果+分页生成...2006-08-08

标题有点拗口,今天群里在说这个问题,CSDN有答案,附上,需要的朋友可以参考下2012-03-03

非常不错的ASP+Access数据库的终极安全大法18则...2007-06-06

最新评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值