Sha256: 51d3e052983d47d5f4e9a58df6c7a01648300f08e07398026d3a3e01c1aec38e
Contents?: true
Size: 1.91 KB
Versions: 4
Compression:
Stored size: 1.91 KB
Contents
require 'ronin/exploits/local' require 'ronin/exploits/helpers/buffer_overflow' require 'spec_helper' describe Exploits::Helpers::BufferOverflow do before(:all) do @exploit = Exploits::Local.new do helper :buffer_overflow self.name = 'example_bof' targeting do |target| target.arch = Arch.i686 target.buffer_length = 256 target.ip = 0xffffaaaa end targeting do |target| target.arch = Arch.i686 target.buffer_length = 256 target.bp = 0xffffbbbb target.ip = 0xffffaaaa end targeting do |target| target.arch = Arch.i686 target.buffer_length = 256 target.bp = 0xffffbbbb target.ip = 0xffffaabb target.frame_repeat = 2 end end end it "should use Targets::BufferOverflow for targets" do @exploit.targets.all? { |target| target.class == Exploits::Targets::BufferOverflow }.should == true end it "should build a buffer overflow" do @exploit.target = @exploit.targets[0] @exploit.build! @exploit.buffer.length.should == (256 + 4*2) @exploit.buffer[256,4].should == "\xaa\xaa\xff\xff" @exploit.buffer[260,4].should == "\xaa\xaa\xff\xff" end it "should build a buffer overflow that includes the BP" do @exploit.target = @exploit.targets[1] @exploit.build! @exploit.buffer.length.should == (256 + 4*2) @exploit.buffer[256,4].should == "\xbb\xbb\xff\xff" @exploit.buffer[260,4].should == "\xaa\xaa\xff\xff" end it "should build a buffer overflow that has repeating stack frames" do @exploit.target = @exploit.targets[2] @exploit.build! @exploit.buffer.length.should == (256 + 4*4) @exploit.buffer[256,4].should == "\xbb\xbb\xff\xff" @exploit.buffer[260,4].should == "\xbb\xaa\xff\xff" @exploit.buffer[264,4].should == "\xbb\xbb\xff\xff" @exploit.buffer[268,4].should == "\xbb\xaa\xff\xff" end end
Version data entries
4 entries across 4 versions & 1 rubygems