Class: Arachni::State

Inherits:
Object show all
Defined in:
lib/arachni/state.rb,
lib/arachni/state/http.rb,
lib/arachni/state/audit.rb,
lib/arachni/state/options.rb,
lib/arachni/state/plugins.rb,
lib/arachni/state/framework.rb,
lib/arachni/state/framework/rpc.rb,
lib/arachni/state/element_filter.rb

Overview

Stores and provides access to the state of the system.

Author:

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

Defined Under Namespace

Classes: Audit, ElementFilter, Error, Framework, HTTP, Options, Plugins

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.auditAudit

Returns:



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

def audit
  @audit
end

.element_filterElementFilter

Returns:



46
47
48
# File 'lib/arachni/state.rb', line 46

def element_filter
  @element_filter
end

.frameworkFramework

Returns:



49
50
51
# File 'lib/arachni/state.rb', line 49

def framework
  @framework
end

.httpHTTP

Returns:



37
38
39
# File 'lib/arachni/state.rb', line 37

def http
  @http
end

.optionsOptions

Returns:



34
35
36
# File 'lib/arachni/state.rb', line 34

def options
  @options
end

.pluginsPlugins

Returns:



40
41
42
# File 'lib/arachni/state.rb', line 40

def plugins
  @plugins
end

Class Method Details

.clearObject

Clears all states.



97
98
99
100
# File 'lib/arachni/state.rb', line 97

def clear
    each { |_, state| state.clear }
    self
end

.dump(directory) ⇒ String

Returns Location of the directory.

Parameters:

  • directory (String)

    Location of the dump directory.

Returns:

  • (String)

    Location of the directory.



73
74
75
76
77
78
79
80
81
# File 'lib/arachni/state.rb', line 73

def dump( directory )
    FileUtils.mkdir_p( directory )

    each do |name, state|
        state.dump( "#{directory}/#{name}/" )
    end

    directory
end

.load(directory) ⇒ State

Returns `self`.

Parameters:

  • directory (String)

    Location of the dump directory.

Returns:



88
89
90
91
92
93
94
# File 'lib/arachni/state.rb', line 88

def load( directory )
    each do |name, state|
        send( "#{name}=", state.class.load( "#{directory}/#{name}/" ) )
    end

    self
end

.resetObject



51
52
53
54
55
56
57
58
# File 'lib/arachni/state.rb', line 51

def reset
    @http           = HTTP.new
    @plugins        = Plugins.new
    @options        = Options.new
    @audit          = Audit.new
    @element_filter = ElementFilter.new
    @framework      = Framework.new
end

.statisticsObject



60
61
62
63
64
65
66
# File 'lib/arachni/state.rb', line 60

def statistics
    stats = {}
    each do |attribute|
        stats[attribute] = send(attribute).statistics
    end
    stats
end