Export /etc/hosts file content from the Clients list of a TP-Link wireless router website
- In the terminal, install the dependency
pyperclip
usingpip3 install pyperclip
- In your TP-Link router's admin website, click "Network Map", then "Clients".
- Hit
command
+a
(orctrl
+a
) to select everything on the page. - Hit
command
+c
(orctrl
+c
) to copy the contents of the page to the clipboard. - In the terminal, run
python3 tplink2hosts.py
. The program will parse the contents of the clipboard and print just the IP addresses and hostnames separated withtab
characters, ready to copy and paste into/etc/hosts
on your Pi-hole or wherever else you need to use this information.
Tested to work on a Mac (MacOS 12.5) using Safari (15.6) and a TP-Link Archer AXE75 v1.0 router using firmware 1.0.5 Build 20220405 rel.80113(5553).