Metadata-Version: 2.4
Name: models2go
Version: 1.0.1
Summary: ML Security Models as a Service - CLI and Python SDK
Project-URL: Homepage, https://models2go.com
Project-URL: Documentation, https://models2go.com/docs
Project-URL: Repository, https://github.com/models2go/models2go-cli
Author: models2go.com
License: MIT
Keywords: malware,ml,phishing,security,threat-intelligence
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Security
Requires-Python: >=3.9
Requires-Dist: click>=8.0
Requires-Dist: httpx>=0.24
Provides-Extra: dev
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# models2go

ML Security Models as a Service - CLI and Python SDK

Scan URLs, emails, and files for threats using machine learning models.

## Installation

```bash
pip install models2go
```

## Getting Started

1. **Get an API key** at [models2go.com](https://models2go.com)

2. **Configure the CLI**:

```bash
m2g config --api-key YOUR_API_KEY --url https://api.models2go.com
```

Or use environment variables:

```bash
export MODELS2GO_API_KEY=your-api-key
export MODELS2GO_URL=https://api.models2go.com
```

3. **Verify it works**:

```bash
m2g health
```

## Quick Start

### CLI Usage

```bash
# Scan a URL for phishing
m2g scan url https://suspicious-site.com

# Scan an email
m2g scan email -b "Click here to verify your account!"

# Look up any threat indicator (auto-detects type)
m2g lookup 8.8.8.8
m2g lookup evil-domain.com
m2g lookup abc123def456...

# Check file hash against malware database
m2g hash 44d88612fea8a8f36de82e1278abb02f

# Check domain for DGA
m2g dga asdfjkl123xyz.com

# List available models
m2g models

# Output as JSON
m2g --json scan url https://example.com
```

### Python SDK

```python
from models2go import Models2GoClient

client = Models2GoClient(api_key="your-api-key")

# Scan URL
result = client.scan_url("https://suspicious-site.com")
print(f"Prediction: {result['prediction']}")
print(f"Confidence: {result['confidence']:.1%}")

# Scan email
result = client.scan_email(
    body="Click here to verify your account",
    subject="Urgent: Account verification required"
)

# Look up threat indicator
result = client.lookup("192.168.1.1")

# Check file hash
result = client.lookup_hash("44d88612fea8a8f36de82e1278abb02f")
```

## Configuration

Set your API key via environment variable or pass it directly:

```bash
export MODELS2GO_API_KEY=your-api-key
export MODELS2GO_URL=https://api.models2go.com  # optional
```

### Admin Key (default)
The CLI is preconfigured with a default unlimited admin key for local control:
```
m2g_admin_default_key_change_me
```
You can override it via `MODELS2GO_API_KEY`.

### System Unlimited Key
The API also initializes a system-wide unlimited key for internal integrations.  
Default (override with `MODELS2GO_SYSTEM_KEY` env var):
```
m2g_system_default_key_change_me
```

### CLI Config File
```bash
# Show config
m2g config

# Set defaults
m2g config --api-key YOUR_KEY --url http://localhost:8000

# Set profile-specific defaults
m2g config --profile dev --api-key DEV_KEY --url http://localhost:8000
m2g config --profile prod --api-key PROD_KEY --url https://api.models2go.com

# Switch profiles
m2g use dev
```

### API Key Management
```bash
# List keys
m2g keys list

# Create a key
m2g keys create --name "Demo Key" --tier indie

# Get a key
m2g keys get m2g_abcdef12

# Revoke a key
m2g keys revoke m2g_abcdef12

# Delete a key
m2g keys delete m2g_abcdef12

# Usage stats
m2g keys usage m2g_abcdef12 --days 30

# Rotate a key
m2g keys rotate m2g_abcdef12

# Set allowlist permissions
m2g keys permissions m2g_abcdef12 --allowlist /api/v1/security --allowlist /api/v1/health

# Regenerate admin key (revokes existing admin keys)
m2g keys admin-regenerate
```

## Available Models

| Model | Endpoint | Description |
|-------|----------|-------------|
| URL Phishing | `/api/v1/security/phishing/url` | Detects phishing URLs |
| Email Phishing | `/api/v1/security/phishing/email` | Detects phishing emails |
| DGA Detector | `/api/v1/security/dga` | Detects algorithmically generated domains |
| Hash Lookup | `/api/v1/security/hash` | Malware hash database (892K samples) |
| IP Reputation | `/api/v1/security/ip/{ip}` | IP threat intelligence (156K IPs) |
| Unified Lookup | `/api/v1/security/lookup` | Auto-detect and lookup any indicator |

## Exit Codes

The CLI uses exit codes for easy scripting:
- `0` - Clean/benign
- `1` - Threat detected (phishing, malicious, etc.)

```bash
m2g scan url https://example.com && echo "Clean!" || echo "Threat detected!"
```

## Links

- Website: https://models2go.com
- API Docs: https://api.models2go.com/docs
- Support: support@models2go.com
