Repository navigation
agent: ingest nuclei, httpx and ffuf output in ingest_scan_output - #215
Merged
Merged
Conversation
Extends ingest_scan_output with three formats: - nuclei-jsonl: one tool_output fact per result and an asset for the scanned target when it is valid; no automatic finding - httpx-jsonl: one HTTP service asset and one fact per URL - ffuf-json: one URL asset and one fact per result, read token by token with encoding/json; a file cut short keeps the complete results JSONL lines go through readJSONLines, taken from the bbot ingester (64 KiB per line; longer lines and invalid JSON are skipped and counted). bbot now uses the same reader, with no behaviour change. One file yields at most 50000 assets and facts; records past the cap are counted in over_cap and the result is marked truncated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Extends
ingest_scan_output(added in #214 for nmap XML) with three more scanner formats. The worker writes the scanner output to a file, then calls the tool with the format and path instead of reading the raw output:nuclei-jsonlnuclei -jsonl -o <file>host): an HTTP service when it is an http(s) URL, otherwise aniporsubdomainasset, only when the host validateshttpx-jsonlhttpx -json -o <file>ffuf-jsonffuf -of json -o <file>Fields read:
template-id,info.name,info.severity,host,matched-at,matcher-name,extracted-results.url,status_code,title,tech,webserver,content_length,host,ip,tls.results[]withinput,status,length,words,lines,url.Assets go through the existing
insert_assetshandler and facts throughrecord_fact(sourcetool_output). The model receives the same compact summary as for nmap: counters plus at most 20 notable items per type.Additive
formatenum.ingest_bbot. No registration change.encoding/json,bufio).Limits
readJSONLines, the line reader taken from the bbot ingester. A longer line is dropped without being buffered whole and counted inoversized_lines. A line that is not valid JSON, or lacks valid typed fields, is counted inskipped. bbot now uses the same reader, with no behaviour change; its tests are unchanged and green.json.Decoder, oneresults[]element at a time, under the 256 MiB file cap from Agent: ingest_scan_output for nmap XML files (worker, additive) #214. A file cut short keeps the complete results and returnstruncated: true.scanMaxItems), across all four formats, nmap included. Records past the cap are counted inover_cap, not ingested, and the result is markedtruncated. The cap is checked once per record, so the last record admitted can take the total slightly past it..., absolute paths outside it and symlinks leading outside are refused.strconv.Quote) JSON string. Summaries and notable items carry only validated typed fields: URL, host, status code, sizes, template-id token, severity enum.facts_existing, not written again (Agent: ingest_scan_output for nmap XML files (worker, additive) #214).Tests
insert_assetsandrecord_factfor nuclei, httpx and ffuf. Re-ingestion keeps the counters and adds no asset row and no fact.gofmt -lon changed files,go build ./...,go vet ./agent,go test -count=1 ./agent,go test -count=1 -race ./agent.Limitations
EvalSymlinks+Rel, then opened.template-idplus a valid host for nuclei, and a valid http(s)urlfor httpx and ffuf. A record without them is skipped and counted. Other missing fields are left empty. For the asset IP, httpxipis read first, thenhostwhen it holds an IP.