class Arachni::Data

Stores and provides access to the data of the system.

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

Attributes

framework[RW]

@return [Framework]

issues[RW]

@return [Issues]

plugins[RW]

@return [Plugins]

session[RW]

@return [Session]

Public Class Methods

clear() click to toggle source

Clears all data.

# File lib/arachni/data.rb, line 84
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 dump directory.
# File lib/arachni/data.rb, line 62
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 [Data] ‘self`

# File lib/arachni/data.rb, line 75
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/data.rb, line 43
def reset
    @framework = Framework.new
    @session   = Session.new
    @issues    = Issues.new
    @plugins   = Plugins.new
end
statistics() click to toggle source
# File lib/arachni/data.rb, line 50
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/data.rb, line 97
def accessors
    instance_variables.map do |ivar|
        attribute = "#{ivar.to_s.gsub('@','')}"
        next if !methods.include?( :"#{attribute}=" )
        attribute.to_sym
    end.compact
end
each( &block ) click to toggle source
# File lib/arachni/data.rb, line 91
def each( &block )
    accessors.each do |attr|
        block.call attr, send( attr )
    end
end