module Rex::Script

This class provides an easy interface for loading and executing ruby scripts.

Public Class Methods

execute(str, in_binding = nil) click to toggle source

Executes arbitrary ruby from the supplied string.

# File lib/rex/script.rb, line 27
def self.execute(str, in_binding = nil)
  begin
    eval(str, in_binding)
  rescue Completed
  end
end
execute_file(file, in_binding = nil) click to toggle source

Reads the contents of the supplied file and exeutes them.

# File lib/rex/script.rb, line 18
def self.execute_file(file, in_binding = nil)
  str = ''
  buf = ::File.read(file, ::File.size(file))
  execute(buf, in_binding)
end