Module: Rex::Script
- Defined in:
- lib/rex/script.rb,
lib/rex/script/base.rb,
lib/rex/script/shell.rb,
lib/rex/script/meterpreter.rb
Overview
This class provides an easy interface for loading and executing ruby scripts.
Defined Under Namespace
Classes: Base, Completed, Meterpreter, Shell
Class Method Summary collapse
-
.execute(str, in_binding = nil) ⇒ Object
Executes arbitrary ruby from the supplied string.
-
.execute_file(file, in_binding = nil) ⇒ Object
Reads the contents of the supplied file and exeutes them.
Class Method Details
.execute(str, in_binding = nil) ⇒ Object
Executes arbitrary ruby from the supplied string.
28 29 30 31 32 33 |
# File 'lib/rex/script.rb', line 28 def self.execute(str, in_binding = nil) begin eval(str, in_binding) rescue Completed end end |
.execute_file(file, in_binding = nil) ⇒ Object
Reads the contents of the supplied file and exeutes them.
19 20 21 22 23 |
# File 'lib/rex/script.rb', line 19 def self.execute_file(file, in_binding = nil) str = '' buf = ::File.read(file, ::File.size(file), mode: 'rb') execute(buf, in_binding) end |