-
Notifications
You must be signed in to change notification settings - Fork 26
/
password-recon.py
42 lines (35 loc) · 1.46 KB
/
password-recon.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import requests
import sys
import json
def main():
if len(sys.argv) != 4:
print("Usage: python password-recon.py [TARGET-DOMAIN] [USERNAME] [API-KEY]")
print("Note: Requires an active DeHashed.com account and API Key")
print("Author: Tyler Ramsbey from Hack Smarter - https://hacksmarter.org")
return
target_domain = sys.argv[1]
username = sys.argv[2]
apikey = sys.argv[3]
url = f"https://api.dehashed.com/search?query=domain:{target_domain}&size=10000"
headers = {
"Accept": "application/json"
}
auth = (username, apikey)
try:
response = requests.get(url, headers=headers, auth=auth)
response.raise_for_status()
data = response.json()
if "entries" in data and data["entries"]:
entries = data["entries"]
filtered_entries = [entry for entry in entries if entry.get("email") and entry.get("password")]
formatted_entries = [f"{entry['email']}:{entry['password']}" for entry in filtered_entries]
unique_entries = sorted(set(formatted_entries))
with open("emails_passwords.txt", "w") as file:
file.write("\n".join(unique_entries))
print("Results saved to emails_passwords.txt")
else:
print("The target domain does not have any dehashed results.")
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
main()