Class: Nexpose::External::Asset
- Inherits:
-
Object
- Object
- Nexpose::External::Asset
- Defined in:
- lib/nexpose/external.rb
Overview
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.
Defined Under Namespace
Modules: HostType
Instance Attribute Summary collapse
-
#aliases ⇒ Object
A list of alternate identifiers of the asset.
-
#attributes ⇒ Object
A list of key-value attributes associated with the asset.
-
#files ⇒ Object
Files and directories on the asset.
-
#fqdn ⇒ Object
A fully qualified domain name of the asset.
-
#groups ⇒ Object
A list of group accounts on the asset.
-
#host_type ⇒ Object
The host type of the asset.
-
#ip ⇒ Object
IPv4 or IPv6 that is the primary identifier of the asset.
-
#mac ⇒ Object
The MAC address of the asset.
-
#net_bios ⇒ Object
A NetBIOS name of the asset.
-
#os ⇒ Object
The CPE for the operating system on the asset.
-
#scan_date ⇒ Object
The date the asset was scanned.
-
#services ⇒ Object
A list of service endpoints on the asset.
-
#software ⇒ Object
A list of CPEs identifying software installed on the asset.
-
#unique_identifiers ⇒ Object
Unique system identifiers on the asset.
-
#users ⇒ Object
A list of user accounts on the asset.
-
#vulnerabilities ⇒ Object
Asset-level vulnerabilities.
Instance Method Summary collapse
-
#initialize ⇒ Asset
constructor
A new instance of Asset.
- #to_h ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize ⇒ Asset
Returns a new instance of Asset.
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/nexpose/external.rb', line 89 def initialize @aliases = [] @software = [] @services = [] @attributes = [] @users = [] @groups = [] @files = [] @unique_identifiers = [] @vulnerabilities = [] end |
Instance Attribute Details
#aliases ⇒ Object
A list of alternate identifiers of the asset. This can include additional IP addresses and host names.
65 66 67 |
# File 'lib/nexpose/external.rb', line 65 def aliases @aliases end |
#attributes ⇒ Object
A list of key-value attributes associated with the asset.
85 86 87 |
# File 'lib/nexpose/external.rb', line 85 def attributes @attributes end |
#files ⇒ Object
Files and directories on the asset.
81 82 83 |
# File 'lib/nexpose/external.rb', line 81 def files @files end |
#fqdn ⇒ Object
A fully qualified domain name of the asset.
56 57 58 |
# File 'lib/nexpose/external.rb', line 56 def fqdn @fqdn end |
#groups ⇒ Object
A list of group accounts on the asset.
79 80 81 |
# File 'lib/nexpose/external.rb', line 79 def groups @groups end |
#host_type ⇒ Object
The host type of the asset. One of: GUEST, HYPERVISOR, PHYSICAL, MOBILE.
62 63 64 |
# File 'lib/nexpose/external.rb', line 62 def host_type @host_type end |
#ip ⇒ Object
IPv4 or IPv6 that is the primary identifier of the asset.
54 55 56 |
# File 'lib/nexpose/external.rb', line 54 def ip @ip end |
#mac ⇒ Object
The MAC address of the asset.
60 61 62 |
# File 'lib/nexpose/external.rb', line 60 def mac @mac end |
#net_bios ⇒ Object
A NetBIOS name of the asset.
58 59 60 |
# File 'lib/nexpose/external.rb', line 58 def net_bios @net_bios end |
#os ⇒ Object
The CPE for the operating system on the asset.
71 72 73 |
# File 'lib/nexpose/external.rb', line 71 def os @os end |
#scan_date ⇒ Object
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
69 70 71 |
# File 'lib/nexpose/external.rb', line 69 def scan_date @scan_date end |
#services ⇒ Object
A list of service endpoints on the asset.
75 76 77 |
# File 'lib/nexpose/external.rb', line 75 def services @services end |
#software ⇒ Object
A list of CPEs identifying software installed on the asset.
73 74 75 |
# File 'lib/nexpose/external.rb', line 73 def software @software end |
#unique_identifiers ⇒ Object
Unique system identifiers on the asset.
83 84 85 |
# File 'lib/nexpose/external.rb', line 83 def unique_identifiers @unique_identifiers end |
#users ⇒ Object
A list of user accounts on the asset.
77 78 79 |
# File 'lib/nexpose/external.rb', line 77 def users @users end |
#vulnerabilities ⇒ Object
Asset-level vulnerabilities.
87 88 89 |
# File 'lib/nexpose/external.rb', line 87 def vulnerabilities @vulnerabilities end |
Instance Method Details
#to_h ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# 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 ⇒ Object
101 102 103 |
# File 'lib/nexpose/external.rb', line 101 def to_json JSON.generate(to_h) end |