class Arachni::State

Stores and provides access to the state of the system.

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

Attributes

audit[RW]

@return [Audit]

element_filter[RW]

@return [ElementFilter]

framework[RW]

@return [Framework]

http[RW]

@return [HTTP]

options[RW]

@return [Options]

plugins[RW]

@return [Plugins]

Public Class Methods

clear() click to toggle source

Clears all states.

# File lib/arachni/state.rb, line 97
def clear
    each { |_, state| state.clear }
    self
end
dump( directory ) click to toggle source

@param [String] directory

Location of the dump directory.

@return [String]

Location of the directory.
# 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 ) click to toggle source

@param [String] directory

Location of the dump directory.

@return [State]

`self`
# File lib/arachni/state.rb, line 88
def load( directory )
    each do |name, state|
        send( "#{name}=", state.class.load( "#{directory}/#{name}/" ) )
    end

    self
end
reset() click to toggle source
# 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
statistics() click to toggle source
# File lib/arachni/state.rb, line 60
def statistics
    stats = {}
    each do |attribute|
        stats[attribute] = send(attribute).statistics
    end
    stats
end

Private Class Methods

accessors() click to toggle source
# File lib/arachni/state.rb, line 110
def accessors
    instance_variables.map do |ivar|
        attribute = "#{ivar.to_s.gsub('@','')}"
        next if !methods.include?( :"#{attribute}=" )
        attribute
    end.compact.map(&:to_sym)
end
each( &block ) click to toggle source
# File lib/arachni/state.rb, line 104
def each( &block )
    accessors.each do |attr|
        block.call attr, send( attr )
    end
end