Class: SCNR::Introspector::DataFlow::Sink
- Inherits:
-
Object
- Object
- SCNR::Introspector::DataFlow::Sink
- Defined in:
- lib/scnr/introspector/data_flow/sink.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#backtrace ⇒ Object
Returns the value of attribute backtrace.
-
#method_name ⇒ Object
Returns the value of attribute method_name.
-
#method_source ⇒ Object
Returns the value of attribute method_source.
-
#method_source_location ⇒ Object
Returns the value of attribute method_source_location.
-
#object ⇒ Object
Returns the value of attribute object.
-
#source ⇒ Object
Returns the value of attribute source.
-
#tainted_argument_index ⇒ Object
Returns the value of attribute tainted_argument_index.
-
#tainted_value ⇒ Object
Returns the value of attribute tainted_value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Sink
constructor
A new instance of Sink.
- #marshal_dump ⇒ Object
- #marshal_load(h) ⇒ Object
- #to_rpc_data ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Sink
Returns a new instance of Sink.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 26 def initialize( = {} ) .each do |k, v| next if v.nil? send( "#{k}=", v ) end if !@method_source && @method_source_location filepath = @method_source_location.first lineno = @method_source_location.last if File.exists? filepath File.open filepath do |f| begin @method_source = MyMethodSource::CodeHelpers.expression_at( File.open( f ), lineno ) rescue SyntaxError end end end end if !@source && @backtrace source_location = @backtrace.first.split( ':' ).first if File.exists? source_location @source = IO.read( source_location ) end end end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
17 18 19 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 17 def arguments @arguments end |
#backtrace ⇒ Object
Returns the value of attribute backtrace.
23 24 25 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 23 def backtrace @backtrace end |
#method_name ⇒ Object
Returns the value of attribute method_name.
11 12 13 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 11 def method_name @method_name end |
#method_source ⇒ Object
Returns the value of attribute method_source.
12 13 14 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 12 def method_source @method_source end |
#method_source_location ⇒ Object
Returns the value of attribute method_source_location.
13 14 15 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 13 def method_source_location @method_source_location end |
#object ⇒ Object
Returns the value of attribute object.
9 10 11 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 9 def object @object end |
#source ⇒ Object
Returns the value of attribute source.
15 16 17 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 15 def source @source end |
#tainted_argument_index ⇒ Object
Returns the value of attribute tainted_argument_index.
19 20 21 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 19 def tainted_argument_index @tainted_argument_index end |
#tainted_value ⇒ Object
Returns the value of attribute tainted_value.
21 22 23 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 21 def tainted_value @tainted_value end |
Class Method Details
.from_rpc_data(data) ⇒ Object
70 71 72 73 74 75 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 70 def self.from_rpc_data( data ) n = self.new n.marshal_load( data ) n.arguments = n.arguments.map { |a| ::JSON.load a } n end |
Instance Method Details
#marshal_dump ⇒ Object
55 56 57 58 59 60 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 55 def marshal_dump instance_variables.inject( {} ) do |h, iv| h[iv.to_s.gsub('@','')] = instance_variable_get( iv ) h end end |
#marshal_load(h) ⇒ Object
66 67 68 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 66 def marshal_load( h ) h.each { |k, v| instance_variable_set( "@#{k}", v ) } end |
#to_rpc_data ⇒ Object
62 63 64 |
# File 'lib/scnr/introspector/data_flow/sink.rb', line 62 def to_rpc_data marshal_dump.merge 'arguments' => arguments.map(&:to_json) end |