mirror of
https://github.com/cisagov/snafflepy
synced 2026-09-24 18:22:23 +00:00
Merge pull request #27 from robert-todora/dev
Minor tweaks to output in case of error condition with downloading files
This commit is contained in:
@@ -59,10 +59,11 @@ def begin_snaffle(options):
|
||||
if not options.go_loud:
|
||||
is_interest_share(share, snaff_rules)
|
||||
files = smb_client.ls(share, "")
|
||||
|
||||
bad_name = ""
|
||||
for file in files:
|
||||
size = file.get_filesize()
|
||||
name = file.get_longname()
|
||||
bad_name = name
|
||||
file = RemoteFile(name, share, target, size)
|
||||
|
||||
if options.go_loud:
|
||||
@@ -84,12 +85,12 @@ def begin_snaffle(options):
|
||||
try:
|
||||
is_interest_file(file, snaff_rules, smb_client, share)
|
||||
except FileRetrievalError as e:
|
||||
if str(e).find("ACCESS_DENIED"):
|
||||
log.debug(f"Access Denied, cannot download \\\\{target}\\{share}\\{file}")
|
||||
# if str(e).find("ACCESS_DENIED"):
|
||||
# log.debug(f"Access Denied, cannot download \\\\{target}\\{share}\\{file}")
|
||||
continue
|
||||
|
||||
except FileListError as e:
|
||||
log.error(f"Access denied, cannot read at {share}")
|
||||
log.error(f"Access denied, cannot read at {target}\\{share}\\{bad_name}")
|
||||
continue
|
||||
|
||||
except Exception as e:
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ class SMBClient:
|
||||
subfiles = self.ls(share, str(dir_path))
|
||||
# print(list(subfiles), len(list(subfiles)))
|
||||
except FileListError as e:
|
||||
pass
|
||||
log.error(f"Access denied, cannot read at \\\\{self.server}\\{share}\\{dir_path}")
|
||||
# print(len(list(subfiles)))
|
||||
# while str(err).find("STATUS_FILE_IS_A_DIRECTORY") != -1:
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ def parse_arguments():
|
||||
syntax_error = False
|
||||
print("SnafflePy by @robert-todora")
|
||||
|
||||
# TODO - Check that if targets > 1 then "-n" needs to be set to true
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=True, prog='snaffler.py', description='A "port" of Snaffler in python')
|
||||
parser.add_argument("targets", nargs='+', type=make_targets,
|
||||
|
||||
Reference in New Issue
Block a user