Class: Ronin::Payloads::CLI::PayloadCommand Private
- Includes:
- PayloadMethods
- Defined in:
- lib/ronin/payloads/cli/payload_command.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Base class for all commands which load a payload.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#payload ⇒ Payload?
readonly
private
The initialized payload object.
-
#payload_class ⇒ Class<Payload>?
readonly
private
The loaded payload class.
Instance Method Summary collapse
-
#initialize_payload(**kwargs) ⇒ Object
private
Initializes the payload and sets #payload.
-
#load_payload(id) ⇒ Object
private
Loads the payload and sets #payload_class.
-
#load_payload_from(file) ⇒ Object
private
Loads the payload from the given file and sets #payload_class.
-
#run(name = nil) ⇒ Object
private
Loads the payload.
-
#validate_payload ⇒ Object
private
Validates the payload.
Instance Attribute Details
#payload ⇒ Payload? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The initialized payload object.
55 56 57 |
# File 'lib/ronin/payloads/cli/payload_command.rb', line 55 def payload @payload end |
#payload_class ⇒ Class<Payload>? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The loaded payload class.
50 51 52 |
# File 'lib/ronin/payloads/cli/payload_command.rb', line 50 def payload_class @payload_class end |
Instance Method Details
#initialize_payload(**kwargs) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the payload and sets #payload.
98 99 100 |
# File 'lib/ronin/payloads/cli/payload_command.rb', line 98 def initialize_payload(**kwargs) @payload = super(@payload_class,**kwargs) end |
#load_payload(id) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Loads the payload and sets #payload_class.
78 79 80 |
# File 'lib/ronin/payloads/cli/payload_command.rb', line 78 def load_payload(id) @payload_class = super(id) end |
#load_payload_from(file) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Loads the payload from the given file and sets #payload_class.
88 89 90 |
# File 'lib/ronin/payloads/cli/payload_command.rb', line 88 def load_payload_from(file) @payload_class = super(file) end |
#run(name = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Loads the payload.
63 64 65 66 67 68 69 70 |
# File 'lib/ronin/payloads/cli/payload_command.rb', line 63 def run(name=nil) if name then load_payload(name) elsif [:file] then load_payload_from([:file]) else print_error "must specify --file or a NAME" exit(-1) end end |
#validate_payload ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Validates the payload.
111 112 113 |
# File 'lib/ronin/payloads/cli/payload_command.rb', line 111 def validate_payload super(@payload) end |