Class: Nessus::Scan
- Inherits:
-
Object
- Object
- Nessus::Scan
- Defined in:
- lib/nessus/scan.rb
Defined Under Namespace
Classes: Result
Instance Attribute Summary collapse
-
#details ⇒ Object
readonly
Wrapper for XMLRPC client.
-
#id ⇒ Object
readonly
Wrapper for XMLRPC client.
-
#result ⇒ Object
readonly
Wrapper for XMLRPC client.
-
#uuid ⇒ Object
readonly
Wrapper for XMLRPC client.
Instance Method Summary collapse
-
#export_csv(filepath) ⇒ Fixnum
Export scan to csv file.
-
#initialize(name, targets) ⇒ Scan
constructor
Create a new scan instance.
-
#launch! ⇒ Result
Launches the scan.
-
#view ⇒ Hash
View the result of a finished scan.
Constructor Details
#initialize(name, targets) ⇒ Scan
Create a new scan instance
23 24 25 26 |
# File 'lib/nessus/scan.rb', line 23 def initialize(name, targets) set_uuid(name) setup_scan(targets) end |
Instance Attribute Details
#details ⇒ Object (readonly)
Wrapper for XMLRPC client
14 15 16 |
# File 'lib/nessus/scan.rb', line 14 def details @details end |
#id ⇒ Object (readonly)
Wrapper for XMLRPC client
14 15 16 |
# File 'lib/nessus/scan.rb', line 14 def id @id end |
#result ⇒ Object (readonly)
Wrapper for XMLRPC client
14 15 16 |
# File 'lib/nessus/scan.rb', line 14 def result @result end |
#uuid ⇒ Object (readonly)
Wrapper for XMLRPC client
14 15 16 |
# File 'lib/nessus/scan.rb', line 14 def uuid @uuid end |
Instance Method Details
#export_csv(filepath) ⇒ Fixnum
Export scan to csv file
62 63 64 65 66 67 |
# File 'lib/nessus/scan.rb', line 62 def export_csv(filepath) csv_id = client.scan_export(@id, 'csv') csv_data = client.report_download(@id, csv_id['file']) File.write(filepath, csv_data) end |
#launch! ⇒ Result
Launches the scan
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/nessus/scan.rb', line 32 def launch! client.scan_launch(@id) loop do raw = client.scan_details(@id) status = raw['info']['status'] if status != 'running' @result = Result.new(raw) break end sleep Nessus::Settings.refresh_interval end end |
#view ⇒ Hash
View the result of a finished scan
52 53 54 |
# File 'lib/nessus/scan.rb', line 52 def view result && result.raw end |