Module: Arachni::Framework::Parts::Browser

Included in:
Arachni::Framework
Defined in:
lib/arachni/framework/parts/browser.rb

Overview

Provides access to the BrowserCluster and relevant helpers.

Author:

Instance Method Summary collapse

Instance Method Details

#browser_clusterBrowserCluster?

Returns A lazy-loaded browser cluster or ‘nil` if OptionGroups::BrowserCluster#pool_size or OptionGroups::Scope#dom_depth_limit are 0 or not #host_has_browser?.

Returns:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/arachni/framework/parts/browser.rb', line 23

def browser_cluster
    return if options.browser_cluster.pool_size == 0 ||
        Options.scope.dom_depth_limit == 0 || !host_has_browser?

    # Initialization may take a while so since we lazy load this make sure
    # that only one thread gets to this code at a time.
    synchronize do
        if !@browser_cluster
            state.set_status_message :browser_cluster_startup
        end

        @browser_cluster ||= BrowserCluster.new
        state.clear_status_messages
        @browser_cluster
    end
end

#browser_job_skip_statesObject



50
51
52
53
# File 'lib/arachni/framework/parts/browser.rb', line 50

def browser_job_skip_states
    return if !@browser_cluster
    browser_cluster.skip_states( browser_job.id )
end

#host_has_browser?Bool

Returns ‘true` if the environment has a browser, `false` otherwise.

Returns:

  • (Bool)

    ‘true` if the environment has a browser, `false` otherwise.



42
43
44
# File 'lib/arachni/framework/parts/browser.rb', line 42

def host_has_browser?
    Arachni::Browser.has_executable?
end

#wait_for_browser?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/arachni/framework/parts/browser.rb', line 46

def wait_for_browser?
    @browser_cluster && !browser_cluster.done?
end