More bug fixes...

git-svn-id: file:///home/svn/framework3/trunk@3911 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2006-09-18 00:29:14 +00:00
parent e96ed4c254
commit 6c3c67fec0
3 changed files with 16 additions and 8 deletions

View File

@ -46,7 +46,7 @@ class Plugin::DBPostgres < Msf::Plugin
def cmd_db_disconnect(*args) def cmd_db_disconnect(*args)
if (framework.db) if (framework.db)
framework.db.disconnect() framework.db.disconnect()
driver.remove_dispatcher(DatabaseCommandDispatcher) driver.remove_dispatcher('Database Backend')
end end
end end

View File

@ -45,7 +45,7 @@ class Plugin::DBSQLite2 < Msf::Plugin
def cmd_db_disconnect(*args) def cmd_db_disconnect(*args)
if (framework.db) if (framework.db)
framework.db.disconnect() framework.db.disconnect()
driver.remove_dispatcher(DatabaseCommandDispatcher) driver.remove_dispatcher('Database Backend')
end end
end end
@ -58,7 +58,11 @@ class Plugin::DBSQLite2 < Msf::Plugin
opts['dbfile'] = info[:path] opts['dbfile'] = info[:path]
if (not File.exists?(opts['dbfile']))
print_status("The specified database does not exist")
return
end
if (not framework.db.connect(opts)) if (not framework.db.connect(opts))
raise PluginLoadError.new("Failed to connect to the database") raise PluginLoadError.new("Failed to connect to the database")
end end
@ -79,7 +83,7 @@ class Plugin::DBSQLite2 < Msf::Plugin
odb = File.join(Msf::Config.install_root, "data", "sql", "sqlite2.db") odb = File.join(Msf::Config.install_root, "data", "sql", "sqlite2.db")
File.copy(odb, info[:path]) FileUtils.copy(odb, info[:path])
if (not framework.db.connect(opts)) if (not framework.db.connect(opts))
raise PluginLoadError.new("Failed to connect to the database") raise PluginLoadError.new("Failed to connect to the database")
@ -98,7 +102,7 @@ class Plugin::DBSQLite2 < Msf::Plugin
def parse_db_uri(path) def parse_db_uri(path)
res = {} res = {}
res[:path] = path || Msf::Config.config_directory('metasploit3.db2') res[:path] = path || File.join(Msf::Config.config_directory, 'sqlite2.db')
res res
end end
end end

View File

@ -45,7 +45,7 @@ class Plugin::DBSQLite3 < Msf::Plugin
def cmd_db_disconnect(*args) def cmd_db_disconnect(*args)
if (framework.db) if (framework.db)
framework.db.disconnect() framework.db.disconnect()
driver.remove_dispatcher(DatabaseCommandDispatcher) driver.remove_dispatcher('Database Backend')
end end
end end
@ -58,6 +58,10 @@ class Plugin::DBSQLite3 < Msf::Plugin
opts['dbfile'] = info[:path] opts['dbfile'] = info[:path]
if (not File.exists?(opts['dbfile']))
print_status("The specified database does not exist")
return
end
if (not framework.db.connect(opts)) if (not framework.db.connect(opts))
raise PluginLoadError.new("Failed to connect to the database") raise PluginLoadError.new("Failed to connect to the database")
@ -79,7 +83,7 @@ class Plugin::DBSQLite3 < Msf::Plugin
odb = File.join(Msf::Config.install_root, "data", "sql", "sqlite3.db") odb = File.join(Msf::Config.install_root, "data", "sql", "sqlite3.db")
File.copy(odb, info[:path]) FileUtils.copy(odb, info[:path])
if (not framework.db.connect(opts)) if (not framework.db.connect(opts))
raise PluginLoadError.new("Failed to connect to the database") raise PluginLoadError.new("Failed to connect to the database")
@ -98,7 +102,7 @@ class Plugin::DBSQLite3 < Msf::Plugin
def parse_db_uri(path) def parse_db_uri(path)
res = {} res = {}
res[:path] = path || Msf::Config.config_directory('metasploit3.db3') res[:path] = path || File.join(Msf::Config.config_directory, 'sqlite3.db')
res res
end end
end end