class Rex::Script::Base
Attributes
args[RW]
client[RW]
error[RW]
framework[RW]
path[RW]
session[RW]
sink[RW]
workspace[RW]
Public Class Methods
new(client, path)
click to toggle source
# File lib/rex/script/base.rb, line 17 def initialize(client, path) self.client = client self.framework = client.framework self.path = path self.sink = OutputSink.new if(client.framework.db and client.framework.db.active) self.workspace = client.framework.db.find_workspace( client.workspace.to_s ) || client.framework.db.workspace end # Convenience aliases self.session = self.client end
Public Instance Methods
completed()
click to toggle source
# File lib/rex/script/base.rb, line 35 def completed raise Rex::Script::Completed end
output()
click to toggle source
# File lib/rex/script/base.rb, line 31 def output client.user_output || self.sink end
print(*args)
click to toggle source
# File lib/rex/script/base.rb, line 51 def print(*args); output.print(*args); end
print_error(*args)
click to toggle source
# File lib/rex/script/base.rb, line 53 def print_error(*args); output.print_error(*args); end
print_good(*args)
click to toggle source
# File lib/rex/script/base.rb, line 54 def print_good(*args); output.print_good(*args); end
print_line(*args)
click to toggle source
# File lib/rex/script/base.rb, line 55 def print_line(*args); output.print_line(*args); end
print_status(*args)
click to toggle source
# File lib/rex/script/base.rb, line 52 def print_status(*args); output.print_status(*args); end
run(args=[])
click to toggle source
# File lib/rex/script/base.rb, line 39 def run(args=[]) self.args = args = args.flatten begin eval(::File.read(self.path, ::File.size(self.path)), binding ) rescue ::Interrupt rescue ::Rex::Script::Completed rescue ::Exception => e self.error = e raise e end end