# # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and # payload crafting functionality. # # Copyright (c) 2007-2023 Hal Brodigan (postmodern.mod3 at gmail.com) # # ronin-exploits is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ronin-exploits 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with ronin-exploits. If not, see . # require 'ostruct' module Ronin module Exploits # # Contains targeting information used for exploits. # A target may specify which architecture, Operating System (OS), # software version is targets. The target may also contain additional target # parameters. # class Target < OpenStruct # The target's architecture. # # @return [Symbol, nil] attr_reader :arch # The target's Operating System. # # @return [Symbol, nil] attr_reader :os # The target's Operating System (OS) version. # # @return [String, nil] attr_reader :os_version # The target's software. # # @return [String, nil] attr_reader :software # The target's software version. # # @return [String, nil] attr_reader :version # # Creates a new ExploitTarget object # # @param [Symbol, nil] arch # The architecture name of the target (ex: `:x86_64`). # # @param [Symbol, nil] os # The Operating System (OS) name of the target (ex: `:linux`). # # @param [String, nil] os_version # The Operating System (OS) version of the target (ex: `"10.13"`). # # @param [String, nil] software # The software name of the target (ex: `"Apache"`). # # @param [String, nil] version # The software version of the target (ex: `"2.4.54"`). # # @yield [target] # If a block is given, it will be passed the new target object. # # @yieldparam [Target] target # The newly created target object. # def initialize(arch: nil, os: nil, os_version: nil, software: nil, version: nil, **params) super(**params) @arch = arch @os = os @os_version = os_version @software = software @version = version yield self if block_given? end end end end