Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/msf/base/sessions/hwbridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ def info
# Initializes the console's I/O handles.
#
def init_ui(input, output)
self.user_input = input
self.user_output = output
super

console.init_ui(input, output)
console.set_log_source(log_source)

super
end

##
# :category: Msf::Session::Interactive implementors
#
# Resets the console's I/O handles.
# Does not call super - the session preserves its own user_input/user_output
# while only resetting the console's I/O.
#
def reset_ui
console.unset_log_source
Expand Down
8 changes: 4 additions & 4 deletions lib/msf/base/sessions/ldap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,18 @@ def port
# Initializes the console's I/O handles.
#
def init_ui(input, output)
self.user_input = input
self.user_output = output
super

console.init_ui(input, output)
console.set_log_source(log_source)

super
end

##
# :category: Msf::Session::Interactive implementors
#
# Resets the console's I/O handles.
# Does not call super - the session preserves its own user_input/user_output
# while only resetting the console's I/O.
#
def reset_ui
console.unset_log_source
Expand Down
8 changes: 4 additions & 4 deletions lib/msf/base/sessions/meterpreter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,18 +370,18 @@ def execute_file(full_path, args)
# Initializes the console's I/O handles.
#
def init_ui(input, output)
self.user_input = input
self.user_output = output
super

console.init_ui(input, output)
console.set_log_source(log_source)

super
end

##
# :category: Msf::Session::Interactive implementors
#
# Resets the console's I/O handles.
# Does not call super - the session preserves its own user_input/user_output
# while only resetting the console's I/O.
#
def reset_ui
console.unset_log_source
Expand Down
8 changes: 4 additions & 4 deletions lib/msf/base/sessions/smb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ def port
# Initializes the console's I/O handles.
#
def init_ui(input, output)
self.user_input = input
self.user_output = output
super

console.init_ui(input, output)
console.set_log_source(log_source)

super
end

##
# :category: Msf::Session::Interactive implementors
#
# Resets the console's I/O handles.
# Does not call super - the session preserves its own user_input/user_output
# while only resetting the console's I/O.
#
def reset_ui
console.unset_log_source
Expand Down
2 changes: 2 additions & 0 deletions lib/msf/base/sessions/sql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def init_ui(input, output)
end

# Resets the console's I/O handles.
# Does not call super - the session preserves its own user_input/user_output
# while only resetting the console's I/O.
#
# @return [Object]
def reset_ui
Expand Down
18 changes: 18 additions & 0 deletions lib/rex/ui/subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ def gets
# Sets the input and output handles.
#
def init_ui(input = nil, output = nil)
# Release FDs held by Input::Buffer socket pairs
if user_input && user_input != input && user_input.respond_to?(:close)
begin
user_input.close
rescue IOError, Errno::EBADF => e
elog("init_ui: failed to close old user_input: #{e}") if defined?(elog)
end
end

self.user_input = input
self.user_output = output
end
Expand All @@ -135,6 +144,15 @@ def init_ui(input = nil, output = nil)
# Disables input/output
#
def reset_ui
# Release FDs held by Input::Buffer socket pairs
if user_input.respond_to?(:close)
begin
user_input.close
rescue IOError, Errno::EBADF => e
elog("reset_ui: failed to close user_input: #{e}") if defined?(elog)
end
end

self.user_input = nil
self.user_output = nil
end
Expand Down
Loading
Loading