@@ -423,6 +423,7 @@ def parseArgs():
423423 parser = argparse .ArgumentParser (add_help = True , description = "Find uncommon SMB shares on remote machines." )
424424
425425 parser .add_argument ("-v" , "--verbose" , action = "store_true" , help = "Verbose mode. (default: False)." )
426+ parser .add_argument ("--print-unc" , action = "store_true" , default = False , help = "Print the corresponding UNC path." )
426427
427428 parser .add_argument ("-q" , "--quiet" , dest = "quiet" , action = "store_true" , default = False , help = "Show no information at all." )
428429 parser .add_argument ("--debug" , dest = "debug" , action = "store_true" , default = False , help = "Debug mode. (default: False)." )
@@ -561,6 +562,9 @@ def print_results(options, shareData):
561562 else :
562563 # Default uncolored print
563564 print ("[>] Found '%s' on '%s' (comment: '%s') %s" % (shareData ["share" ]["name" ], shareData ["computer" ]["fqdn" ], shareData ["share" ]["comment" ], str_access ))
565+
566+ if options .print_unc :
567+ print (f"[>] \\ \\ { shareData ['computer' ]['fqdn' ]} \\ { shareData ['share' ]['name' ]} " )
564568
565569 # Share has no comment
566570 else :
@@ -580,6 +584,10 @@ def print_results(options, shareData):
580584 else :
581585 # Default uncolored print
582586 print ("[>] Found '%s' on '%s' %s" % (shareData ["share" ]["name" ], shareData ["computer" ]["fqdn" ], str_access ))
587+
588+ if options .print_unc :
589+ print (f"[>] \\ \\ { shareData ['computer' ]['fqdn' ]} \\ { shareData ['share' ]['name' ]} " )
590+
583591 else :
584592 # Quiet mode, do not print anything
585593 pass
@@ -731,14 +739,14 @@ def worker(options, target, domain, username, password, lmhash, nthash, results,
731739
732740 shareData = {
733741 "computer" : {
734- "fqdn" : target_ip ,
742+ "fqdn" : target_name ,
735743 "ip" : target_ip
736744 },
737745 "share" : {
738746 "name" : sharename ,
739747 "comment" : sharecomment ,
740748 "hidden" : (True if sharename .endswith ('$' ) else False ),
741- "uncpath" : "\\ " .join (['' , '' , target_ip , sharename , '' ]),
749+ "uncpath" : "\\ " .join (['' , '' , target_name , sharename , '' ]),
742750 "type" : {
743751 "stype_value" : sharetype ,
744752 "stype_flags" : STYPE_MASK (sharetype )
0 commit comments