Class: BurpTasks

Inherits:
Thor
  • Object
show all
Defined in:
lib/tasks/thorfile.rb

Instance Method Summary collapse

Instance Method Details

#upload(file_path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tasks/thorfile.rb', line 7

def upload(file_path)
  require 'config/environment'

  unless File.exists?(file_path)
    $stderr.puts "** the file [#{file_path}] does not exist"
    exit(-1)
  end

  detect_and_set_project_scope

  importer =
    if File.extname(file_path) == '.xml'
      Dradis::Plugins::Burp::Xml::Importer.new(task_options)
    elsif File.extname(file_path) == '.html'
      Dradis::Plugins::Burp::Html::Importer.new(task_options)
    else
      $stderr.puts "** Unsupported file. Must be .xml or .html"
      exit(-2)
    end

  importer.import(file: file_path)
end