Skip to main content

ML Security Models as a Service - CLI and Python SDK

Project description

models2go

ML Security Models as a Service - CLI and Python SDK

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

Installation

pip install models2go

Getting Started

  1. Get an API key at models2go.com

  2. Configure the CLI:

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

Or use environment variables:

export MODELS2GO_API_KEY=your-api-key
export MODELS2GO_URL=https://api.models2go.com
  1. Verify it works:
m2g health

Quick Start

CLI Usage

# 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

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:

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

# 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

# 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.)
m2g scan url https://example.com && echo "Clean!" || echo "Threat detected!"

Links

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

models2go-1.0.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

models2go-1.0.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file models2go-1.0.1.tar.gz.

File metadata

  • Download URL: models2go-1.0.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for models2go-1.0.1.tar.gz
Algorithm Hash digest
SHA256 614c9e156e3f22fcc5b1a9a40b21cc2bb90e3cfd92011ee974f2329221f691d7
MD5 d6e72bb2ecd3ce8887b48406bed26aae
BLAKE2b-256 6c1a2bfd9b419cde0c18f396ea00b8d2cc23ed2ea8540475832f87e7068a41dd

See more details on using hashes here.

File details

Details for the file models2go-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: models2go-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for models2go-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae07975a21bc4f925f0aafdf77f534880cffdde655a7e86a053e8f6ee52c5791
MD5 8ee069693b6168f99a6ddc6e65c0ebaf
BLAKE2b-256 b53f9c498e3d54979cb39aa19fe71e499fb74236b172f5e8b25a4bedcaacfe05

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