Skip to content

Commit

Permalink
Fix minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Mchoji committed Jun 17, 2021
1 parent 449e120 commit 14be8aa
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions o365creeper-ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@
'email': args.email,
'timeout': args.timeout,
'retry': args.retry,
'url': 'https://login.microsoftonline.com/common/GetCredentialType',
}

url = 'https://login.microsoftonline.com/common/GetCredentialType'


def check_email(
url: str,
Expand Down Expand Up @@ -169,7 +168,7 @@ def need_retry(status: dict) -> bool:
return status['throttle'] or status['error']


def retry(config: Dict) -> None:
def retry(email: str, config: Dict) -> None:
n = config['retry']
while (n > 0):
# generate new circuit
Expand All @@ -180,7 +179,7 @@ def retry(config: Dict) -> None:
# TODO: validates auth and try other methods
c.signal(Signal.NEWNYM)

new_check = check_email(url, email, config['tor'], config['timeout'])
new_check = check_email(config['url'], email, config['tor'], config['timeout'])
if need_retry(new_check):
n -= 1
else:
Expand Down Expand Up @@ -210,14 +209,13 @@ def validate_result(
check_res: Dict,
email: str,
config: Dict,
url: str,
) -> None:
"""
Validate results and redo if necessary
"""
# is endpoint throttling requests or some error occured?
if need_retry(check_res):
retry(config)
retry(email, config)
# response was not throttled
else:
# is valid email?
Expand All @@ -237,13 +235,13 @@ def main():
with config['files']['input'].open() as file:
for line in file:
email = line.strip()
checked = check_email(url, email, config['tor'], config['timeout'])
validate_result(checked, email, config, url)
checked = check_email(config['url'], email, config['tor'], config['timeout'])
validate_result(checked, email, config)

elif config.email is not None:
email = config.email
checked = check_email(url, email, config['tor'], config['timeout'])
validate_result(checked, email, config, url)
checked = check_email(config['url'], email, config['tor'], config['timeout'])
validate_result(checked, email, config)


if __name__ == "__main__":
Expand Down

0 comments on commit 14be8aa

Please sign in to comment.