Class: Ronin::Exploits::Target
- Inherits:
-
Object
- Object
- Ronin::Exploits::Target
- Includes:
- Model, Model::TargetsArch, Model::TargetsOS, Model::TargetsProduct
- Defined in:
- lib/ronin/exploits/target.rb
Direct Known Subclasses
Ronin::Exploits::Targets::BufferOverflow, Ronin::Exploits::Targets::FormatString
Instance Method Summary collapse
-
#[](name) ⇒ Object?
Returns the target data with the matching name.
-
#[]=(name, value) ⇒ Object
Sets the target data with the matching name.
-
#has?(name) ⇒ Boolean
Searches for target data with the matching name.
-
#initialize(attributes = {}) {|target| ... } ⇒ Target
constructor
Creates a new ExploitTarget object.
Methods included from Model::TargetsProduct
Methods included from Model::TargetsOS
Methods included from Model::TargetsArch
Constructor Details
#initialize(attributes = {}) {|target| ... } ⇒ Target
Creates a new ExploitTarget object
63 64 65 66 67 |
# File 'lib/ronin/exploits/target.rb', line 63 def initialize(attributes={},&block) super(attributes) block.call(self) if block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *arguments, &block) ⇒ Object (protected)
Provides transparent access to the target data Hash.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/ronin/exploits/target.rb', line 123 def method_missing(name,*arguments,&block) unless block name = name.to_s if (name[-1..-1] == '=' && arguments.length == 1) return self[name.chop] = arguments.first elsif arguments.length == 0 unless has?(name) raise(TargetDataMissing,"the target is missing data for #{name.dump}",caller) end return self[name] end end super(name,*arguments,&block) end |
Instance Method Details
#[](name) ⇒ Object?
Returns the target data with the matching name.
91 92 93 |
# File 'lib/ronin/exploits/target.rb', line 91 def [](name) self.data[name.to_sym] end |
#[]=(name, value) ⇒ Object
Sets the target data with the matching name.
104 105 106 |
# File 'lib/ronin/exploits/target.rb', line 104 def []=(name,value) self.data[name.to_sym] = value end |
#has?(name) ⇒ Boolean
Searches for target data with the matching name.
78 79 80 |
# File 'lib/ronin/exploits/target.rb', line 78 def has?(name) self.data.has_key?(name.to_sym) end |