Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/rex/post/postgresql/ui/console.rb
Views: 11789
# -*- coding: binary -*-12require 'rex/post/sql/ui/console'34module Rex5module Post6module PostgreSQL7module Ui8###9#10# This class provides a shell driven interface to the PostgreSQL client API.11#12###13class Console14include Rex::Post::Sql::Ui::Console15include Rex::Ui::Text::DispatcherShell1617# Dispatchers18require 'rex/post/postgresql/ui/console/command_dispatcher'19require 'rex/post/postgresql/ui/console/command_dispatcher/core'20require 'rex/post/postgresql/ui/console/command_dispatcher/client'2122#23# Initialize the PostgreSQL console.24#25# @param [Msf::Sessions::PostgreSQL] session26def initialize(session)27# The postgresql client context28self.session = session29self.client = session.client30prompt = "%undPostgreSQL @ #{client.peerinfo} (#{current_database})%clr"31history_file = Msf::Config.history_file_for_session_type(session_type: session.type, interactive: false)32super(prompt, '>', history_file, nil, :postgresql)3334# Queued commands array35self.commands = []3637# Point the input/output handles elsewhere38reset_ui3940enstack_dispatcher(::Rex::Post::PostgreSQL::Ui::Console::CommandDispatcher::Core)41enstack_dispatcher(::Rex::Post::PostgreSQL::Ui::Console::CommandDispatcher::Client)42enstack_dispatcher(Msf::Ui::Console::CommandDispatcher::LocalFileSystem)4344# Set up logging to whatever logsink 'core' is using45if ! $dispatcher['postgresql']46$dispatcher['postgresql'] = $dispatcher['core']47end48end4950# @return [Msf::Sessions::PostgreSQL]51attr_reader :session5253# @return [PostgreSQL::Client]54attr_reader :client # :nodoc:5556protected5758attr_writer :session, :client # :nodoc:59attr_accessor :commands # :nodoc:60end61end62end63end64end656667