Sha256: 6836f3321202110fa11ddd675b2c544418f9fd32b4858afbd519d56a0d2b0236

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

require 'ronin/exploits/local'
require 'ronin/exploits/helpers/file_based'

require 'spec_helper'

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

      self.name = 'file exploit'
      self.file_name = 'file_exploit.dat'

      def build
        file_open do |file|
          file << 'some data'
        end
      end
    end
  end

  it "should have an absolute path for the file to be built" do
    @exploit.file_path.should_not be_empty
  end

  it "should have a default output directory" do
    @exploit.output_dir.should == Ronin::Config::TMP_DIR
  end

  it "should have a default file name, derived from the exploit name" do
    @exploit.file_name.should == 'file_exploit.dat'
  end

  it "should build a file" do
    @exploit.build!

    File.read(@exploit.file_path).should == 'some data'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ronin-exploits-0.2.1 spec/exploits/file_based_exploit_spec.rb