Name

dnsfilter — filter a stream, looking up the domain names of any IP addresses

Synopsis

dnsfilter [-c queries] [-l lines]

Description

dnsfilter is a filter that reads its standard input, writing it to its standard output. Any lines in its input that begin with an IP address are modified to include the domain name that that IP address maps to in the Domain Name System, if available; other lines are passed through as-is.

If an IP address does not have a domain name listed in the DNS, dnsfilter leaves the line alone. If an IP address has a domain name listed in the DNS, dnsfilter inserts an equals sign and the domain name before the first space or tab in the line. If a DNS lookup fails temporarily, dnsfilter inserts a colon and a dash-separated error message before the first space or tab in the line.

While dnsfilter is looking up an address in the DNS, it reads ahead in the input and looks for more addresses to look up in parallel.

Options

-c n

Do at most n DNS queries in parallel. Default: 10.

-l n

Read ahead at most n lines. Default: 1000.

History

dnsfilter was originally part of Daniel J. Bernstein's djbdns toolset in 1999.

Author

Original code and documentation by Daniel J. Bernstein. Documentation modernizations by Jonathan de Boyne Pollard.