Module: Rex::Ui::Subscriber

Includes:
Input, Output
Included in:
Msf::Module::UI, Msf::Sessions::Modem, Interactive
Defined in:
lib/rex/ui/subscriber.rb

Overview

This module provides a subscriber interface to input/output.

Defined Under Namespace

Modules: Input, Output

Instance Attribute Summary

Attributes included from Input

#user_input

Attributes included from Output

#user_output

Instance Method Summary collapse

Methods included from Input

#gets

Methods included from Output

#flush, #print, #print_blank_line, #print_error, #print_good, #print_line, #print_status, #print_warning

Instance Method Details

#copy_ui(subscriber) ⇒ Object

Copy the user input and output handles from the supplied subscriber.



163
164
165
# File 'lib/rex/ui/subscriber.rb', line 163

def copy_ui(subscriber)
  init_ui(subscriber.user_input, subscriber.user_output)
end

#init_ui(input = nil, output = nil) ⇒ Object

Sets the input and output handles.



129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/rex/ui/subscriber.rb', line 129

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

#reset_uiObject

Disables input/output



146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/rex/ui/subscriber.rb', line 146

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