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/mysql/ui/console.rb
Views: 11788
# -*- coding: binary -*-12require 'rex/post/sql/ui/console'34module Rex5module Post6module MySQL7module Ui89# This class provides a shell driven interface to the MySQL client API.10class Console11include Rex::Post::Sql::Ui::Console12include Rex::Ui::Text::DispatcherShell1314# Dispatchers15require 'rex/post/mysql/ui/console/command_dispatcher'16require 'rex/post/mysql/ui/console/command_dispatcher/core'17require 'rex/post/mysql/ui/console/command_dispatcher/client'1819# Initialize the MySQL console.20#21# @param [Msf::Sessions::MySQL] session22def initialize(session)23# The mysql client context24self.session = session25self.client = session.client26prompt = "%undMySQL @ #{client.peerinfo} (#{current_database})%clr"27history_file = Msf::Config.history_file_for_session_type(session_type: session.type, interactive: false)28super(prompt, '>', history_file, nil, :mysql)2930# Queued commands array31self.commands = []3233# Point the input/output handles elsewhere34reset_ui3536enstack_dispatcher(::Rex::Post::MySQL::Ui::Console::CommandDispatcher::Core)37enstack_dispatcher(::Rex::Post::MySQL::Ui::Console::CommandDispatcher::Client)38enstack_dispatcher(Msf::Ui::Console::CommandDispatcher::LocalFileSystem)3940# Set up logging to whatever logsink 'core' is using41if ! $dispatcher['mysql']42$dispatcher['mysql'] = $dispatcher['core']43end44end4546# @return [Msf::Sessions::MySQL]47attr_reader :session4849# @return [MySQL::Client]50attr_reader :client5152protected5354attr_writer :session, :client # :nodoc:55attr_accessor :commands # :nodoc:56end57end58end59end60end616263