上一篇:关于在浏览器中执行*.exe文件的深入探讨 >>
获得客房端的MAC(Media Access Control)地址
node of a network. Works great on LAN@#s. Firewalls and Proxy@#s will be an issue depending what side of
them you@#re coding for.
Can@#t Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
@#**************************************
@# for :MAC address
@#**************************************
This code is AS IS! I had a need For it on a
project I was working On and found almost no info
anywhere On what I needed To accomplish. If it
helps you, great! If it does Not work For you:
1.Make sure you@#re Not trying To hit on the same
pc it@#s on.
2.Comment out where the file gets deleted
(fso.deletefile "c:\" & strIP & ".txt"), To view
some potential Error info.
3.Have fun debugging :) (I did)
code:
Can@#t Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
@#**************************************
@# Name: MAC address
@# Description:Get the clients MAC(Media
@# Access Control)
address, a hardware address that uniquely
identifies Each node of a network. Works great on
LAN@#s. Firewalls and Proxy@#s will be an issue
depending what side of them you@#re coding for.
@# By: Jerry Aguilar
@#
@#
@# Inputs:None
@#
@# Returns:Returns the client IP and MAC
@# address.
@#
@#Assumes:You can@#t navigate to it runnin
@# g PWS on the same
pc but If you are running PWS, you can navigate
To it from another pc on the same lan (it does
Not like 127.0.0.1)
@#
@#Side Effects:None
@#
@#Warranty:
@#code provided by Planet Source Code(tm)
@# (www.Planet-Source-Code.com) @#as is@#, wi
@# thout warranties as to performance, fitn
@# ess, merchantability,and any other warra
@# nty (whether expressed or implied).
@#Terms of Agreement:
@#By using this source code, you agree to
@# the following terms...
@# 1) You may use this source code in per
@# sonal projects and may compile it into a
@# n .exe/.dll/.ocx and distribute it in bi
@# nary format freely and with no charge.
@# 2) You MAY NOT redistribute this sourc
@# e code (for example to a web site) witho
@# ut written permission from the original
@# author.Failure to do so is a violation o
@# f copyright laws.
@# 3) You may link to this code from anot
@# her website, provided it is not wrapped
@# in a frame.
@# 4) The author of this code may have re
@# tained certain additional copyright righ
@# ts.If so, this is indicated in the autho
@# r@#s description.
@#**************************************
<%@ LANGUAGE="VBSCRIPT"%>
<%
strIP = Request.ServerVariables("REMOTE_ADDR")
strMac = GetMACAddress(strIP)
strHost = Request.ServerVariables("REMOTE_HOST")
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
%>
<HTML>
<HEAD>
<TITLE>Say Hello To the MAC MAN</TITLE>
</HEAD>
<BODY>
<%Response.Write("Your IP is : " & strIP & "<BR>" & vbcrlf)%>
<%Response.Write("Your MAC is : " & strMac & vbcrlf)%>
</BODY>
</HTML>
下一篇:动态缓冲 >>
相关文章:
- · 判断客户端是否支持cookie的脚本!
- · 一个类似vbscript的round函数的javascript函数
- · HEAD元素使用集锦
- · 最新的关于Cookies的操作
- · 高级表单验证-针对多次提交表单
- · 脚本控制Frame
- · ASP中Cookie使用指南
- · 在大型社区系统中用二维数组实现用户高级功能(1)
- · 在ASP应用中如何限制同一表单被多次提交
- · 自己动手,结合javascript和dhtml做一个ubb编辑器(附例子代码)
- · Asp与导航文件
- · 在FLASH中调用ASP
- · 列出 IE5 所支持的所有server端变量
- · 深入研究“用ASP上载文件”(二)
- · 深入研究“用ASP上载文件”(一)
- · 复杂表单的动态生成与动态验证
- · ADO 事件模型
- · ACCESS97关于数据库安全的几个问题
- · 在程序中直接设定待连接的数据库
- · 使用@IDENTITY
- · 在linux上用ASP
- · 数据库记录的表格显示,编辑与更新
- · asp实现数据记录的备份及恢复-----抛砖引玉
- · 选择最快的镜像站点
- · 用ASP列出服务器上的所有硬盘及类型
- · 在ADO使用SELECT语法六
- · 在asp聊天室里实现房间功能和用户显示
- · ASP编写的一个简单的颜色吸取器
- · 让IIS 5.0的错误信息提示更详细的方法
- · Iasp+Apache+W98简单试用
- · 利用正则表达式把用URLEncode的字符串转换成正常的字符串函数
- · 用ASP判断Email地址是否有效
- · 如何利用ASP实现邮箱访问
- · 在ASP处理程序时,进度显示
- · 一个显示原代码的asp程序
- · 调试 ASP 脚本
- · 在ADO使用SELECT语法五
- · 在ADO使用SELECT语法四
