Script to get RPi temperature and convert into domain query

This script will measure the temperature of a Raspberry Pi and convert it into a domain query so that it appears in the Query Log and Long-term database.

Why? No particular reason, it was more of a curiosity than anything, and to practice using GitHub for the first time and using bash functions. It's certainly not a serious way to monitor your Pi's temperature but it does work.

The script supports C (default) and F, see the script comments.

These queries should be blocked with a Blacklist regex, and they use home.arpa just in case. Be sure to create a Blacklist regex for

^.*temperature\.home\.arpa$

Run the script manually or via cron as needed, eg every 1 minute.

The Query log entry shows as a TYPE66 query for the domain pihole-temp-<temperature>.temperature.home.arpa

The Dashboard Query Types collates these under OTHER.

1 Like

This is certainly a very inventive way of repurposing your Query Log.

And as you've noted already, this shouldn't be considered a serious approach to log or monitor CPU temperature. :wink:
I'll just add that this will result in 1,440 DNS-wise meaningless queries in your log per day.

1 Like

I'm already working on v2.0* which will add daily haikus, calendar appointments and weather forecasts.

*I'm not

4 Likes

This is the most creative DNS abuse I've ever seen :joy:

2 Likes

You could even remove the hardcoded 127.0.0.1 and send information of a different device to your Pi-hole as well

Thankyou :grinning:

This is one method used by bad actors to exfiltrate compromised data from private networks, since it can go unnoticed and is likely not blocked. Encode the data in chunks and make specific type subdomain queries to a temporary DNS server controlled by the bad actor. They end up with DNS logs containing the encoded data in the requests.