Class: Arachni::Data::Framework::RPC

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

Overview

Data 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.



21
22
23
# File 'lib/arachni/data/framework/rpc.rb', line 21

def initialize
    @distributed_page_queue = Support::Database::Queue.new
end

Instance Attribute Details

#distributed_page_queueSupport::Database::Queue (readonly)



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

def distributed_page_queue
  @distributed_page_queue
end

Class Method Details

.load(directory) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/arachni/data/framework/rpc.rb', line 49

def self.load( directory )
    rpc = new

    Dir["#{directory}/distributed_page_queue/*"].each do |page_file|
        rpc.distributed_page_queue.disk << page_file
    end

    rpc
end

Instance Method Details

#clearObject



59
60
61
# File 'lib/arachni/data/framework/rpc.rb', line 59

def clear
    @distributed_page_queue.clear
end

#dump(directory) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/arachni/data/framework/rpc.rb', line 29

def dump( directory )
    FileUtils.mkdir_p( directory )

    page_queue_directory = "#{directory}/distributed_page_queue/"

    FileUtils.rm_rf( page_queue_directory )
    FileUtils.mkdir_p( page_queue_directory )

    distributed_page_queue.buffer.each do |page|
        IO.binwrite(
            "#{page_queue_directory}/#{page.persistent_hash}",
            distributed_page_queue.serialize( page )
        )
    end

    distributed_page_queue.disk.each do |filepath|
        FileUtils.cp filepath, "#{page_queue_directory}/"
    end
end

#statisticsObject



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

def statistics
    { distributed_page_queue: @distributed_page_queue.size }
end