Use auto/security at https://api.pentestllm.ai/v1 to summarize redacted Nuclei JSONL while keeping scanner matches separate from analyst-confirmed findings. The scan is already done, authorized in writing and within the signed scope. Your script trims each line, groups duplicates, and sends only the grouped facts. The model writes short summaries. A person on the engagement decides which matches become findings in the report.
Start from a finished, authorized scan
This guide begins after the scan. You hold a JSONL file from a run the client approved in writing, against targets listed in the signed scope. Nothing here runs Nuclei, writes templates or touches a target. The model receives text and returns text. It has no tools and cannot reach the network on your behalf.
If you are still writing templates, that is a different job, covered on AI Nuclei template generation. Keep the rules of engagement next to the file, because the summary should never mention a host that the scope does not.
What one result line carries
Nuclei writes one JSON object per match when output is set to JSONL (the -jsonl flag, or -jsonl-export to a file). The field names below come from the output struct in the Nuclei repository, read 21 November 2026; they are an illustrative guide to adapt, so confirm them against a result line from your own version. The ones that matter for review:
template-idandinfo.name: which check produced the match.info.severity: the severity the template author assigned. It is not your rating.host,matched-at,type: where the match happened and over which protocol.matcher-nameandextractor-name: which condition inside the template fired.extracted-results: values the template pulled from the response.timestamp: when the match was recorded.request,response,curl-command: raw traffic for the match.
Raw request and response pairs are included by default. The Nuclei running docs list -omit-raw as the switch that leaves them out of JSON and JSONL output, with the config default omit-raw: false. So assume your file holds full HTTP bodies, cookies and headers unless you know it was written with that flag.
Trim each line before it leaves your machine
Most of a result line is not needed for a summary, and the raw traffic is the riskiest part. Keep the provenance fields, drop the rest, and record the source line number so every later claim points back to the file.
import json KEEP = ("template-id", "matcher-name", "extractor-name", "type", "host", "matched-at", "timestamp") def load(path): rows = [] with open(path, encoding="utf-8") as f: for n, line in enumerate(f, 1): if not line.strip(): continue r = json.loads(line) info = r.get("info") or {} row = {k: r.get(k) for k in KEEP} row.update(line=n, name=info.get("name"), severity=info.get("severity"), extracted_count=len(r.get("extracted-results") or [])) rows.append(row) return rowsOnly a count of extracted values survives, not the values. If host names identify the client, swap them for labels such as host-03 before sending and keep that map on your side. Then turn on redaction for the key or the request, as described on files and redaction. It replaces secrets in message text with placeholders such as [[SECRET_1]] before the request is forwarded, and an option covers personal values too. It is a second net for a token left in a matched-at URL, not a replacement for trimming.
Group duplicates in code, not in the prompt
A model asked to deduplicate will sometimes merge two different issues or split one. Do the grouping yourself, with a key you can explain to a reviewer: template, matcher and host.
from collections import defaultdict def group(rows): buckets = defaultdict(list) for r in rows: buckets[(r["template-id"], r["matcher-name"] or "", r["host"] or "")].append(r) groups = [] for i, ((tid, matcher, host), items) in enumerate(sorted(buckets.items()), 1): groups.append({ "group_id": f"G{i:03d}", "template_id": tid, "matcher": matcher, "host": host, "name": items[0]["name"], "severity": items[0]["severity"], "matched_at": sorted({x["matched-at"] for x in items if x["matched-at"]}), "lines": [x["line"] for x in items], "first_seen": min(x["timestamp"] for x in items), }) return groupsForty identical hits on one host become one group with forty line numbers. The same template on two hosts stays as two groups, because each host may have a different owner and a different fix.
Ask for summaries bound to a schema
Send the groups and ask for one summary per group_id. With a json_schema response format the answer is billed only if it matches the schema, and a miss on a non-streamed request is retried once with the missed answer free. The call below is an example to adapt: make one request first and confirm the reply parses, and see pricing for rates.
import osfrom openai import OpenAI SCHEMA = {"type": "object", "required": ["groups"], "additionalProperties": False, "properties": {"groups": {"type": "array", "items": { "type": "object", "additionalProperties": False, "required": ["group_id", "summary", "analyst_check"], "properties": {"group_id": {"type": "string"}, "summary": {"type": "string"}, "analyst_check": {"type": "string"}}}}}} SYSTEM = ("Each group is an unconfirmed scanner match from an authorized scan. " "Write one plain summary per group_id using only the fields given. " "Never call a match confirmed. Add no hosts, CVEs or severities. " "Give no exploitation steps. In analyst_check, name the records " "the analyst should compare before deciding.") client = OpenAI(api_key=os.environ["PENTESTLLM_API_KEY"], base_url="https://api.pentestllm.ai/v1")groups = group(load("scan.jsonl"))resp = client.chat.completions.create( model="auto/security", response_format={"type": "json_schema", "json_schema": {"name": "nuclei_review", "schema": SCHEMA}}, messages=[{"role": "system", "content": SYSTEM}, {"role": "user", "content": json.dumps(groups)}])out = json.loads(resp.choices[0].message.content)Get a key at the console. Other client libraries are listed on SDKs.
Check the answer before anyone reads it
A schema match proves shape, not truth. Run three checks: every group came back exactly once, no summary claims confirmation, and the facts still come from your code.
import re sent = sorted(g["group_id"] for g in groups)got = sorted(g["group_id"] for g in out["groups"])assert got == sent, "model dropped, added or repeated a group"for g in out["groups"]: assert not re.search(r"(?<!un)confirmed", g["summary"], re.I), g["group_id"] by_id = {g["group_id"]: g for g in out["groups"]}for g in groups: g.update(summary=by_id[g["group_id"]]["summary"], analyst_check=by_id[g["group_id"]]["analyst_check"], status="scanner match", verdict=None, analyst=None)json.dump(groups, open("review.json", "w"), indent=2)Host, severity and line numbers in review.json come from the scan file, never from the model’s text.
Keep two lists: matches and findings
review.json is a work queue. Each entry stays a scanner match until a named analyst sets verdict to confirmed, false positive or out of scope, and fills in analyst. Only confirmed entries move into the findings list. The analyst also sets the final severity, using the CVSS calculator rather than the template’s label.
From there the confirmed findings go into the normal reporting flow described in pentest report writing. Matches the analyst rejected stay in the work papers with their line numbers, so a client who asks why something is missing gets a clear answer. For deciding which confirmed issues to fix first, see vulnerability triage. All of this assumes testing within the acceptable use policy.
Questions
Which Nuclei fields preserve provenance?
template-id, matcher-name and extractor-name tie a match to the exact check that fired. host, matched-at and timestamp say where and when. Add the source line number yourself, and carry it through every step so any sentence in the report traces back to one line of the original file.
How should duplicate matches be grouped?
Group in your script, not in the prompt, using a key of template, matcher and host. Keep every line number inside the group so nothing is lost. Split groups by host, since separate hosts often have separate owners and fixes.
Who confirms a match?
A named analyst on the engagement, never the model. The model only writes summaries of unconfirmed matches. The analyst checks each one against their own evidence, records a verdict and their name, and only then does it appear as a finding.