How Can I Change Routing?

I do a lot of general Linux operations, but I'm more familiar with python than I am with making a .sh. That said, I want to create a sub-routine for traffic from some addresses. Essentially, I still need some of the ads to come through for some features to work (e.g. ad-driven android games). That said, my thought is to deliver the ad to a routine that will compress or cut it.

Given these factors, these are my questions:

  • Which file is the web interface stored in?

  • Is there a pre-built method that I could use to compress an ad and pass it in Linux or an alternative solution that would trigger the game into thinking that the intended server had served the ad?

  • How would I assign the routine in the pi-hole interface?

Pi-hole isn't blocking ads per-se, it's blocking some domains by matching them to domain names or regular expressions. The blocked domains are resolved to IP addresses 0.0.0.0 or :: and so can't be reached. You can use whitelisting to ensure that domains which contain content that you want are resolved and not blocked.

If Pi-hole is not blocking a domain that contains an ad that you want, the ad will be delivered as normal and you can process it with whatever workflow you need. Pi-hole doesn't deliver any content; it's not a web-application firewall. It's a testament to the Pi-hole UX and how well it is put together that it can often feel like it is doing content filtering.

I imaged Pi OS and then installed Pi-hole using the script at https://install.pi-hole.net and the web root is in /var/www/html

Pi-hole is just blocking or not blocking domains. Ensure that Pi-hole is not blocking the domains that contain the content you need, and then it will be all be available to your client machines for you to further process there.

I understood the blocking table and the method used and I know that pi-hole isn't necessarily redistributing content to an existing place as it is currently designed. I was just thinking, conceptually, of adding a listener, that handles those methods, but I wanted to follow the design and integrate it as a component of my pi-hole setup, rather than external to the program.

The idea in python would be to modify the ad filtering list to target self for those specific domains, watch the transmitted data that pi-hole receives, then any time those domains are called, allow the data to transmit, but pass it to the listening agent, compress, and pass to destination addr with original header data.

I can do this in python, but I'm worried about processing power on the pi zero w that I'm using for this.

That said, my thought is to deliver the ad to a routine that will compress or cut it.

Pi-hole is a DNS server configured to block some domains.

Pi-hole just receives a domain, decides if it will be blocked or not (using its lists) and responds with an IP.

The content (including ads, blocked or not) never reaches Pi-hole.
It can't differentiate a web page from an AD or from any other content, because it never receives or transmits content.

1 Like