mirror of
https://github.com/p0dalirius/pyFindUncommonShares
synced 2026-08-09 13:02:16 +00:00
[enhancement] Add output option for UNC path to stdout (#38)
* add default output of share in unc path form (copy/paste) * add option to activate unc path output
This commit is contained in:
+10
-2
@@ -423,6 +423,7 @@ def parseArgs():
|
||||
parser = argparse.ArgumentParser(add_help=True, description="Find uncommon SMB shares on remote machines.")
|
||||
|
||||
parser.add_argument("-v", "--verbose", action="store_true", help="Verbose mode. (default: False).")
|
||||
parser.add_argument("--print-unc", action="store_true", default=False, help="Print the corresponding UNC path.")
|
||||
|
||||
parser.add_argument("-q", "--quiet", dest="quiet", action="store_true", default=False, help="Show no information at all.")
|
||||
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):
|
||||
else:
|
||||
# Default uncolored print
|
||||
print("[>] Found '%s' on '%s' (comment: '%s') %s" % (shareData["share"]["name"], shareData["computer"]["fqdn"], shareData["share"]["comment"], str_access))
|
||||
|
||||
if options.print_unc:
|
||||
print(f"[>] \\\\{shareData['computer']['fqdn']}\\{shareData['share']['name']}")
|
||||
|
||||
# Share has no comment
|
||||
else:
|
||||
@@ -580,6 +584,10 @@ def print_results(options, shareData):
|
||||
else:
|
||||
# Default uncolored print
|
||||
print("[>] Found '%s' on '%s' %s" % (shareData["share"]["name"], shareData["computer"]["fqdn"], str_access))
|
||||
|
||||
if options.print_unc:
|
||||
print(f"[>] \\\\{shareData['computer']['fqdn']}\\{shareData['share']['name']}")
|
||||
|
||||
else:
|
||||
# Quiet mode, do not print anything
|
||||
pass
|
||||
@@ -731,14 +739,14 @@ def worker(options, target, domain, username, password, lmhash, nthash, results,
|
||||
|
||||
shareData = {
|
||||
"computer": {
|
||||
"fqdn": target_ip,
|
||||
"fqdn": target_name,
|
||||
"ip": target_ip
|
||||
},
|
||||
"share": {
|
||||
"name": sharename,
|
||||
"comment": sharecomment,
|
||||
"hidden": (True if sharename.endswith('$') else False),
|
||||
"uncpath": "\\".join(['', '', target_ip, sharename, '']),
|
||||
"uncpath": "\\".join(['', '', target_name, sharename, '']),
|
||||
"type": {
|
||||
"stype_value": sharetype,
|
||||
"stype_flags": STYPE_MASK(sharetype)
|
||||
|
||||
Reference in New Issue
Block a user