From 9e2a4839772366e051239d4cbd3c190b328be763 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Wed, 12 Mar 2014 17:07:27 +0000 Subject: [PATCH] Add example usage to Msf::Exploit::Remote::SMBFileServer documentation --- lib/msf/core/exploit/smb.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/msf/core/exploit/smb.rb b/lib/msf/core/exploit/smb.rb index 05c31881b9..fddc9d069d 100644 --- a/lib/msf/core/exploit/smb.rb +++ b/lib/msf/core/exploit/smb.rb @@ -795,6 +795,7 @@ end # from a network share. # # Author: Matthew Hall +# ## module Exploit::Remote::SMBFileServer @@ -812,6 +813,10 @@ module Exploit::Remote::SMBFileServer @server = nil end + # Clean up + # + # This will stop the SMB file server instance when handler is called + # @return [void] def cleanup begin super @@ -820,6 +825,8 @@ module Exploit::Remote::SMBFileServer end end + ## + # # Start the SMBFileServer # # @param unc [String] The UNC path to expose by the server: @@ -830,6 +837,19 @@ module Exploit::Remote::SMBFileServer # ie. myfile.extension # @return [void] # @raise [RuntimeError] + # + # Example Usage: + # include Msf::Exploit::Remote::SMBFileServer + # exe = generate_payload_dll + # @exe_file = rand_text_alpha(7) + ".dll" + # @share = rand_text_alpha(5) + # my_host = datastore['SRVHOST'] + # @unc = "\\\\#{my_host}\\#{@share}\\#{@exe_file}" + # start_smb_server(@unc, exe, @exe_file) + # // Inject DLL + # handler + # + ## def start_smb_server(unc, contents, exe_file) @server.stop if @server vprint_status("Starting SMB Server on " + datastore['SRVHOST'].to_s + ":" + datastore['SRVPORT'].to_s)