Update README.md

This commit is contained in:
Richard Mwewa
2023-01-25 14:28:14 +02:00
committed by GitHub
parent 85cadefd50
commit 8bc799c829

View File

@@ -59,39 +59,36 @@ A framework for gathering open-source intelligence on GitHub users, repositories
**Used the following implementation from [Somdev Sangwan](https://github.com/s0md3v)'s [Zen](https://github.com/s0md3v/zen) to get an email from a username**
```python
def findReposFromUsername(username):
response = get('https://api.github.com/users/%s/repos?per_page=100&sort=pushed' % username, auth=HTTPBasicAuth(uname, '')).text
repos = re.findall(r'"full_name":"%s/(.*?)",.*?"fork":(.*?),' % username, response)
nonForkedRepos = []
for repo in repos:
if repo[1] == 'false':
nonForkedRepos.append(repo[0])
return nonForkedRepos
response = get('https://api.github.com/users/%s/repos?per_page=100&sort=pushed' % username, auth=HTTPBasicAuth(uname, '')).text
repos = re.findall(r'"full_name":"%s/(.*?)",.*?"fork":(.*?),' % username, response)
nonForkedRepos = []
for repo in repos:
if repo[1] == 'false':
nonForkedRepos.append(repo[0])
return nonForkedRepos
def findEmailFromContributor(username, repo, contributor):
response = get('https://github.com/%s/%s/commits?author=%s' % (username, repo, contributor), auth=HTTPBasicAuth(uname, '')).text
latestCommit = re.search(r'href="/%s/%s/commit/(.*?)"' % (username, repo), response)
if latestCommit:
latestCommit = latestCommit.group(1)
else:
latestCommit = 'dummy'
commitDetails = get('https://github.com/%s/%s/commit/%s.patch' % (username, repo, latestCommit), auth=HTTPBasicAuth(uname, '')).text
email = re.search(r'<(.*)>', commitDetails)
if email:
email = email.group(1)
if breach:
jsonOutput[contributor] = {}
jsonOutput[contributor]['email'] = email
else:
jsonOutput[contributor] = email
return email
response = get('https://github.com/%s/%s/commits?author=%s' % (username, repo, contributor), auth=HTTPBasicAuth(uname, '')).text
latestCommit = re.search(r'href="/%s/%s/commit/(.*?)"' % (username, repo), response)
if latestCommit:
latestCommit = latestCommit.group(1)
else:
latestCommit = 'dummy'
commitDetails = get('https://github.com/%s/%s/commit/%s.patch' % (username, repo, latestCommit), auth=HTTPBasicAuth(uname, '')).text
email = re.search(r'<(.*)>', commitDetails)
if email:
email = email.group(1)
return email
def findEmailFromUsername(username):
repos = findReposFromUsername(username)
for repo in repos:
email = findEmailFromContributor(username, repo, username)
if email:
print (username + ' : ' + email)
break
repos = findReposFromUsername(username)
for repo in repos:
email = findEmailFromContributor(username, repo, username)
if email:
print (username + ' : ' + email)
break
```
## Note
> Octosuite automatically logs network and user activity of each session, the logs are saved by date and time in the .logs folder