PromptHub
Back to Blog
Developer Tools Security

sooryathejas/METATRON: Local AI Penetration Testing on Linux

B

Bright Coding

Author

11 min read 32 views
sooryathejas/METATRON: Local AI Penetration Testing on Linux

sooryathejas/METATRON: Local AI Penetration Testing on Linux

Penetration testers and security researchers face a persistent trade-off: cloud-based AI tools offer powerful analysis but require sending sensitive target data to third-party APIs, while traditional CLI recon tools demand manual correlation and interpretation. For teams working on classified networks, bug bounty programs with strict scope rules, or simply practitioners who value operational security, this gap is costly. METATRON penetration testing solves this directly—it's a CLI-based AI assistant that runs 100% locally using Ollama and a fine-tuned Qwen model, automating reconnaissance and analysis without ever touching an external API.


What is sooryathejas/METATRON?

METATRON is an open-source, AI-powered penetration testing assistant maintained by Soorya Thejas (@sooryathejas). Built in Python↗ Bright Coding Blog 3 and designed for Parrot OS (Debian-based), it combines traditional security tooling with local large language model inference to automate target reconnaissance, vulnerability identification, and remediation guidance.

The project has gained significant traction in the security community: 3,323 GitHub stars, 664 forks, and active development with the last commit on 2026-04-11. It's released under the MIT License, making it free for commercial and educational use.

What distinguishes METATRON from other AI security tools is its complete offline operation. The tool orchestrates real reconnaissance utilities—nmap, whois, whatweb, curl, dig, nikto—feeds their output to a locally running metatron-qwen model via Ollama, and persists all results to a MariaDB database with full scan history. No API keys. No subscriptions. No data exfiltration risk.

The AI model itself is a fine-tuned variant of huihui_ai/qwen3.5-abliterated:9b, configured with a 16,384-token context window and pentest-specific parameters (temperature 0.7, top-k 10, top-p 0.9). This isn't a generic chatbot bolted onto security tools; it's a purpose-tuned inference pipeline designed for structured vulnerability analysis.

For developers evaluating AI-assisted security workflows, METATRON represents a pragmatic middle path: more automation than manual recon, more privacy than cloud AI, and more structure than ad-hoc scripting.


Key Features

Local AI Analysis via Ollama METATRON runs metatron-qwen entirely on your hardware through Ollama. The model analyzes recon output, identifies attack vectors, suggests exploits, and recommends fixes—all without network egress. The 9b base model requires ~8.4 GB RAM, with a 4b fallback for resource-constrained systems.

Automated Reconnaissance Pipeline The tool integrates six standard security utilities:

  • nmap: Port scanning and service detection
  • whois: Domain registration and ownership data
  • whatweb: Web technology fingerprinting
  • curl: HTTP header analysis
  • dig: DNS record enumeration
  • nikto: Web vulnerability scanning (optional, slower)

Users select tools per-scan or run bulk presets (all excluding nikto, or all + nikto).

Agentic Analysis Loop The AI can request additional tool runs mid-analysis. If initial recon is inconclusive, metatron-qwen dynamically asks for deeper scanning rather than producing generic output. This closes the loop between static tool execution and adaptive investigation.

MariaDB Backend with Full CRUD All scan data persists across five linked tables: history (session tracking), vulnerabilities, fixes, exploits_attempted, and summary. Users can edit or delete any saved result directly from the CLI—no raw SQL required.

DuckDuckGo Web Search & CVE Lookup For context beyond local inference, METATRON queries DuckDuckGo and performs CVE lookups without requiring API keys. This bridges offline analysis with current threat intelligence.

Report Export Scan results export to PDF (professional vulnerability reports) and HTML (browser-viewable) formats via the history menu.


Use Cases

Authorized Infrastructure Audits Security teams conducting internal network assessments can run METATRON on air-gapped or sensitive environments. The local LLM ensures no scan data leaves the premises, satisfying compliance requirements that prohibit cloud AI usage (e.g., FedRAMP, ITAR, or client NDAs).

Bug Bounty Reconnaissance Researchers targeting scoped programs can rapidly enumerate subdomains, services, and web technologies. The automated CVE lookup and AI-generated exploit suggestions accelerate triage, while MariaDB history prevents re-scanning known-good targets.

Security Training & CTF Labs Educators and students use METATRON to learn recon methodology without manual tool chaining. The AI analysis explains why specific ports or headers matter, making it a pedagogical scaffold for beginners who understand tool output but lack pattern recognition.

Offline Red Team Exercises Teams simulating adversarial operations in disconnected environments gain structured reporting without cloud dependencies. The PDF/HTML export produces deliverables comparable to commercial tools, but generated entirely offline.

Vulnerability Research Workflows Researchers analyzing multiple targets benefit from the relational database schema. Cross-referencing fixes against vulnerabilities across historical scans identifies recurring misconfigurations in an organization's infrastructure.


Installation & Setup

METATRON requires Parrot OS or a compatible Debian-based Linux distribution. The installation involves four components: repository clone, Python environment, system tools, and AI model setup.

1. Clone and Configure Python Environment

git clone https://github.com/sooryathejas/METATRON.git
cd METATRON
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

The virtual environment isolates dependencies (likely including pymysql, requests, and Ollama Python bindings). Always activate venv before running METATRON.

2. Install System Recon Tools

sudo apt install nmap whois whatweb curl dnsutils nikto

These are the actual executables METATRON shells out to. Missing binaries will cause scan failures, not graceful degradation—verify installation with which nmap etc.

3. Install Ollama and Pull Base Model

curl -fsSL https://ollama.com/install.sh | sh
ollama pull huihui_ai/qwen3.5-abliterated:9b

The install.sh script handles systemd service setup. The 9b model requires 8.4 GB RAM minimum; for systems below this threshold, substitute:

ollama pull huihui_ai/qwen3.5-abliterated:4b

Then edit the FROM line in the repository's Modelfile to reference the 4b variant before building.

4. Build Custom metatron-qwen Model

ollama create metatron-qwen -f Modelfile

This applies pentest-specific tuning: 16,384 context window, temperature 0.7 (balanced creativity/consistency), top-k 10, top-p 0.9. Verify with ollama list.

5. Database Setup

sudo systemctl start mariadb
sudo systemctl enable mariadb
mysql↗ Bright Coding Blog -u root

In the MariaDB console:

CREATE DATABASE metatron;
CREATE USER 'metatron'@'localhost' IDENTIFIED BY '123';
GRANT ALL PRIVILEGES ON metatron.* TO 'metatron'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Then create tables:

mysql -u metatron -p123 metatron

Execute the five CREATE TABLE statements from the README (history, vulnerabilities, fixes, exploits_attempted, summary). The sl_no field links all tables as a session identifier.


Real Code Examples

Running METATRON: Two-Terminal Workflow

METATRON requires concurrent terminals—one for the Ollama model daemon, one for the CLI.

Terminal 1 — Load AI model:

ollama run metatron-qwen

Wait for the >>> prompt indicating model readiness. This terminal remains active; Ollama holds the model in VRAM/RAM for low-latency inference.

Terminal 2 — Launch application:

cd ~/METATRON
source venv/bin/activate
python metatron.py

This pattern—model server plus client—is standard for Ollama applications but worth emphasizing: METATRON does not embed the LLM directly; it communicates via Ollama's local API.

Main Menu Interaction

Upon launch, METATRON presents:

  [1]  New Scan
  [2]  View History
  [3]  Exit

Selecting [1] prompts for target input:

[?] Enter target IP or domain: 192.168.1.1

Valid inputs include IPv4 addresses, IPv6 (implied by tool support), or resolvable domains.

Tool Selection Preset

After target entry:

  [1] nmap
  [2] whois
  [3] whatweb
  [4] curl headers
  [5] dig DNS
  [6] nikto
  [a] Run all (except nikto)
  [n] Run all + nikto (slow)

The [a] preset balances speed and coverage; [n] includes nikto's comprehensive but time-consuming web audit. This design acknowledges that nikto's duration disrupts rapid iteration cycles.

Database Schema: Relational Structure

The five-table schema demonstrates intentional normalization:

-- Session spine: one row per scan
CREATE TABLE history (
  sl_no     INT AUTO_INCREMENT PRIMARY KEY,
  target    VARCHAR(255) NOT NULL,
  scan_date DATETIME NOT NULL,
  status    VARCHAR(50) DEFAULT 'active'
);

-- Vulnerabilities found, linked to session
CREATE TABLE vulnerabilities (
  id          INT AUTO_INCREMENT PRIMARY KEY,
  sl_no       INT,
  vuln_name   TEXT,
  severity    VARCHAR(50),
  port        VARCHAR(20),
  service     VARCHAR(100),
  description TEXT,
  FOREIGN KEY (sl_no) REFERENCES history(sl_no)
);

The fixes table adds vuln_id foreign key enabling per-vulnerability remediation tracking—critical for audit trails. The summary table's LONGTEXT fields store raw scan output and AI analysis, preserving complete evidence chains.


Advanced Usage & Best Practices

Model Memory Management The 9b model's 8.4 GB RAM requirement assumes exclusive use. On systems with 16 GB total RAM, close browsers and IDEs before ollama run. For sustained usage, consider the 4b variant despite reduced reasoning depth—latency and stability often outweigh marginal accuracy gains in recon automation.

Database Security The default MariaDB credentials (metatron/123) are documentation conveniences, not production defaults. Rotate passwords and restrict metatron user privileges if storing sensitive client data. The schema design supports multi-user deployments but lacks built-in access controls—implement at the database layer.

Nikto Scope Control Nikto's aggressiveness can trigger IDS/IPS alerts or rate-limiting. Use [a] (all except nikto) for initial enumeration, reserving [n] for confirmed web targets. The AI's agentic loop may request nikto specifically if headers suggest web application complexity—monitor Terminal 1 for these dynamic requests.

Report Export Workflow Exported PDFs include the full summary.ai_analysis and vulnerabilities tables. For client deliverables, review AI-generated exploit suggestions against your methodology—local models can hallucinate CVE applicability. Treat METATRON's output as prioritized triage, not verified findings.

Integration with CI/CD While not documented, the CLI structure supports scripting: echo "1\ntarget.com\na" | python metatron.py could automate standard scans. The MariaDB backend then feeds dashboards via SQL queries. This is untested by the maintainer—proceed with validation.


Comparison with Alternatives

Tool Architecture AI Integration Data Privacy Key Trade-off
METATRON Local CLI + Ollama Fine-tuned local LLM Complete (no network) Manual setup, Linux-only
OpenVAS/GVM Client-server scanner None Local No AI analysis, steep learning curve
Burp Suite Professional Desktop + cloud extensions Optional BApps/AI plugins Cloud-dependent features Commercial, subscription model
Nuclei + GPT scripts CLI + external API User-built OpenAI integration API data exposure Requires development effort

METATRON occupies a distinct niche: structured AI analysis without cloud dependency. OpenVAS offers comparable local operation but lacks intelligent interpretation. Burp Suite's AI features require PortSwigger cloud connectivity or manual plugin configuration. Nuclei's ecosystem is more mature for template-based scanning, but AI integration demands custom scripting and API keys.

The trade-off is ecosystem maturity. METATRON's 3,323 stars indicate community interest, but it lacks the decade-long refinement of OpenVAS or Burp's extensibility. For privacy-first practitioners, this is acceptable; for enterprise teams needing compliance certifications, evaluate carefully.


FAQ

Q: Does METATRON work on macOS or Windows? The README specifies Parrot OS (Debian-based). Ollama supports macOS/Windows, but recon tool availability (apt install packages) and path assumptions likely break. Expect to port manually.

Q: Can I use a different Ollama model? The Modelfile is tuned for huihui_ai/qwen3.5-abliterated. Other models will run but may ignore pentest-specific prompting. Retuning the Modelfile is required for optimal results.

Q: Is the MIT License compatible with commercial use? Yes. MIT permits commercial use, modification, and distribution with attribution. Review the LICENSE file for full terms.

Q: How does the agentic loop work? During analysis, metatron-qwen can emit structured requests for additional tool runs. llm.py parses these and dispatches to tools.py, feeding results back into context. This continues until the model signals completion.

Q: What's the performance impact of local inference? First-run latency includes model load time (~10-30s). Subsequent queries use cached weights. Scan duration depends on selected tools—nmap timing, not AI inference, typically dominates.

Q: Can I migrate data to another database? The schema uses standard SQL with MariaDB-specific AUTO_INCREMENT. Porting to PostgreSQL↗ Bright Coding Blog or MySQL requires minor syntax adjustments. The db.py module centralizes all queries for modification.

Q: Where do I report bugs or request features? Use GitHub Issues on the repository. The maintainer's activity (last commit 2026-04-11) suggests responsive development.


Conclusion

sooryathejas/METATRON delivers on a specific, underserved need: AI-assisted penetration testing that preserves complete operational privacy. For security professionals working in restricted environments, bug bounty researchers avoiding scope violations, and educators demonstrating recon methodology, the combination of local LLM inference, structured database persistence, and zero API dependencies is genuinely compelling.

The tool is not without limitations. Linux-only deployment, manual database setup, and the resource requirements of local inference create friction that cloud alternatives avoid. But for practitioners who prioritize data sovereignty, these are acceptable costs.

With 3,323 stars, active maintenance, and a clear architectural vision, METATRON merits evaluation in any privacy-conscious security workflow. Clone the repository, build the model, and run your first local scan—no API keys required.

→ Get started: https://github.com/sooryathejas/METATRON

Comments (0)

Comments are moderated before appearing.

No comments yet. Be the first to share your thoughts!

Recommended Prompts

View All
All tools