Class: Ronin::Payloads::ASMPayload
- Inherits:
-
BinaryPayload
- Object
- Payload
- BinaryPayload
- Ronin::Payloads::ASMPayload
- Includes:
- Metadata::Arch, Metadata::OS
- Defined in:
- lib/ronin/payloads/asm_payload.rb
Overview
A Payload class that represents payloads written in Assembly (ASM).
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Payload
Class Method Summary collapse
-
.assembler ⇒ String
The default assembler.
-
.payload_type ⇒ Symbol
private
Returns the type or kind of payload.
Instance Method Summary collapse
-
#assemble(*source_files, output:, defs: {}) ⇒ Boolean?
Assembles one or more source files using
as
.
Methods included from Metadata::OS
Methods included from Metadata::Arch
Methods inherited from Payload
#build, #built?, #built_payload, #bytesize, #cleanup, #encode_payload, #encoded_payload, encoder_class, #initialize, #length, #perform_build, #perform_cleanup, #perform_postlaunch, #perform_prelaunch, #perform_validate, #postlaunch, #prelaunch, #rebuild_payload, #reencode_payload, register, #to_s, #validate
Constructor Details
This class inherits a constructor from Ronin::Payloads::Payload
Class Method Details
.assembler ⇒ String
The default assembler.
59 60 61 |
# File 'lib/ronin/payloads/asm_payload.rb', line 59 def self.assembler ENV['AS'] || 'as' end |
.payload_type ⇒ Symbol
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.
This is used internally to map an payload class to a printable type.
Returns the type or kind of payload.
50 51 52 |
# File 'lib/ronin/payloads/asm_payload.rb', line 50 def self.payload_type :asm end |
Instance Method Details
#assemble(*source_files, output:, defs: {}) ⇒ Boolean?
Assembles one or more source files using as
.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ronin/payloads/asm_payload.rb', line 82 def assemble(*source_files, output: , defs: {}) args = [params[:assembler], '-o', output] defs.each do |name,value| args << "--defsym" << "#{name}=#{value}" end args.concat(source_files) case system(*args) when false raise(BuildFailed,"assembler command failed: #{args.join(' ')}") when nil raise(BuildFailed,"assembler command not installed") end end |