llmatch-security-checker 2025.12.20174007
**Offline Security Checker** – A lightweight package that takes raw text input (e.g., code snippets, config files, or security policies) and returns a structured, actionable security assessment using 
License: MIT
Requires Python: >=3.9

# Offline Security Checker

[![PyPI version](https://img.shields.io/pypi/v/offline-security-checker.svg)](https://pypi.org/project/offline-security-checker/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://static.pepy.tech/badge/offline-security-checker)](https://pepy.tech/project/offline-security-checker)
[![LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue)](https://www.linkedin.com/in/eugene-evstafev/)

A lightweight Python package that analyzes raw text inputs (code snippets, config files, security policies) for security vulnerabilities and returns structured, actionable assessments using reliable LLM parsing.

## Features

- 🔍 **Security Analysis**: Identifies vulnerabilities in code, configurations, and policy documents
- 📋 **Structured Output**: Returns clear findings with vulnerabilities, recommendations, and security scores
- 🚫 **Offline Capable**: Works without internet connection when using local LLMs
- 🔧 **Flexible Integration**: Supports multiple LLM backends through LangChain
- ⚡ **Easy to Use**: Simple API with minimal configuration required

## Installation

```bash
pip install offline-security-checker
```

## Quick Start

```python
from offline_security_checker import check_security

# Analyze a code snippet for security issues
result = check_security(
    input_text="app_config = {'user': 'admin', 'pass': 'hardcoded123'}"
)

print(result)
```

Sample output:
```python
{
    "vulnerabilities": [
        {
            "type": "hardcoded_credentials",
            "severity": "high",
            "lines": [1],
            "description": "Hardcoded database credentials found"
        }
    ],
    "recommendations": [
        "Use environment variables for sensitive credentials",
        "Implement secure secret management"
    ],
    "score": 65
}
```

## Advanced Usage

### Using Different LLM Providers

The package uses `ChatLLM7` from [langchain-llm7](https://pypi.org/project/langchain-llm7/) by default, but you can use any LangChain-compatible LLM:

**OpenAI GPT**
```python
from langchain_openai import ChatOpenAI
from offline_security_checker import check_security

llm = ChatOpenAI()
result = check_security(input_text="your code here", llm=llm)
```

**Anthropic Claude**
```python
from langchain_anthropic import ChatAnthropic
from offline_security_checker import check_security

llm = ChatAnthropic()
result = check_security(input_text="your code here", llm=llm)
```

**Google Gemini**
```python
from langchain_google_genai import ChatGoogleGenerativeAI
from offline_security_checker import check_security

llm = ChatGoogleGenerativeAI()
result = check_security(input_text="your code here", llm=llm)
```

### API Key Management

For LLM7, you can set your API key:

```python
# Via environment variable
import os
os.environ['LLM7_API_KEY'] = 'your-api-key'

# Or directly in code
result = check_security(input_text="your code", api_key="your-api-key")
```

Get a free API key at: https://token.llm7.io

## Supported Input Types

- Python code snippets
- Dockerfiles and container configurations
- Infrastructure as Code (Terraform, CloudFormation)
- Security policy documents
- Configuration files (JSON, YAML, INI)
- Any plaintext containing potential security concerns

## Output Format

The analysis returns a structured dictionary with:
- `vulnerabilities`: List of identified security issues with type, severity, and location
- `recommendations`: Actionable fixes for each vulnerability
- `score`: Overall security score (0-100)

## Rate Limits

The default LLM7 free tier provides sufficient rate limits for most use cases. For higher throughput, use your own API key or switch to a different LLM provider.

## Contributing

Issues and feature requests: https://github.com/your-username/offline-security-checker/issues

## Author

**Eugene Evstafev**  
Email: hi@euegne.plus

## License

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