class Ronin::ASM::Shellcode

Represents Shellcode. Shellcode is like an Assembly {Program}, but assembles into raw machine code which can be injected into a process.

ASM::Shellcode.new do
  xor   eax,  eax
  push  eax
  push  0x68732f2f
  push  0x6e69622f
  mov   esp,  ebx
  push  eax
  push  ebx
  mov   esp,  ecx
  xor   edx,  edx
  mov   0xb,  al
  int   0x80
end

Public Instance Methods

assemble(options={}) click to toggle source

Assembles the Shellcode.

@param [Hash] options

Additional options.

@return [String]

The raw object-code of the Shellcode.

@see Program#assemble

Calls superclass method Ronin::ASM::Program#assemble
# File lib/ronin/asm/shellcode.rb, line 60
def assemble(options={})
  output = Tempfile.new(['ronin-shellcode', '.bin']).path

  super(output,options.merge(format: :bin))

  return File.new(output,'rb').read
end