Sha256: 353c2d06891a05d4f01b240a721b43dff2782ceee52a8808ad1f525dd644e011

Contents?: true

Size: 865 Bytes

Versions: 4

Compression:

Stored size: 865 Bytes

Contents

require 'ronin/exploits/local'
require 'ronin/exploits/helpers/padding'

require 'spec_helper'

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

      def pad_buffer
        pad(1024)
      end

      def pad_data_left
        pad_left('hello',1024)
      end

      def pad_data_right
        pad_right('hello',1024)
      end
    end
  end

  it "should pad a buffer" do
    buffer = @exploit.pad_buffer

    buffer.length.should == 1024
  end

  it "should pad a buffer with data to the left" do
    buffer = @exploit.pad_data_left

    buffer.length.should == 1024
    (buffer =~ /hello$/).should_not be_nil
  end

  it "should pad a buffer with data to the right" do
    buffer = @exploit.pad_data_right

    buffer.length.should == 1024
    (buffer =~ /^hello/).should_not be_nil
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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