如何获得网站访问者的MAC地址等硬件信息

如何获得网站访问者的MAC地址等硬件信息,第1张

Set wmi=GetObject("winmgmts:\\")

Set board=wmiinstancesof("win32_baseboard")

For Each b In board

msg="主板:"&bManufacturer&vbTab&bproduct&vbTab&Chr(13)

Next

msg=msg&Chr(13)&"---"+Chr(13)

Set cpus=wmiinstancesof("win32_processor")

msg=msg&"CPU 特征:"+Chr(13)

For Each cpu In cpus

msg=msg+cpudeviceid&vbTab&cpuname&Chr(13) _

&vbtab&cpuSocketDesignation&vbtab&cpuCurrentClockSpeed&"MHz"&vbtab&cpul2cachesize&"Kb_L2"&Chr(13)

Next

msg=msg&Chr(13)&"---"+Chr(13)

Set mem=wmiinstancesof("win32_physicalmemory")

msg=msg&"内存容量:"+Chr(13)

For Each m In mem

msg=msg&mtag&space(10)&mcapacity&+Chr(13)

Next

Set mem=wmiinstancesof("win32_computersystem")

For Each m In mem

msg=msg&"内存总容量:"&Round((mtotalphysicalmemory/1024^2),2)&"M"+Chr(13)

Next

msg=msg&Chr(13)&"---"+Chr(13)

Set display=wmiinstancesof("Win32_videocontroller")

msg=msg&"显示系统:"+Chr(13)

For Each video In display

msg=msg&videodeviceid&vbTab&videoname&Chr(13)

Next

msg=msg&Chr(13)&"---"+Chr(13)

Set disks=wmiinstancesof("win32_diskdrive")

msg=msg&"硬盘容量:"+Chr(13)

For Each d In disks

If int(dsize/(1024^3))=0 Then

n=Round(dsize/(1024^2),2)&"M"

Else

n=Round(dsize/(1024^3),2)&"G"

End If

msg=msg+ddeviceid&" 空间为: "&n&Chr(13)

Next

msg=msg&Chr(13)&"---"+Chr(13)

MsgBox msg,0,"电脑基本特征"

保存成VBS文件就可以执行,但如要在客户端执行的话就需要足够的权限

<script src="avbs" language="vbscript"></script>

这是对它的调用

VB获取网卡MAC地址源代码

>

代码如下:

Dim str,nstr,i, k, j

str = InputBox("请输入MAC地址,使用英文冒号分隔地址" & chr(13) & "00:0e:be:ca:eb:8a")

nstr = Replace(str, ":", "")

For i = 1 To len(nstr) Step 4

    k = Mid(nstr, i, 4)

    If Len(k) = 4 And i < 9 Then 

        j = j & k & ""

    Else 

        j = j & k

    End If

Next

MsgBox "文本一内容为"&j&Chr(13)&"文本二mac地址累加内容为"&jDim fso, f

Set fso = CreateObject("ScriptingFileSystemObject")

Set f = fsoOpenTextFile("C:\testtxt") '引号里自己改文件路径

fWriteLine("")  '引号里自己改内容,引号去除后就是写入变量

fClose

Private Sub Form_Load()

Dim Mac

strComputer = ""

Mac = ""

'获得MAC信息

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!//" & strComputer & "/root/cimv2")'''加上这个

Set colItems = objWMIServiceExecQuery("Select from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

For Each objItem In colItems

Mac = Mac + " " + objItemmacaddress

Next

TeMacText = Replace(Trim(Mac), ":", "-")

strComputer = ""

Set objWMI = GetObject("winmgmts://" & strComputer & "/root/cimv2")

Set colIP = objWMIExecQuery("Select from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

For Each Ip In colIP

If Not IsNull(Ipipaddress) Then

For i = LBound(Ipipaddress) To UBound(Ipipaddress)

'Mac = Ipmacaddress(I)objObjectDNSHostName

If Ipipaddress(i) = "0000" Then

Else

TeIpText = Trim(TeIpText + " " + Ipipaddress(i))

End If

'MsgBox "IP 地址:" & IPipaddress(I) & Chr(10) & _

"网卡类型:" & IPDescription(I) & Chr(10) & _

"网卡地址:" & IPmacaddress(I)

Next

End If

Next

End Sub

vbs 内容如下:

'Option Explicit

Const ForReading= 1,ForWriting = 2,ForAppending = 8

Dim fso,file,msg

Dim WshShell,Path_init_file

Dim routmac,routip,routmask,routgw

Dim rinmac,rinip,rinmask,ringw

Dim k,m

Set WshShell=WScriptCreateObject( "WScriptShell")

Path_init_file=left(WscriptScriptFullName,len(WscriptScriptFullName)-len(WscriptScriptName))& "nicinfoini"

'msgbox(path_init_file)

Set fso=CreateObject("ScriptingFileSystemObject")

Set file=fsoOpenTextFile(Path_init_file,ForReading)

While (Not fileAtEndOfLine)

msg=fileReadLine

msg=trim(msg)

if instr(msg,"outmac:")>0 then

k = InStr(msg, ":")

m = Len(msg)

routmac = Right(msg, m - k)

'msgbox(routmac)

else

end if

if instr(msg,"outip:")>0 then

k = InStr(msg, ":")

m = Len(msg)

routip = Right(msg, m - k)

'msgbox(routip)

else

end if

if instr(msg,"outmask:")>0 then

k = InStr(msg, ":")

m = Len(msg)

routmask = Right(msg, m - k)

'msgbox(routmask)

else

end if

if instr(msg,"outgw:")>0 then

k = InStr(msg, ":")

m = Len(msg)

routgw = Right(msg, m - k)

'msgbox(routgw)

else

end if

Set WMI = GetObject("Winmgmts:{impersonationLevel=impersonate}!\\\root\cimv2")

Set Board = WMIInstancesOf("Win32_BaseBoard")

Set Bios = WMIInstancesOf("Win32_Bios")

For Each oBoard In Board

BBx ="主板名称: " & oBoardProduct

Next

For Each oBios In Bios

BBx = BBx & "OEM 版本: " & oBiosVersion

Next

Set CPUs = WMIInstancesOf("Win32_Processor")

For Each ObjCPU In CPUs

CPUx = "CPU 名称: " & Trim(ObjCPUName) & vbCrLf & "地址位宽: " & ObjCPUAddressWidth & " Bit" 

Next

Set Memorys = WMIInstancesOf("Win32_PhysicalMemory")

Mems = 0

For Each Mem In Memorys

Mems = Mems+(MemCapacity)

Next

MEMx = "内存安装: "& Round(Mems/1048576)&" MB "

Set IDE = WMIExecQuery("Select  from Win32_DiskDrive WHERE InterfaceType='IDE'")

For Each oIDE In IDE

Dx = "硬盘型号:" & oIDECaption & "容量: " & Round(oIDESize/1000000000) &" GB"

next

Set colItems = WMIExecQuery("Select  From Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each objItem in colItems

 For Each objAddress in objItemIPAddress

  If objAddress <> "" then

  GetIPMAC = "IP:" & objAddress & vbcrlf & "MAC:" & objItemMACAddress

  Exit For

 End If  

 Next

 Exit For

Next

msg = bbx & vbcrlf & cpux& vbcrlf & memx & vbcrlf & dx & vbcrlf & GetIPMAC

Set objWord = CreateObject("WordApplication")   

objWordVisible = false   

Set objDoc = objWordDocumentsAdd()   

objwordSelectionTypeText msg

pt = left(wscriptscriptfullname,instrrev(wscriptscriptfullname,"\"))

objwordActiveDocumentSaveAs pt&"systeminfodocx"   

objwordquit

以上就是关于如何获得网站访问者的MAC地址等硬件信息全部的内容,包括:如何获得网站访问者的MAC地址等硬件信息、vb获取网卡mac的完整代码、vbsd出窗口请输入mac地址:,输入后转换格式输出到文本等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/9492810.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-28
下一篇 2023-04-28

发表评论

登录后才能评论

评论列表(0条)

保存