Skip to main content

Security-focused command line tool to scan Git repositories for potentially malicious code patterns

Project description

Insect Logo

Insect Security Scanner

Safely analyze external Git repositories for malicious content before cloning or execution

PyPI version Python Version License: MIT CI/CD Status Release Status

🚨 What is Insect?

Insect is a security tool that helps you safely evaluate external Git repositories before cloning them to your system. It uses container-based isolation to analyze potentially malicious code without risk to your environment.

Primary Use Cases

  • 🔍 Vet third-party repositories before cloning from GitHub/GitLab
  • 🛡️ Detect malware and stealers in open-source projects
  • 🐳 Analyze in isolation using Docker containers for safety
  • 📊 Generate security reports on external dependencies

⚡ Quick Start

Prerequisites

  • Docker (required for safe external repository analysis)
  • Python 3.8+

Analyze External Repository (Recommended)

# Install Insect
pip install insect

# Safely analyze external repository before cloning
insect clone https://github.com/suspicious/repository

# Advanced: Scan with high sensitivity for comprehensive analysis
insect clone https://github.com/example/repo --scan-args "--sensitivity high"

# Generate detailed security report
insect clone https://github.com/vendor/tool --report-path security-analysis.json

Scan Local Code (Secondary Use Case)

# Scan local project (requires Docker for full features)
insect scan ./my-project --format html --output security-report.html

🔥 Key Features

  • 🐳 Container Isolation: Analyze untrusted code safely in Docker
  • 🔍 Comprehensive Detection: Find malware, credential stealers, crypto miners
  • 🛡️ Pre-execution Analysis: Detect threats before code runs
  • 📊 Detailed Reports: Interactive HTML reports with threat analysis
  • ⚡ Multiple Formats: Text, JSON, HTML output options
  • 🎛️ Configurable: Adjust sensitivity for different threat models

🎯 What Insect Detects

Malicious Patterns

  • Browser Data Theft: Cookie stealers, password extractors, session hijackers
  • Cryptocurrency Theft: Wallet stealers, private key extractors, clipboard hijackers
  • System Compromise: Command injection, privilege escalation, backdoors
  • Data Exfiltration: Secret harvesters, API key stealers, data miners

Security Vulnerabilities

  • Code Injection: SQL injection, XSS, command injection
  • Insecure Configurations: Hardcoded credentials, weak settings
  • Dependency Issues: Vulnerable libraries, supply chain risks

🚀 Real-World Examples

Vetting Dependencies

# Check a JavaScript library before adding to your project
insect clone https://github.com/author/js-library --report-path security-analysis.json

# Analyze a Python package source
insect clone https://github.com/author/python-package --scan-args "--severity medium"

# Comprehensive analysis of suspicious repository
insect clone https://github.com/reported/malware --scan-args "--sensitivity very_high"

Security Research

# Analyze suspicious repository reported by community
insect clone https://github.com/suspicious/stealer --report-path investigation.json

# Generate detailed report for security review
insect clone https://github.com/questionable/project --scan-args "--format html"

Team Integration

# Security team validation workflow
insect clone https://github.com/vendor/tool --report-path vendor-assessment.json

# Developer pre-integration check
insect clone https://github.com/library/candidate --scan-args "--severity medium"

🛡️ Safety First

Never run untrusted code directly! Always use Insect's container-based scanning:

# ✅ Safe: Analyze in container first
insect clone https://github.com/untrusted/repo

# ❌ Dangerous: Don't clone and run unknown code
git clone https://github.com/untrusted/repo && cd repo && ./install.sh

📖 Documentation

🔧 Requirements

  • Docker: Required for safe analysis of external repositories
  • Python 3.8+: For running Insect
  • Internet: For cloning external repositories

💡 Why Use Insect?

In today's threat landscape, malicious repositories are increasingly common:

  • Supply chain attacks through compromised packages
  • Fake repositories designed to steal credentials
  • Crypto miners disguised as legitimate tools
  • Browser stealers targeting developer machines

Insect helps you stay safe by analyzing code before it touches your system.

Installation

pip install insect

Or using pipenv:

pipenv install insect

Additional Commands

Check status of external dependencies:

insect deps

For more advanced usage and configuration options, see our documentation.

Development

Setup

# Clone the repository
git clone https://github.com/somasays/insect.git
cd insect

# Setup development environment
pipenv install --dev
pipenv shell

# Install pre-commit hooks
pre-commit install

Testing

# Run tests
pytest

# Run tests with coverage
pytest --cov=insect

# Run tox to test across different Python versions
tox

Code Quality

# Format code
black .
isort .

# Lint code
ruff .

# Type checking
mypy .

For detailed development workflows, see our contributing guide.

License

MIT


Insect - Analyze first, trust later.

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

insect-0.1.6.tar.gz (135.7 kB view details)

Uploaded Source

Built Distribution

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

insect-0.1.6-py3-none-any.whl (151.1 kB view details)

Uploaded Python 3

File details

Details for the file insect-0.1.6.tar.gz.

File metadata

  • Download URL: insect-0.1.6.tar.gz
  • Upload date:
  • Size: 135.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for insect-0.1.6.tar.gz
Algorithm Hash digest
SHA256 8f527eaf76f1c1dfe0ecfa89e320a9d7ed38bbb95c003c1984f6e497e2d38a25
MD5 a9a68c5aa027921b3dff90336863bd86
BLAKE2b-256 2440c68c12bddf4b41e8fc2873d065787f2b1ee8b05f97be78ebe8c96e9d6b47

See more details on using hashes here.

File details

Details for the file insect-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: insect-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 151.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for insect-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 702c1efbd2b593a7b17ce6e919bb98814c7860184508ae07371f1ea636d12454
MD5 6238ff080315feef933c36d9085e501a
BLAKE2b-256 dad2894ede3ca6b8ad9b2ad879375814e72cd614f6f1ce5e0105b827ce4334e2

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