Path: blob/master/spec/lib/msf/base/sessions/mysql_spec.rb
19778 views
# frozen_string_literal: true12require 'spec_helper'3require 'rex/proto/mysql/client'45RSpec.describe Msf::Sessions::MySQL do6let(:client) { instance_double(::Rex::Proto::MySQL::Client) }7let(:opts) { { client: client, platform: Msf::Platform::Linux.realname, arch: ARCH_X86_64 } }8let(:console_class) { Rex::Post::MySQL::Ui::Console }9let(:user_input) { instance_double(Rex::Ui::Text::Input::Readline) }10let(:user_output) { instance_double(Rex::Ui::Text::Output::Stdio) }11let(:name) { 'mysql' }12let(:log_source) { "session_#{name}" }13let(:type) { 'mysql' }14let(:description) { 'MySQL' }15let(:can_cleanup_files) { false }16let(:address) { '192.0.2.1' }17let(:port) { 3306 }18let(:peerinfo) { "#{address}:#{port}" }19let(:current_database) { 'database_name' }2021before(:each) do22allow(user_input).to receive(:output=)23allow(user_input).to receive(:intrinsic_shell?).and_return(true)24allow(client).to receive(:peerinfo).and_return(peerinfo)25allow(client).to receive(:peerport).and_return(port)26allow(client).to receive(:peerhost).and_return(address)27allow(client).to receive(:current_database).and_return(current_database)28allow(::Rex::Proto::MySQL::Client).to receive(:connect).and_return(client)29end3031it_behaves_like 'client session'32end333435