Skip to main content

🔍 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
  • 👁️ Less than 200 lines of Python - easily audit it yourself

🚀 Quick Start

Install using pip:

pip install binspect

Or with pipx:

pipx 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-4o'
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.

Metadata

Release files for binspect 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for binspect 0.1.1
File Size Uploaded Provenance Actions
binspect-0.1.1.tar.gz 4.4 kB Without provenance Details for binspect-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for binspect 0.1.1
File Interpreter ABI Platform Actions
binspect-0.1.1-py3-none-any.whl Python 3 none any Details for binspect-0.1.1-py3-none-any.whl

Total release size: 11.3 kB

Release files / binspect-0.1.1.tar.gz

Download URL binspect-0.1.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ec9aa4895a2c329c69652e2457abe20f4fab8bc4dcb984dfe6391edf7ceefa09
BLAKE2b-256 checksum
How to use checksums
7060a2f1cddd44e53f46ad17dc015be564c6adb2a7a8fb25796d03b9d0378d5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.6

Release files / binspect-0.1.1-py3-none-any.whl

Download URL binspect-0.1.1-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6df7208492dc34795650c496225fd9f218dfb408049fafba86000041bc17d3b
BLAKE2b-256 checksum
How to use checksums
cefa467f74e0db8353531f3bd0b1bdc33b40a24cdfc4dba6e8833c06b32719ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.6

Security for binspect 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page