怎样获得服务器的网卡地址(MAC地址)?

molishao 2002-01-31 10:59:12
...全文
119 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
BrightEye 2002-01-31
  • 打赏
  • 举报
回复
关注......
yanchang 2002-01-31
  • 打赏
  • 举报
回复
转编文章,不过我没试过对不对

大家好,下面我们来谈谈在集团内部的网络中如何限制用户自己不要乱改自己的ip地址呢,我通过设置网卡物理地址和ip地址的对应来实现,建两个基本的表,一个记录着正确的ip,mac关系,一个记录者不法分子的进入过程,当然这些是通过他们对内部网的访问来控制的,如果用户改了自己的ip,那么他就无法用内部的系统了。
获取的过程如下,对数据库的操作自己写了,strIP是ip,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,"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
strMac = GetMACAddress





Studio 2002-01-31
  • 打赏
  • 举报
回复
ASP实现不了的啦! 要不写控件 要不用ASP.NET
molishao 2002-01-31
  • 打赏
  • 举报
回复
唉!不会吧。我是想在程序中获得,不是想看一下。
flounder 2002-01-31
  • 打赏
  • 举报
回复


ipconfig /all


28,405

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧