# -*- coding: binary -*-12module Rex34###5#6# This class provides an easy interface for loading and executing ruby7# scripts.8#9###10module Script1112class Completed < ::RuntimeError13end1415#16# Reads the contents of the supplied file and exeutes them.17#18def self.execute_file(file, in_binding = nil)19str = ''20buf = ::File.read(file, ::File.size(file), mode: 'rb')21execute(buf, in_binding)22end2324#25# Executes arbitrary ruby from the supplied string.26#27def self.execute(str, in_binding = nil)28begin29eval(str, in_binding)30rescue Completed31end32end3334end3536end373839