Salta ai contenuti

gitxray

gitxray is an OSINT (Open Source Intelligence) tool for analyzing GitHub repositories to discover secrets, identify sensitive information, and perform security research. It automatically scans repositories for exposed credentials, API keys, configuration files, and other security indicators.

gitxray is valuable for:

  • GitHub security reconnaissance
  • Secret and credential detection
  • Commit history analysis
  • Source code vulnerability discovery
  • Configuration file identification
  • Threat intelligence gathering
  • Bug bounty hunting and assessment
  • Python 3.6+
  • pip (Python package manager)
  • Git
  • GitHub API access (optional, for higher rate limits)
  • Linux/macOS/Windows
# Install from PyPI
pip install gitxray

# Verify installation
gitxray --help
gitxray --version
# Clone repository
git clone https://github.com/evilgenius1000/gitxray.git
cd gitxray

# Install dependencies
pip install -r requirements.txt

# Run directly
python gitxray.py --help

# Or install as package
pip install -e .
# Set GitHub token for higher rate limits
export GITHUB_TOKEN=your_github_token

# Or create ~/.gitxray config file
cat > ~/.gitxray << 'EOF'
[github]
token = your_github_token
EOF
CommandPurposeExample
gitxray <repo>Analyze repositorygitxray username/repo
gitxray -hShow helpgitxray -h
gitxray --versionShow versiongitxray --version
gitxray --scanFull security scangitxray --scan username/repo
OptionPurposeExample
-o, --outputOutput filegitxray -o results.json repo
-f, --formatOutput formatgitxray -f json repo
-s, --scanFull scan modegitxray -s repo
-c, --commitsAnalyze commitsgitxray -c repo
-d, --depthSearch depthgitxray -d 50 repo
# Basic repository scan
gitxray username/repository

# Full security scan
gitxray --scan username/repository

# Example output:
# Repository: username/repository
# Stars: 1500
# Forks: 200
# Size: 25MB
# Language: Python
# Last Updated: 2024-01-15
# Get repository details
gitxray owner/repo

# Analyze repository structure
gitxray owner/repo --format json

# Deep analysis
gitxray owner/repo --scan --depth 100
# Save results to JSON
gitxray owner/repo -o results.json -f json

# Save as text
gitxray owner/repo -o results.txt -f text

# Save as CSV (if supported)
gitxray owner/repo -o results.csv
# Scan for API keys
gitxray --scan username/repo --type secrets

# Find AWS credentials
gitxray username/repo | grep -i "aws\|access_key\|secret_key"

# Detect database credentials
gitxray username/repo | grep -i "password\|db_\|database_"
# Search for common secret types
gitxray username/repo --scan

# Patterns detected:
# - AWS Access Key IDs
# - Private API keys
# - Database credentials
# - OAuth tokens
# - JWT tokens
# - SSH private keys
# - Database connection strings
# Find configuration files
gitxray username/repo | grep -i "config\|setting"

# Locate credential files
gitxray username/repo | grep -E "\.env|\.properties|\.conf"

# Identify backup files
gitxray username/repo | grep -E "\.bak|\.backup|\.old"
# Scan all commits
gitxray username/repo -c

# Analyze last N commits
gitxray username/repo --commits --depth 50

# Search commit messages
gitxray username/repo --commits | grep -i "secret\|password\|token"
# Find removed secrets in history
gitxray username/repo --scan --commits --depth 100

# Identify commits with secret removals
gitxray username/repo | grep -E "removed|deleted|secret"

# Check for secret re-addition
gitxray username/repo --commits | grep -B2 -A2 "secret\|password"
# Get commit metadata
gitxray username/repo --commits

# Analyze commit patterns
gitxray username/repo -c | grep -oE "[0-9]{4}-[0-9]{2}-[0-9]{2}" | sort | uniq -c

# Track author activity
gitxray username/repo -c | grep "@" | sort | uniq -c
# Scan for vulnerability patterns
gitxray username/repo --scan

# Look for insecure functions
gitxray username/repo | grep -iE "eval|exec|system|popen"

# Find hardcoded values
gitxray username/repo | grep -E "password\s*=|secret\s*=|key\s*="
# Identify frameworks and libraries
gitxray username/repo | grep -i "import\|require\|use"

# Detect vulnerable dependencies
gitxray username/repo | grep -E "version|>=|<|=="

# Find database usage
gitxray username/repo | grep -iE "mysql|postgresql|mongodb|redis"
# Find SQL operations
gitxray username/repo | grep -iE "select|update|delete|insert"

# Detect authentication code
gitxray username/repo | grep -iE "login|auth|password|token"

# Identify API endpoints
gitxray username/repo | grep -E "route|endpoint|@app\.|@router\."
# List all public repositories for user
gitxray user:username

# Analyze all user repositories
for repo in $(gitxray user:username | grep "Repository:"); do
  gitxray "$repo" --scan
done
# Scan organization repositories
gitxray org:organization

# Analyze security posture
gitxray org:organization --scan

# Compare repositories
for repo in repo1 repo2 repo3; do
  gitxray "org/$repo" | grep -i "secret\|credential"
done
# Search with specific criteria
gitxray "language:python stars:>1000" --scan

# Filter by size
gitxray "size:>1000000" --scan

# Search by last update
gitxray "pushed:>2024-01-01" --scan

# Combine criteria
gitxray "language:python stars:>500 pushed:>2023-01-01" --scan
# Search repositories for specific vulnerability
gitxray "struts" --scan

# Find Log4j vulnerable repos
gitxray "log4j" --scan --commits

# Identify outdated dependencies
gitxray "require 'rails' '5.0" --scan
# 1. Identify organization
ORG="target-company"

# 2. List repositories
echo "Discovering repositories..."
gitxray "org:$ORG" > ${ORG}_repos.txt

# 3. Scan each for secrets
while read repo; do
  echo "Scanning $repo..."
  gitxray "$repo" --scan -o "${repo////_}_results.json"
done < ${ORG}_repos.txt

# 4. Analyze results
grep -r "secret\|password\|key" *_results.json > ${ORG}_findings.txt
# 1. Identify target company
TARGET="company-name"

# 2. Find organization on GitHub
gitxray "org:$TARGET"

# 3. Scan for vulnerabilities
gitxray "org:$TARGET" --scan --depth 100

# 4. Focus on interesting findings
gitxray "org:$TARGET" --scan | grep -iE "secret|api|config|password"

# 5. Document findings
gitxray "org:$TARGET" --scan -o ${TARGET}_assessment.json -f json
# 1. Analyze competitor
COMPETITOR="competitor-company"

# 2. Scan repositories
gitxray "org:$COMPETITOR" --scan

# 3. Identify technologies
gitxray "org:$COMPETITOR" | grep -iE "framework|library|dependency"

# 4. Find security issues
gitxray "org:$COMPETITOR" --scan | grep -i "vulnerability\|cve\|security"

# 5. Generate report
gitxray "org:$COMPETITOR" --scan -o ${COMPETITOR}_analysis.json
# Get all detected secrets
gitxray username/repo --scan | grep -E "aws|key|token|password" > secrets.txt

# Filter and deduplicate
gitxray username/repo --scan | grep "secret" | sort -u

# Count secret types
gitxray username/repo --scan | grep -oE "aws|api|token|password" | sort | uniq -c
# Pretty print JSON results
gitxray username/repo -o results.json -f json
cat results.json | jq '.'

# Extract specific fields
cat results.json | jq '.secrets[]'
cat results.json | jq '.vulnerabilities[]'

# Filter by type
cat results.json | jq '.secrets[] | select(.type=="api_key")'
# Create markdown report
cat > report.md << 'EOF'
# GitXray Assessment Report

## Repository Information
$(gitxray username/repo)

## Detected Secrets
$(gitxray username/repo --scan | grep "secret")

## Vulnerabilities
$(gitxray username/repo --scan | grep "vulnerability")
EOF

# Create summary
gitxray username/repo --scan | tee full_report.txt | \
  grep -E "Repository|Stars|Language|Secrets|Vulnerabilities" > summary.txt
#!/bin/bash
# Scan multiple repositories

REPOS=(
  "org/repo1"
  "org/repo2"
  "org/repo3"
)

RESULTS_DIR="gitxray_results"
mkdir -p "$RESULTS_DIR"

for repo in "${REPOS[@]}"; do
  echo "Scanning $repo..."
  gitxray "$repo" --scan \
    -o "$RESULTS_DIR/${repo////_}.json" \
    -f json
done

# Aggregate findings
echo "# Summary of Findings" > "$RESULTS_DIR/SUMMARY.md"
grep -r "secret" "$RESULTS_DIR" >> "$RESULTS_DIR/SUMMARY.md"
#!/bin/bash
# Monitor organization repositories for new secrets

ORG="target-org"
BASELINE_DIR="baseline_results"
CURRENT_DIR="current_results"
DATE=$(date +%Y%m%d)

mkdir -p "$BASELINE_DIR" "$CURRENT_DIR"

# Scan all repositories
gitxray "org:$ORG" | while read repo; do
  gitxray "$repo" --scan \
    -o "$CURRENT_DIR/${repo////_}_${DATE}.json" \
    -f json
done

# Compare with baseline
for current_file in "$CURRENT_DIR"/*_${DATE}.json; do
  baseline_file="$BASELINE_DIR/$(basename "$current_file" "_${DATE}.json").json"
  
  if [ -f "$baseline_file" ]; then
    # Find new secrets
    diff <(jq '.secrets | sort' "$baseline_file") \
         <(jq '.secrets | sort' "$current_file")
  else
    echo "New repository found: $current_file"
  fi
done
  • Only scan authorized targets: Ensure proper authorization for reconnaissance
  • Respect disclosure policies: Follow responsible disclosure practices
  • Don’t extract credentials maliciously: Report secrets rather than exploit
  • Maintain confidentiality: Keep sensitive findings secure
  • Document all activities: Maintain audit trail of research
  • Use GitHub API token: Increases rate limits significantly
  • Scan comprehensively: Use --depth flag for thorough analysis
  • Review commit history: Secrets may be in older commits
  • Focus on recent changes: New code more likely to contain errors
  • Combine multiple search strategies: Different approaches find different issues
  • Secure output files: Store scan results securely
  • Encrypt sensitive data: Protect extracted secrets
  • Clean logs: Remove sensitive information from logs
  • Archive findings: Keep historical scanning data
  • Regular backups: Backup scan results
# Use with trufflehog for deeper scanning
trufflehog github --org="target-org" --only-verified

# Compare results
gitxray "org:target-org" > gitxray_results.txt
trufflehog github --org="target-org" > trufflehog_results.txt
# Find repositories with google-fu
# Then analyze with gitxray
gitxray "company-name" --scan

# Cross-reference with domain enumeration
for subdomain in $(dig +short company.com); do
  gitxray "$subdomain" --scan
done
IssueSolution
Rate limitingUse GitHub API token with export GITHUB_TOKEN=...
No resultsVerify repository name format: owner/repo
Incomplete scanIncrease depth with --depth 100
Timeout errorsTry scanning specific branches or commits
Authentication issuesVerify GitHub API token has necessary permissions

gitxray provides comprehensive GitHub repository analysis for security research:

  1. Secret Detection - Identifies exposed credentials and API keys
  2. Commit Analysis - Reviews version history for sensitive data
  3. Code Scanning - Detects vulnerable patterns and insecure practices
  4. Organization Assessment - Evaluates security posture across repositories
  5. Intelligence Gathering - Supports bug bounty and competitive analysis

Key capabilities include:

  • Automated secret detection
  • Commit history analysis
  • Technology identification
  • Vulnerability pattern recognition
  • Multi-repository assessment
  • Flexible output formats

Use gitxray as part of comprehensive security assessment and OSINT activities for authorized targets only.