Code Monkey home page Code Monkey logo

esp32_adblocker's Introduction

ESP32_AdBlocker

ESP32_AdBlocker acts as a DNS Sinkhole (like Pi-Hole) by returning 0.0.0.0 for any domain names in its blocklist, else forwards to an external DNS server to resolve IP addresses. This prevents content being retrieved from or sent to blocked domains. A web server is provided to control the service and monitor its operation.

Requirements

ESP32_AdBlocker is an Arduino sketch. The ESP32 module needs PSRAM:

  • ESP32-S3 with 8MB PSRAM can host a currently sized blocklist. Domain searches take <50 micro seconds.
  • ESP32 with 4MB PSRAM may truncate a currently sized blocklist. Domain searches take <100 micro seconds.

Operation

The ESP32_AdBlocker web page is used to enter the URL of the blocklist to be downloaded:

After entry, it will take several minutes for ESP32_AdBlocker to be ready after processing and sorting the data. Progress can be monitored on the web page. Subsequent reloads of the same file are much quicker as only updates need to be processed. ESP32-S3 is about twice as fast as the ESP32. As only one file can be downloaded, a consolidated blocklist should be used. Ideally select a file less than the size of the PSRAM. The file format should be in either HOSTS format or Adblock format (only domain name entries processed). The following site for example provides a list of suitable files: https://github.com/StevenBlack/hosts.

ESP32_AdBlocker will subsequently download the selected file daily at a given time to keep the blocklist updated.

To make ESP32_AdBlocker your preferred DNS server, enter its IPv4 address in place of the current DNS server IPs in your router / devices. ESP32_AdBlocker does not have an IPv6 address but some devices use IPv6 by default, so disable IPv6 DNS on your device / router to force it to use IPv4 DNS.
Eg for a Windows PC, to use AdBlocker as DNS Server having IP address 192.168.1.168, at the Windows command prompt, enter:
netsh interface ip set dns "Wi-Fi" static 192.168.1.168
To switch back to usual DNS Server, eg Google, enter:
netsh interface ip set dns "Wi-Fi" static 8.8.8.8

Installation

Download github files into the Arduino IDE sketch folder, removing -main from the application folder name.

Compile using arduino core v2.x or V3.x (min v3.0.3) with PSRAM enabled and the following Partition scheme:

  • ESP32-S3 - 8M with spiffs (...)
  • ESP32 - Minimal SPIFFS (...)

On first installation, the application will start in wifi AP mode - connect to SSID: ESP32_AdBlocker_..., to allow router and password details to be entered via the web page on 192.168.4.1. The configuration data file (except passwords) is automatically created, and the application web pages automatically downloaded from GitHub to the SD card /data folder when an internet connection is available.

Subsequent updates to the application, or to the /data folder files, can be made using the OTA Upload tab. The /data folder can also be reloaded from GitHub using the Reload /data button on the Edit Config tab, or by using a WebDAV client.

Configuration

More configuration details accessed via Edit Config tab, which displays further buttons:

Wifi: Additional WiFi and webserver settings.

Settings: environmental settings affecting blocklist operation

Press Save to make changes persistent.

Logging

The application log messages can be monitored on the web page tab Show Log.

The Verbose button will reveal subsequent logging for each blocked or accepted connection.

esp32_adblocker's People

Contributors

s60sc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

esp32_adblocker's Issues

Support DNS over TLS for upstream servers?

Thank you so much for this project. It's almost exactly what I want. My ISP tracks dns queries made, even to third parties, so I would like to set the upstream DNS to one that uses DNS over TLS or DNS over HTTPS, to protect my privacy some.

It doesn't seem like there's a way currently to enable upstream servers to use either of those features?

W5500 support

Hi. Any chance you can add W5500 support to this project?

Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.

01:47:32.942 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
01:47:32.942 -> configsip: 0, SPIWP:0xee
01:47:32.942 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
01:47:32.942 -> mode:DIO, clock div:1
01:47:32.942 -> load:0x3fff0030,len:1344
01:47:32.942 -> load:0x40078000,len:13864
01:47:32.942 -> load:0x40080400,len:3608
01:47:32.942 -> entry 0x400805f0
01:47:33.367 -> E (283) psram: PSRAM ID read error: 0xffffffff
01:47:33.367 ->
01:47:33.367 -> [00:03:26.982 startStorage] File: /data/configs.txt, size: 1115
01:47:33.413 -> [00:03:26.983 startStorage] LittleFS: Total bytes 196608, Used bytes 20480
01:47:33.600 -> [00:03:26.988 startStorage] Sketch size 1263kB
01:47:33.600 -> [00:03:27.207 loadConfig] Load config
01:47:33.741 -> [00:03:27.340 onWiFiEvent] Wifi Station started, connecting to: Me
01:47:33.741 -> [00:03:27.341 onWiFiEvent] Wifi AP SSID: ESP_367A99 started, use 'http://192.168.4.1' to connect
01:47:33.741 -> [00:03:27.341 setWifiSTA] Wifi Station IP from DHCP
01:47:33.741 -> ..........[00:03:32.359 startPing] Started ping monitoring
01:47:38.747 -> [00:03:32.361 startWebServer] Starting web server on port: 80
01:47:38.794 -> Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
01:47:38.794 ->
01:47:38.794 -> Core 1 register dump:
01:47:38.794 -> PC : 0x400d3ceb PS : 0x00060f30 A0 : 0x800d304f A1 : 0x3ffb27e0
01:47:38.794 -> A2 : 0x00000021 A3 : 0x00000068 A4 : 0x3ffc5968 A5 : 0xf25f5ef1
01:47:38.794 -> A6 : 0xfffffffe A7 : 0x0000ff00 A8 : 0x00000002 A9 : 0x3ffb27c0
01:47:38.794 -> A10 : 0x00000000 A11 : 0x00000001 A12 : 0x3ffc3c94 A13 : 0x00000000
01:47:38.794 -> A14 : 0x00000000 A15 : 0x0000003c SAR : 0x0000001f EXCCAUSE: 0x0000001d
01:47:38.841 -> EXCVADDR: 0x00000000 LBEG : 0x4008ade6 LEND : 0x4008adf1 LCOUNT : 0x00000000
01:47:38.841 ->
01:47:38.841 ->
01:47:38.841 -> Backtrace:0x400d3ce8:0x3ffb27e00x400d304c:0x3ffb2800 0x400ec066:0x3ffb2820
01:47:38.841 ->
01:47:38.841 ->
01:47:38.841 ->
01:47:38.841 ->
01:47:38.841 -> ELF file SHA256: 0000000000000000
01:47:38.841 ->
01:47:38.841 -> Rebooting...
01:47:38.841 -> ets Jun 8 2016 00:22:57

Infinitely “Connection failed with error: connection refused”.

ESP32-WROVER

I keep getting an error:

[00:00:11.753 startPing] Started ping monitoring
[00:00:11.766 getLocalNTP] Using NTP server: pool.ntp.org
[00:00:11.767 WARN getLocalNTP] Not yet synced with NTP 
[00:00:11.771 startWebServer] Starting web server on port: 80
[00:00:11.771 checkMemory] Free: heap 196296, block: 110580, pSRAM 4177119
[00:00:12.064 resetWatchDog] WatchDog started using task: ping
[00:00:12.186 loadBlockList] Initial load of latest blocklist
[00:00:12.188 downloadFile] Downloading https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

[00:00:12.280 ERROR @ appSpecific.cpp:200] Connection failed with error: connection refused 
[00:00:12.281 doRestart] Controlled restart: Failed to complete blocklist download, retry ... 
[00:48:34.001 onWiFiEvent] WiFi Station disconnected

What can be done about it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.