A security analysis tool that automates GitLeaks scanning across multiple GitHub repositories.
- Bulk repository scanning
- Smart repository handling (skips existing repos)
- Automatic repository cloning and cleanup
- JSON formatted scan results
- Progress tracking and error handling
- Cross-platform compatibility (macOS, Linux)
- Working directory safety checks
To use this tool, you need:
- Git
- GitLeaks
- curl
- jq (JSON processor)
For macOS, install using Homebrew:
brew install gitleaks jq
Clone the repository:
git clone https://github.com/yourusername/git-scanner.git
cd git-scanner
chmod +x scan_repos.sh
Scan all repositories for a user or organization:
./git-scanner.sh <github-user-or-org>
The script accepts both usernames and full GitHub URLs:
./git-scanner.sh microsoft
./git-scanner.sh https://github.com/microsoft/
Before scanning, the script will:
- Show your current working directory
- Ask for confirmation before proceeding
- Check for existing repositories
Note: The script will NOT delete existing repositories in your working directory.
Results are saved in the results directory with the following structure:
results/
├── repo1/
│ └── scan_results.json
├── repo2/
│ └── scan_results.json
└── repo3/
└── scan_results.json
Each scan produces a JSON file containing:
- Repository metadata
- Detected secrets or sensitive data
- Scan timestamp
- File locations and line numbers
The script handles:
- Missing dependencies
- Failed repository clones
- API rate limiting
- Invalid usernames/organizations
- Network connectivity issues
- Existing repository detection
- Working directory verification
- Organization vs user repository detection
- Results may contain sensitive data - handle with care
- Default scan uses public API access
- Consider rate limiting for large organizations
- Clean up results after analysis
- Follow responsible disclosure practices
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT License
@johnforfar
- GitLeaks Project
- GitHub API Documentation
- GitHub token support
- Custom GitLeaks rules
- Parallel scanning
- HTML report generation
- Slack/Discord notifications
- Repository filtering options
- Dry-run mode
- Force re-clone option
- Custom working directory support
- Enhanced logging options