Module: Msf::Auxiliary::CommandShell
- Includes:
- Sessions::CommandShellOptions
- Defined in:
- lib/msf/core/auxiliary/command_shell.rb
Overview
This module provides methods for scanning modules that yield Command Shell sessions.
Defined Under Namespace
Modules: CRLFLineEndings
Instance Method Summary collapse
Methods included from Sessions::CommandShellOptions
Instance Method Details
#start_session(obj, info, ds_merge, crlf = false, sock = nil, sess = nil) ⇒ Object
[View source]
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/msf/core/auxiliary/command_shell.rb', line 32 def start_session(obj, info, ds_merge, crlf = false, sock = nil, sess = nil) if crlf # Windows telnet server requires \r\n line endings and it doesn't # seem to affect anything else. obj.sock.extend(CRLFLineEndings) end sock ||= obj.respond_to?(:sock) ? obj.sock : nil sess ||= Msf::Sessions::CommandShell.new(sock) sess.set_from_exploit(obj) # Clean up the stored data sess.exploit_datastore.merge!(ds_merge) # Prevent the socket from being closed obj.sockets.delete(sock) if sock obj.sock = nil if obj.respond_to?(:sock) framework.sessions.register(sess) if sess.respond_to?(:bootstrap) sess.bootstrap(datastore) return unless sess.alive end sess.process_autoruns(datastore) sess.info = info unless info.blank? # Notify the framework that we have a new session opening up... # Don't let errant event handlers kill our session begin framework.events.on_session_open(sess) rescue ::Exception => e wlog("Exception in on_session_open event handler: #{e.class}: #{e}") wlog("Call Stack\n#{e.backtrace.join("\n")}") end sess end |