A powerful Open Source Intelligence (OSINT) tool for searching and analyzing GitHub repositories, code patterns, files, and commits. Discover sensitive information, security vulnerabilities, API keys, private credentials, and dangerous code patterns across GitHub's public repositories.
- Features
- Prerequisites
- Installation
- Configuration
- Usage
- Examples
- Advanced Features
- Output Formats
- Troubleshooting
- Project Structure
- Contributing
- License
- Multi-Source Search: Search across code, repositories, issues, and commits
- Pattern Detection: Automatically detect dangerous patterns like private keys, mnemonics, API keys
- File-Based Searching: Find specific files by name (e.g.,
.env,hardhat.config.js,.git) - Content Extraction: Fetch and analyze file contents directly from repositories
- Smart Rate Limiting: Automatic handling of GitHub API rate limits
- State Management: Track searched patterns and avoid duplicate results
- Continuous Monitoring: Run continuous searches with automatic state persistence
- JSON Format: Structured data export for programmatic analysis
- CSV Format: Spreadsheet-compatible export for data analysis
- Enriched Metadata: Enhanced results with repository stats, file details, and timestamps
- Detects hardcoded credentials (API keys, mnemonics, private keys)
- Identifies sensitive configuration files
- Searches for dangerous code patterns
- Tracks repository updates for new vulnerable code
- Interactive mode for real-time queries
- Auto-search for all dangerous patterns
- Continuous monitoring mode with state persistence
- Customizable result limits (up to 1,000 per pattern)
- Optional file content fetching
Before installing, ensure you have:
- Python 3.8 or higher
- GitHub Account (for API token)
- Internet Connection (for GitHub API access)
- Git (for cloning the repository)
- pip (usually comes with Python)
- Virtual Environment (for isolated dependencies)
- Download Python from python.org
- Run the installer
- β Important: Check "Add Python to PATH" during installation
- Click "Install Now"
- Verify installation:
python --version pip --version
Using Homebrew (recommended):
brew install python3Or download from python.org
Verify installation:
python3 --version
pip3 --versionsudo apt update
sudo apt install python3 python3-pip python3-venv -y
python3 --version
pip3 --versionsudo dnf install python3 python3-pip -y
python3 --version
pip3 --version# Using Git
git clone https://github.com/amirofski/github_osint.git
cd github_osint
# OR download the ZIP file and extract itpython -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activateAfter activation, your terminal should show (venv) prefix.
pip install -r requirements.txtThis will install:
requests- HTTP library for API callspython-dotenv- Environment variable management
- Go to GitHub Settings - Personal Access Tokens
- Click "Generate new token (classic)"
- Give it a descriptive name (e.g., "OSINT Tool")
- Select scopes:
- β
public_repo- Access public repositories - β
read:user- Read user data
- β
- Click "Generate token"
- Copy the token immediately (you won't see it again)
Create a .env file in the project root directory:
# Windows
echo GITHUB_TOKEN=your_token_here > .env
echo OUTPUT_FORMAT=json >> .env
echo OUTPUT_FILE=results.json >> .env
# macOS/Linux
cat > .env << EOF
GITHUB_TOKEN=your_token_here
OUTPUT_FORMAT=json
OUTPUT_FILE=results.json
EOFReplace your_token_here with your actual GitHub token
Or manually create .env with this content:
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OUTPUT_FORMAT=json
OUTPUT_FILE=results.json| Variable | Description | Default | Example |
|---|---|---|---|
GITHUB_TOKEN |
GitHub API token (required) | None | ghp_xxx... |
OUTPUT_FORMAT |
Output file format | json |
json or csv |
OUTPUT_FILE |
Default output filename | Auto-generated | results.json |
Best for exploring and testing queries:
python main.py --interactiveInteractive commands:
- Type search queries directly
- Use
autoto search all dangerous patterns - Use
exit,quit, orqto exit - Customize results limit, format, and content fetching
Search for specific patterns:
# Search for private keys
python main.py "privateKey"
# Search for specific files
python main.py filename:hardhat.config.js
# Search with custom max results
python main.py "mnemonic" --max-results 500
# Output to CSV
python main.py "alchemy" --format csv --output results.csvSearch all dangerous patterns automatically:
# Single run
python main.py --auto
# With custom settings
python main.py --auto --max-results 200 --format csv --output danger.csv
# Skip file content fetching (faster)
python main.py --auto --no-fetch-contentKeep searching and tracking new results:
# Start continuous monitoring
python main.py --auto --continuous --output ongoing_results.json
# With state file for persistence
python main.py --auto --continuous --state-file my_state.json --output results.jsonPress Ctrl+C to stop continuous mode.
python main.py "infura" --max-results 100 --format json --output infura_keys.jsonOutput: All repositories containing "infura" with file content and metadata.
python main.py filename:.env --max-results 500Output: All .env files found publicly on GitHub.
python main.py "-----BEGIN PRIVATE KEY-----" --max-results 200 --output pem_keys.csv --format csvpython main.py --auto --continuous \
--max-results 100 \
--format json \
--output comprehensive_scan.json \
--state-file tracking.jsonpython main.py --interactiveThen interact:
Enter search query: filename:hardhat.config.js
Max results (default 100, max 1000): 50
Fetch file content? (y/n, default: y): y
Output format (json/csv, default: json): json
Track what you've already searched to avoid duplicates:
python main.py --auto --continuous \
--state-file github_intel_state.json \
--output results.jsonState file tracks:
- Searched patterns
- Last page processed
- Last result time
- Unique repositories seen
The tool automatically manages GitHub API rate limits:
- Authenticated: 5,000 requests/hour
- Unauthenticated: 60 requests/hour (not recommended)
- Auto-waits when limit is approaching
- Handles rate limit reset gracefully
# Fetch content (default) - more data, slower
python main.py "privateKey"
# Skip content - faster, basic info only
python main.py "privateKey" --no-fetch-content[
{
"search_type": "code",
"repository": {
"name": "example-repo",
"owner": "username",
"full_name": "username/example-repo",
"url": "https://github.com/username/example-repo",
"stars": 150,
"forks": 45,
"language": "JavaScript",
"updated_at": "2024-01-15T10:30:00Z"
},
"file": {
"name": ".env",
"path": ".env",
"url": "https://github.com/username/example-repo/blob/main/.env",
"sha": "abc123...",
"content": "PRIVATE_KEY=0x1234567890..."
},
"matched_pattern": "filename:.env"
}
]search_type,repo_owner,repo_name,file_name,file_path,file_url,repo_url,content,matched_pattern
code,username,example-repo,.env,.env,https://...,https://...,PRIVATE_KEY=0x...,filename:.envSolution:
# Create .env file with your token
echo GITHUB_TOKEN=your_token_here > .env
# Or set environment variable directly
# Windows
set GITHUB_TOKEN=your_token_here
python main.py --auto
# macOS/Linux
export GITHUB_TOKEN=your_token_here
python main.py --autoSolution: The tool automatically waits, but you can:
- Use fewer results:
--max-results 50 - Use
--no-fetch-contentto reduce API calls - Wait 1 hour for rate limit reset
- Use a token with higher rate limits
Solution:
pip install -r requirements.txtSolution:
pip install python-dotenv
# or reinstall all
pip install -r requirements.txtSolution: Use proper GitHub search syntax:
# β
Correct
python main.py "privateKey"
python main.py filename:hardhat.config.js
python main.py filename:.env
# β Avoid
python main.py "user@email.com" # Special characters need escapingSolution:
- Check internet connection
- GitHub API might be down
- Try again in a few moments
- Use
--no-fetch-contentto reduce time
github_osint/
βββ main.py # Main entry point, CLI interface
βββ github_client.py # GitHub API interaction
βββ search_engine.py # Search logic and pattern matching
βββ config.py # Configuration and constants
βββ patterns.py # Dangerous patterns definition
βββ output_handler.py # Result export (JSON/CSV)
βββ state_manager.py # State persistence for tracking
βββ extractor.py # Data extraction utilities
βββ requirements.txt # Python dependencies
βββ .env # Environment variables (create locally)
βββ README.md # This file
Contributions are welcome! Areas for improvement:
- Add more dangerous patterns
- Support for additional output formats (XML, SQLite)
- Proxy support
- Database integration
- Web UI
- Result filtering and analytics
This project is provided for educational and security research purposes.
Disclaimer: Use responsibly and only on repositories where you have permission. Unauthorized access to computer systems is illegal.
- Educational Purpose Only: This tool is designed for security researchers and authorized penetration testing.
- Legal Compliance: Only search public repositories and ensure you have authorization.
- Responsible Disclosure: If you find real vulnerabilities, report them to the affected parties.
- No Warranty: Use at your own risk. The author assumes no liability.
For issues and questions:
- Check the Troubleshooting section above
- Review GitHub Issues
- Check existing documentation
- Create a new issue with detailed information
Built for security researchers and the open-source community to discover and remediate vulnerabilities in publicly shared code.
Last Updated: January 2026
Version: 1.0.0
Author: amirofski