Skip to main content

Add a layer of protection to piped bash installs

Project description

🔍 Binspect - Secure Your Pipe-to-Shell Installations

PyPI version Python 3.8+ License: MIT

Binspect is a security tool that analyzes shell scripts before they're executed on your system. It's designed to make pipe-to-shell installations safer by detecting potentially malicious code.

🎬 See It In Action

Demo

🚨 The Problem

We've all seen installation instructions like this:

curl -fsSL https://example.com/install.sh | bash

This pattern is convenient but dangerous - you're executing code without reviewing it. Binspect helps bridge the security gap by analyzing scripts for malicious content before execution.

✨ Features

  • 🤖 Uses AI to analyze shell scripts for malicious patterns
  • 🔄 Works with a wide variety of LLM providers (uses LiteLLM to achieve this)
  • 🎨 Rich terminal output with syntax highlighting
  • 🛑 Interactive prompt to proceed or abort installation
  • 🚀 Fast and efficient analysis

🚀 Quick Start

Install using pipx (recommended):

pipx install binspect

Or with pip:

pip install binspect

📖 Usage

Instead of piping directly to bash, pipe through binspect first:

curl -fsSL https://example.com/install.sh | binspect | bash

Binspect will:

  1. Analyze the script for suspicious patterns
  2. Show you detailed findings
  3. Ask for confirmation before proceeding
  4. Pass the script to bash only if you approve

⚙️ Configuration

LLM Provider Setup

Binspect uses LiteLLM under the hood, allowing you to use various LLM providers. Set up your preferred provider using environment variables:

# For OpenAI
export OPENAI_API_KEY='your-api-key'

# For Anthropic/Claude
export ANTHROPIC_API_KEY='your-api-key'

# For other providers, see LiteLLM documentation

Model Selection

Choose your preferred model using the BASH_INSPECTOR_MODEL environment variable:

# Default is 'openai/gpt-4'
export BASH_INSPECTOR_MODEL='anthropic/claude-3-sonnet-20240229'

For a full list of providers, see https://docs.litellm.ai/docs/providers.

🔒 Security Notes

  • Binspect is a helper tool, not a guarantee of safety
  • Always review scripts manually when possible
  • Use trusted sources and verify checksums
  • Consider using package managers instead of pipe-to-shell when available

🤝 Contributing

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

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Disclaimer

Binspect is provided as-is without any guarantees. While it can help identify obvious malicious patterns, it should not be your only security measure. Always exercise caution when executing scripts from the internet.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

binspect-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

binspect-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file binspect-0.1.0.tar.gz.

File metadata

  • Download URL: binspect-0.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.6

File hashes

Hashes for binspect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f5a10ef8a59e66d6d8173febc01f8104768ca66e1c40fe57fbd96a37e4e8f8d4
MD5 d2391c26786a87e39b9d9332ce1cdc29
BLAKE2b-256 506e787b59bc9e766f9c681baa6d31c2ba6f5ff4fe7ce2668c76e322c0499eb0

See more details on using hashes here.

File details

Details for the file binspect-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: binspect-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.6

File hashes

Hashes for binspect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc4d232c11265af1bb1f54ca9f1339cb1306a75c695bbfac08ad3d49c5dd84ea
MD5 ef5638ab9d7e574867a68b3b2a97eebd
BLAKE2b-256 2222aefa1e30a107be6bceaba7eacbd66d5a8b1842b01d9cba1d687904523b93

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page