# #-- # 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 #++ # module Ronin module Exploits module Verifiers # # Verifies that a target has been selected. If a target has not been # selected, a TargetUnspecified exception will be raised, otherwise # +true+ will be returned. # def verify_target! if target.nil? raise(TargetUnspecified,"no suitable target provided",caller) end return true end # # Verifies that the selected target has an arch property. # If the selected target does not have an arch property, a # TargetDataMissing exception will be raised, otherwise # +true+ will be return. # def verify_arch! if arch.nil? raise(TargetDataMissing,"no suitable arch was provided",caller) end end # # Verifies that the selected target has an os property. # If the selected target does not have an os property, a # TargetDataMissing exception will be raised, otherwise # +true+ will be return. # def verify_os! if os.nil? raise(TargetDataMissing,"no suitable os was provided",caller) end end # # Verifies that the selected target has an product property. # If the selected target does not have an product property, a # TargetDataMissing exception will be raised, otherwise # +true+ will be return. # def verify_product! if product.nil? raise(TargetDataMissing,"no suitable product was provided",caller) end end # # Raises a RestrictedChar exception if the specified _text_ contains # any restricted characters, returns +true+ otherwise. # def verify_restricted!(text) found = @restricted_chars.select { |char| text.include?(char) }.map { |char| char.dump } unless found.empty? raise(RestrictedChar,"restricted characters #{found.join(', ')} was detected in #{text.dump}",caller) end return true end end end end