Repository navigation
Expand file tree
/
Copy pathgithub2email.py
More file actions
41 lines (36 loc) · 1.44 KB
/
Copy pathgithub2email.py
File metadata and controls
41 lines (36 loc) · 1.44 KB
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
import requests, click, re
from colorama import Fore as f
@click.command()
@click.argument("username")
def findemail(username):
click.echo(f.GREEN +
r"""
______ _ _ _ ______ _______ _ _
/ _____|_)_ | | | | (_____ \(_______) (_) |
| / ___ _| |_ | | _ _ _| | _ ____) )_____ ____ ____ _| |
| | (___) | _)| || \| | | | || \/_____/| ___) | \ / _ | | |
| \____/| | |__| | | | |_| | |_) )______| |_____| | | ( ( | | | |
\_____/|_|\___)_| |_|\____|____(_______)_______)_|_|_|\_||_|_|_|
Find the email address of a github user.
""")
try:
# Fetch repos
repos = requests.get(f"https://api.github.com/users/{username}/repos").json()
for repo in repos:
# Fetch Commits
commits = requests.get(
f"https://api.github.com/repos/{username}/{repo['name']}/commits"
).json()
for commit in commits:
# Fetch the author of the commit
author = commit.get("author")
# If the author is the target
if author["login"].lower() == username.lower():
# Fetch email
email = commit["commit"]["author"].get("email")
if email:
print(f.GREEN + "[+] Public email:", email)
except Exception as e:
print(f.RED + "[!] ERROR", e)
if __name__ == "__main__":
findemail()