Class: Dradis::Plugins::Zap::Importer
- Inherits:
 - 
      Upload::Importer
      
        
- Object
 - Upload::Importer
 - Dradis::Plugins::Zap::Importer
 
 
- Defined in:
 - lib/dradis/plugins/zap/importer.rb
 
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.
 
Class Method Details
.templates ⇒ Object
      3 4 5  | 
    
      # File 'lib/dradis/plugins/zap/importer.rb', line 3 def self.templates { evidence: 'evidence', issue: 'issue' } 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.
      10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  | 
    
      # File 'lib/dradis/plugins/zap/importer.rb', line 10 def import(params={}) file_content = File.read( params.fetch(:file) ) logger.info{'Parsing ZAP output file...'} @doc = Nokogiri::XML( file_content ) logger.info{'Done.'} if @doc.xpath('/OWASPZAPReport/site').empty? error = "No scan results were detected in the uploaded file (/OWASPZAPReport/site). Ensure you uploaded an ZAP XML report." logger.fatal{ error } content_service.create_note text: error return false end @doc.xpath('/OWASPZAPReport/site').each do |xml_site| process_site(xml_site) end return true end  |