Class: Arachni::Browser::Javascript::TaintTracer::Sink::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/arachni/browser/javascript/taint_tracer/sink/base.rb

Overview

Author:

Direct Known Subclasses

DataFlow, ExecutionFlow

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



22
23
24
25
26
27
28
# File 'lib/arachni/browser/javascript/taint_tracer/sink/base.rb', line 22

def initialize( options = {} )
    options.my_symbolize_keys(false).each do |k, v|
        send( "#{k}=", v )
    end

    @trace ||= []
end

Instance Attribute Details

#traceArray<Frame>

Returns Stacktrace.

Returns:



20
21
22
# File 'lib/arachni/browser/javascript/taint_tracer/sink/base.rb', line 20

def trace
  @trace
end

Class Method Details

.from_rpc_data(data) ⇒ Object



52
53
54
55
# File 'lib/arachni/browser/javascript/taint_tracer/sink/base.rb', line 52

def self.from_rpc_data( data )
    data['trace'] = data['trace'].map { |d| Frame.from_rpc_data( d ) }
    new data
end

Instance Method Details

#==(other) ⇒ Object



44
45
46
# File 'lib/arachni/browser/javascript/taint_tracer/sink/base.rb', line 44

def ==( other )
    hash == other.hash
end

#hashObject



40
41
42
# File 'lib/arachni/browser/javascript/taint_tracer/sink/base.rb', line 40

def hash
    to_h.hash
end

#to_hObject



30
31
32
33
34
35
# File 'lib/arachni/browser/javascript/taint_tracer/sink/base.rb', line 30

def to_h
    instance_variables.inject({}) do |h, iv|
        h[iv.to_s.gsub('@', '').to_sym] = instance_variable_get( iv )
        h
    end.merge( trace: trace.map(&:to_h))
end

#to_hashObject



36
37
38
# File 'lib/arachni/browser/javascript/taint_tracer/sink/base.rb', line 36

def to_hash
    to_h
end

#to_rpc_dataObject



48
49
50
# File 'lib/arachni/browser/javascript/taint_tracer/sink/base.rb', line 48

def to_rpc_data
    to_h.merge( trace: trace.map(&:to_rpc_data) )
end