Module: Kernel
- Defined in:
- lib/tcell_agent/instrumentation/monkey_patches/kernel.rb,
lib/tcell_agent/instrumentation/monkey_patches/kernel.rb
Class Method Summary collapse
- .exec(*args) ⇒ Object
- .gets(*args, &block) ⇒ Object
- .open(*args, &block) ⇒ Object
- .readline(*args, &block) ⇒ Object
- .spawn(*args) ⇒ Object
- .system(*args) ⇒ Object
- .tcell_original_1_gets ⇒ Object
- .tcell_original_1_open ⇒ Object
- .tcell_original_1_spawn ⇒ Object
- .tcell_original_1_system ⇒ Object
- .tcell_original_exec ⇒ Object
- .tcell_original_readline ⇒ Object
Instance Method Summary collapse
- #`(cmd) ⇒ Object
- #gets(*args, &block) ⇒ Object
- #open(*args, &block) ⇒ Object
- #readline(*args, &block) ⇒ Object
- #spawn(*args) ⇒ Object
- #system(*args) ⇒ Object
- #tcell_original_2_gets ⇒ Object
- #tcell_original_2_open ⇒ Object
- #tcell_original_2_spawn ⇒ Object
- #tcell_original_2_system ⇒ Object
- #tcell_original_exec ⇒ Object
- #tcell_original_readline ⇒ Object
Class Method Details
.exec(*args) ⇒ Object
134 135 136 137 138 139 140 141 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 134 def exec(*args) cmd = TCellAgent::Cmdi.parse_command(*args) if TCellAgent::Cmdi.block_command?(cmd) raise "tCell.io Agent: Command not allowed by policy: #{cmd}" end tcell_original_exec(*args) end |
.gets(*args, &block) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 20 def gets(*args, &block) path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode_argf if TCellAgent::Instrumentation::Lfi.block_file_access?(path, mode) raise IOError, "tCell.io Agent: Attempted access to file #{path} with mode #{mode} denied" end tcell_original_1_gets(*args, &block) end |
.open(*args, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 4 def open(*args, &block) path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args) if path && TCellAgent::Instrumentation::Lfi.block_file_access?(path, mode) raise IOError, "tCell.io Agent: Attempted access to file #{path} with mode #{mode} denied" end cmd = TCellAgent::Cmdi.parse_command_from_open(*args) if cmd && TCellAgent::Cmdi.block_command?(cmd) raise "tCell.io Agent: Command not allowed by policy: #{cmd}" end tcell_original_1_open(*args, &block) end |
.readline(*args, &block) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 31 def readline(*args, &block) path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode_argf if TCellAgent::Instrumentation::Lfi.block_file_access?(path, mode) raise IOError, "tCell.io Agent: Attempted access to file #{path} with mode #{mode} denied" end tcell_original_readline(*args, &block) end |
.spawn(*args) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 42 def spawn(*args) cmd = TCellAgent::Cmdi.parse_command(*args) if TCellAgent::Cmdi.block_command?(cmd) raise "tCell.io Agent: Command not allowed by policy: #{cmd}" end tcell_original_1_spawn(*args) end |
.system(*args) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 52 def system(*args) cmd = TCellAgent::Cmdi.parse_command(*args) if TCellAgent::Cmdi.block_command?(cmd) raise "tCell.io Agent: Command not allowed by policy: #{cmd}" end tcell_original_1_system(*args) end |
.tcell_original_1_gets ⇒ Object
19 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 19 alias_method :tcell_original_1_gets, :gets |
.tcell_original_1_open ⇒ Object
3 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 3 alias_method :tcell_original_1_open, :open |
.tcell_original_1_spawn ⇒ Object
41 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 41 alias_method :tcell_original_1_spawn, :spawn |
.tcell_original_1_system ⇒ Object
51 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 51 alias_method :tcell_original_1_system, :system |
.tcell_original_exec ⇒ Object
133 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 133 alias_method :tcell_original_exec, :exec |
.tcell_original_readline ⇒ Object
30 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 30 alias_method :tcell_original_readline, :readline |
Instance Method Details
#`(cmd) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 63 def `(cmd) if TCellAgent::Cmdi.block_command?(cmd) raise "tCell.io Agent: Command not allowed by policy: #{cmd}" end tcell_original_backtick(cmd) end |
#gets(*args, &block) ⇒ Object
88 89 90 91 92 93 94 95 96 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 88 def gets(*args, &block) path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode_argf if TCellAgent::Instrumentation::Lfi.block_file_access?(path, mode) raise IOError, "tCell.io Agent: Attempted access to file #{path} with mode #{mode} denied" end tcell_original_2_gets(*args, &block) end |
#open(*args, &block) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 72 def open(*args, &block) path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode(*args) if path && TCellAgent::Instrumentation::Lfi.block_file_access?(path, mode) raise IOError, "tCell.io Agent: Attempted access to file #{path} with mode #{mode} denied" end cmd = TCellAgent::Cmdi.parse_command_from_open(*args) if cmd && TCellAgent::Cmdi.block_command?(cmd) raise "tCell.io Agent: Command not allowed by policy: #{cmd}" end tcell_original_2_open(*args, &block) end |
#readline(*args, &block) ⇒ Object
99 100 101 102 103 104 105 106 107 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 99 def readline(*args, &block) path, mode = TCellAgent::Instrumentation::Lfi.extract_path_mode_argf if TCellAgent::Instrumentation::Lfi.block_file_access?(path, mode) raise IOError, "tCell.io Agent: Attempted access to file #{path} with mode #{mode} denied" end tcell_original_readline(*args, &block) end |
#spawn(*args) ⇒ Object
110 111 112 113 114 115 116 117 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 110 def spawn(*args) cmd = TCellAgent::Cmdi.parse_command(*args) if TCellAgent::Cmdi.block_command?(cmd) raise "tCell.io Agent: Command not allowed by policy: #{cmd}" end tcell_original_2_spawn(*args) end |
#system(*args) ⇒ Object
120 121 122 123 124 125 126 127 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 120 def system(*args) cmd = TCellAgent::Cmdi.parse_command(*args) if TCellAgent::Cmdi.block_command?(cmd) raise "tCell.io Agent: Command not allowed by policy: #{cmd}" end tcell_original_2_system(*args) end |
#tcell_original_2_gets ⇒ Object
87 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 87 alias_method :tcell_original_2_gets, :gets |
#tcell_original_2_open ⇒ Object
71 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 71 alias_method :tcell_original_2_open, :open |
#tcell_original_2_spawn ⇒ Object
109 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 109 alias_method :tcell_original_2_spawn, :spawn |
#tcell_original_2_system ⇒ Object
119 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 119 alias_method :tcell_original_2_system, :system |
#tcell_original_exec ⇒ Object
144 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 144 alias_method :tcell_original_exec, :exec |
#tcell_original_readline ⇒ Object
98 |
# File 'lib/tcell_agent/instrumentation/monkey_patches/kernel.rb', line 98 alias_method :tcell_original_readline, :readline |