fixing a busted -R on creds search
I broke this when moving creds to its own file.
This commit is contained in:
parent
90c86dbc94
commit
2682874652
|
@ -3,6 +3,7 @@
|
||||||
require 'rexml/document'
|
require 'rexml/document'
|
||||||
require 'rex/parser/nmap_xml'
|
require 'rex/parser/nmap_xml'
|
||||||
require 'msf/core/db_export'
|
require 'msf/core/db_export'
|
||||||
|
require 'msf/ui/console/command_dispatcher/db_common'
|
||||||
|
|
||||||
module Msf
|
module Msf
|
||||||
module Ui
|
module Ui
|
||||||
|
@ -14,6 +15,7 @@ class Creds
|
||||||
|
|
||||||
include Msf::Ui::Console::CommandDispatcher
|
include Msf::Ui::Console::CommandDispatcher
|
||||||
include Metasploit::Credential::Creation
|
include Metasploit::Credential::Creation
|
||||||
|
include Msf::Ui::Console::CommandDispatcher::DbCommon
|
||||||
|
|
||||||
#
|
#
|
||||||
# The dispatcher's name.
|
# The dispatcher's name.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
require 'rexml/document'
|
require 'rexml/document'
|
||||||
require 'rex/parser/nmap_xml'
|
require 'rex/parser/nmap_xml'
|
||||||
require 'msf/core/db_export'
|
require 'msf/core/db_export'
|
||||||
|
require 'msf/ui/console/command_dispatcher/db_common'
|
||||||
|
|
||||||
module Msf
|
module Msf
|
||||||
module Ui
|
module Ui
|
||||||
|
@ -14,6 +15,7 @@ class Db
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
include Msf::Ui::Console::CommandDispatcher
|
include Msf::Ui::Console::CommandDispatcher
|
||||||
|
include Msf::Ui::Console::CommandDispatcher::DbCommon
|
||||||
|
|
||||||
#
|
#
|
||||||
# The dispatcher's name.
|
# The dispatcher's name.
|
||||||
|
@ -1715,43 +1717,6 @@ class Db
|
||||||
print_line
|
print_line
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
|
||||||
# Set RHOSTS in the +active_module+'s (or global if none) datastore from an array of addresses
|
|
||||||
#
|
|
||||||
# This stores all the addresses to a temporary file and utilizes the
|
|
||||||
# <pre>file:/tmp/filename</pre> syntax to confer the addrs. +rhosts+
|
|
||||||
# should be an Array. NOTE: the temporary file is *not* deleted
|
|
||||||
# automatically.
|
|
||||||
#
|
|
||||||
def set_rhosts_from_addrs(rhosts)
|
|
||||||
if rhosts.empty?
|
|
||||||
print_status("The list is empty, cowardly refusing to set RHOSTS")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if active_module
|
|
||||||
mydatastore = active_module.datastore
|
|
||||||
else
|
|
||||||
# if there is no module in use set the list to the global variable
|
|
||||||
mydatastore = self.framework.datastore
|
|
||||||
end
|
|
||||||
|
|
||||||
if rhosts.length > 5
|
|
||||||
# Lots of hosts makes 'show options' wrap which is difficult to
|
|
||||||
# read, store to a temp file
|
|
||||||
rhosts_file = Rex::Quickfile.new("msf-db-rhosts-")
|
|
||||||
mydatastore['RHOSTS'] = 'file:'+rhosts_file.path
|
|
||||||
# create the output file and assign it to the RHOSTS variable
|
|
||||||
rhosts_file.write(rhosts.join("\n")+"\n")
|
|
||||||
rhosts_file.close
|
|
||||||
else
|
|
||||||
# For short lists, just set it directly
|
|
||||||
mydatastore['RHOSTS'] = rhosts.join(" ")
|
|
||||||
end
|
|
||||||
|
|
||||||
print_line "RHOSTS => #{mydatastore['RHOSTS']}"
|
|
||||||
print_line
|
|
||||||
end
|
|
||||||
|
|
||||||
def db_find_tools(tools)
|
def db_find_tools(tools)
|
||||||
missed = []
|
missed = []
|
||||||
tools.each do |name|
|
tools.each do |name|
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
# -*- coding: binary -*-
|
||||||
|
|
||||||
|
require 'rexml/document'
|
||||||
|
require 'rex/parser/nmap_xml'
|
||||||
|
require 'msf/core/db_export'
|
||||||
|
|
||||||
|
module Msf
|
||||||
|
module Ui
|
||||||
|
module Console
|
||||||
|
module CommandDispatcher
|
||||||
|
|
||||||
|
module DbCommon
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set RHOSTS in the +active_module+'s (or global if none) datastore from an array of addresses
|
||||||
|
#
|
||||||
|
# This stores all the addresses to a temporary file and utilizes the
|
||||||
|
# <pre>file:/tmp/filename</pre> syntax to confer the addrs. +rhosts+
|
||||||
|
# should be an Array. NOTE: the temporary file is *not* deleted
|
||||||
|
# automatically.
|
||||||
|
#
|
||||||
|
def set_rhosts_from_addrs(rhosts)
|
||||||
|
if rhosts.empty?
|
||||||
|
print_status("The list is empty, cowardly refusing to set RHOSTS")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if active_module
|
||||||
|
mydatastore = active_module.datastore
|
||||||
|
else
|
||||||
|
# if there is no module in use set the list to the global variable
|
||||||
|
mydatastore = self.framework.datastore
|
||||||
|
end
|
||||||
|
|
||||||
|
if rhosts.length > 5
|
||||||
|
# Lots of hosts makes 'show options' wrap which is difficult to
|
||||||
|
# read, store to a temp file
|
||||||
|
rhosts_file = Rex::Quickfile.new("msf-db-rhosts-")
|
||||||
|
mydatastore['RHOSTS'] = 'file:'+rhosts_file.path
|
||||||
|
# create the output file and assign it to the RHOSTS variable
|
||||||
|
rhosts_file.write(rhosts.join("\n")+"\n")
|
||||||
|
rhosts_file.close
|
||||||
|
else
|
||||||
|
# For short lists, just set it directly
|
||||||
|
mydatastore['RHOSTS'] = rhosts.join(" ")
|
||||||
|
end
|
||||||
|
|
||||||
|
print_line "RHOSTS => #{mydatastore['RHOSTS']}"
|
||||||
|
print_line
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue