From f0fc98b6d7165977e8659181c5cf98f9ab586f6f Mon Sep 17 00:00:00 2001 From: kenna-bmcdevitt Date: Mon, 26 Aug 2024 16:08:50 -0500 Subject: [PATCH] updated README --- README.md | 40 +++++++++++++++++++++++++++++++++++++++- github_searcher.py | 22 +++++++++------------- 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6afcccb..7ba15bd 100644 --- a/README.md +++ b/README.md @@ -1 +1,39 @@ -# github_searcher \ No newline at end of file +# GitHub Searcher + +GitHub Searcher is a command-line tool to search for PoC exploits for CVEs and security vulnerabilities in open-source software on GitHub. It allows you to search repositories, users, and repository names, and optionally fetch open issues and repository contents. + +## Features + +- Search GitHub repositories, users, and repository names. +- Fetch open issues of a repository. +- Fetch contents of a repository. + +## Requirements + +- Python 3.x +- `PyGithub` library + +## Installation + +1. Clone the repository: + ```bash + git clone https://github.com/yourusername/github_searcher.git + cd github_searcher + ``` + +2. Install the required dependencies: + ```bash + pip install PyGithub + ``` + +3. Set your GitHub access token as an environment variable: + ```bash + export GITHUB_ACCESS_TOKEN=your_access_token + ``` + +## Usage + +Run the script with the required arguments: + +```bash +python3 github_searcher.py --query= --search_type= [--get_open_issues] [--get_file_contents] \ No newline at end of file diff --git a/github_searcher.py b/github_searcher.py index 18d701a..b4b6aea 100644 --- a/github_searcher.py +++ b/github_searcher.py @@ -43,7 +43,11 @@ class GithubSearcher(): def get_repo_open_issues(self, repo): try: - return repo.get_issues(state='open') + issues = repo.get_issues(state='open') + for issue in issues: + print(issue) + return issues + except GithubException as e: logging.error(f"Error getting open issues: {e}") return None @@ -92,20 +96,12 @@ def main(): print(item.html_url) if args.get_open_issues: - issues = searcher.get_repo_open_issues(item) - if issues: - print("Open issues:") - for issue in issues: - print(f"Issue: {issue.title}") - print("\n") + searcher.get_repo_open_issues(item) + print("\n") if args.get_file_contents: - contents = searcher.get_repo_contents(item) - if contents: - print("Contents:") - for content in contents: - print(f"File: {content.path}") - print("\n") + searcher.get_repo_contents(item) + print("\n") if __name__ == "__main__": main() \ No newline at end of file