Readline mode disabledby defualt for interactive sessios

Fixed an issue with exploit.rb directly running a session command after the session command had been renamed



git-svn-id: file:///home/svn/framework3/trunk@3774 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2006-07-29 23:01:38 +00:00
parent 817c4c189f
commit a2592959c3
2 changed files with 22 additions and 6 deletions

View File

@ -138,7 +138,7 @@ class Exploit
if (bg == false and session.interactive?)
print_line
driver.run_single("session -q -i #{session.sid}")
driver.run_single("sessions -q -i #{session.sid}")
# Otherwise, log that we created a session
else
print_status("Session #{session.sid} created in the background.")

View File

@ -16,10 +16,20 @@ begin
class Input::Readline < Rex::Ui::Text::Input
include ::Readline
@@rl_thread = nil
@@rl_pipes = nil
@@rl_prompt = ''
@@rl_history = true;
@@rl_thread = nil
@@rl_pipes = nil
@@rl_prompt = ''
@@rl_history = true
#
# Enable readline mode by setting rl_usestdio to false
# Address the following items before switching:
#
# XXX: Find a way to emulate ^Z when in readline mode
# XXX: Create histories/tab completion for shells
# XXX: Capture remote shell prompt and use for readline
#
@@rl_usestdio = true
#
# Initializes the readline-aware Input instance for text.
@ -35,6 +45,7 @@ begin
# Start the readline thread
#
def readline_start
return if @@rl_usestdio
return if @@rl_thread
@@rl_pipes = Rex::Compat.pipe
@@rl_thread = ::Thread.new do
@ -84,6 +95,8 @@ begin
# Calls sysread on the standard input handle.
#
def sysread(len = 1)
return $stdin.sysread(len) if @@rl_usestdio
if (! readline_status)
$stderr.puts "ERROR: sysread() called outside of thread mode: " + caller(1).to_s
return ''
@ -95,6 +108,8 @@ begin
# Fake gets using readline
#
def gets()
return $stdin.gets() if @@rl_usestdio
if (! readline_status)
$stderr.puts "ERROR: gets() called outside of thread mode: " + caller(1).to_s
return ''
@ -113,7 +128,6 @@ begin
#
# Prompt-based getline using readline.
# XXX: Incompatible with thread mode
#
def pgets
if (readline_status)
@ -134,6 +148,8 @@ begin
# Returns the output pipe handle
#
def fd
return $stdin if @@rl_usestdio
if (! readline_status)
$stderr.puts "fd called outside of thread mode: " + caller(1).to_s
return ''