Module: NewRelic::Security::Instrumentation::PTY

Included in:
Prepend
Defined in:
lib/newrelic_security/instrumentation-security/pty/chain.rb,
lib/newrelic_security/instrumentation-security/pty/prepend.rb,
lib/newrelic_security/instrumentation-security/pty/instrumentation.rb

Defined Under Namespace

Modules: Chain, Prepend

Instance Method Summary collapse

Instance Method Details

#getpty_on_enter(*var) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/newrelic_security/instrumentation-security/pty/instrumentation.rb', line 28

def getpty_on_enter(*var)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  event = NewRelic::Security::Agent::Control::Collector.collect(SYSTEM_COMMAND, var)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
  return event
end

#getpty_on_exit(event) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/newrelic_security/instrumentation-security/pty/instrumentation.rb', line 39

def getpty_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end

#spawn_on_enter(*var) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/newrelic_security/instrumentation-security/pty/instrumentation.rb', line 8

def spawn_on_enter(*var)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  event = NewRelic::Security::Agent::Control::Collector.collect(SYSTEM_COMMAND, var)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
  return event
end

#spawn_on_exit(event) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/newrelic_security/instrumentation-security/pty/instrumentation.rb', line 19

def spawn_on_exit(event)
  NewRelic::Security::Agent.logger.debug "OnExit :  #{self.class}.#{__method__}"
  NewRelic::Security::Agent::Utils.create_exit_event(event)
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
end