d***@neverbox.com
2017-09-30 15:57:27 UTC
Date: Monday 11th February 2013 09:45:46 UTC (over 4 years ago)
to start hacking on the existing cache dumping code in src/cache.c to
make it do what you want.
I did exactly this about a month ago:¹
https://github.com/guns/dnsmasq/commit/13ac5ace736a5d24c629d8cadc65eda92ea443cb.patch
This adds a `--hosts-cache=` option that dumps the current cache
to in hosts file format on SIGUSR1.
If anyone is curious why I would want such a feature, I am using the
information to construct firewalls for children (e.g. visit pbs.org,
browse around, dump hosts to file, then add them to child's outbound
firewall rules). There are other ways to go about this, but I found this
to be straightforward.
It also happens to be useful for navigating to sites whose DNS entries
have been recently hijacked, which has become a frightening reality in
recent years.
guns
This is exactly what I am looking for.
@Simon,
The dnsmasq cache dump is a feature that is desirable by many people, and
this is the most straightforward solution. Would you take this patch
please, or there are better ways to do it now?
Thanks
Hello,
I use dnsmasq 2.63 on debian, only dns is on, and want to read cache
dump with a small script. Till now the cache dump has been written
in extra log file (log-facility is on) or in syslog. Is there any
way to get an extra cache file? It will be easier to parse the
content of the cache. Furthermore, the host name in the log is cut
after about 39 characters. Is there any way to get the complete
content?
There's not way to do either of those, sorry. You best bet is probablyI use dnsmasq 2.63 on debian, only dns is on, and want to read cache
dump with a small script. Till now the cache dump has been written
in extra log file (log-facility is on) or in syslog. Is there any
way to get an extra cache file? It will be easier to parse the
content of the cache. Furthermore, the host name in the log is cut
after about 39 characters. Is there any way to get the complete
content?
to start hacking on the existing cache dumping code in src/cache.c to
make it do what you want.
https://github.com/guns/dnsmasq/commit/13ac5ace736a5d24c629d8cadc65eda92ea443cb.patch
This adds a `--hosts-cache=` option that dumps the current cache
to in hosts file format on SIGUSR1.
If anyone is curious why I would want such a feature, I am using the
information to construct firewalls for children (e.g. visit pbs.org,
browse around, dump hosts to file, then add them to child's outbound
firewall rules). There are other ways to go about this, but I found this
to be straightforward.
It also happens to be useful for navigating to sites whose DNS entries
have been recently hijacked, which has become a frightening reality in
recent years.
guns
@Simon,
The dnsmasq cache dump is a feature that is desirable by many people, and
this is the most straightforward solution. Would you take this patch
please, or there are better ways to do it now?
Thanks