Class: Rex::Post::PostgreSQL::Ui::Console

Inherits:
Object
  • Object
show all
Includes:
Sql::Ui::Console, Ui::Text::DispatcherShell
Defined in:
lib/rex/post/postgresql/ui/console.rb

Overview

This class provides a shell driven interface to the PostgreSQL client API.

Defined Under Namespace

Modules: CommandDispatcher

Instance Attribute Summary collapse

Attributes included from Ui::Text::DispatcherShell

#blocked, #busy, #dispatcher_stack

Attributes included from Ui::Text::Shell

#cont_flag, #cont_prompt, #disable_output, #framework, #hist_last_saved, #histfile, #history_manager, #input, #local_hostname, #local_username, #log_source, #name, #on_command_proc, #on_print_proc, #output, #prompt, #prompt_char, #stop_count, #stop_flag, #tab_complete_proc

Instance Method Summary collapse

Methods included from Ui::Text::DispatcherShell

#append_dispatcher, #block_command, #blocked_command?, #current_dispatcher, #destack_dispatcher, #enstack_dispatcher, #help_to_s, #remove_dispatcher, #run_command, #run_single, #shellsplitex, #tab_complete, #tab_complete_helper, #tab_complete_stub, #unblock_command, #unknown_command

Methods included from Ui::Text::Shell

#_print_prompt, #format_prompt, #get_input_line, #init_tab_complete, #init_ui, #log_input, #log_output, #parse_line, #print, #print_error, #print_good, #print_line, #print_status, #print_warning, #prompt_yesno, #reset_ui, #run, #set_log_source, #stop, #stopped?, #supports_color?, #tab_complete, #unset_log_source, #update_prompt, #with_history_manager_context

Methods included from Ui::Text::Resource

#load_resource

Methods included from Sql::Ui::Console

#current_database, #format_prompt, #help_to_s, #interact, #interact_with_client, #interact_with_client_notification, #log_error, #queue_cmd, #run_command, #sql_prompt

Methods included from SessionCompatibleModules

#format_session_compatible_modules, #session_compatible_modules

Constructor Details

#initialize(session) ⇒ Console

Initialize the PostgreSQL console.

Parameters:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rex/post/postgresql/ui/console.rb', line 27

def initialize(session)
  # The postgresql client context
  self.session = session
  self.client = session.client
  prompt = "%undPostgreSQL @ #{client.peerinfo} (#{current_database})%clr"
  history_manager = Msf::Config.postgresql_session_history
  super(prompt, '>', history_manager, nil, :postgresql)

  # Queued commands array
  self.commands = []

  # Point the input/output handles elsewhere
  reset_ui

  enstack_dispatcher(::Rex::Post::PostgreSQL::Ui::Console::CommandDispatcher::Core)
  enstack_dispatcher(::Rex::Post::PostgreSQL::Ui::Console::CommandDispatcher::Client)
  enstack_dispatcher(Msf::Ui::Console::CommandDispatcher::LocalFileSystem)

  # Set up logging to whatever logsink 'core' is using
  if ! $dispatcher['postgresql']
    $dispatcher['postgresql'] = $dispatcher['core']
  end
end

Instance Attribute Details

#clientPostgreSQL::Client

Returns:

  • (PostgreSQL::Client)


55
56
57
# File 'lib/rex/post/postgresql/ui/console.rb', line 55

def client
  @client
end

#commandsObject (protected)

:nodoc:



60
61
62
# File 'lib/rex/post/postgresql/ui/console.rb', line 60

def commands
  @commands
end

#sessionMsf::Sessions::PostgreSQL



52
53
54
# File 'lib/rex/post/postgresql/ui/console.rb', line 52

def session
  @session
end