Class: Dradis::Plugins::Pentera::Importer
- Inherits:
-
Upload::Importer
- Object
- Upload::Importer
- Dradis::Plugins::Pentera::Importer
- Defined in:
- lib/dradis/plugins/pentera/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/pentera/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 |
# File 'lib/dradis/plugins/pentera/importer.rb', line 10 def import(params = {}) file_content = File.read(params[:file]) # Parse the uploaded file into a Ruby Hash logger.info { "Parsing Pentera output from #{ params[:file] }..." } @data = MultiJson.decode(file_content) logger.info { 'Done.' } @node_cache = {} parse_hosts parse_vulnerabilities true rescue MultiJson::ParseError logger.error 'ERROR: invalid JSON file uploaded. '\ 'Are you sure you uploaded a Pentera file?' false end |