Class: Arachni::Checks::XssScriptContext::SAX
- Defined in:
- components/checks/active/xss_script_context.rb
Instance Attribute Summary collapse
-
#tainted ⇒ Object
readonly
Returns the value of attribute tainted.
Instance Method Summary collapse
- #attr(name, value) ⇒ Object
- #document ⇒ Object
- #end_element(name) ⇒ Object
-
#initialize(seed) ⇒ SAX
constructor
A new instance of SAX.
- #start_element(name) ⇒ Object
- #tainted? ⇒ Boolean
- #text(value) ⇒ Object
Constructor Details
#initialize(seed) ⇒ SAX
Returns a new instance of SAX.
48 49 50 51 |
# File 'components/checks/active/xss_script_context.rb', line 48 def initialize( seed ) @seed = seed @attributes = Set.new( ATTRIBUTES ) end |
Instance Attribute Details
#tainted ⇒ Object (readonly)
Returns the value of attribute tainted.
46 47 48 |
# File 'components/checks/active/xss_script_context.rb', line 46 def tainted @tainted end |
Instance Method Details
#attr(name, value) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'components/checks/active/xss_script_context.rb', line 68 def attr( name, value ) name = name.to_s.downcase value = value.downcase return if !@attributes.include?( name ) if name == 'src' if @seed.start_with?( 'javascript:' ) && value == @seed @tainted = true fail Arachni::Parser::SAX::Stop end else if value == @seed @tainted = true fail Arachni::Parser::SAX::Stop end end if value.include?( @seed ) @tainted = true fail Arachni::Parser::SAX::Stop end end |
#document ⇒ Object
53 54 |
# File 'components/checks/active/xss_script_context.rb', line 53 def document end |
#end_element(name) ⇒ Object
64 65 66 |
# File 'components/checks/active/xss_script_context.rb', line 64 def end_element( name ) @in_script = false end |
#start_element(name) ⇒ Object
60 61 62 |
# File 'components/checks/active/xss_script_context.rb', line 60 def start_element( name ) @in_script = (name.to_s.downcase == 'script') end |
#tainted? ⇒ Boolean
56 57 58 |
# File 'components/checks/active/xss_script_context.rb', line 56 def tainted? !!@tainted end |