Class: Arachni::State::Framework::RPC

Inherits:
Object
  • Object
show all
Defined in:
lib/arachni/state/framework/rpc.rb

Overview

State information for RPC::Server::Framework.

Author:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRPC

Returns a new instance of RPC.



24
25
26
27
# File 'lib/arachni/state/framework/rpc.rb', line 24

def initialize
    @distributed_pages    = Support::LookUp::HashSet.new( hasher: :persistent_hash )
    @distributed_elements = Set.new
end

Instance Attribute Details

#distributed_elementsSet (readonly)

Returns:



22
23
24
# File 'lib/arachni/state/framework/rpc.rb', line 22

def distributed_elements
  @distributed_elements
end

#distributed_pagesSupport::LookUp::HashSet (readonly)



19
20
21
# File 'lib/arachni/state/framework/rpc.rb', line 19

def distributed_pages
  @distributed_pages
end

Class Method Details

.load(directory) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/arachni/state/framework/rpc.rb', line 44

def self.load( directory )
    rpc = new

    rpc.distributed_elements.merge Marshal.load( IO.binread( "#{directory}/distributed_elements" ) )
    rpc.distributed_pages.merge Marshal.load( IO.binread( "#{directory}/distributed_pages" ) )

    rpc
end

Instance Method Details

#clearObject



53
54
55
56
# File 'lib/arachni/state/framework/rpc.rb', line 53

def clear
    @distributed_pages.clear
    @distributed_elements.clear
end

#dump(directory) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/arachni/state/framework/rpc.rb', line 36

def dump( directory )
    FileUtils.mkdir_p( directory )

    %w(distributed_pages distributed_elements).each do |attribute|
        IO.binwrite( "#{directory}/#{attribute}", Marshal.dump( send(attribute) ) )
    end
end

#statisticsObject



29
30
31
32
33
34
# File 'lib/arachni/state/framework/rpc.rb', line 29

def statistics
    {
        distributed_pages:    @distributed_pages.size,
        distributed_elements: @distributed_elements.size
    }
end