Skip to content

Phronesis, an NSE script selector for Nmap

Animated walkthrough: a scan state goes in, Phronesis ranks the NSE scripts for each port

Phronesis

The Nmap NSE script selector that takes into account what the scan already knows.

Phronesis takes the state of a scan (open ports, identified services and results collected so far) plus a list of candidate scripts. It returns a single script id, or STOP if none is worth the cost. The wrapper prints the matching Nmap command without running it.

Phronesis GitHub repository Model card

Apache 2.0 license Python 3.10+ Offline decision Platforms

In-sample results

Phronesis ranking up to 4 NSE scripts per port, with probabilities and STOP

One-command start

phronesis --xml examples/quickstart-scan.xml --top 8

This command analyzes a demo XML file without sending any network traffic. It shows the chosen script and the matching Nmap command, without running it. If you haven't installed Phronesis yet, start with installation, then follow the quickstart.

What it does

  • Analyzes an existing Nmap XML file and picks one script per port, or STOP.
  • Reads XML from standard input, so nmap ... -oX - cible | phronesis works.
  • Can run -sV reconnaissance on an authorized target before suggesting a script.
  • Only runs a script if you explicitly add --run.
  • Ships a ready-to-use NSE library, with an automatic pool limited to official, non-risky scripts.
  • Runs locally, on CPU, with no network calls for the decision.

Measured results

On 171 lab contexts. Both model-based methods use the same prompt and parameters; the other rows are baselines:

Method Agreement with optimal action Agreement excluding STOP Mean regret STOP Invalid outputs
Always STOP 66.7 % 0.0 % 0.1141 100 % 0 %
Simple rule 0.6 % 1.8 % 0.0458 0 % 0 %
Phronesis Safetensors, ranking (top 1) 87.1 % not measured 0.000081 66.7 % 0 %
Phronesis GGUF Q8_0, strict JSON 86.6 % 59.7 % 0.1096 66.7 % 8.2 %
Phronesis GGUF Q8_0, JSON schema 94.2 % 82.5 % 0.0000 66.7 % 0 %
Oracle (ceiling) 100 % 100 % 0 66.7 % 0 %

The GGUF with a JSON schema agrees with the optimal action on 94.2 % of the 171 contexts; without a schema, 8.2 % of its answers are invalid. The Safetensors row is the ranking path (suggest), measured without generation.

In-sample result, and failure outside the training data

These 171 contexts were used to train the teacher. On 124 out-of-corpus contexts, the strict top-1 drops to 13.7 %, STOP is right on 7 of the 44 contexts that need no script, and those 124 contexts also helped choose this release. The table therefore mostly describes situations the model has already seen. Details and limits are in the benchmark.

Known limits

  • A recommendation does not validate the target or the scope of the engagement.
  • The benchmark was run in a controlled lab, not on client engagements.
  • --run really runs the suggested scripts. Check the command, the script and the target before using it.
  • Custom NSE scripts are executable code supplied by the user.

Where to go next

Install

Python 3.10 or later, PyTorch, then the environment and dependencies. The model ships with the repository, not with the pip package.

Installation

Try it

A demo XML file, no network traffic. Your first decision in one command.

Get started

Understand

Candidate ranking, conditional probabilities, benchmarks and limits.

Suggestions

Page What it covers
Usage Options, output formats, pipes, exit codes
MCP and Claude skill Claude connector, skill, limits and troubleshooting
NSE library Bundled scripts, custom scripts, updates
The model Input format, expected output, llama.cpp
Benchmark Numbers, protocol, limits
Security Scope, execution, data
Deployment Installing on another machine, air-gapped
Demos Real examples and GIFs
License and links License, sources, contact

Support the project

The project is free and needs no account. A star, a like or feedback on how you use it already goes a long way.

Star on GitHub Like the model card Sponsor on GitHub Buy me a coffee

Star the repo on GitHub, like the Hugging Face model card, buy a coffee or become a sponsor: it all helps, and feedback on how you use it helps even more.

Author

Project and model by 34zY. Follow progress on GitHub and find the model card on Hugging Face.