mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
Split filepath and count in credential module
This commit is contained in:
parent
4895ee9fa2
commit
90e1b25426
1 changed files with 10 additions and 4 deletions
|
@ -13,18 +13,24 @@ if __name__ == "__main__":
|
||||||
p = Process(config_section)
|
p = Process(config_section)
|
||||||
publisher.info("Find credentials")
|
publisher.info("Find credentials")
|
||||||
|
|
||||||
critical = 10
|
critical = 8
|
||||||
|
|
||||||
regex_web = "/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/"
|
regex_web = "/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/"
|
||||||
regex_cred = "[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}:[a-zA-Z0-9\_\-]+"
|
regex_cred = "[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}:[a-zA-Z0-9\_\-]+"
|
||||||
while True:
|
while True:
|
||||||
filepath = p.get_from_set()
|
message = p.get_from_set()
|
||||||
if filepath is None:
|
if message is None:
|
||||||
publisher.debug("Script Credential is Idling 10s")
|
publisher.debug("Script Credential is Idling 10s")
|
||||||
print('Sleeping')
|
print('Sleeping')
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
filepath, count = message.split()
|
||||||
|
|
||||||
|
if count < 5:
|
||||||
|
# Less than 5 matches from the top password list, false positive.
|
||||||
|
continue
|
||||||
|
|
||||||
paste = Paste.Paste(filepath)
|
paste = Paste.Paste(filepath)
|
||||||
content = paste.get_p_content()
|
content = paste.get_p_content()
|
||||||
creds = set(re.findall(regex_cred, content))
|
creds = set(re.findall(regex_cred, content))
|
||||||
|
@ -42,7 +48,7 @@ if __name__ == "__main__":
|
||||||
print('\n '.join(creds))
|
print('\n '.join(creds))
|
||||||
|
|
||||||
if len(creds) > critical:
|
if len(creds) > critical:
|
||||||
print("========> Found more than 10 credentials on this file : {}".format(filepath))
|
print("========> Found more than 10 credentials in this file : {}".format(filepath))
|
||||||
publisher.warning(to_print)
|
publisher.warning(to_print)
|
||||||
if sites:
|
if sites:
|
||||||
print("=======> Probably on : {}".format(', '.join(sites)))
|
print("=======> Probably on : {}".format(', '.join(sites)))
|
||||||
|
|
Loading…
Reference in a new issue