Module: Arachni::Rest::Server::InstanceHelpers

Defined in:
lib/arachni/rest/server/instance_helpers.rb

Constant Summary collapse

@@instances =
{}

Instance Method Summary collapse

Instance Method Details

#exists?(id) ⇒ Boolean

Returns:

  • (Boolean)

34
35
36
# File 'lib/arachni/rest/server/instance_helpers.rb', line 34

def exists?( id )
    instances.include? id
end

#instancesObject


17
18
19
# File 'lib/arachni/rest/server/instance_helpers.rb', line 17

def instances
    @@instances
end

#kill_instance(id) ⇒ Object


38
39
40
# File 'lib/arachni/rest/server/instance_helpers.rb', line 38

def kill_instance( id )
    Processes::Instances.kill( instances[id].url )
end

#scan_for(id) ⇒ Object


21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/arachni/rest/server/instance_helpers.rb', line 21

def scan_for( id )
    @@instances[id].service
rescue => e
    instances.delete( id ).close
    session.delete id

    halt 500,
         json(
             error:     "#{e.class}: #{e}",
             backtrace: e.backtrace
         )
end