Sha256: d5d57e51e79cc791b4cb6ec70e38ef61d8b31cefb371e803385fc813929c8a81
Contents?: true
Size: 1.68 KB
Versions: 27
Compression:
Stored size: 1.68 KB
Contents
require 'webrick' require File.dirname(__FILE__) + '/../lib/yawast' require File.dirname(__FILE__) + '/base' class TestDirectorySearch < Minitest::Test include TestBase def test_directory_search_recurs port = rand(60000) + 1024 # pick a random port number server = run_server port override_stdout uri = Yawast::Commands::Utils.extract_uri(["http://localhost:#{port}"]) Yawast::Shared::Http.setup nil, nil Yawast::Scanner::Plugins::Http::DirectorySearch.search uri, true, true, %w(test data) assert stdout_value.include?('Recursively searching for common directories'), 'Output not found' server.exit restore_stdout end def test_directory_search port = rand(60000) + 1024 # pick a random port number server = run_server port override_stdout uri = Yawast::Commands::Utils.extract_uri(["http://localhost:#{port}"]) Yawast::Shared::Http.setup nil, nil Yawast::Scanner::Plugins::Http::DirectorySearch.search uri, false, true, %w(test data) assert stdout_value.include?('Searching for common directories'), 'Output not found' server.exit restore_stdout end def run_server(port) Thread.new { sockets = WEBrick::Utils.create_listeners nil, port server = WEBrick::HTTPServer.new :Port => port, :BindAddress => 'localhost', :AccessLog => [], :Logger => WEBrick::Log.new('/dev/null'), :DocumentRoot => File.dirname(__FILE__), :DoNotListen => true server.listeners.replace sockets server.start } end end
Version data entries
27 entries across 27 versions & 1 rubygems