5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
54
55
56
57
58
59
60
61
|
# File 'lib/newrelic_security/instrumentation-security/kernel/chain.rb', line 5
def self.instrument!
::Object.class_eval do
include NewRelic::Security::Instrumentation::Kernel
private
alias_method :system_without_security, :system
def system(*var)
retval = nil
event = system_on_enter(*var) { retval = system_without_security(*var) }
system_on_exit(event, retval) { return retval }
end
alias_method :backtick_without_security, :`
def `(cmd)
retval = nil
event = backtick_on_enter(cmd) { retval = backtick_without_security(cmd) }
backtick_on_exit(event) { return retval }
end
alias_method :spawn_without_security, :spawn
def spawn(*var)
retval = nil
event = spawn_on_enter(*var) { retval = spawn_without_security(*var) }
spawn_on_exit(event, retval) { return retval }
end
alias_method :exec_without_security, :exec
def exec(*var)
retval = nil
event = exec_on_enter(*var) { retval = exec_without_security(*var) }
exec_on_exit(event) { return retval }
end
alias_method :open_without_security, :open
def open(*args, **kwargs)
retval = nil
event = open_on_enter(*args, **kwargs) { retval = open_without_security(*args, **kwargs) }
open_on_exit(event, retval) { return retval }
end
end
end
|