Module: Ronin::Exploits::Mixins::HasTargets::ClassMethods

Defined in:
lib/ronin/exploits/mixins/has_targets.rb

Overview

Class methods for defining targets.

Since:

  • 1.0.0

Instance Method Summary collapse

Instance Method Details

#target(**kwargs, &block) ⇒ Object

Adds a target to the exploit.

Examples:

target arch: :x86_64, os: :linux, software: 'Apache' do |t|
  t.foo = 0x123456
  t.bar = '...'
end

Parameters:

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments for Target#initialize.

Options Hash (**kwargs):

  • :arch (Symbol, nil)

    The architecture of the target.

  • :os (Symbol, nil)

    The Operating System (OS) of the target.

  • :os_version (String, nil)

    The Operating System (OS) version of the target.

  • :software (Symbol, nil)

    The software name of the target.

  • :version (String, nil)

    The software version of the target.

Since:

  • 1.0.0



105
106
107
# File 'lib/ronin/exploits/mixins/has_targets.rb', line 105

def target(**kwargs,&block)
  targets << Target.new(**kwargs,&block)
end

#targetsArray<Target>

The targets for the exploit.

Returns:

Since:

  • 1.0.0



68
69
70
71
72
73
74
# File 'lib/ronin/exploits/mixins/has_targets.rb', line 68

def targets
  @targets ||= if superclass.kind_of?(ClassMethods)
                 superclass.targets.dup
               else
                 []
               end
end