Class: Dradis::Plugins::Qualys::Vuln::Importer
- Inherits:
-
Upload::Importer
- Object
- Upload::Importer
- Dradis::Plugins::Qualys::Vuln::Importer
- Defined in:
- lib/dradis/plugins/qualys/vuln/importer.rb
Instance Attribute Summary collapse
-
#host_node ⇒ Object
Returns the value of attribute host_node.
Class Method Summary collapse
Instance Method Summary collapse
-
#import(params = {}) ⇒ Object
The framework will call this function if the user selects this plugin from the dropdown list and uploads a file.
-
#initialize(args = {}) ⇒ Importer
constructor
A new instance of Importer.
Constructor Details
Instance Attribute Details
#host_node ⇒ Object
Returns the value of attribute host_node.
14 15 16 |
# File 'lib/dradis/plugins/qualys/vuln/importer.rb', line 14 def host_node @host_node end |
Class Method Details
.templates ⇒ Object
16 17 18 |
# File 'lib/dradis/plugins/qualys/vuln/importer.rb', line 16 def self.templates { evidence: 'vuln_evidence', issue: 'vuln_element' } end |
Instance Method Details
#import(params = {}) ⇒ Object
The framework will call this function if the user selects this plugin from the dropdown list and uploads a file.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/dradis/plugins/qualys/vuln/importer.rb', line 28 def import(params={}) file_content = File.read( params[:file] ) logger.info{'Parsing Qualys output file...'} @doc = Nokogiri::XML( file_content ) logger.info{'Done.'} if @doc.root.name != 'SCAN' error = "No scan results were detected in the uploaded file. Ensure you uploaded a Qualys XML file." logger.fatal{ error } content_service.create_note text: error return false end @doc.xpath('SCAN/IP').each do |xml_host| process_ip(xml_host) end logger.info { 'Qualys Vuln file successfully imported' } return true end |