Class: Arachni::OptionGroups::Audit

Inherits:
Arachni::OptionGroup show all
Defined in:
lib/arachni/option_groups/audit.rb

Overview

Options for audit scope/coverage, mostly decides what types of elements should be considered.

Author:

Defined Under Namespace

Classes: Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Arachni::OptionGroup

#==, attr_accessor, #attributes, attributes, defaults, #defaults, #hash, inherited, #initialize, #merge, set_defaults, #to_hash, #to_rpc_data, #update, #validate

Constructor Details

This class inherits a constructor from Arachni::OptionGroup

Instance Attribute Details

#cookiesBool Also known as: cookie_doms

Note:

Default is ‘false`.

Returns Audit cookies.

Returns:

  • (Bool)

    Audit cookies.

See Also:



105
106
107
# File 'lib/arachni/option_groups/audit.rb', line 105

def cookies
  @cookies
end

#cookies_extensivelyBool

Note:

Default is ‘false`.

Returns Like #cookies but all cookie audits are submitted along with any other available element on the page.

Returns:

  • (Bool)

    Like #cookies but all cookie audits are submitted along with any other available element on the page.

See Also:



117
118
119
# File 'lib/arachni/option_groups/audit.rb', line 117

def cookies_extensively
  @cookies_extensively
end

#exclude_vector_patternsArray<Regexp>

Returns Patterns to use to exclude vectors from the audit, by name.

Returns:

  • (Array<Regexp>)

    Patterns to use to exclude vectors from the audit, by name.

See Also:



68
69
70
# File 'lib/arachni/option_groups/audit.rb', line 68

def exclude_vector_patterns
  @exclude_vector_patterns
end

#formsBool Also known as: form_doms

Note:

Default is ‘false`.

Returns Audit forms.

Returns:

  • (Bool)

    Audit forms.

See Also:



94
95
96
# File 'lib/arachni/option_groups/audit.rb', line 94

def forms
  @forms
end

#headersBool

Note:

Default is ‘false`.

Returns Audit HTTP request headers.

Returns:

  • (Bool)

    Audit HTTP request headers.



123
124
125
# File 'lib/arachni/option_groups/audit.rb', line 123

def headers
  @headers
end

#include_vector_patternsArray<Regexp>

Returns Patterns to use to include vectors in the audit exclusively, by name.

Returns:

  • (Array<Regexp>)

    Patterns to use to include vectors in the audit exclusively, by name.

See Also:



74
75
76
# File 'lib/arachni/option_groups/audit.rb', line 74

def include_vector_patterns
  @include_vector_patterns
end

#jsonsBool

Note:

Default is ‘false`.

Returns Audit JSON request inputs.

Returns:

  • (Bool)

    Audit JSON request inputs.



142
143
144
# File 'lib/arachni/option_groups/audit.rb', line 142

def jsons
  @jsons
end

Returns Regular expressions with named captures, serving as templates used to extract input vectors from links.

Returns:

  • (Array<Regexp>)

    Regular expressions with named captures, serving as templates used to extract input vectors from links.

See Also:



130
131
132
# File 'lib/arachni/option_groups/audit.rb', line 130

def link_templates
  @link_templates
end
Note:

Default is ‘false`.

Returns Audit links.

Returns:

  • (Bool)

    Audit links.

See Also:



83
84
85
# File 'lib/arachni/option_groups/audit.rb', line 83

def links
  @links
end

#parameter_namesBool

Note:

Default is ‘false`.

Returns Inject payloads into parameter names.

Returns:

  • (Bool)

    Inject payloads into parameter names.

See Also:



43
44
45
# File 'lib/arachni/option_groups/audit.rb', line 43

def parameter_names
  @parameter_names
end

#parameter_valuesBool

Note:

Default is ‘true`.

Returns Inject payloads into parameter values.

Returns:

  • (Bool)

    Inject payloads into parameter values.

See Also:



35
36
37
# File 'lib/arachni/option_groups/audit.rb', line 35

def parameter_values
  @parameter_values
end

#with_both_http_methodsBool

Note:

Default is ‘false`.

Returns If enabled, all element audits will be performed with both ‘GET` and `POST` HTTP methods.

Returns:

  • (Bool)

    If enabled, all element audits will be performed with both ‘GET` and `POST` HTTP methods.

See Also:



62
63
64
# File 'lib/arachni/option_groups/audit.rb', line 62

def with_both_http_methods
  @with_both_http_methods
end

#with_extra_parameterBool

Note:

Default is ‘false`.

Returns Inject payloads into extra element parameters.

Returns:

  • (Bool)

    Inject payloads into extra element parameters.

See Also:



51
52
53
# File 'lib/arachni/option_groups/audit.rb', line 51

def with_extra_parameter
  @with_extra_parameter
end

#xmlsBool

Note:

Default is ‘false`.

Returns Audit XML request inputs.

Returns:

  • (Bool)

    Audit XML request inputs.



148
149
150
# File 'lib/arachni/option_groups/audit.rb', line 148

def xmls
  @xmls
end

Instance Method Details

#elements(*element_types) ⇒ Object Also known as: elements=, element

Enables auditing of element types.

Parameters:

  • element_types (String, Symbol, Array)

    Allowed:

    • ‘:links`

    • ‘:forms`

    • ‘:cookies`

    • ‘:headers`



198
199
200
201
202
203
204
205
# File 'lib/arachni/option_groups/audit.rb', line 198

def elements( *element_types )
    element_types.flatten.compact.each do |type|
        fail_on_unknown_element_type( type ) do
            self.send( "#{type}=", true ) rescue self.send( "#{type}s=", true )
        end
    end
    true
end

#elements?(*element_types) ⇒ Bool Also known as: element?

Get audit settings for the given element types.

Parameters:

  • element_types (String, Symbol, Array)

    Allowed:

    • ‘:links`

    • ‘:forms`

    • ‘:cookies`

    • ‘:headers`

Returns:

  • (Bool)

Raises:



242
243
244
245
246
247
248
# File 'lib/arachni/option_groups/audit.rb', line 242

def elements?( *element_types )
    !(element_types.flatten.compact.map do |type|
        fail_on_unknown_element_type( type ) do
            !!(self.send( "#{type}?" ) rescue self.send( "#{type}s?" ))
        end
    end.uniq.include?( false ))
end

Returns ‘true` if link templates have been specified, `false` otherwise.

Returns:

  • (Bool)

    ‘true` if link templates have been specified, `false` otherwise.



270
271
272
# File 'lib/arachni/option_groups/audit.rb', line 270

def link_templates?
    @link_templates.any?
end

#skip_elements(*element_types) ⇒ Object Also known as: skip_element

Disables auditing of element types.

Parameters:

  • element_types (String, Symbol, Array)

    Allowed:

    • ‘:links`

    • ‘:forms`

    • ‘:cookies`

    • ‘:headers`



219
220
221
222
223
224
225
226
# File 'lib/arachni/option_groups/audit.rb', line 219

def skip_elements( *element_types )
    element_types.flatten.compact.each do |type|
        fail_on_unknown_element_type( type ) do
            self.send( "#{type}=", false ) rescue self.send( "#{type}s=", false )
        end
    end
    true
end

#to_hObject



275
276
277
278
279
280
281
# File 'lib/arachni/option_groups/audit.rb', line 275

def to_h
    h = super
    [:link_templates, :include_vector_patterns, :exclude_vector_patterns].each do |k|
        h[k] = h[k].map(&:to_s)
    end
    h
end

#vector?(name) ⇒ Boolean

Returns:

  • (Boolean)


260
261
262
263
264
265
266
# File 'lib/arachni/option_groups/audit.rb', line 260

def vector?( name )
    if include_vector_patterns.any? && !include_vector_patterns.find { |p| p =~ name }
        return false
    end

    !exclude_vector_patterns.find { |p| p =~ name }
end