Sha256: 01cd963af77b7e45987fcf1a4a69cc1e2f3d2efa2af24d2a7685bd50a2433f63

Contents?: true

Size: 1.8 KB

Versions: 14

Compression:

Stored size: 1.8 KB

Contents

require 'sinatra'
require 'sinatra/contrib'

def get_variations( str )
    return if !str

    cookies['session'] = str
end

def logged_in?
    cookies['session'] == 'blah'
end

def ensure_logged_in
    redirect '/' if !logged_in?
end

def greet_user
    'Hello dear user!' if logged_in?
end

get '/' do
    cookies['blah'] ||= 'blah1'
    cookies['blah2'] ||= 'blah2'
    cookies['session'] ||= 'blah'

    <<-EOHTML
        #{greet_user}
        <a href="/link?input=default">Link</a>
        <a href="/form">Form</a>
        <a href="/cookie">Cookie</a>
        <a href="/header">Header</a>
    EOHTML
end

get "/link" do
    ensure_logged_in
    <<-EOHTML
        #{greet_user}
        <a href="/link/straight?input=default">Link</a>
        <a href="/link/append?input=default">Link</a>
    EOHTML
end

get "/link/straight" do
    ensure_logged_in
    default = 'default'
    return if params['input'].start_with?( default )

    get_variations( params['input'].split( default ).last )
    greet_user
end

get "/link/append" do
    ensure_logged_in
    default = 'default'
    return if !params['input'].start_with?( default )

    get_variations( params['input'].split( default ).last )
end

get "/form" do
    <<-EOHTML
        #{greet_user}
        <form action="/form/straight">
            <input name='input' value='default' />
        </form>

        <form action="/form/append">
            <input name='input' value='default' />
        </form>
    EOHTML
end

get "/form/straight" do
    default = 'default'
    return if !params['input'] || params['input'].start_with?( default )

    get_variations( params['input'].split( default ).last )
end

get "/form/append" do
    default = 'default'
    return if !params['input'] || !params['input'].start_with?( default )

    get_variations( params['input'].split( default ).last )
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
arachni-0.4.7 spec/support/servers/modules/audit/session_fixation.rb
arachni-0.4.6 spec/support/servers/modules/audit/session_fixation.rb
arachni-0.4.5.2 spec/support/servers/modules/audit/session_fixation.rb
arachni-0.4.5.1 spec/support/servers/modules/audit/session_fixation.rb
arachni-0.4.5 spec/support/servers/modules/audit/session_fixation.rb
arachni-0.4.4 spec/support/servers/modules/audit/session_fixation.rb
arachni-0.4.3.2 spec/support/servers/modules/audit/session_fixation.rb
arachni-0.4.3.1 spec/support/servers/modules/audit/session_fixation.rb
arachni-0.4.3 spec/support/servers/modules/audit/session_fixation.rb
arachni-0.4.2 spec/servers/modules/audit/session_fixation.rb
arachni-0.4.1.3 spec/servers/modules/audit/session_fixation.rb
arachni-0.4.1.2 spec/servers/modules/audit/session_fixation.rb
arachni-0.4.1.1 spec/servers/modules/audit/session_fixation.rb
arachni-0.4.1 spec/servers/modules/audit/session_fixation.rb