Top Level Namespace

Includes:
Arachni

Defined Under Namespace

Modules: Arachni, Ethon, Selenium Classes: Array, Hash, Object, Set, String

Constant Summary

Constants included from Arachni

Arachni::BANNER, Arachni::Cookie, Arachni::Form, Arachni::Header, Arachni::JSON, Arachni::Link, Arachni::LinkTemplate, Arachni::NestedCookie, Arachni::Severity, Arachni::UIForm, Arachni::UIInput, Arachni::VERSION, Arachni::WEBSITE, Arachni::WIKI, Arachni::XML

Instance Method Summary collapse

Methods included from Arachni

URI, collect_young_objects, #get_long_win32_filename, jruby?, null_device, profile?, windows?

Instance Method Details

#ap(obj) ⇒ Object



15
16
17
# File 'lib/arachni.rb', line 15

def ap( obj )
    super obj, raw: true
end

#dispatcher_connect(*args) ⇒ RPC::Client::Dispatcher

Parameters:

  • url (String)

    URL of the Dispatcher.

  • options (Hash)

    Options for the RPC client.

Returns:



39
40
41
# File 'lib/arachni/processes/helpers/dispatchers.rb', line 39

def dispatcher_connect( *args )
    Arachni::Processes::Dispatchers.connect( *args )
end

#dispatcher_kill(*args) ⇒ Object

Parameters:

  • url (String)

    URL of the Dispatcher to kill.



23
24
25
# File 'lib/arachni/processes/helpers/dispatchers.rb', line 23

def dispatcher_kill( *args )
    Arachni::Processes::Dispatchers.kill( *args )
end

#dispatcher_kill_by_instance(instance) ⇒ Object



27
28
29
# File 'lib/arachni/processes/helpers/dispatchers.rb', line 27

def dispatcher_kill_by_instance( instance )
    dispatcher_kill instance.options.datastore.dispatcher_url
end

#dispatcher_killallObject



33
34
35
# File 'lib/arachni/processes/helpers/dispatchers.rb', line 33

def dispatcher_killall
    Arachni::Processes::Dispatchers.killall
end

#dispatcher_light_spawn(*args) ⇒ Object



17
18
19
# File 'lib/arachni/processes/helpers/dispatchers.rb', line 17

def dispatcher_light_spawn( *args )
    Arachni::Processes::Dispatchers.light_spawn( *args )
end

#dispatcher_spawn(*args) ⇒ RPC::Client::Dispatcher

Parameters:

  • options (Hash)

    To be passed to Arachni::Options#set. Allows `address` instead of `rpc_server_address` and `port` instead of `rpc_port`.

Returns:



11
12
13
# File 'lib/arachni/processes/helpers/dispatchers.rb', line 11

def dispatcher_spawn( *args )
    Arachni::Processes::Dispatchers.spawn( *args )
end

#exit?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
19
20
# File 'lib/arachni/processes/executables/browser.rb', line 11

def exit?
    $stdin.read_nonblock( 1 )
    false
rescue Errno::EWOULDBLOCK
    false
# Parent dead or willfully closed STDIN as a signal.
rescue EOFError, Errno::EPIPE => e
    print_exception( e )
    true
end

#instance_connect(*args) ⇒ RPC::Client::Instance

Parameters:

  • url (String)

    URL of the Dispatcher.

  • token (String)

    Authentication token – only need be provided once.

Returns:



43
44
45
# File 'lib/arachni/processes/helpers/instances.rb', line 43

def instance_connect( *args )
    Arachni::Processes::Instances.connect( *args )
end

#instance_dispatcher_spawn(*args) ⇒ RPC::Client::Instance



27
28
29
# File 'lib/arachni/processes/helpers/instances.rb', line 27

def instance_dispatcher_spawn( *args )
    Arachni::Processes::Instances.dispatcher.spawn( *args )
end

#instance_grid_spawn(*args) ⇒ RPC::Client::Instance

Parameters:

Returns:



17
18
19
# File 'lib/arachni/processes/helpers/instances.rb', line 17

def instance_grid_spawn( *args )
    Arachni::Processes::Instances.grid_spawn( *args )
end

#instance_kill(url) ⇒ Object



31
32
33
# File 'lib/arachni/processes/helpers/instances.rb', line 31

def instance_kill( url )
    Arachni::Processes::Instances.kill url
end

#instance_killallObject



37
38
39
# File 'lib/arachni/processes/helpers/instances.rb', line 37

def instance_killall
    Arachni::Processes::Instances.killall
end

#instance_light_grid_spawn(*args) ⇒ Object



21
22
23
# File 'lib/arachni/processes/helpers/instances.rb', line 21

def instance_light_grid_spawn( *args )
    Arachni::Processes::Instances.light_grid_spawn( *args )
end

#instance_spawn(*args) ⇒ RPC::Client::Instance

Parameters:

  • options (Hash)

    To be passed to Arachni::Options#set. Allows `address` instead of `rpc_server_address` and `port` instead of `rpc_port`.

Returns:



11
12
13
# File 'lib/arachni/processes/helpers/instances.rb', line 11

def instance_spawn( *args )
    Arachni::Processes::Instances.spawn( *args )
end

#instance_token_for(*args) ⇒ String

Returns Cached authentication token for the given Instance.

Parameters:

Returns:

  • (String)

    Cached authentication token for the given Instance.



49
50
51
# File 'lib/arachni/processes/helpers/instances.rb', line 49

def instance_token_for( *args )
    Arachni::Processes::Instances.token_for( *args )
end

#parent_alive?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/arachni/processes/executables/base.rb', line 22

def parent_alive?
    # Windows is not big on POSIX so try it its own way if possible.
    if Gem.win_platform?
        begin
            alive = false
            wmi = WIN32OLE.connect( 'winmgmts://' )
            processes = wmi.ExecQuery( "select ProcessId from win32_process where ProcessID='#{ppid}'")
            processes.each do |proc|
                proc.ole_free
                alive = true
            end
            processes.ole_free
            wmi.ole_free

            return alive
        rescue WIN32OLERuntimeError
        end
    end

    !!(Process.kill( 0, ppid ) rescue false)
end

#ppidObject



18
19
20
# File 'lib/arachni/processes/executables/base.rb', line 18

def ppid
    $options[:ppid]
end


3
4
5
6
7
8
9
# File 'lib/arachni/processes/executables/browser.rb', line 3

def print_exception( e )
    puts_stderr "#{Process.pid}: [#{e.class}] #{e}"
    e.backtrace.each do |line|
        puts_stderr "#{Process.pid}: #{line}"
    end
rescue
end

#process_kill(*args) ⇒ Object

Parameters:

  • pid (Integer)

    PID of the process to kill.



17
18
19
# File 'lib/arachni/processes/helpers/processes.rb', line 17

def process_kill( *args )
    Arachni::Processes::Manager.kill( *args )
end

#process_kill_many(*args) ⇒ Object

Parameters:



29
30
31
# File 'lib/arachni/processes/helpers/processes.rb', line 29

def process_kill_many( *args )
    Arachni::Processes::Manager.kill_many( *args )
end

#process_kill_reactor(*args) ⇒ Object



11
12
13
# File 'lib/arachni/processes/helpers/processes.rb', line 11

def process_kill_reactor( *args )
    Arachni::Processes::Manager.kill_reactor( *args )
end

#process_killall(*args) ⇒ Object



23
24
25
# File 'lib/arachni/processes/helpers/processes.rb', line 23

def process_killall( *args )
    Arachni::Processes::Manager.killall( *args )
end

#puts_stderr(str) ⇒ Object



44
45
46
47
48
49
# File 'lib/arachni/processes/executables/base.rb', line 44

def puts_stderr( str )
    return if $stderr.closed?

    $stderr.puts str
rescue
end