Class: Ronin::UI::CommandLine::Commands::Exploits

Inherits:
Command
  • Object
show all
Defined in:
lib/ronin/ui/command_line/commands/exploits.rb

Instance Method Summary collapse

Instance Method Details

#defaultObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/ronin/ui/command_line/commands/exploits.rb', line 45

def default
  Database.setup(options[:database])

  exploits = Ronin::Exploits::Exploit.all

  if options[:name]
    exploits = exploits.named(options[:name])
  end

  if options[:version]
    exploits = exploits.revision(options[:version])
  end

  if options[:describing]
    exploits = exploits.describing(options[:describing])
  end

  if options[:license]
    exploits = exploits.licensed_under(options[:license])
  end

  if options[:status]
    exploits = exploits.all(:status => options[:status].to_sym)
  end

  if options[:arch]
    exploits = exploits.targeting_arch(options[:arch])
  end

  if options[:os]
    exploits = exploits.targeting_os(options[:os])
  end

  if options[:product]
    exploits = exploits.targeting_product(options[:product])
  end

  if exploits.empty?
    print_error "Could not find similar exploits"
    exit -1
  end

  if options.verbose?
    exploits.each { |exploit| print_exploit(exploit) }
  else
    exploits.each { |exploit| puts "  #{exploit}" }
  end
end