INSPECTOR(1)
π INSPECTOR(1) π
okay bestie, this is the DNS-STATS manual page for inspector β header folded in, vibe check passed. π
β¨ NAME β¨
inspector - convert C-DNS query/response info to PCAP or text. periodt. π
π SYNOPSIS π
inspector ['OPTIONS']... ['FILE'...]
π DESCRIPTION π
okay so inspector reads C-DNS query/response files produced by compactor, and it writes output files using one of two output formats. Optional lil bonus: IP addresses may be pseudo-anonymised. β¨
By default, inspector writes output using PCAP. This generates reconstructed traffic for the query/responses in the C-DNS file. main character output format, honestly. π₯
Alternatively, inspector can use a templated text output. This generates output based on a text template which specifies the output to be produced for each query/response record. very choose-your-own-adventure. π
inspector also writes a .info file for each output data file written. This is a plain text file, named as the output file but with .info appended. It contains a configuration and statistics summary for the capture. so you get receipts. π§Ύ
If no input file is given, inspector reads its standard input. In this case, an output file must be specified with the --output option. no input? stdin era. but you must name an output file with --output. π
π OPTIONS π
okay, the flags. there are a lot. hydrate before reading. π
π Generic Program Information π
-h,--helpβ Print a usage message briefly summarising these command-line options and then exit. helpful king. π-v,--versionβ Print the version number ofinspectorto the standard output stream and then exit. yes,-vshows up again later under template-specific options β the manpage does that, bestie. I'm not merging them. π--defaultsfile [arg]β Specify the path to thedefault_values.conffile. If not specified, the default configuration file/nix/store/d6lld5x1pyrklnxiw4agakzl3zhxk6nb-compactor-1.2.3/etc/dns-stats-compactor/default_values.confis read if present. path said exactly, no cap. π«Ά
πΈ Outputs πΈ
-o,--output FILENAMEβ Write a single output file named FILENAME containing output generated from all the input files specified. If no output filename is specified, an output file is written for each input file named as the input file with.pcapor.txtappended to the name. In either case, if the file already exists, a counter is appended to the filename (e.g.-1) until a filename is generated that does not exist. If FILENAME is-, output is written to standard output. In this case, no info (configuration and statistics summary) is generated. no.infowhen you go stdout mode, bestie. π-F,--output-format FORMATβ Write output using the nominated FORMAT. This must be eitherpcaportemplate. If not specified,pcapis the default. slay. π₯-z,--gzip-output [arg]β Compress data in the output files usinggzip(1)format. arg may betrueor1to enable compression,falseor0to disable compression. If arg is omitted, it defaults totrue. If compression is enabled, an extension.gzis added to the output filename. zip zip. π-y,--gzip-level [arg]β Compression level to use when producinggzip(1)output. arg must be a single digit0to9. If not specified, the default level is6. six is the vibe. β¨-x,--xz-output [arg]β Compress data in the output files usingxz(1)format. arg may betrueor1to enable compression,falseor0to disable compression. If arg is omitted, it defaults totrue. If compression is enabled, an extension.xzis added to the output filename. xz said let me cook. π-u,--xz-preset [arg]β Compression preset level to use when producingxz(1)output. arg must be a single digit0to9. If not specified, the default level is6. again, six. consistency icon. π-r.,--report-infoβ Report info (config and statistics summary) to standard output on exit. the original really has that dot after-rβ I'm keeping it exactly, bestie. π-D.,--relaxed-modeβ Warn (instead of error) if unrecognized command line options are found. and yes, the dot after-Dis also exactly what the source says. I am not editing the manpage's choices. π-N,--no-outputβ Donβt write any output PCAP or template files, just generate any requested ancillary outputs e.g..infofiles. no main output, just side quests. π¦-O,--no-infoβ Donβt write any.infofiles. no receipts. π-X,--excludesfileβ For each input, write a.excludesfilefile. This is in the format of an exclude hints file as specified tocompactorand indicates which data fields in the input file were not collected. tea about what's missing. π΅-S,--statsβ For each input file, write the number of query/response records converted and the time taken to standard error on completion. stats to stderr, bestie. π-k,--pseudo-anonymisation-keyβ Key to use during output pseudo-anonymisation. Must be16bytes long. sixteen bytes, exactly. π-P,--pseudo-anonymisation-passphraseβ Passphrase to use to generate key for output pseudo-anonymisation. passphrase era. π«Ά-p,--pseudo-anonymiseβ Pseudo-anonymise output. privacy slay. π--debug-qrβ Print a summary of each query/response pair to standard output on reading from the input C-DNS file. debug tea, served hot. β
π¦ PCAP-specific options π¦
-q,--query-onlyβ Write only query messages to the output. queries only, no responses. keep it focused. π
π§ Template-specific options π§
-t,--template FILENAMEβ Write output based on the template in the file named FILENAME. template time. β¨-v,--value NAME=TEXTβ Set a value named NAME with value TEXT on the command line. This value can be used in the template. This parameter may be repeated multiple times to specify different values. yes,-vis here too, doing a different job. the manpage said duplicate short option and I said okay bestie. π-g,--geoip-db-dir DIRβinspectorcan present geographic IP data in the output. This requires the MaxMind GeoLite2 database files, which should be found in directory DIR. If not specified, the default directory/nix/store/d6lld5x1pyrklnxiw4agakzl3zhxk6nb-compactor-1.2.3/var/lib/dns-stats-compactor/GeoIPis checked.inspectorneeds filesGeoLite2-ASN.mmdbandGeoLite2-City.mmdbto be present to enable geographic IP data in the output. both files, or no geo vibes. π
π TEMPLATE FILES π
A template file describes the output generated by inspector for each query/response item in a C-DNS file. it's giving custom output couture. π
π Template markers π
When output for each query/response item is generated, elements, or markers, like {{NAME}} in the template are replaced with a data item named NAME from the query/response (QR) item. marker magic. β¨π¦
Okay bestie, quick but important heads-up before the item list: if a data item isn't available in the query/response item you're working with, nothing gets output for that marker. Like, it just vanishes. π¨
So for example, "QTYPE {{query_type}}" will output "QTYPE 1" for a query whose question type is QTYPE A, and will output "QTYPE " if there's no query question at all. Empty vibes, but no error. Slay.
Here's the whole roster of things you can drop in π
client_addressβ IP address of client as raw bytes,4for IPv4,16for IPv6.client_portβ port used by client.server_addressβ IP address of server as raw bytes,4for IPv4,16for IPv6.server_portβ port used by server.client_hoplimitβ value of query client hoplimit. Blank if no query.dns_flagsβ DNS flags value. See the C-DNS definition for the actual values, iykyk.idβ query ID, or the response ID if there's no query.opcodeβ value of query OPCODE, or response OPCODE if there's no query.query_nameβ QNAME in the first Question. Blank if no question.query_classβ numeric QCLASS in the first Question. Blank if no question.query_typeβ numeric QTYPE in the first Question. Blank if no question.query_authoritative_answerβ value of query AA flag. Blank if no query.query_authenticated_dataβ value of query AD flag. Blank if no query.query_checking_disabledβ value of query CD flag. Blank if no query.query_checking_recursion_availableβ value of query RA flag. Blank if no query.query_checking_recursion_desiredβ value of query RD flag. Blank if no query.query_truncatedβ value of query TC flag. Blank if no query.query_zβ value of query Z flag. Blank if no query.query_doβ value of query EDNS0 DO bit. Blank if no query EDNS0.query_edns_udp_payload_sizeβ value of query EDNS0 UDP payload size. Blank if no query EDNS0.query_edns_versionβ value of query EDNS0 version bit. Blank if no query EDNS0.query_opt_codesβ comma separated list of query EDNS0 OPT codes. Blank if no query EDNS0.query_lenβ value of query length onquery_rcodeβ the value of the query RCODE. Blank if there's no query πquery_qdcountβ how many questions got captured from the query. Blank if no query.query_ancountβ how many answer RRs got captured from the query. Blank if no query β¨query_nscountβ how many authority RRs got captured from the query. Blank if no query.query_arcountβ how many additional RRs got captured from the query. Blank if no query π«query_response_has_queryβ1if QR contains a query, otherwise0. no cap.query_response_has_responseβ1if QR contains a response, otherwise0.query_response_query_has_optβ1if QR contains a query that has OPT, otherwise0. Blank if no query π«Άquery_response_query_has_no_questionβ0if QR contains a query that has a question, otherwise1. Blank if no query. (yes bestie, the logic is inverted on purpose, read it twice π)query_response_response_has_no_questionβ0if QR contains a response that has a question, otherwise1. Blank if no query.query_response_response_has_optβ1if QR contains a response that has OPT, otherwise0. Blank if no response πΈquery_response_flagsβ the Query/Response flags value. See C-DNS definition for values π
okay now we're in response territory, and it's giving "every single DNS flag gets its own little spotlight" β¨
response_authoritative_answerβ the value of the response AA flag. Blank if no response.response_authenticated_dataβ the value of the response AD flag. Blank if no response πresponse_checking_disabledβ the value of the response CD flag. Blank if no response.response_checking_recursion_availableβ the value of the response RA flag. Blank if no response π¦response_checking_recursion_desiredβ the value of the response RD flag. Blank if no response.response_truncatedβ the value of the response TC flag. Blank if no response.response_zβ the value of the response Z flag. Blank if no response πresponse_lenβ the value of the response length on the wire. Blank if no response.response_rcodeβ the value of the response RCODE. Blank if no response βresponse_qdcountβ the count of questions captured from the response. Blank if no β¦response_ancountβ how many answer RRs got captured from the response. Blank if there's no response at all. πresponse_nscountβ how many authority RRs got captured from the response. Blank when there's no response.response_arcountβ how many additional RRs got captured from the response. Also blank if there's no response, bestie.response_delay_nanosecsβ the gap, in nano-seconds, between the query timestamp and the response timestamp. It's0if there's no query or no response. πtimestamp_secsβ QR timestamp, in seconds since epoch.timestamp_microsecsβ QR timestamp, in micro-seconds since epoch.timestamp_nanosecsβ QR timestamp, in nano-seconds since epoch.transport_flagsβ the transport flags value. For the actual values, see the C-DNS definition, iykyk. πtransaction_typeβ the transaction type value. Again: see the C-DNS definition for values.transport_ipv6β literally, quote-unquote: "1 if the IPv4 used, 0 if IPv4." That's what the page says, bestie, we don't make the rules π«Άtransport_tcpβ1if the transport used was TCP,0if it was UDP. Easy.
π Template section π
Okay so a template is allowed to optionally contain a section start marker:
{{#QUERY_RESPONSE_HEADER}}
and a section end marker:
{{/QUERY_RESPONSE_HEADER}}
If those markers are present, everything between them gets output before the first query/response output record. So it's like the little intro text that shows up once, at the top, before the actual data starts. Cute, right? β¨
π·οΈ Template marker modifiers π·οΈ
Okay bestie, so a marker modifier is literally just a filter that gets applied at template-expansion time β it swoops in, tweaks the value of the marker, and then the output happens. You write one by putting a colon after the marker name and then the modifier name, like this:
{{client_address:x-ipaddr}}
Iconic. Now here's the whole lineup, no skips, no cuts:
x-cstringβ spits out binary input data using C string style escapes, e.g.Hello, world\n\0. Any non-printable character that doesn't have a defined escape gets output as\xaa.x-arrayβ wraps your input data up in square parenthesis. Cute little present. πx-csvescapeβ outputs input data escaped for use with CSV, exactly as described in RFC4180 <https://tools.ietf.org/html/rfc4180>, e.g."Hello, ""quotes""".x-hexstringβ outputs binary input data as hex characters. A 0 byte comes out as\0, and every other value comes out as\xaa.x-ipaddrβ outputs the text representation of an IPv4 or IPv6 address, depending on whether the filter input was 4 bytes or 16 bytes.x-ip6addrβ outputs an IPv4 or IPv6 address as the IPv6 printable address representation. IPv4 addresses get output as::ffff:192.0.2.25.x-ip6addr-binβ outputs IPv4 or IPv6 addresses as a 16 byte binary IPv6 address. IPv4 addresses come out as0x00000000000000000000ffffc0000219.x-ipaddr-geo-locationβ give it an IPv4 or IPv6 address and it outputs the location ID that the MaxMind database reports for that address. The city ID gets reported if it's found, otherwise the country ID if that's found, otherwise the continent ID if that's found, otherwise0. It'll error out if no MaxMind database files are found, so likeβ¦ make sure they're there. π«x-ipaddr-geo-asnβ give it an IPv4 or IPv6 address and it outputs the ASN reported by the MaxMind database for that address, or0if it's not found. Error if no MaxMind database files are found.x-ipaddr-geo-as-netmaskβ give it an IPv4 or IPv6 address and it outputs the netmask reported by the MaxMind database for the AS network that contains that address, or0if it's not found. Error if no MaxMind database files are found. Yes, same warning, three times β that's just how it is. πx-dateβ outputs a timestamp in seconds as a UTC date in ISO601 format (YYYY-MM-DD).x-datefmt=<fmt>β outputs a timestamp in seconds as a UTC date and time in whatever format you specify. The string<fmt>must be a validstrftime(3)format string, no cap.x-datetimeβ outputs a timestamp in seconds as a UTC date and time in ISO601 format (YYYY-MM-DD HH:MM:SS).
There are also other predefined modifiers that are designed for use with HTML output β those ones are available too. Go see the documentation for the ctemplate library at https://github.com/OlafvdSpek/ctemplate for the deets. β¨
π¦ EXIT STATUS π¦
The exit status is 1 if any error occurred. A successful run ends with an exit status of 0. That's it, that's the whole vibe check. π’
π LIMITATIONS π
So here's a thing. The design of C-DNS allows blocks with different storage and collection parameters to be present in the same C-DNS file. When does that even happen? Bestie, it can arise when two separate C-DNS files get merged.
At the time of writing, no tool exists to actually do that merging. And inspector has not been tested on such inputs β so if you hand it a file like that, it may not exhibit correct behaviour. You've been warned, love you. π
π RESOURCES π
https://github.com/dns-stats/compactor/wiki
Β©οΈ COPYRIGHT Β©οΈ
Copyright 2016-2019 Internet Corporation for Assigned Names and Numbers and Sinodun Internet Technologies.
Free use of this software is granted under the terms of the Mozilla Public Licence, version 2.0. See the source for full details.
π AUTHOR π
Sinodun Internet Technologies
That's the whole page, bestie! This one's from DNS-STATS, dated 1980-01-01, and it's INSPECTOR(1) β go forth and inspect responsibly. π¦ππ
π¦ where this page comes from
- nixpkgs unstable: compactor 1.2.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms