Sha256: 08861d23b32931a8206c335afb666048f0a04e97fee8f2dd3f91add1e1b00e08
Contents?: true
Size: 1.22 KB
Versions: 11
Compression:
Stored size: 1.22 KB
Contents
require 'hpricot' module Relevance module Tarantula class AttackHandler include ERB::Util def attacks Relevance::Tarantula::FormSubmission.attacks.select(&:output) end def handle(result) return unless attacks.size > 0 regexp = '(' + attacks.map {|a| Regexp.escape a.output}.join('|') + ')' response = result.response return unless response.html? if n = (response.body =~ /#{regexp}/) error_result = result.dup error_result.success = false error_result.description = "XSS error found, match was: #{h($1)}" error_result.data = <<-STR ######################################################################## # Text around unescaped string: #{$1} ######################################################################## #{response.body[[0, n - 200].max , 400]} ######################################################################## # Attack information: ######################################################################## #{attacks.select {|a| a.output == $1}[0].to_yaml} STR error_result end end end end end
Version data entries
11 entries across 11 versions & 2 rubygems