Class: Arachni::BrowserCluster::Jobs::DOMExploration::EventTrigger

Inherits:
Arachni::BrowserCluster::Jobs::DOMExploration show all
Defined in:
lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb,
lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger/result.rb

Overview

Loads a #resource and triggers the specified #event on the given element.

Author:

Direct Known Subclasses

TaintTrace::EventTrigger

Defined Under Namespace

Classes: Result

Instance Attribute Summary collapse

Attributes inherited from Arachni::BrowserCluster::Jobs::DOMExploration

#resource

Attributes inherited from Arachni::BrowserCluster::Job

#args, #browser, #forwarder, #time

Instance Method Summary collapse

Methods inherited from Arachni::BrowserCluster::Jobs::DOMExploration

#clean_copy, #dup, #initialize

Methods inherited from Arachni::BrowserCluster::Job

#==, #clean_copy, #configure_and_run, #dup, #forward, #forward_as, #hash, #id, #initialize, #never_ending=, #never_ending?, #save_result, #timed_out!, #timed_out?

Constructor Details

This class inherits a constructor from Arachni::BrowserCluster::Jobs::DOMExploration

Instance Attribute Details

#elementBrowser::ElementLocator


27
28
29
# File 'lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb', line 27

def element
  @element
end

#eventSymbol

Returns Event to trigger on the given element.

Returns:

  • (Symbol)

    Event to trigger on the given element.


24
25
26
# File 'lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb', line 24

def event
  @event
end

Instance Method Details

#runObject


31
32
33
34
35
36
37
38
39
# File 'lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb', line 31

def run
    browser.on_new_page { |page| save_result( page: page ) }

    browser.load resource

    # We're disabling page restoration for the trigger as this is an one-time
    # job situation, the browser's state is going to be discarded at the end.
    browser.trigger_event( resource, element, event, false )
end

#to_sObject


41
42
43
44
45
# File 'lib/arachni/browser_cluster/jobs/dom_exploration/event_trigger.rb', line 41

def to_s
    "#<#{self.class}:#{object_id} @resource=#{@resource} " +
        "@event=#{@event.inspect} @element=#{@element.inspect} " <<
        "time=#{@time} timed_out=#{timed_out?}>"
end