Skip to content

Commit

Permalink
Land rapid7#19731, new feature for recognizing broken SMB session and…
Browse files Browse the repository at this point in the history
… managing them
  • Loading branch information
msutovsky-r7 committed Dec 23, 2024
2 parents 6eb2f61 + 40f2eaa commit 789f7cf
Show file tree
Hide file tree
Showing 16 changed files with 226 additions and 204 deletions.
10 changes: 8 additions & 2 deletions lib/msf/base/sessions/smb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Msf::Sessions::SMB
# @option opts [RubySMB::Client] :client
def initialize(rstream, opts = {})
@client = opts.fetch(:client)
@simple_client = ::Rex::Proto::SMB::SimpleClient.new(client.dispatcher.tcp_socket, client: client)
@simple_client = ::Rex::Proto::SMB::SimpleClient.new(client.dispatcher.tcp_socket, client: client, msf_session: self)
self.console = Rex::Post::SMB::Ui::Console.new(self)
super(rstream, opts)
end
Expand Down Expand Up @@ -53,6 +53,13 @@ def process_autoruns(datastore)
end
end

def verify_connectivity
@client.dispatcher.tcp_socket.peerinfo
rescue Errno::ENOTCONN
self.kill
raise
end

def type
self.class.type
end
Expand Down Expand Up @@ -140,5 +147,4 @@ def _interact_stream
# the EOFError so we can drop this handle like a bad habit.
raise EOFError if (console.stopped? == true)
end

end
Loading

0 comments on commit 789f7cf

Please sign in to comment.