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/smb_spec.rb
Views: 11766
1
# frozen_string_literal: true
2
3
require 'spec_helper'
4
5
RSpec.describe Msf::Sessions::SMB do
6
let(:rstream) { instance_double(Rex::Socket) }
7
let(:client) { instance_double(RubySMB::Client) }
8
let(:dispatcher) { instance_double(RubySMB::Dispatcher::Socket) }
9
let(:opts) { { client: client } }
10
let(:console_class) { Rex::Post::SMB::Ui::Console }
11
let(:user_input) { instance_double(Rex::Ui::Text::Input::Readline) }
12
let(:user_output) { instance_double(Rex::Ui::Text::Output::Stdio) }
13
let(:name) { 'name' }
14
let(:log_source) { "session_#{name}" }
15
let(:type) { 'smb' }
16
let(:description) { 'SMB' }
17
let(:can_cleanup_files) { false }
18
let(:address) { '192.0.2.1' }
19
let(:port) { 1337 }
20
let(:peer_info) { "#{address}:#{port}" }
21
22
before(:each) do
23
allow(user_input).to receive(:intrinsic_shell?).and_return(true)
24
allow(user_input).to receive(:output=)
25
allow(rstream).to receive(:peerinfo).and_return(peer_info)
26
allow(client).to receive(:dispatcher).and_return(dispatcher)
27
allow(dispatcher).to receive(:tcp_socket).and_return(rstream)
28
end
29
30
it_behaves_like 'client session'
31
end
32
33