# #-- # Ronin Exploits - A Ruby library for Ronin that provides exploitation and # payload crafting functionality. # # Copyright (c) 2007-2009 Hal Brodigan (postmodern.mod3 at gmail.com) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #++ # require 'ronin/ui/command_line/command' require 'ronin/exploits' require 'ronin/database' module Ronin module UI module CommandLine module Commands class Exploits < Command def defaults @query = {} end def define_options(opts) opts.usage = '[options]' opts.options do opts.on('-D','--database URI','The URI for the database') do |uri| Database.config = uri.to_s end opts.on('-n','--name NAME','Search for exploits with the similar NAME') do |name| @query[:name.like] = name.to_s end opts.on('-v','--version VERSION','Search for exploits with the similar VERSION') do |version| @query[:version.like] = version.to_s end opts.on('-s','--status STATUS','Search for exploits with the STATUS (potential, proven or weaponized)') do |status| @query[:status] = status.to_sym end end end def arguments(*args) Database.setup exploits = Ronin::Exploits::Exploit.all(@query) if exploits.empty? fail("could not find similar exploits") end exploits.each { |exploit| puts " #{exploit}" } end end end end end end