Class: Ronin::Payloads::ASMPayload

Inherits:
BinaryPayload show all
Defined in:
lib/ronin/payloads/asm_payload.rb

Overview

A Payload class that represents payloads written in Assembly (ASM).

Direct Known Subclasses

Nops, Shellcode

Instance Attribute Summary

Attributes inherited from Payload

#exploit, #helpers, #raw_payload

Attributes included from HasPayload

#payload

Instance Method Summary collapse

Methods inherited from Payload

#build!, #helper, #initialize

Methods included from Ronin::PostExploitation::Mixin

#fs, #post_exploitation, #process, #resources, #shell

Methods included from HasPayload

#default_payload, #initialize, #method_missing, #payload_class, #respond_to?, #use_payload!, #use_payload_from!

Methods included from Model::TargetsOS

included

Methods included from Model::TargetsArch

included

Constructor Details

This class inherits a constructor from Ronin::Payloads::Payload

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ronin::Payloads::HasPayload

Instance Method Details

#assemble(options = {}) { ... } ⇒ String (protected)

Creates an ASM Program.

Options Hash (options):

  • :arch (Symbol, String) — default: self.arch.name

    The architecture for the ASM Program.

  • :os (Symbol, String) — default: self.os.name

    The Operating System for the ASM Program.

Yields:

  • [] The given block represents the instructions of the ASM Program.

Raises:

  • (Behaviors::BuildFailed)

    An Arch must be targeted for the Assembly payload.


57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ronin/payloads/asm_payload.rb', line 57

def assemble(options={},&block)
  unless self.arch
    build_failed! "Must target an Arch for Assembly payload"
  end

  program_options = {arch: self.arch.name.to_sym}

  if self.os
    program_options[:os] = self.os.name.to_sym
  end

  return ASM::Program.new(program_options,&block).assemble(options)
end