Sha256: f932545afb97072a8859b8235801af32845c26194cf83b923212b3e23dbfcd1b

Contents?: true

Size: 972 Bytes

Versions: 1

Compression:

Stored size: 972 Bytes

Contents

# encoding: US-ASCII

require 'spec_helper'
require 'ronin/asm/shellcode'

describe ASM::Shellcode do
  describe "#assemble", integration: true do
    subject do
      described_class.new do
        xor   eax,  eax
        push  eax
        push  0x68732f2f
        push  0x6e69622f
        mov   ebx, esp
        push  eax
        push  ebx
        mov   ecx,  esp
        xor   edx,  edx
        mov   al,   0xb
        int   0x80
      end
    end

    let(:shellcode) { "1\xC0Ph//shh/bin\x89\xE3PS\x89\xE11\xD2\xB0\v\xCD\x80" }

    it "assemble down to raw machine code" do
      subject.assemble.should == shellcode
    end

    context "with :syntax is :intel" do
      it "assemble down to raw machine code" do
        subject.assemble(syntax: :intel).should == shellcode
      end
    end

    context "with :syntax is :att" do
      it "assemble down to raw machine code" do
        subject.assemble(syntax: :att).should == shellcode
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ronin-asm-0.2.0 spec/asm/shellcode_spec.rb