blob: 9fd4efbeeb41b50a59e8cb0e6ddaa1b3a55fe3e1 [file] [log] [blame]
Simon Kelley4c960fa2015-03-04 20:32:26 +00001The script reads stdin and replaces all IP addresses with names before
2outputting it again. IPs from private networks are reverse looked up
Josh Soref730c6742017-02-06 16:14:04 +00003via dns. Other IP addresses are searched for in the dnsmasq query log.
Simon Kelley4c960fa2015-03-04 20:32:26 +00004This gives names (CNAMEs if I understand DNS correctly) that are closer
5to the name the client originally asked for then the names obtained by
6reverse lookup. Just run
Joachim Zobel47b9ac52015-02-23 21:38:11 +00007
Simon Kelley4c960fa2015-03-04 20:32:26 +00008netstat -n -4 | ./reverse_replace.sh
9
10to see what it does. It needs
Joachim Zobel47b9ac52015-02-23 21:38:11 +000011
12log-queries
13log-facility=/var/log/dnsmasq.log
14
Simon Kelley4c960fa2015-03-04 20:32:26 +000015in the dnsmasq configuration.
Joachim Zobel47b9ac52015-02-23 21:38:11 +000016
Simon Kelley4c960fa2015-03-04 20:32:26 +000017The script runs on debian (with ash installed) and on busybox.
Joachim Zobel47b9ac52015-02-23 21:38:11 +000018