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

Class Method Details

.execute(str, in_binding = nil) ⇒ Object

Executes arbitrary ruby from the supplied string.



29
30
31
32
33
34
# File 'lib/rex/script.rb', line 29

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.



20
21
22
23
24
# File 'lib/rex/script.rb', line 20

def self.execute_file(file, in_binding = nil)
	str = ''
	buf = ::File.read(file, ::File.size(file))
	execute(buf, in_binding)
end