Skip to content
On this page

Script - MAC Lookup

Hover over a MAC address and initiate the script will search macvendors for the mac address and output the result.

vb
# $language = "VBScript"
# $interface = "1.0"

' Define constants
Const ForWriting = 2
Const ForAppending = 8

' Get the current script tab
Set objTab = crt.GetScriptTab

' Create objects for Shell and FileSystem operations
Set g_shell = CreateObject("WScript.Shell")
Set g_fso = CreateObject("Scripting.FileSystemObject")

' Create an object for making HTTP requests
Dim o
Set o = CreateObject("MSXML2.XMLHTTP")

' Define the API URL
website = "http://api.macvendors.com/"

' Get the selected text from the terminal
strSelection = objTab.Screen.Selection

If Not (Trim(strSelection) = "") Then
    ' If there is a selected MAC address, query the API
    url = website & strSelection
    o.open "GET", url, False
    o.send
    crt.Dialog.MessageBox("MAC Vendor: " & o.responseText)
Else
    ' If no selection, prompt the user for a MAC address
    macAddress = InputBox("Please enter a MAC Address")
    url = website & macAddress
    o.open "GET", url, False
    o.send
    crt.Dialog.MessageBox("MAC Vendor: " & o.responseText)
End If