Files
metasploit-gs/lib/rex/script.rb
T
Matt Miller 00ffcc3835 support for meterpreter scripts
git-svn-id: file:///home/svn/framework3/trunk@3916 4d416f70-5f16-0410-b530-b9f4589650da
2006-09-19 03:15:25 +00:00

41 lines
573 B
Ruby

#!/usr/bin/env ruby
module Rex
###
#
# This class provides an easy interface for loading and executing ruby
# scripts.
#
###
module Script
#
# Reads the contents of the supplied file and exeutes them.
#
def self.execute_file(file, in_binding = nil)
str = ''
File.open(file) { |f|
begin
while data = f.read and data.length > 0
str += data
end
rescue EOFError
end
}
execute(str, in_binding)
end
#
# Executes arbitrary ruby from the supplied string.
#
def self.execute(str, in_binding = nil)
eval(str, in_binding)
end
end
end