Sha256: 311f304e8344d35e479407f25e3f8c48a67d0f11c75b8db3545199f6d73378d8

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

=begin
    Copyright 2010-2015 Tasos Laskos <tasos.laskos@arachni-scanner.com>

    This file is part of the Arachni Framework project and is subject to
    redistribution and commercial restrictions. Please see the Arachni Framework
    web site for more information on licensing and terms of use.
=end

module Arachni
class State

# Stores and provides access to the state of the {Arachni::ElementFilter}.
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
class ElementFilter

    TYPES = [:forms, :links, :link_templates, :cookies, :jsons, :xmls]

    TYPES.each do |type|
        attr_reader type
    end

    def initialize
        TYPES.each do |type|
            instance_variable_set "@#{type}",
                                  Support::LookUp::HashSet.new( hasher: :persistent_hash )
        end
    end

    def statistics
        TYPES.inject({}) { |h, type| h.merge!( type => send(type).size) }
    end

    def dump( directory )
        FileUtils.mkdir_p( directory )

        IO.binwrite( "#{directory}/sets", Marshal.dump( self ) )
    end

    def self.load( directory )
        Marshal.load( IO.binread( "#{directory}/sets" ) )
    end

    def ==( other )
        hash == other.hash
    end

    def hash
        TYPES.map { |type| send(type).hash }.hash
    end

    def clear
        TYPES.each { |type| send(type).clear }
    end

end

end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arachni-1.3.2 lib/arachni/state/element_filter.rb
arachni-1.3.1 lib/arachni/state/element_filter.rb
arachni-1.3 lib/arachni/state/element_filter.rb
arachni-1.2.1 lib/arachni/state/element_filter.rb
arachni-1.2 lib/arachni/state/element_filter.rb
arachni-1.1 lib/arachni/state/element_filter.rb