require 'sinatra' require 'sinatra/contrib' REGEXP = { mysql: 'sleep\(\s?(\d+)\s?\)', postgresql: 'pg_sleep\(\s?(\d+)\s?\)', mssql: 'waitfor\sdelay\s\'0:0:(\d+)\'', } def get_variations( platform, str ) return if !str time = str.scan( Regexp.new( REGEXP[platform] ) ).flatten.first return if !time sleep( Integer( time ) ) if time end REGEXP.keys.each do |platform| get "/#{platform}"do <<-EOHTML Link Form Cookie Header EOHTML end get "/#{platform}/link" do <<-EOHTML Link Link EOHTML end get "/#{platform}/link/straight" do default = 'default' return if params['input'].start_with?( default ) get_variations( platform, params['input'] ) end get "/#{platform}/link/append" do default = 'default' return if !params['input'].start_with?( default ) get_variations( platform, params['input'] ) end get "/#{platform}/form" do <<-EOHTML
EOHTML end post "/#{platform}/form/straight" do default = 'default' return if !params['input'] || params['input'].start_with?( default ) get_variations( platform, params['input'] ) end post "/#{platform}/form/append" do default = 'default' return if !params['input'] || !params['input'].start_with?( default ) get_variations( platform, params['input'] ) end get "/#{platform}/cookie" do <<-EOHTML Cookie Cookie EOHTML end get "/#{platform}/cookie/straight" do default = 'cookie value' cookies['cookie'] ||= default return if cookies['cookie'].start_with?( default ) get_variations( platform, cookies['cookie'] ) end get "/#{platform}/cookie/append" do default = 'cookie value' cookies['cookie2'] ||= default return if !cookies['cookie2'].start_with?( default ) get_variations( platform, cookies['cookie2'] ) end get "/#{platform}/header" do <<-EOHTML Cookie Cookie EOHTML end get "/#{platform}/header/straight" do default = 'arachni_user' return if !env['HTTP_USER_AGENT'] || env['HTTP_USER_AGENT'].start_with?( default ) get_variations( platform, env['HTTP_USER_AGENT'] ) end get "/#{platform}/header/append" do default = 'arachni_user' return if !env['HTTP_USER_AGENT'] || !env['HTTP_USER_AGENT'].start_with?( default ) get_variations( platform, env['HTTP_USER_AGENT'] ) end end