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

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

Overview

Author:

  • Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com>

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CalledFunction

Returns a new instance of CalledFunction.



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

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

Instance Attribute Details

#argumentsArray

Returns Arguments passed to the relevant function.

Returns:

  • (Array)

    Arguments passed to the relevant function.



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

def arguments
  @arguments
end

#nameString

Returns Name of the function.

Returns:

  • (String)

    Name of the function.



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

def name
  @name
end

#sourceString?

Returns Source of the function.

Returns:

  • (String, nil)

    Source of the function.



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

def source
  @source
end

Class Method Details

.from_rpc_data(data) ⇒ Object



66
67
68
# File 'lib/arachni/browser/javascript/taint_tracer/frame/called_function.rb', line 66

def self.from_rpc_data( data )
    new data
end

Instance Method Details

#==(other) ⇒ Object



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

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

#hashObject



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

def hash
    to_h.hash
end

#signatureObject



41
42
43
44
# File 'lib/arachni/browser/javascript/taint_tracer/frame/called_function.rb', line 41

def signature
    return if !@source
    @source.match( /function\s*(.*?)\s*\{/m )[1]
end

#signature_argumentsObject



36
37
38
39
# File 'lib/arachni/browser/javascript/taint_tracer/frame/called_function.rb', line 36

def signature_arguments
    return if !signature
    signature.match( /\((.*)\)/ )[1].split( ',' ).map(&:strip)
end

#to_hObject Also known as: to_hash



46
47
48
49
50
51
# File 'lib/arachni/browser/javascript/taint_tracer/frame/called_function.rb', line 46

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

#to_rpc_dataObject



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

def to_rpc_data
    to_h
end