Path: blob/master/spec/lib/msf/base/sessions/ldap_spec.rb
19721 views
# frozen_string_literal: true12require 'spec_helper'34RSpec.describe Msf::Sessions::LDAP do5let(:client) { instance_double(Rex::Proto::LDAP::Client) }6let(:opts) { { client: client, keepalive_seconds: 600 } }7let(:console_class) { Rex::Post::LDAP::Ui::Console }8let(:user_input) { instance_double(Rex::Ui::Text::Input::Readline) }9let(:user_output) { instance_double(Rex::Ui::Text::Output::Stdio) }10let(:name) { 'name' }11let(:log_source) { "session_#{name}" }12let(:type) { 'ldap' }13let(:description) { 'LDAP' }14let(:can_cleanup_files) { false }15let(:address) { '192.0.2.1' }16let(:port) { 1337 }17let(:peer_info) { "#{address}:#{port}" }1819before(:each) do20allow(user_input).to receive(:intrinsic_shell?).and_return(true)21allow(user_input).to receive(:output=)22allow(client).to receive(:peerinfo).and_return(peer_info)23allow(client).to receive(:peerhost).and_return(address)24allow(client).to receive(:peerport).and_return(port)25allow(client).to receive(:ldapwhoami).and_return("u:WORKGROUP\\Administrator")26end2728it_behaves_like 'client session'29end303132