kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
304 stars 59 forks source link

fritzhosts: option to create /etc/hosts.fritz file #33

Closed renne closed 3 years ago

renne commented 4 years ago

The Fritz!Box has no way to share the local hostnames/IP resolution with remote locations (e.g. VPN). It would be helpful if fritzhosts gets an argument to create a hosts file (e.g. /etc/hosts.fritz) with a user supplied domain name.

Currently I use

*/2 * * * * fritzhosts --ip-address '192.168.178.1' --port 49000 --username '<myuser>' --password '<mypasswd>' | sed -e '/^$/d' -e '/^[[:graph:]].*/d' -e '/  n:/d' -e 's/^ \{1,2\}[[:digit:]]\{1,2\}: \([[:graph:]]\+\) \+\([[:graph:]]\+\) \+\([[:graph:]]\+\).*/\1\t\t\2.<mydomain.tld>/' -e 's/fritz.box/fritz/' -e 's/RIPE-Atlas-Probe-3156/ripe/' > /etc/hosts.fritz

as a cronjob on OpenWRT which is a quite complicated syntax.

kbr commented 4 years ago

This is a more specialised request. Using fritzconnection as a library, you could easily implement this on your own to gather informations of interest and store them in a file-format and -location at your likings.

kbr commented 3 years ago

In my opinion this should not be a part of fritzconnection but can be implemented on top of fritzconnection – as it's a specific usecase. Please feel free to reopen or use github discussions first.