CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/lib/msf/base/sessions/ldap_spec.rb
Views: 11766
1
# frozen_string_literal: true
2
3
require 'spec_helper'
4
5
RSpec.describe Msf::Sessions::LDAP do
6
let(:client) { instance_double(Rex::Proto::LDAP::Client) }
7
let(:opts) { { client: client, keepalive_seconds: 600 } }
8
let(:console_class) { Rex::Post::LDAP::Ui::Console }
9
let(:user_input) { instance_double(Rex::Ui::Text::Input::Readline) }
10
let(:user_output) { instance_double(Rex::Ui::Text::Output::Stdio) }
11
let(:name) { 'name' }
12
let(:log_source) { "session_#{name}" }
13
let(:type) { 'ldap' }
14
let(:description) { 'LDAP' }
15
let(:can_cleanup_files) { false }
16
let(:address) { '192.0.2.1' }
17
let(:port) { 1337 }
18
let(:peer_info) { "#{address}:#{port}" }
19
20
before(:each) do
21
allow(user_input).to receive(:intrinsic_shell?).and_return(true)
22
allow(user_input).to receive(:output=)
23
allow(client).to receive(:peerinfo).and_return(peer_info)
24
allow(client).to receive(:peerhost).and_return(address)
25
allow(client).to receive(:peerport).and_return(port)
26
end
27
28
it_behaves_like 'client session'
29
end
30
31