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/mssql/ui/console.rb
Views: 11789
# -*- coding: binary -*-12require 'rex/post/sql/ui/console'34module Rex5module Post6module MSSQL7module Ui8###9#10# This class provides a shell driven interface to the MSSQL client API.11#12###13class Console14include Rex::Post::Sql::Ui::Console15include Rex::Ui::Text::DispatcherShell1617# Dispatchers18require 'rex/post/mssql/ui/console/command_dispatcher'19require 'rex/post/mssql/ui/console/command_dispatcher/core'20require 'rex/post/mssql/ui/console/command_dispatcher/client'2122#23# Initialize the MSSQL console.24#25# @param [Msf::Sessions::MSSQL] session26def initialize(session, opts={})27# The mssql client context28self.session = session29self.client = session.client30envchange = ::Rex::Proto::MSSQL::ClientMixin::ENVCHANGE31prompt = "%undMSSQL @ #{client.peerinfo} (#{client.initial_info_for_envchange(envchange: envchange::DATABASE)[:new]})%clr"32history_file = Msf::Config.history_file_for_session_type(session_type: session.type, interactive: false)33super(prompt, '>', history_file, nil, :mssql)3435# Queued commands array36self.commands = []3738# Point the input/output handles elsewhere39reset_ui4041enstack_dispatcher(::Rex::Post::MSSQL::Ui::Console::CommandDispatcher::Core)42enstack_dispatcher(::Rex::Post::MSSQL::Ui::Console::CommandDispatcher::Client)43enstack_dispatcher(Msf::Ui::Console::CommandDispatcher::LocalFileSystem)4445# Set up logging to whatever logsink 'core' is using46if ! $dispatcher['mssql']47$dispatcher['mssql'] = $dispatcher['core']48end49end5051# @return [Msf::Sessions::MSSQL]52attr_reader :session5354# @return [MSSQL::Client]55attr_reader :client5657protected5859attr_writer :session, :client # :nodoc:60attr_accessor :commands # :nodoc:61end62end63end64end65end666768