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

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.0.tar.gz (6.6 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.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: models2go-1.0.0.tar.gz
  • Upload date:
  • Size: 6.6 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.0.tar.gz
Algorithm Hash digest
SHA256 81af86ef7ec7c89855cf7a74f5df355c5441308b1df284618017c88ae5b4f35c
MD5 17ab1e21e3e3f1dd5f96579a44ba8076
BLAKE2b-256 82420ac5d4b0eee71b19d0c7dbfdc44fae02db30a6e8be5b5af9ad6e466925fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: models2go-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6d57304516798342e9710385efb8179d3ddf8ac1553a253f02a7ae6908e5fd1
MD5 6037076e3c9a4f47790c4ce5cdf425ea
BLAKE2b-256 3a4e7a1743aaffd0fc52c21ac39765c1541875dcd4196674a8197ad3474cb746

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