# #-- # 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/payloads' require 'ronin/database' module Ronin module UI module CommandLine module Commands class Payloads < 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 payloads with the similar NAME') do |name| @query[:name.like] = name.to_s end opts.on('-v','--version VERSION','Search for payloads with the similar VERSION') do |version| @query[:version.like] = version.to_s end end end def arguments(*args) Database.setup! payloads = Ronin::Payloads::Payload.all(@query) if payloads.empty? fail("could not find similar payloads") end payloads.each { |payload| puts " #{payload.name}" } end end end end end end