Skip to content

Bundled NSE library

Phronesis ships a ready-to-use NSE library in nse-library/. For common use cases, you don't need to look for scripts elsewhere.

Contents

  • 619 official Nmap 7.992 scripts in scripts/.
  • The matching nselib in nselib/, which most scripts need.
  • 30 unique community additions in community/, including hackertarget, vulners, psc4re and personal scripts.
  • Full copies of the collections and the duplicates in sources/, for provenance. They are not loaded automatically.
  • catalog.jsonl, manifest.json, LICENSES/ and THIRD_PARTY_NOTICES.md.

Automatic pool

By default, the selector only suggests official scripts whose categories include safe, default, discovery, version, vuln, auth or info. Scripts in intrusive, brute, exploit, dos, malware, fuzzer and external, as well as community and personal scripts, are excluded.

To use them:

  • --scripts identifiant forces one or more specific scripts.
  • --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 external scripts, which send data to a third party.
  • A documented, safe personal script is added automatically as soon as --personal-dir points to its folder. Otherwise, --scripts forces it explicitly.

The model only receives the script's id and its @output description. The candidate pool determines what it can choose.

Testing with a community script

The test below forces a community candidate on a WordPress state. Since there is only one possible action, this test checks the full path and the rendering, not the model's preference. http-wordpress-info comes from the hackertarget collection.

phronesis --xml examples/community-scan.xml --scripts http-wordpress-info --silent

Selecting a community script

--all-scripts adds the safe community scripts to the automatic pool. The model may still prefer an official script, or answer STOP. To test a specific community script, --scripts is the explicit way.

Licenses

The official Nmap scripts are under the Nmap Public Source License 0.95. The text is in LICENSES/nmap-NPSL.txt.

Community collections keep their own licenses. Collections with no LICENSE file are marked unlicensed in THIRD_PARTY_NOTICES.md. Their redistribution has not been checked. Review the notices before republishing the library.

Check the library

python tools/build_nse_library.py --check

The command checks the SHA-256 fingerprints, the catalog, the uniqueness of ids and the consistency of script.db. No script is executed.

Rebuild the library

The build runs from local collections, with no network:

python tools/build_nse_library.py --source D:\nse-scripts --dest nse-library --update

The command rewrites catalog.jsonl, manifest.json and data/nse-catalog.jsonl. It refuses an unexpected official commit unless you pass --allow-commit-mismatch.

Using it with Nmap

The wrapper passes NMAPDIR to the Nmap process that runs the script. It doesn't use --datadir, which would also replace Nmap's data files.

On Windows, Phronesis uses the Nmap on the PATH; if it goes through WSL, NMAPDIR is converted to a /mnt/... path. In that case, make sure the folder is readable from WSL.

Updating the library

phronesis update-db --check
phronesis update-db --dry-run --source-dir D:\nse-scripts
phronesis update-db --source-dir D:\nse-scripts
phronesis update-db --rollback

The command builds a staging library, checks hashes and the catalog, backs up the old version, then replaces it. It doesn't touch personal scripts, templates or the model. No script is executed during the update.

The nseft-sources.json registry adds pinned sources:

phronesis update-db --registry nseft-sources.json --source nmap-official --dry-run
phronesis update-db --registry nseft-sources.json --source nmap-official
phronesis update-db --registry nseft-sources.json --source nmap-official-tarball --online --dry-run
phronesis update-db --registry nseft-sources.json --source all
  • --source all rebuilds the library from the registry: it may contain slightly fewer scripts than the current install. The exact count is shown at the end of the update.
  • An archive is only accepted if its SHA-256 matches the value pinned in the registry.
  • No network access without an explicit --online. --archive lets you use a file you've already downloaded.
  • Unlicensed sources are included with a warning and the usual notices; --strict-license blocks them. --force additionally accepts an archive whose SHA-256 isn't pinned.
  • A declared Ed25519 signature is verified if the cryptography module is installed. Otherwise, the update refuses to continue. The shipped registry declares no signature: integrity relies on the pinned SHA-256, not on the authenticity of the source.
  • --dry-run builds and checks in a temporary folder, without writing to the library.
  • --rollback restores the last backup.

Personal scripts

A dedicated personal folder can be indexed with phronesis index --personal DIR --output FILE, then used with phronesis suggest --personal-dir DIR. Documented, safe scripts are included automatically; the others stay explicit. See Suggestions and templates.

Security

NSE scripts are executable Lua code. The default pool restricts them to non-risky official scripts, but --scripts, --allow-risky and --run remain explicit actions. Always check the command and the scope before running anything.