class Nexpose::External::Asset

Object for importing assets from external sources into a Nexpose console. This exists primarily as a convenience for marshalling the data into the proper JSON format.

In order to successfully import an asset, it must contain at least one scannable identifier: IP address, fully qualified domain name, or NetBIOS name. This ensures that once an asset is imported to the console, it can be scanned.

Besides a scannable identifier, all other fields are optional.

Attributes

aliases[RW]

A list of alternate identifiers of the asset. This can include additional IP addresses and host names.

attributes[RW]

A list of key-value attributes associated with the asset.

files[RW]

Files and directories on the asset.

fqdn[RW]

A fully qualified domain name of the asset.

groups[RW]

A list of group accounts on the asset.

host_type[RW]

The host type of the asset. One of: GUEST, HYPERVISOR, PHYSICAL, MOBILE.

ip[RW]

IPv4 or IPv6 that is the primary identifier of the asset.

mac[RW]

The MAC address of the asset.

net_bios[RW]

A NetBIOS name of the asset.

os[RW]

The CPE for the operating system on the asset.

scan_date[RW]

The date the asset was scanned. If left blank, the current time will be used by the console. Use the ISO 8601 basic date-time format. For example: 20141211T100614.526Z

services[RW]

A list of service endpoints on the asset.

software[RW]

A list of CPEs identifying software installed on the asset.

unique_identifiers[RW]

Unique system identifiers on the asset.

users[RW]

A list of user accounts on the asset.

vulnerabilities[RW]

Asset-level vulnerabilities.

Public Class Methods

new() click to toggle source
# File lib/nexpose/external.rb, line 89
def initialize
  @aliases            = []
  @software           = []
  @services           = []
  @attributes         = []
  @users              = []
  @groups             = []
  @files              = []
  @unique_identifiers = []
  @vulnerabilities    = []
end

Public Instance Methods

to_h() click to toggle source
# File lib/nexpose/external.rb, line 105
def to_h
  { ip: ip,
    fqdn: fqdn,
    net_bios: net_bios,
    mac: mac,
    host_type: host_type,
    aliases: aliases,
    scan_date: scan_date,
    os: os,
    software: software,
    services: services.map(&:to_h),
    users: users.map(&:to_h),
    groups: groups.map(&:to_h),
    files: files.map(&:to_h),
    unique_identifiers: unique_identifiers.map(&:to_h),
    vulnerabilities: vulnerabilities.map(&:to_h),
    attributes: Attributes.to_hash(attributes) }
end
to_json() click to toggle source
# File lib/nexpose/external.rb, line 101
def to_json
  JSON.generate(to_h)
end