Overview
After the evil-twin project, I continued to root machines on hackthebox/vulnhub and left my raspberry pi to collect dust, recently I randomly thought of my raspberry pi and wanted to put my raspberry pi to its full use again!
During my research for my Wi-Fi pentesting project, I stumbled upon pi-hole raspberry pi projects, at that point I thought that it could be really useful for me as I am unable to block ads on my phone/tv, however since it is not related to my project scope, I had to find another project. But now, I can finally try it out!
Prerequisite Tools
Pi-Hole Setup
OS Installation
- Select
Raspberry Pi OS
- Select Settings at
Bottom Right
, - Enable SSH, set username & password
- Eject SSD
- Plug SSD into Pi
- Connect ethernet cable
- Power on the Pi
Configure Static IP address for your Pi
- Login to your Router’s web interface
http://192.168.1.1
http://192.168.1.254
.
- View local device to find out Pi’s assigned IP address
- SSH w/ your configured credentials
- View currently defined router
- routers:
192.168.1.254
- routers:
- View current DNS Server
1
sudo nano /etc/resolv.conf
- nameserver:
192.168.1.254
- nameserver:
- Modify
dhcpcd.conf
to configure our static IP address for your Pi1 2 3 4 5 6 7 8 9
interface <NETWORK> static ip_address=<STATICIP>/24 static routers=<ROUTERIP> static domain_name_servers=<DNSIP> <NETWORK>: wlan0(wireless)/eth0(wired) <STATICIP>: IP Address in the Upper Numbers of your DHCP range [Recommendation] <routers>: Refer to Step 4 <DNSIP>: Refer to step 5
- Save the file
CTRL + X
thenY
, followed byENTER
- Save the file
- Reboot
1
sudo reboot
Pi-Hole Installation
- Proceed to your SSH w/ your configured credentials
- Install Pi-Hole (one-liner)
1
curl -sSL https://install.pi-hole.net | bash
- Use the following settings
YES
- Set static IP using current values- Choose your DNS Provider
- Select 3rd party list, just go with the suggested list
On
- web admin interfaceOn
- web server (lighttpd)On
- Log queries0
- Show everything- Done
- Add additional blocklist
- Login to
http://<Pi IP address>/admin
- Proceed to
Group Management
>Adlists
- Proceed to firebog, copy links that are highlighted in green
- Paste them in
Address
, underAdd new adlist
- Click online to update your gravity list, and you’re done!
- Login to
DNS Server
- If you have the option to set your DNS Server on your router, change it to your Pi’s IP Address
- Unfortunately my router does not allow me to do so, so I will have to manually set the DNS Server of my devices
Results
- Youtube:
- Unfortunately, due to how youtube ads works, it does not work for youtube.
- Streaming sites, it works really well!
- For e.g., when you click on the play button, an ad pops up and forces you to open another tab and sometimes even redirects you to another application!
- Or there are so many ads that you cannot even see the panels/video.
- Demo:
Comments powered by Disqus.