2.6 KiB
2.6 KiB
GitHub Searcher
GitHub Searcher is a command-line tool to search GitHub repositories and users for PoC exploits and CVEs. It supports various search types and can output results in JSON format.
Features
- Search GitHub repositories by query.
- Search GitHub users by query.
- Search within repository names.
- Retrieve open issues and pull requests for repositories.
- Retrieve file contents for repositories.
- Output results in JSON format.
Requirements
- Python 3.x
PyGithub
library
Installation
-
Clone the repository:
git clone https://github.com/yourusername/github_searcher.git cd github_searcher
-
Install the required dependencies:
pip install PyGithub
-
Set the
GITHUB_ACCESS_TOKEN
environment variable with your GitHub access token:export GITHUB_ACCESS_TOKEN=your_access_token
Usage
python github_searcher.py --query QUERY --search_type SEARCH_TYPE [--get_file_contents] [--get_open_issues] [--get_open_pull_requests] [--json]
Arguments
--query
: The search query (required).--search_type
: The type of search to perform (required). Choices are:repo
: Search repositories.users
: Search users.in-repo-name
: Search within repository names.
--get_file_contents
: Get the contents of repository results (optional).--get_open_issues
: Get the open issues of repository results (optional).--get_open_pull_requests
: Get the open pull requests of repository results (optional).--json
: Output the results in JSON format (optional).
Examples
-
Search repositories with a query:
python github_searcher.py --query "machine learning" --search_type repo
-
Search users with a query:
python github_searcher.py --query "john doe" --search_type users
-
Search within repository names:
python github_searcher.py --query "tensorflow" --search_type in-repo-name
-
Get open issues and pull requests for repositories:
python github_searcher.py --query "machine learning" --search_type repo --get_open_issues --get_open_pull_requests
-
Output results in JSON format:
python github_searcher.py --query "machine learning" --search_type repo --json
-
Use Docker Compose to search for a specific CVE-ID and output results to a file:
docker-compose run --rm app python3 /usr/src/app/github_searcher.py --query=CVE-2024-5932 --search_type=in-repo-name --get_open_issues --get_open_pull_requests --get_file_contents --json > cve-2024-5932