Skip to content

Usage

Offline analysis

From an existing Nmap XML file:

phronesis --xml .\scan.xml --top 8

With XML, there's no need to run Nmap for the analysis. You still need the model and the NSE library.

Nmap pipe

nmap -Pn -sV -oX - 10.10.10.5 | phronesis

-oX - is required: Nmap must write XML to stdout. phronesis reads that XML and prints one line per port. The pipe also works with --xml -.

In PowerShell 5.1, the pipe may re-encode the XML. If you hit that error, use cmd /c or run the pipe in WSL.

Lab scan

phronesis 192.0.2.10 -p 80,443

The example uses an address reserved for documentation. For your lab, replace it with a target whose scope you control.

The wrapper runs -sV service and version detection, then suggests one script per port. --run executes the suggested scripts. Review the command, the script and the target before using it.

Output formats

  • By default, one line per port: host:port/tcp [service] script.
  • --format jsonl or -json: one JSON object per decision.
  • --commands: Nmap commands only.
  • --table: a table that reads well in a terminal.
  • --silent: hides [INF] messages, keeps results and errors.

Examples:

phronesis --xml scan.xml --format jsonl
phronesis --xml scan.xml --table
nmap -Pn -sV -oX - 10.10.10.5 | phronesis --commands

[INF], [WRN] and [ERR] messages go to stderr. Results go to stdout, so you can redirect or parse them.

Sample default output:

192.0.2.10:80/tcp [http] http-title
192.0.2.10:443/tcp [https] STOP

STOP means no script in the pool is worth its cost for this port.

Exit codes

Code Meaning
0 Success
1 Error, for example model not found or execution failure
2 Invalid argument, unreadable XML or empty standard input

Useful options

Option Effect
--xml FICHIER Analyzes an existing XML file, or - for stdin
-p PORTS Limits the ports of the basic reconnaissance
--top N Limits the number of candidates sent to the model
--scripts LISTE Forces a list of candidates
--allow-risky Allows the official intrusive, brute, dos, exploit, malware and fuzzer scripts
--all-scripts Adds the safe community scripts to the automatic pool
--allow-external Allows scripts that contact a third party
--method Engine for single-action mode: sequence or generative. suggest always uses sequence
--no-templates Ignores all suggestion templates
--datadir DOSSIER Uses another NSE library root
--model-dir DOSSIER Points to another model folder
--device cpu|cuda:0 Chooses the inference hardware
--timeout SECONDES Timeout for Nmap commands
--run Runs the suggested scripts
-o FICHIER Writes results to a file
-nc Disables colors
-v Shows commands and details

Choosing candidates

--top limits the number of candidates sent to the model. --scripts forces a specific list. With neither option, the wrapper builds a list from the service and the port.

The automatic pool only contains official scripts whose categories include safe, default, discovery, version, vuln, auth or info. Risky scripts require --allow-risky, community scripts --all-scripts, external scripts --allow-external. A documented, safe personal script is added automatically as soon as --personal-dir points to its folder. --scripts forces a specific list without applying these filters. See the NSE library.

Personal scripts

You enable a personal folder with --personal-dir, or personal_dir in a profile; that is what triggers the automatic inclusion of documented, safe scripts. The NSE_PERSONAL variable is only used to locate a script passed via --scripts. Phronesis uses the Nmap found on the PATH; on Windows, if Nmap isn't installed natively, it goes through WSL, so use paths that are visible from WSL.

Personal scripts are taken into account based on their description. Check their contents before running anything: they are executable programs, not just data.