-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitsearch.py
More file actions
26 lines (18 loc) · 735 Bytes
/
gitsearch.py
File metadata and controls
26 lines (18 loc) · 735 Bytes
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
#!/usr/bin/env python3
import argparse
from github import Github
# Replace with your GitHub personal access token
GITHUB_TOKEN = 'gitapikey'
def search_github(query, sort='stars', order='desc'):
g = Github(GITHUB_TOKEN)
repositories = g.search_repositories(query=query, sort=sort, order=order)
return repositories
def main(query):
repositories = search_github(query)
for repo in repositories:
print(f"{repo.full_name} ({repo.stargazers_count} stars) - {repo.html_url}")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Search GitHub repositories for CVEs.")
parser.add_argument("query", help="GitHub search query")
args = parser.parse_args()
main(args.query)