Swap around rbreadline - load it by default, but also allow the old readline with the -L (--real-readline) parameter to msfconsole. This also fixes absolute path handling for msfconsole command passthrough
git-svn-id: file:///home/svn/framework3/trunk@7115 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
45372a6870
commit
35fcf8c2b2
|
@ -46,14 +46,26 @@ class Driver < Msf::Ui::Driver
|
|||
# Whether or not unknown commands should be passed through and executed by
|
||||
# the local system.
|
||||
#
|
||||
# RealReadline
|
||||
#
|
||||
# Whether or to use the system Readline or the RBReadline (default)
|
||||
#
|
||||
def initialize(prompt = DefaultPrompt, prompt_char = DefaultPromptChar, opts = {})
|
||||
|
||||
if (Rex::Compat.is_windows())
|
||||
# Disable the color support
|
||||
prompt = "msf"
|
||||
prompt_char = ">"
|
||||
# Choose a readline library before calling the parent
|
||||
rl = false
|
||||
begin
|
||||
if(opts['RealReadline'])
|
||||
require 'readline'
|
||||
rl = true
|
||||
end
|
||||
rescue ::LoadError
|
||||
end
|
||||
|
||||
# Default to the RbReadline wrapper
|
||||
require 'readline_compatible' if(not rl)
|
||||
|
||||
|
||||
# Call the parent
|
||||
super(prompt, prompt_char)
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ module Readline
|
|||
raise IOError, "stdin closed"
|
||||
end
|
||||
|
||||
RbReadline.rl_instream = $stdin
|
||||
RbReadline.rl_instream = $stdin
|
||||
RbReadline.rl_outstream = $stdout
|
||||
|
||||
status = 0
|
|
@ -16,6 +16,12 @@ module FileUtils
|
|||
# a fully qualified path to the supplied file name.
|
||||
#
|
||||
def self.find_full_path(file_name)
|
||||
|
||||
# Check for the absolute fast first
|
||||
if (file_name[0,1] == "/" and ::File::Stat.new(file_name))
|
||||
return file_name
|
||||
end
|
||||
|
||||
path = Rex::Compat.getenv('PATH')
|
||||
if (path)
|
||||
path.split(::File::PATH_SEPARATOR).each { |base|
|
||||
|
|
|
@ -5,7 +5,6 @@ module Ui
|
|||
module Text
|
||||
|
||||
begin
|
||||
require 'readline'
|
||||
|
||||
###
|
||||
#
|
||||
|
@ -14,12 +13,24 @@ begin
|
|||
#
|
||||
###
|
||||
class Input::Readline < Rex::Ui::Text::Input
|
||||
include ::Readline
|
||||
|
||||
#
|
||||
# Initializes the readline-aware Input instance for text.
|
||||
#
|
||||
def initialize(tab_complete_proc = nil)
|
||||
|
||||
|
||||
if(not Object.const_defined?('Readline'))
|
||||
$stderr.puts "TRYING TO FIGURE OUT WHICH READLINE LIBRARY: #{caller}"
|
||||
begin
|
||||
require 'readline'
|
||||
rescue ::LoadError
|
||||
require 'readline_compat'
|
||||
end
|
||||
end
|
||||
|
||||
self.extend(::Readline)
|
||||
|
||||
if (tab_complete_proc)
|
||||
::Readline.basic_word_break_characters = "\x00"
|
||||
::Readline.completion_proc = tab_complete_proc
|
||||
|
|
|
@ -57,6 +57,11 @@ class OptsConsole
|
|||
options['Version'] = true
|
||||
end
|
||||
|
||||
# Boolean switch.
|
||||
opts.on("-L", "--real-readline", "Use the system Readline library instead of RbReadline") do |v|
|
||||
options['RealReadline'] = true
|
||||
end
|
||||
|
||||
opts.separator ""
|
||||
opts.separator "Common options:"
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env
|
||||
|
||||
$:.unshift(File.join(File.expand_path(File.dirname(__FILE__))), '..', 'lib')
|
||||
|
||||
require 'rex'
|
||||
require 'msf/core'
|
Loading…
Reference in New Issue