Skip to content

tanmayshahane/kyubisweep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸฆŠ KyubiSweep

Hunt exposed secrets with the cunning of a fox!

A lightweight, cross-platform CLI tool that scans your filesystem to detect exposed secrets, API keys, and tokens. Built with Go for maximum performance and zero dependencies.


โœจ Features

  • ๐Ÿ” 30+ Secret Patterns - Detects AWS, Stripe, GitHub, Google, Slack, database credentials, and more
  • ๐Ÿงฎ Shannon Entropy Analysis - Catches random high-entropy strings that regex might miss
  • โšก Concurrent Scanning - Uses Go's goroutines for blazing-fast parallel processing
  • ๏ฟฝ Security Hygiene Scorecard - Beautiful terminal output with color-coded risk levels
  • ๏ฟฝ๐Ÿ“ฆ Zero Dependencies - Single static binary, just download and run
  • ๐Ÿ–ฅ๏ธ Cross-Platform - Works on macOS (Intel + Apple Silicon), Linux, and Windows
  • ๐ŸŽฏ Smart Filtering - Scans only text-based files by default, skips binaries
  • ๐Ÿ”’ Quarantine Mode - Move sensitive files to a secure vault location

๐Ÿš€ Quick Start

Option 1: Download Pre-built Binary (Coming soon)

# macOS Apple Silicon (M1/M2/M3)
curl -L -o kyubisweep https://github.com/tanmayshahane/kyubisweep/releases/latest/kyubisweep-darwin-arm64
chmod +x kyubisweep

# Run it!
./kyubisweep --path /path/to/your/project

Option 2: Build from Source

# Ensure Go 1.21+ is installed
go version

# Clone and build
git clone https://github.com/tanmayshahane/kyubisweep.git
cd kyubisweep
go build -o kyubisweep ./cmd/sweep/main.go

# Run it!
./kyubisweep --path .

๐Ÿ“– Usage

USAGE:
  kyubisweep [OPTIONS]

OPTIONS:
  --path <directory>   Path to scan (default: current directory)
  --verbose            Enable detailed output
  --all                Show all severity levels (default: HIGH only)
  --all-files          Scan all files, not just text-based files
  --ext <extensions>   Additional extensions to scan (comma-separated)
  --json               Output report as JSON file
  --no-report          Don't save report file
  --quiet              Minimal output, just summary
  --move-to <path>     Move files with secrets to quarantine directory
  --help               Show this help message

EXAMPLES:
  kyubisweep --path ./my-project
  kyubisweep --path . --all                    # Show all severities
  kyubisweep --path . --ext log,dat            # Add custom extensions
  kyubisweep --path . --move-to ./vault        # Quarantine sensitive files
  kyubisweep --path . --json                   # Export as JSON

๐Ÿ“Š Sample Output

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘     ๐Ÿ›ก๏ธ  KYUBISWEEP SECURITY HYGIENE SCORECARD                            โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

  ๐Ÿšจ CRITICAL ISSUES FOUND

  ๐Ÿ“Š RISK BREAKDOWN
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  ๐Ÿšจ CRITICAL   9 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘
  ๐Ÿ”ด HIGH       2 โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘
  ๐ŸŸก MEDIUM     0 โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘
  ๐Ÿ”ต LOW        0 โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘

  ๐Ÿ” FINDINGS DETAIL
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  RISK        TYPE                        LOCATION
  [CRITICAL]  AWS Access Key ID           ~/project/.env:5
  [CRITICAL]  PostgreSQL Connection       ~/project/config.yaml:12
  [HIGH]      Stripe Secret Key           ~/project/payment.js:42

  ๐Ÿ“ Scanned: ~/my-project
  ๐Ÿ“„ Files analyzed: 2.9K
  โฑ๏ธ  Duration: 1.2s

graph TD
    subgraph "Initialization (Main Goroutine)"
        A[Start CLI] --> B{Parse Flags};
        B -->|--path| C[Init Walker];
        B -->|--move-to| D[Init Quarantine Mgr];
        C --> E[Create Jobs Channel];
        E --> F[Create Results Channel];
    end

    subgraph "Producer (Goroutine 1)"
        G[Walker] -->|Finds Files| E;
        style G fill:#f9f,stroke:#333,stroke-width:2px
        style E fill:#ccf,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5
    end

    subgraph "Worker Pool (Goroutines 2...N)"
        E -->|Read File Path| H[Worker 1];
        E -->|Read File Path| I[Worker 2];
        E -->|Read File Path| J[Worker N];

        H -->|Read Content| K{Analyzer};
        I -->|Read Content| K{Analyzer};
        J -->|Read Content| K{Analyzer};

        K -- No Secret --> L((Discard));
        K -- Secret Found --> M[Send Finding];

        M --> F;
        style K fill:#ff9,stroke:#333,stroke-width:2px
    end

    subgraph "Consumer & Wrap up (Main Goroutine)"
        F -->|Collect Findings| N[Reporter / Table UI];
        style F fill:#ccf,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5
        N --> O{Quarantine Requested?};
        O -- Yes --> P[Move Files to Vault];
        O -- No --> Q[Exit];
        P --> Q;
    end

    %% Add a WaitGroup visual helper
    H -.-> WG[sync.WaitGroup];
    I -.-> WG;
    J -.-> WG;
    WG -.->|All Done| F;
Loading

๐Ÿ” What It Detects

Category Examples
Cloud Credentials AWS Access Keys, Google API Keys, Azure tokens
Payment Systems Stripe API keys (live & test)
Developer Tools GitHub PATs, NPM tokens, Heroku API keys
Communication Slack tokens, Discord bot tokens, Twilio keys
Databases PostgreSQL, MongoDB, MySQL connection strings
Cryptographic RSA/SSH/PGP private keys
Generic Passwords, API keys, Bearer tokens

๐Ÿ—๏ธ Project Structure

kyubisweep/
โ”œโ”€โ”€ cmd/
โ”‚   โ””โ”€โ”€ sweep/
โ”‚       โ””โ”€โ”€ main.go           # CLI entry point + worker pool
โ”œโ”€โ”€ pkg/
โ”‚   โ”œโ”€โ”€ analyzer/
โ”‚   โ”‚   โ””โ”€โ”€ analyzer.go       # Entropy + regex detection
โ”‚   โ”œโ”€โ”€ scanner/
โ”‚   โ”‚   โ””โ”€โ”€ walker.go         # Concurrent directory walker
โ”‚   โ”œโ”€โ”€ reporter/
โ”‚   โ”‚   โ””โ”€โ”€ reporter.go       # Security Scorecard output
โ”‚   โ”œโ”€โ”€ quarantine/
โ”‚   โ”‚   โ””โ”€โ”€ manager.go        # Secure file relocation
โ”‚   โ””โ”€โ”€ common/
โ”‚       โ””โ”€โ”€ colors.go         # Shared ANSI color utilities
โ”œโ”€โ”€ reports/                  # Generated scan reports
โ”œโ”€โ”€ build/                    # Cross-compiled binaries
โ”œโ”€โ”€ go.mod                    # Go module definition
โ”œโ”€โ”€ build.sh                  # Cross-platform build script
โ””โ”€โ”€ README.md

๐Ÿ› ๏ธ Building for All Platforms

# Make the build script executable
chmod +x build.sh

# Build for all platforms
./build.sh

# Outputs:
# build/kyubisweep-darwin-arm64   (macOS Apple Silicon)
# build/kyubisweep-darwin-amd64   (macOS Intel)
# build/kyubisweep-linux-amd64    (Linux 64-bit)
# build/kyubisweep-linux-arm64    (Linux ARM)
# build/kyubisweep-windows-amd64.exe (Windows 64-bit)

๏ฟฝ Quarantine Mode

Found secrets you need to secure immediately? Use --move-to to relocate files:

./kyubisweep --path . --move-to ./secure_vault

Safety features:

  • โš ๏ธ Bold red warning before any files are moved
  • ๐Ÿ” Requires typing "yes" to confirm
  • ๐Ÿ“‚ Creates vault directory with secure permissions (0700)
  • ๐Ÿ”„ Handles cross-filesystem moves automatically
  • ๐Ÿ“› Prevents overwrites with timestamp-based naming

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


๐Ÿ“„ License

MIT License - feel free to use this in your own projects!


Made with ๐ŸฆŠ by developers who accidentally committed their API keys one too many times.

About

A lightweight, cross-platform CLI tool that scans your filesystem to detect exposed secrets, API keys, and tokens. Built with Go for maximum performance and zero dependencies.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors