Sha256: a66b1e05e5e9c4def3b5f5bdbabdc818e25c4dbd93468da86ea6b0dfaed7cebb

Contents?: true

Size: 1001 Bytes

Versions: 4

Compression:

Stored size: 1001 Bytes

Contents

require 'ronin/exploits/local'
require 'ronin/exploits/helpers/binary'

require 'spec_helper'

describe Exploits::Helpers::Binary do
  before(:all) do
    @exploit = Exploits::Local.new do
      helper :binary

      targeting(:arch => Arch.i686)
      targeting(:arch => nil)

      def pack_integer
        pack(0xffffaaaa)
      end

      def pack_integer_with_address_length
        pack(0xffffaaaa,2)
      end
    end
  end

  it "should require a targeted arch" do
    @exploit.target = @exploit.targets.last
    @exploit.target.arch.should be_nil

    lambda {
      @exploit.pack_integer
    }.should raise_error(Exploits::TargetDataMissing)
  end

  it "should be able to pack an integer" do
    @exploit.target = @exploit.targets.first

    @exploit.pack_integer.should == "\xaa\xaa\xff\xff"
  end

  it "should be able to pack an integer with an address length" do
    @exploit.target = @exploit.targets.first

    @exploit.pack_integer_with_address_length.should == "\xaa\xaa"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ronin-exploits-0.3.1 spec/exploits/binary_exploit_spec.rb
ronin-exploits-0.3.0 spec/exploits/binary_exploit_spec.rb
ronin-exploits-0.2.1 spec/exploits/binary_exploit_spec.rb
ronin-exploits-0.2.0 spec/exploits/binary_exploit_spec.rb