Class: Arachni::Browser::Javascript::TaintTracer::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/arachni/browser/javascript/taint_tracer/frame.rb,
lib/arachni/browser/javascript/taint_tracer/frame/called_function.rb

Overview

Represents a stack frame for a JS function call.

Author:

Defined Under Namespace

Classes: CalledFunction

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Frame

Returns a new instance of Frame.


33
34
35
36
37
38
39
40
41
# File 'lib/arachni/browser/javascript/taint_tracer/frame.rb', line 33

def initialize( options = {} )
    if options[:function].is_a? Hash
        @function = CalledFunction.new( options.delete(:function) )
    end

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

Instance Attribute Details

#functionCalledFunction

Returns Relevant function.

Returns:


23
24
25
# File 'lib/arachni/browser/javascript/taint_tracer/frame.rb', line 23

def function
  @function
end

#lineInteger?

Returns Line number related to the called frame.

Returns:

  • (Integer, nil)

    Line number related to the called frame.


31
32
33
# File 'lib/arachni/browser/javascript/taint_tracer/frame.rb', line 31

def line
  @line
end

#urlString?

Returns Location of the file associated with the called frame.

Returns:

  • (String, nil)

    Location of the file associated with the called frame.


27
28
29
# File 'lib/arachni/browser/javascript/taint_tracer/frame.rb', line 27

def url
  @url
end

Class Method Details

.from_rpc_data(data) ⇒ Object


63
64
65
66
# File 'lib/arachni/browser/javascript/taint_tracer/frame.rb', line 63

def self.from_rpc_data( data )
    data['function'] = Frame::CalledFunction.from_rpc_data( data['function'] )
    new data
end

Instance Method Details

#==(other) ⇒ Object


55
56
57
# File 'lib/arachni/browser/javascript/taint_tracer/frame.rb', line 55

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

#hashObject


51
52
53
# File 'lib/arachni/browser/javascript/taint_tracer/frame.rb', line 51

def hash
    to_h.hash
end

#to_hObject Also known as: to_hash


43
44
45
46
47
48
# File 'lib/arachni/browser/javascript/taint_tracer/frame.rb', line 43

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

#to_rpc_dataObject


59
60
61
# File 'lib/arachni/browser/javascript/taint_tracer/frame.rb', line 59

def to_rpc_data
    to_h.merge( function: function.to_rpc_data )
end