minor changes

This commit is contained in:
robert-todora
2023-07-20 15:37:55 -04:00
parent 9b25831040
commit 7af52dd21d
3 changed files with 30 additions and 31 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ class Rules:
log.warning(
f"{dict_rule['RuleName']} is invalid, please check your syntax!")
# pprint.pprint(self.share_classifiers)
#pprint.pprint(self.share_classifiers)
# pprint.pprint(self.directory_classifiers)
# pprint.pprint(self.file_classifiers)
# pprint.pprint(self.contents_classifiers)
@@ -53,7 +53,7 @@ class Rules:
# TODO
def is_interest(file):
def is_interest(file, rules):
# massive_wordlist = prepare_classifiers()
# print(massive_wordlist)
# for root, dirs, files in os.walk(snafflepy_path, topdown=False):
+27 -28
View File
@@ -66,45 +66,44 @@ def begin_snaffle(options):
log.debug(f"Exception: {e}")
log.warning(f"Unable to add{target} to targets to snaffle")
continue
log.debug(f"Targets that will be snaffled: {options.targets}")
# Login via SMB
# log.info("Preparing classifiers...")
# prepare_classifiers()
if options.no_share_discovery:
try:
smb_client = SMBClient(
options.targets[0], options.username, options.password, options.domain, options.hash)
except:
log.error(f"Error logging in to SMB on {options.targets[0]}")
log.warning("[GO LOUD ACTIVATED] Enumerating all shares for all files...")
for target in options.targets:
try:
smb_client = SMBClient(
options.targets[0], options.username, options.password, options.domain, options.hash)
except:
log.error(f"Error logging in to SMB on {options.targets[0]}")
target, options.username, options.password, options.domain, options.hash)
smb_client.login()
for share in smb_client.shares:
try:
files = smb_client.ls(share, "")
if options.go_loud:
log.warning("[GO LOUD ACTIVATED] Enumerating all shares for all files...")
for target in options.targets:
try:
smb_client = SMBClient(
target, options.username, options.password, options.domain, options.hash)
smb_client.login()
for share in smb_client.shares:
try:
files = smb_client.ls(share, "")
for file in files:
# filelist.append(file)
# Ask do they want file sizes?
if options.go_loud:
log.info(f"{target}: {share}\\{file.get_longname()}")
else:
naive_classify(share, file, prepped_rules)
for file in files:
# filelist.append(file)
# Ask do they want file sizes?
log.info(f"{target} Found file in {share}: {file.get_longname()}")
# naive_classify(share, file, prepped_rules)
# log.info(f"{target} Found file in {share}: {file}")
except FileListError:
log.error(
"Access Denied, cannot list files in %s" % share)
continue
except FileListError:
log.error(
"Access Denied, cannot list files in %s" % share)
continue
except Exception as e:
log.error(f"Error creating SMBClient object, {e}")
else:
pass
except Exception as e:
log.error(f"Error creating SMBClient object, {e}")
def access_ldap_server(ip, username, password):
log.info("Accessing LDAP Server")
+1 -1
View File
@@ -42,7 +42,7 @@ class SMBClient:
for i in range(len(resp)):
sharename = resp[i]['shi1_netname'][:-1]
remarkname = resp[i]['shi1_remark'][:-1]
log.info(f'{self.server}: Found share: {sharename}, Remark: {remarkname}')
log.info(f'{self.server}: Share: {sharename}, Remark: {remarkname}')
yield sharename
except Exception as e: