Class: Nexpose::Asset

Inherits:
APIObject show all
Defined in:
lib/nexpose/asset.rb

Overview

Asset object as return from the 2.1 API.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIObject

#object_from_hash

Constructor Details

#initializeAsset

Returns a new instance of Asset.



42
43
44
45
# File 'lib/nexpose/asset.rb', line 42

def initialize
  @addresses = []
  @host_names = []
end

Instance Attribute Details

#assessmentObject (readonly)

Assessment summary of the asset, including most recent scan info. [Lazy]



21
22
23
# File 'lib/nexpose/asset.rb', line 21

def assessment
  @assessment
end

#exploitsObject (readonly)

Vulnerability exploits to which this asset is susceptible. [Lazy]



31
32
33
# File 'lib/nexpose/asset.rb', line 31

def exploits
  @exploits
end

#filesObject (readonly)

Files and directories that have been enumerated on the asset. [Lazy]



40
41
42
# File 'lib/nexpose/asset.rb', line 40

def files
  @files
end

#group_accountsObject (readonly)

Group accounts enumerated on the asset. [Lazy]



38
39
40
# File 'lib/nexpose/asset.rb', line 38

def group_accounts
  @group_accounts
end

#host_namesObject (readonly)

Known host names found for the asset.



12
13
14
# File 'lib/nexpose/asset.rb', line 12

def host_names
  @host_names
end

#host_typeObject (readonly)

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



18
19
20
# File 'lib/nexpose/asset.rb', line 18

def host_type
  @host_type
end

#idObject (readonly)

Unique identifier of the asset on the Nexpose console.



6
7
8
# File 'lib/nexpose/asset.rb', line 6

def id
  @id
end

#ipObject (readonly)

Primary IP address of the asset.



8
9
10
# File 'lib/nexpose/asset.rb', line 8

def ip
  @ip
end

#macObject (readonly)

MAC address of the asset.



10
11
12
# File 'lib/nexpose/asset.rb', line 10

def mac
  @mac
end

#malware_kitsObject (readonly)

Malware kits to which this asset is susceptible. [Lazy]



33
34
35
# File 'lib/nexpose/asset.rb', line 33

def malware_kits
  @malware_kits
end

#os_cpeObject (readonly)

The CPE for the asset’s operating system.



16
17
18
# File 'lib/nexpose/asset.rb', line 16

def os_cpe
  @os_cpe
end

#os_nameObject (readonly)

Operating system name.



14
15
16
# File 'lib/nexpose/asset.rb', line 14

def os_name
  @os_name
end

#servicesObject (readonly)

Service endpoints enumerated on the asset. [Lazy]



23
24
25
# File 'lib/nexpose/asset.rb', line 23

def services
  @services
end

#softwareObject (readonly)

Software enumerated on the asset. [Lazy]



25
26
27
# File 'lib/nexpose/asset.rb', line 25

def software
  @software
end

#user_accountsObject (readonly)

User accounts enumerated on the asset. [Lazy]



36
37
38
# File 'lib/nexpose/asset.rb', line 36

def user_accounts
  @user_accounts
end

#vulnerabilitiesObject (readonly)

Vulnerabilities detected on the asset. [Lazy]



27
28
29
# File 'lib/nexpose/asset.rb', line 27

def vulnerabilities
  @vulnerabilities
end

#vulnerability_instancesObject (readonly)

Vulnerability instances detected on the asset. [Lazy]



29
30
31
# File 'lib/nexpose/asset.rb', line 29

def vulnerability_instances
  @vulnerability_instances
end

Class Method Details

.load(nsc, id) ⇒ Asset

Load an asset from the provided console.

Parameters:

  • nsc (Connection)

    Active connection to a Nexpose console.

  • id (String)

    Unique identifier of an asset.

Returns:

  • (Asset)

    The requested asset, if found.



53
54
55
56
57
58
# File 'lib/nexpose/asset.rb', line 53

def self.load(nsc, id)
  uri = "/api/2.1/assets/#{id}"
  resp = AJAX.get(nsc, uri, AJAX::CONTENT_TYPE::JSON)
  hash = JSON.parse(resp, symbolize_names: true)
  new.object_from_hash(nsc, hash)
end