Fixes #157. Patches from egypt@nmt.edu
git-svn-id: file:///home/svn/framework3/trunk@5137 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
5d1bf914bf
commit
6f79e14c91
|
@ -260,6 +260,10 @@ class Console::CommandDispatcher::Core
|
|||
return true
|
||||
end
|
||||
|
||||
def cmd_use_tabs(str, words)
|
||||
return []
|
||||
end
|
||||
|
||||
#
|
||||
# Reads data from a channel.
|
||||
#
|
||||
|
@ -314,6 +318,21 @@ class Console::CommandDispatcher::Core
|
|||
end
|
||||
end
|
||||
|
||||
def cmd_run_tabs(str, words)
|
||||
if(not words[1] or not words[1].match(/^\//))
|
||||
begin
|
||||
my_directory = Msf::Config.script_directory + ::File::SEPARATOR + "meterpreter"
|
||||
return ::Dir.new(my_directory).find_all { |e|
|
||||
path = my_directory + ::File::SEPARATOR + e
|
||||
::File.file?(path) and ::File.readable?(path)
|
||||
}.map { |e|
|
||||
e.sub!(/\.rb$/, '')
|
||||
}
|
||||
rescue Exception
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Writes data to a channel.
|
||||
#
|
||||
|
@ -396,6 +415,29 @@ class Console::CommandDispatcher::Core
|
|||
return true
|
||||
end
|
||||
|
||||
#
|
||||
# Provide command-specific tab completion
|
||||
# Stolen directly from msf/ui/console/command_dispatcher/core.rb
|
||||
# perhaps this should be moved into rex/ui/text/dispatcher_shell.rb ?
|
||||
#
|
||||
def tab_complete_helper(str, words)
|
||||
items = []
|
||||
|
||||
# Is the user trying to tab complete one of our commands?
|
||||
if (commands.include?(words[0]))
|
||||
if (self.respond_to?('cmd_'+words[0]+'_tabs'))
|
||||
res = self.send('cmd_'+words[0]+'_tabs', str, words)
|
||||
return nil if res.nil?
|
||||
items.concat(res)
|
||||
else
|
||||
# Avoid the default completion list for known commands
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
return items
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
attr_accessor :extensions # :nodoc:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##
|
||||
# $Id:$
|
||||
# $Id$
|
||||
##
|
||||
|
||||
##
|
||||
|
|
|
@ -15,9 +15,9 @@ class Plugin::DBMySQL < Msf::Plugin
|
|||
|
||||
|
||||
#
|
||||
# Command dispatcher for configuring Postgres
|
||||
# Command dispatcher for configuring Mysql
|
||||
#
|
||||
class PostgresCommandDispatcher
|
||||
class MysqlCommandDispatcher
|
||||
include Msf::Ui::Console::CommandDispatcher
|
||||
|
||||
#
|
||||
|
@ -207,7 +207,7 @@ class Plugin::DBMySQL < Msf::Plugin
|
|||
|
||||
def initialize(framework, opts)
|
||||
super
|
||||
add_console_dispatcher(PostgresCommandDispatcher)
|
||||
add_console_dispatcher(MysqlCommandDispatcher)
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue