Class: Ronin::Payloads::Payload
- Inherits:
-
Object
- Object
- Ronin::Payloads::Payload
- Includes:
- Cacheable, Model::HasDescription, Model::HasLicense, Model::HasName, Model::HasVersion, Parameters, Controls::Behaviors, Model::TargetsArch, Model::TargetsOS, UI::Output::Helpers
- Defined in:
- lib/ronin/payloads/payload.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#exploit ⇒ Object
The exploit to deploy with.
-
#raw_payload ⇒ Object
The raw payload.
Class Method Summary collapse
-
.written_by(name) ⇒ Array<Payload>
Finds all payloads written by a specific author.
-
.written_for(name) ⇒ Array<Payload>
Finds all payloads written for a specific organization.
Instance Method Summary collapse
-
#author(attributes = {}) {|author| ... } ⇒ Object
Adds a new author to the payload.
-
#build!(options = {}) {|payload| ... } ⇒ String
Builds the payload.
-
#built? ⇒ Boolean
Specifies whether the payload is built.
-
#deploy! {|payload| ... } ⇒ Object
Verifies the built payload and deploys the payload.
-
#deployed? ⇒ Boolean
Specifies whether the payload has previously been deployed.
-
#initialize(attributes = {}) { ... } ⇒ Payload
constructor
Creates a new Payload object.
-
#inspect ⇒ String
Inspects the contents of the payload.
-
#to_s ⇒ String
Converts the payload to a String.
-
#verify! ⇒ Object
Verifies the payload is properly configured and ready to be deployed.
Methods included from Controls::Behaviors
#behaviors, #control, #control_helper, #control_model, #load_original!
Methods included from Model::TargetsOS
Methods included from Model::TargetsArch
Constructor Details
#initialize(attributes = {}) { ... } ⇒ Payload
Creates a new Payload object.
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/ronin/payloads/payload.rb', line 92 def initialize(attributes={},&block) super(attributes) initialize_params(attributes) @built = false @deployed = false instance_eval(&block) if block end |
Instance Attribute Details
#exploit ⇒ Object
The exploit to deploy with
77 78 79 |
# File 'lib/ronin/payloads/payload.rb', line 77 def exploit @exploit end |
#raw_payload ⇒ Object
The raw payload
80 81 82 |
# File 'lib/ronin/payloads/payload.rb', line 80 def raw_payload @raw_payload end |
Class Method Details
.written_by(name) ⇒ Array<Payload>
Finds all payloads written by a specific author.
112 113 114 |
# File 'lib/ronin/payloads/payload.rb', line 112 def self.written_by(name) all(self..name.like => "%#{name}%") end |
.written_for(name) ⇒ Array<Payload>
Finds all payloads written for a specific organization.
125 126 127 |
# File 'lib/ronin/payloads/payload.rb', line 125 def self.written_for(name) all(self..organization.like => "%#{name}%") end |
Instance Method Details
#author(attributes = {}) {|author| ... } ⇒ Object
Adds a new author to the payload.
147 148 149 |
# File 'lib/ronin/payloads/payload.rb', line 147 def (attributes={},&block) self. << PayloadAuthor.new(attributes,&block) end |
#build!(options = {}) {|payload| ... } ⇒ String
Builds the payload.
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/ronin/payloads/payload.rb', line 176 def build!(={},&block) self.params = print_debug "Payload parameters: #{self.params.inspect}" @built = false @raw_payload = '' print_info "Building payload ..." build() print_info "Payload built!" @built = true if block if block.arity == 1 block.call(self) else block.call() end end return self end |
#built? ⇒ Boolean
Returns Specifies whether the payload is built.
155 156 157 |
# File 'lib/ronin/payloads/payload.rb', line 155 def built? @built == true end |
#deploy! {|payload| ... } ⇒ Object
Verifies the built payload and deploys the payload.
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/ronin/payloads/payload.rb', line 232 def deploy!(&block) # verify the payload verify! print_info "Deploying payload ..." @deployed = false deploy() print_info "Payload deployed!" @deployed = true if block if block.arity == 1 block.call(self) else block.call() end end return self end |
#deployed? ⇒ Boolean
Returns Specifies whether the payload has previously been deployed.
219 220 221 |
# File 'lib/ronin/payloads/payload.rb', line 219 def deployed? @deployed == true end |
#inspect ⇒ String
Inspects the contents of the payload.
277 278 279 280 281 282 |
# File 'lib/ronin/payloads/payload.rb', line 277 def inspect str = "#{self.class}: #{self}" str << " #{self.params.inspect}" unless self.params.empty? return "#<#{str}>" end |
#to_s ⇒ String
Converts the payload to a String.
261 262 263 264 265 266 267 268 269 |
# File 'lib/ronin/payloads/payload.rb', line 261 def to_s if (self.name && self.version) "#{self.name} #{self.version}" elsif self.name self.name elsif self.version self.version end end |
#verify! ⇒ Object
Verifies the payload is properly configured and ready to be deployed.
207 208 209 210 211 212 213 |
# File 'lib/ronin/payloads/payload.rb', line 207 def verify! print_info "Verifying payload ..." verify print_info "Payload verified!" end |