Skip to content

How it works

The path of a decision

  1. The wrapper reads an existing Nmap XML file, or runs basic reconnaissance if you give it a target.
  2. It extracts the open ports, the identified services, the results collected so far and the candidate scripts from nse-library/.
  3. It sends the model the known state and the list of candidates.
  4. It checks that the answer is an id from the list, or STOP.
  5. It prints the matching Nmap command. It only runs it if --run is present.

The model picks one action from the candidates. It doesn't choose the target, the authorization or the risk level. It returns one decision per port, not a ranking of the whole library. The full list of scripts is available with phronesis --catalog.

Model input

The message contains three parts:

  • state: the host, the port, the service, the known findings and the uncertain findings.
  • candidates: the proposed scripts, with their id and description.
  • stop: the special action to choose when no action is worth the cost.

The expected answer is a single JSON object, for example {"action":"ssl-cert"} or {"action":"STOP"}.

What the wrapper does

nmap_select.py prepares the candidates, calls the model, validates the answer and builds the Nmap command. It keeps control of the execution decision, the scope and the safeguards on targets and ids.

The model launches no scans and has no network access.