This is a personal CLI tool that enables interaction with the GitHub API for the purpose of searching .env
files with specified keywords. You can configure a GitHub token and use the crawler to search for keys in .env
files across public repositories.
- Configure GitHub Token: Set your GitHub Personal Access Token to make authorized API requests.
- Search
.env
Files: Search for.env
files on GitHub using a keyword and optionally filter for empty or non-empty key values. - Quiet Output: Optionally disable detailed output to see every step of the search.
- Save Results to Log: Save search results to a log file for future reference.
Follow these instructions to get the tool up and running on your local machine:
- Node.js installed on your machine.
- A GitHub Personal Access Token (PAT) for making API requests.
-
Clone the repository:
git clone https://github.com/surelle-ha/dogma.git cd dogma
-
Install the required dependencies:
npm install
Before using the crawler, you need to configure your GitHub token:
dogma config -t <your-github-token>
This will save your GitHub token in the configuration file located at ~/.github_crawler_config.json
.
The config
command allows you to configure the GitHub Personal Access Token for use in API requests.
dogma config -t <your-github-token>
-t, --token <token>
: Set your GitHub token.
Example:
dogma config -t ghp_1234567890abcdefg
This command will save your GitHub token in the configuration file and allow you to use the crawler command.
The crawl
command searches for .env
files on GitHub repositories containing a specified keyword.
dogma crawl -k <keyword> --not-empty --quiet --log <log-file>
-k, --keyword <string>
: The keyword to search in.env
files (default:API_KEY
).--not-empty
: Only search for keys with non-empty values.--empty
: Search for keys with empty values (default behavior).-q, --quiet
: Disable detailed output for the search.--log <file>
: Save the search results to a log file.
Example:
dogma crawl -k "API_KEY" --not-empty --quiet --log search_results.json
This will search for .env
files containing the API_KEY
keyword, filter for non-empty values, and save the results to search_results.json
.
We welcome contributions to improve this project!
- Fork the Repository: Fork the repository to your GitHub account.
- Clone the Repository: Clone your fork to your local machine.
- Create a Feature Branch: Create a new branch for your feature or bug fix.
- Commit Your Changes: Make changes and commit them with a descriptive message.
- Push Changes: Push your changes to your forked repository.
- Create a Pull Request: Submit a pull request to the original repository with a detailed description of your changes.
We expect all contributors to follow our Code of Conduct. Please ensure that you contribute in a respectful and inclusive manner.
This project is licensed under the MIT License - see the LICENSE file for details.