Sha256: 7066c4a8bea2d815eb8e8c8ecf91aa41ca3fe2647def7a6153a17b5eb988d39b

Contents?: true

Size: 1.66 KB

Versions: 21

Compression:

Stored size: 1.66 KB

Contents

require 'sinatra/base'
require 'webrick'
require 'webrick/https'
require 'openssl'

options = {
    Port:            ARGV[1].to_i,
    Host:            ARGV.last,
    SSLEnable:       true,
    SSLVerifyClient: OpenSSL::SSL::VERIFY_NONE,
    SSLCertName:     [["CN", WEBrick::Utils::getservername]],
}

class MixedResourceHTTPSServer < Sinatra::Base

    get '/' do
        <<-EOHTML
            <a href="/vuln_script">Vuln script</a>
            <a href="/ok_script">OK script</a>
            <a href="/relative_script">Relative script</a>

            <a href="/vuln_link">Vuln link</a>
            <a href="/ok_link">OK link</a>
            <a href="/relative_link">Relative link</a>
        EOHTML
    end

    get '/vuln_script' do
        <<-EOHTML
            <script src="http://localhost/stuff.js"></script>
        EOHTML
    end

    get '/ok_script' do
        <<-EOHTML
            <script src="https://localhost/secure_stuff.js"></script>
        EOHTML
    end

    get '/relative_script' do
        <<-EOHTML
            <script src="stuff/secure_stuff.js"></script>
        EOHTML
    end

    get '/vuln_link' do
        <<-EOHTML
            <link rel="stylesheet" type="text/css" href="http://localhost/theme.css" />
        EOHTML
    end

    get '/ok_script' do
        <<-EOHTML
            <link rel="stylesheet" type="text/css" href="https://localhost/secure_theme.css" />
        EOHTML
    end

    get '/relative_link' do
        <<-EOHTML
            <link rel="stylesheet" type="text/css" href="stuff/secure_theme.css" />
        EOHTML
    end

end

server = ::Rack::Handler::WEBrick
trap( :INT ) { server.shutdown }

server.run( MixedResourceHTTPSServer, options )

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
arachni-1.6.1.3 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.6.1.2 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.6.1.1 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.6.1 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.6.0 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.5.1 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.5 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.4 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.3.2 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.3.1 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.3 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.2.1 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.2 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.1 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.0.6 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.0.5 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.0.4 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.0.3 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.0.2 spec/support/servers/checks/passive/grep/mixed_resource_https.rb
arachni-1.0.1 spec/support/servers/checks/passive/grep/mixed_resource_https.rb