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:

  • Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com>

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:



113
114
115
# File 'lib/arachni/option_groups/audit.rb', line 113

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:



134
135
136
# File 'lib/arachni/option_groups/audit.rb', line 134

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:



76
77
78
# File 'lib/arachni/option_groups/audit.rb', line 76

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:



102
103
104
# File 'lib/arachni/option_groups/audit.rb', line 102

def forms
  @forms
end

#headersBool

Note:

Default is `false`.

Returns Audit HTTP request headers.

Returns:

  • (Bool)

    Audit HTTP request headers.



140
141
142
# File 'lib/arachni/option_groups/audit.rb', line 140

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:



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

def include_vector_patterns
  @include_vector_patterns
end

#jsonsBool

Note:

Default is `false`.

Returns Audit JSON request inputs.

Returns:

  • (Bool)

    Audit JSON request inputs.



159
160
161
# File 'lib/arachni/option_groups/audit.rb', line 159

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:



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

def link_templates
  @link_templates
end
Note:

Default is `false`.

Returns Audit links.

Returns:

  • (Bool)

    Audit links.

See Also:



91
92
93
# File 'lib/arachni/option_groups/audit.rb', line 91

def links
  @links
end

#nested_cookiesBool

Note:

Default is `false`.

Returns Audit nested cookies.

Returns:

  • (Bool)

    Audit nested cookies.

See Also:



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

def nested_cookies
  @nested_cookies
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

#ui_formsBool Also known as: ui_form_doms

Note:

Default is `false`.

Returns Audit DOM UI forms – i.e. combination or orphan inputs and buttons.

Returns:

  • (Bool)

    Audit DOM UI forms – i.e. combination or orphan inputs and buttons.



179
180
181
# File 'lib/arachni/option_groups/audit.rb', line 179

def ui_forms
  @ui_forms
end

#ui_inputsBool Also known as: ui_input_doms

Note:

Default is `false`.

Returns Audit DOM inputs.

Returns:

  • (Bool)

    Audit DOM inputs.



171
172
173
# File 'lib/arachni/option_groups/audit.rb', line 171

def ui_inputs
  @ui_inputs
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:



70
71
72
# File 'lib/arachni/option_groups/audit.rb', line 70

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:



59
60
61
# File 'lib/arachni/option_groups/audit.rb', line 59

def with_extra_parameter
  @with_extra_parameter
end

#with_raw_payloadsBool

Note:

Default is `false`.

Returns Allows checks to sent payloads in raw format, without HTTP encoding.

Returns:

  • (Bool)

    Allows checks to sent payloads in raw format, without HTTP encoding.

See Also:



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

def with_raw_payloads
  @with_raw_payloads
end

#xmlsBool

Note:

Default is `false`.

Returns Audit XML request inputs.

Returns:

  • (Bool)

    Audit XML request inputs.



165
166
167
# File 'lib/arachni/option_groups/audit.rb', line 165

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`



239
240
241
242
243
244
245
246
# File 'lib/arachni/option_groups/audit.rb', line 239

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`

    • `:ui_inputs`

    • `:ui_forms`

    • `:xmls`

    • `:jsons`

Returns:

  • (Bool)

Raises:



287
288
289
290
291
292
293
# File 'lib/arachni/option_groups/audit.rb', line 287

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.



315
316
317
# File 'lib/arachni/option_groups/audit.rb', line 315

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`



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

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



320
321
322
323
324
325
326
# File 'lib/arachni/option_groups/audit.rb', line 320

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

#vector?(name) ⇒ Boolean

Returns:

  • (Boolean)


305
306
307
308
309
310
311
# File 'lib/arachni/option_groups/audit.rb', line 305

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

#with_raw_payloads?Boolean

Returns:

  • (Boolean)


190
191
192
# File 'lib/arachni/option_groups/audit.rb', line 190

def with_raw_payloads?
    !!@with_raw_payloads
end