VBScript reference

Network Scanner User Manual

About

Introduction

Licence agreement

Scanning

Getting started

Scan ranges and modes

Scan options

Working with results

Discovery

DHCP server discovery

Device discovery

Duplicate IP detection

Windows Queries

WMI

Registry

Files

Services

Groups

Performance

PowerShell

Scripting (VBScript)

VBScript reference

Cross-Platform Queries

SNMP

SSH

XML and JSON

Nmap integration

Python

Operations

Device management

Live monitoring

Background scanning

Device history

Friendly names and comments

Data management

Advanced

Customisation

Credentials and security

Command line

Product Page & Download

This page documents the built-in objects available exclusively in Remote Scripting (VBScript). These objects are not available in Python. In addition to regular automation objects created with CreateObject(), you can call Internal.CreateObject() to create the following objects.

Process

Method Description
Execute(“command-line-string”) Launches the specified console program and waits for its completion.
Property Description
ExitCode A numeric exit code with which the program terminates.
Output A collection of strings containing captured console output.

+ Show usage example)

'This runs ping.exe, captures its output and extracts reported packet loss
'It can be adapted to execute any console programs and parse their output

'Create process object and execute ping
Set proc = Internal.CreateObject("process")
proc.execute("ping.exe " & Input.Current)

'Check ping exit code
If proc.ExitCode = 0 Then

    'Setup a regex object
    Set objRegex = New RegExp
    objRegex.IgnoreCase = True
    objRegex.Multiline = True
    objRegex.Global = True
    'Look for a string like (X% loss)
    objRegex.Pattern = "\((\d+%\s\w+)\)"

    'Traverse output lines
    For Each line in proc.output
        Set matches = objRegex.Execute(line)
        'Print matching data
        For Each match in matches
            Output.Write match.SubMatches(0)
        Next
    Next
Else
    Output.Write "Exit code " & proc.ExitCode
End If

DNS

Method Description
GetName(“target”,“type”) Sends a DNS request to the DNS server specified in the Server property. The first parameter is a host name or IP address to be resolved. The second parameter is the record type, usually “a” or “aaaa” for a regular name lookup or “ptr” for a reverse lookup.
Property Description
Server One or more comma-separated DNS server addresses. If not specified, the default servers will be used.

+ Show usage example)

'Resolve a name or IP address via DNS
'This example performs a reverse lookup

'Create internal DNS object
set dnsObj = Internal.CreateObject("dns")

'Optionally set DNS server
'dnsObj.Server = "x.x.x.x"

'Get PTR record for the current IP address
name = dnsObj.GetName(Input.Current, "ptr")

'Print out resolved name
Output.Write name

SNMP

Method Description
SendRequest Sends an SNMP request to the device specified in the Host property. Request parameters are set in the Query property. If this method succeeds, the response is available in the Reply property.
Property Description
Host Target host name or IP address.
Query The Query object defines request parameters.
Reply The Reply object contains response details.
Query Object Description
Query.AddOid(“string”) Adds an OID string to the request. Multiple OIDs can be added.
Query.SetOid(“string”) Sets an OID string for use in the request. Any previously added OIDs are deleted. Pass an empty string to clear all added OIDs.
Query.Version SNMP version number to use: 1, 2 or 3.
Query.PduType PDU type used in the request: &hA0 (GetRequest), &hA1 (GetNextRequest) or &hA5 (GetBulkRequest).
Query.Community Community string for use in SNMPv1 and SNMPv2.
Query.V3Security SNMPv3 security mode string: NoAuthNoPriv, AuthNoPriv or AuthPriv.
Query.V3AuthMode SNMPv3 authentication algorithm string: MD5, SHA1, SHA256, SHA384 or SHA512.
Query.V3PrivMode SNMPv3 privacy algorithm string: DES, 3DES or AES.
Query.V3UserName SNMPv3 username string.
Query.V3AuthPass SNMPv3 authentication password string.
Query.V3PrivPass SNMPv3 privacy password string.
Query.MaxRepetitions Target max-repetitions value for a bulk request.
Query.NonRepeaters Target non-repeaters value for a bulk request.
Reply Object Description
Reply.ErrorStatus A numeric SNMP error code.
Reply.Items Collection of reply items.
Reply.Items.Count Number of items in the collection.
Reply.Items(index).Oid A string value containing response OID.
Reply.Items(index).Value A string value containing response data.
Reply.Items(index).Type A numeric value containing response data type.

+ Show usage example)

'Create SNMP object and set target host
set objSnmp = Internal.CreateObject("snmp")
objSnmp.Host = Input.Current

'Use version 2 and get sysDescr
objSnmp.Query.Version = 2
objSnmp.Query.SetOID("1.3.6.1.2.1.1.1.0")
If objSnmp.SendRequest then
    'Success
    Output.Write objSnmp.Reply.Items(0).Value
End If

'Now get interface table.
'In SNMP v2/3 we can use bulk requests

objSnmp.Query.SetOID("1.3.6.1.2.1.2.2.1.2")
objSnmp.Query.MaxRepetitions = 10
objSnmp.Query.PDUType = &hA5
Do While objSnmp.SendRequest
    'Success
    For Each Item in objSnmp.Reply.Items

        'Break the loop if found a different OID
        If InStr(Item.OID, "1.3.6.1.2.1.2.2.1.2") = 0 Then
            Exit Do
        End if

        'Write interface name
        Output.Write Item.Value

        'Continue from the current OID
        objSnmp.Query.SetOID(Item.OID)
    Next
Loop

Remote namespace

You can invoke any named scan item from your script using the following functions:

Method Description
Remote.Files(“name”) Retrieves file or folder properties from remote machines.
Remote.Groups(“name”) Retrieves user group membership from remote systems.
Remote.JSON(“name”) Extracts data from JSON responses obtained via HTTP.
Remote.Nmap(“name”) Runs an Nmap scan for OS detection, port scanning and more.
Remote.Performance(“name”) Gathers Windows performance counters from remote machines.
Remote.PowerShell(“name”) Executes PowerShell scripts on remote Windows systems.
Remote.Registry(“name”) Queries the Windows Registry on remote devices.
Remote.SNMP(“name”) Performs SNMP queries on network devices.
Remote.SSH(“name”) Executes commands on remote Unix/Linux systems via SSH.
Remote.Services(“name”) Checks the status of Windows services on remote machines.
Remote.WMI(“name”) Runs WMI queries on remote Windows devices.
Remote.XML(“name”) Parses XML data retrieved over HTTP.

Calling an item by its name executes the corresponding scan. For example:

+ Show usage example)

'This script prints the Windows version retrieved via WMI.
winName = Remote.WMI("Windows Name")
Output.Write "This comes from WMI: " & winName