Class: Ronin::Payloads::Encoders::Encoder
- Inherits:
-
Object
- Object
- Ronin::Payloads::Encoders::Encoder
- Includes:
- Core::Metadata::Authors, Core::Metadata::Description, Core::Metadata::ID, Core::Metadata::References, Core::Metadata::Summary, Core::Params::Mixin
- Defined in:
- lib/ronin/payloads/encoders/encoder.rb
Overview
Base-class for all other payload encoders.
Example
# encoders/my_encoder.rb
module Ronin
module Payloads
module Encoders
class MyEncoder < Encoder
register 'my_encoder'
def encode(data)
return ...
end
end
end
end
end
Direct Known Subclasses
HTMLEncoder, JavaScriptEncoder, PowerShellEncoder, SQLEncoder, ShellEncoder, XMLEncoder
Class Method Summary collapse
-
.register(encoder_id) ⇒ Object
Registers the encoder with Ronin::Payloads::Encoders.
Instance Method Summary collapse
-
#encode(data) ⇒ String
abstract
Default method which will encode data.
-
#validate ⇒ Object
Validates that all required params have been set.
Class Method Details
.register(encoder_id) ⇒ Object
Note:
The given id
must match the file name.
Registers the encoder with Ronin::Payloads::Encoders.
79 80 81 82 |
# File 'lib/ronin/payloads/encoders/encoder.rb', line 79 def self.register(encoder_id) id(encoder_id) Encoders.register(encoder_id,self) end |
Instance Method Details
#encode(data) ⇒ String
This method is abstract.
Default method which will encode data.
110 111 112 |
# File 'lib/ronin/payloads/encoders/encoder.rb', line 110 def encode(data) raise(NotImplementedError,"#{self.class}##{__method__} was not implemented") end |
#validate ⇒ Object
Validates that all required params have been set.
95 96 97 |
# File 'lib/ronin/payloads/encoders/encoder.rb', line 95 def validate validate_params end |