remove LocalInput as a string (no Rex::Ui::Text::Input::File class exists), see #3426

git-svn-id: file:///home/svn/framework3/trunk@11440 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Joshua Drake 2010-12-29 02:15:18 +00:00
parent 93e1f56cd8
commit c25b08452b
2 changed files with 9 additions and 17 deletions

View File

@ -86,27 +86,19 @@ class Driver < Msf::Ui::Driver
# Initialize the user interface to use a different input and output
# handle if one is supplied
input = opts['LocalInput']
input ||= Rex::Ui::Text::Input::Stdio.new
if (opts['LocalInput'])
if (opts['LocalInput'].kind_of?(String))
input = Rex::Ui::Text::Input::File.new(opts['LocalInput'])
else
input = opts['LocalInput']
end
else
input = Rex::Ui::Text::Input::Stdio.new
end
if (opts['LocalOutput'])
if (opts['LocalOutput'].kind_of?(String))
output = Rex::Ui::Text::Output::File.new(opts['LocalOutput'])
else
else
output = opts['LocalOutput']
end
else
output = Rex::Ui::Text::Output::Stdio.new
end
init_ui(input, output)
init_tab_complete
@ -164,7 +156,7 @@ class Driver < Msf::Ui::Driver
if @defanged
self.command_passthru = false
end
# Parse any specified database.yml file
if framework.db.usable
# Look for our database configuration in the following places, in order:
@ -178,7 +170,7 @@ class Driver < Msf::Ui::Driver
dbinfo = YAML.load(File.read(dbfile))
dbenv = opts['DatabaseEnv'] || "production"
db = dbinfo[dbenv]
if not db
print_error("No database definition for environment #{dbenv}")
else
@ -186,9 +178,9 @@ class Driver < Msf::Ui::Driver
print_error("Failed to connect to the database: #{framework.db.error} #{db.inspect} #{framework.db.error.backtrace}")
end
end
end
end
end
# Process things before we actually display the prompt and get rocking
on_startup

View File

@ -14,7 +14,7 @@ class Output::File < Rex::Ui::Text::Output
attr_accessor :fd
def initialize(path)
self.fd = ::File.open(path, "w")
self.fd = ::File.open(path, "wb")
end
def supports_color?