Skip to content
Proyek

Tentang

Network-wide Rust DNS adblock, anti-scam firewall & Smart TV/IoT ADB debloater inside home ISP routers (< 408 kB VmRSS RAM, 29 live feeds incl. Thai/SEA, 97% TurtleCute score).

Keamanan dan privasi

Cara angka ini diukur

65 bintang6 Fork +1 dalam 24 jam

Pertumbuhan bintang terukur

dalam 24 jam
+1
dalam 7 hari
Mengumpulkan riwayat
dalam 15 hari
Mengumpulkan riwayat
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli
HomeShield Banner

🛡️ HomeShield

Autonomous Edge Cyber-Shield & Anti-Scam Gateway for Home Networks

Release Rust Threats Blocked Memory Flash Wear Rollback License Blocklists

Network-wide protection against financial scammers, fake loan APKs, malvertising, gambling traps, and Smart TV spyware — running directly inside standard broadband routers without extra hardware.

Why HomeShield? • 4 Security Pillars • Comparison • Before & After (97%) • Architecture • Quick Start • Blocklist Sources & Updates • Playbook & Rollback • Appendix

🌐 Languages / 语言 / ภาษา: English | ภาษาไทย (Thai) | 简体中文 (Chinese) | العربية (Arabic) | Español (Spanish) | Tiếng Việt (Vietnamese) | 日本語 (Japanese) | Italiano (Italian) | Português (Portuguese) | Nederlands (Dutch) | Deutsch (German) | Українська (Ukrainian) | Özbekcha (Uzbek) | Français (French) | Ελληνικά (Greek) | עברית (Hebrew)


🛑 The Modern Cybercrime Epidemic: Why Browser Adblockers Fail

In the past, ad blockers were a mere luxury for visual convenience. Today, rogue ads and malicious domains have evolved into sophisticated financial cybercrime weapons:

⚠️ The Threat Targeting Families & The Elderly

  • Fake Government & Banking APKs: Scammers purchase low-cost ad placements across mainstream Ad Networks and social media, spoofing official government land offices, electricity utilities, or low-interest bank loans. A single accidental click tricks victims into downloading credential-stealing or remote-access APKs.
  • The In-App Webview Blind Spot: Millions of users open malicious links directly inside LINE, Facebook, Messenger, and TikTok webviews. Browser extensions like uBlock Origin cannot run inside these apps.
  • Smart TVs & IoT as Unmonitored Spies: Smart TVs, cheap streaming dongles, and IoT security cameras continuously transmit behavioral analytics or risk being hijacked into botnets. You cannot install antivirus software on a Smart TV.
  • Children & Gambling Traps: Cartoon, anime, and game streaming portals are littered with deceptive popups redirecting children to online gambling, slots, and adult content.

🛡️ HomeShield: Your First Line of Defense

HomeShield solves this epidemic at the root by transforming standard home gateways and broadband routers into an un-bypassable Layer 7 DNS Cyber-Shield. It intercepts and drops dangerous traffic for every smartphone, tablet, PC, and Smart TV in your home before malicious packets can reach your family's screens.


🏛️ 4 Core Security Pillars

HomeShield 4 Core Security Pillars

1. 🛑 Anti-Scam & Financial Cybercrime Defense

  • Fake Banking & Gov Portals: Sinkholes phishing-lookalike domains and typosquatting URLs that imitate official institutions.
  • Malvertising Shield: Neutralizes deceptive ad networks distributing malicious Android APKs and credential harvesters.
  • Zero-Hop Disconnect: Resolves malicious domains to 0.0.0.0 & :: instantly, terminating connections in < 0.1 ms with zero timeout latency.

2. 🔞 Family & Child Protection

  • Gambling & Slot Trap Blocker: Drops aggressive pop-under ads, slot casino banners, and predatory gambling networks.
  • Safe Browsing Across All Devices: Operates automatically across all personal devices, guest Wi-Fi, and gaming consoles without configuring individual clients.
  • Elderly Protection Guarantee: Grandparents and parents browsing LINE or Facebook are protected seamlessly with zero setup required.

3. 📱 Universal IoT & Device Privacy Shield

  • CleanYourTV & Android Device Integration: Disables invasive OEM telemetry and sponsored ads on Android/Google TVs, smartphones (Xiaomi, Huawei, OPPO, Samsung), and streaming sticks over Wi-Fi without installing apps on the device.
  • IP Camera & Smart Speaker Telemetry Block: Stops Reolink, Dahua, Hikvision, Amazon Echo, Google Nest, and Tuya devices from leaking behavioral data to cloud servers.
  • Windows/macOS PC Telemetry Shield: Blocks Microsoft and Apple OS telemetry endpoints at the DNS layer, covering all PCs and Macs on the LAN without any client software.
  • C2 & Botnet Disruption: Stops compromised IoT devices and cameras from beaconing to Command & Control servers.
  • Operator Set-Top Safe: Automatically identifies and preserves carrier IPTV boxes to ensure zero interruption to legitimate broadcasts.

4. ⚡ Zero-Hardware, Zero-Cost Advantage

  • No Raspberry Pi Needed: Runs directly on your existing broadband router (saving $80+ in hardware and recurring electric power).
  • Ultra-Lightweight Rust: Consumes only 408 kB RAM (VmRSS) on dual-core ARMv7 routers—zero CPU spikes or network lag.
  • Zero Flash Wear (NAND): Uses streaming FNV-1a 64-bit checksums to skip redundant writes to router Flash memory.

📊 The Ultimate Comparison: HomeShield vs. Alternatives

Feature / Capability HomeShield (Gateway) Pi-hole / AdGuard Home Browser Extensions (uBlock) Paid ISP "Safe Net" Addon
Additional Hardware Cost $0 (Existing Router) ❌ $60–$100 (Raspberry Pi) $0 $0
Recurring Monthly Subscription $0 (Free & Open Source) $0 $0 ❌ $2–$5 / Month
Protects Smart TVs & IoT Yes — All Android Devices Yes ❌ Impossible Limited
Protects LINE/Facebook Webviews Yes (Network-wide) Yes ❌ Fails inside apps Partial
Hardware-Enforced Anti-Bypass Yes (iptables/ip6tables) ❌ Requires router rules ❌ Cannot control device ❌ Easy to bypass
Privacy & Zero DNS Logging 100% Private on LAN 100% Private 100% Private ❌ Sells DNS metadata
Memory Footprint 408 kB (Rust Daemon) 50–150 MB 100–300 MB / Tab Cloud-managed
Single Point of Failure Auto-Rollback to Shell ❌ SD Card corruption = Offline App crash only ISP outage

⚡ How It Works

HomeShield operates in three autonomous, carrier-grade phases:

Step 1: One-Command Deploy
1. One-Command Deploy
Deploys a static soft-float ARMv7 Rust daemon (445 KB) to router RAM, verifies ABI health with canary checks, and persists securely to Flash.
Step 2: Autonomous Threat Sync
2. Autonomous Threat Sync
Syncs daily with Tier 0 CDN using FNV-1a 64-bit zero-wear delta checks. Self-heals in <5s if gateway firmware rewrites /var/tmp/hosts.
Step 3: Instant Toggle
3. Instant Toggle Switch
Flip between ACTIVE and PAUSED in a single command for diagnostic testing or ad-supported stream viewing without rebooting.

📊 Real-World Verification: Before & After

Live testing conducted against the independent TurtleCute Ad Blocker Test suite (130 ad servers, analytics trackers, telemetry endpoints, and popups) using the Toggle feature under Chrome browser automation via Kapture MCP (re-captured 2026-11-26 on a ZTE F6107A):

HomeShield TurtleCute Verification Score

❌ BEFORE (PAUSED / Unprotected) ✅ AFTER (ACTIVE / HomeShield Enabled)
Before HomeShield: 8 Blocked, 6% Score
Score: 6% (8 / 130 Blocked)
Over 122 ad trackers, OEM telemetry calls, and analytics beacons leaked directly across the network.
After HomeShield: 126 Blocked, 97% Score
Score: 97% (126 / 130 Blocked)
126 ad & tracker domains sinkholed at the router (only 4 not blocked). The remaining 4 are browser-only tests (2 cosmetic ad placeholders + 2 first-party ads.js/pagead.js scripts) that DNS filtering cannot see.

[!NOTE] Why 97% is the peak achievable at the network DNS layer: DNS sinkholes operate at Layer 7 domain resolution. Elements that fail in the test suite are cosmetic CSS element-hiding rules and in-page JavaScript script injection, which can only be hidden by browser extensions like uBlock Origin. Every network-level ad request was blocked at 0.0.0.0 with zero latency.

[!TIP] Automated 24h Threat Sync with TurtleCute: The official TurtleCute blocklists (d3host.txt & d3host.adblock) are integrated directly into HomeShield's daily Tier 0 CDN build cycle (.github/workflows/compile-blocklist.yml) and router fallback configs (config/adblock.conf), ensuring continuous synchronization and zero regression against test endpoints.


🏛️ Architecture

HomeShield employs a Decoupled, Zero-Hop Edge Architecture. The router handles network-wide DNS interception with zero hops, while Smart TV debloating runs as an independent companion utility over LAN ADB.

graph TD
    %% Tier 0 Cloud Edge
    subgraph Tier0["☁️ Tier 0 Cloud Edge — GitHub Actions Daily"]
        T0A["📥 Pull 29 Live Feeds\nAd / Scam / Thai-SEA / IoT / PC Telemetry"]
        T0B["🔄 Deduplicate 285,865+ domains\n& apply Whitelist filter"]
        T0C["🚀 Publish to Tier 0 CDN\nGitHub Pages — hosts.txt"]
        T0A --> T0B --> T0C
    end

    %% Daily Pull
    Tier0 -.->|"⬇️ Daily HTTP Pull (86400s)"| Router

    %% Router/Gateway
    subgraph Router["🌐 Broadband Gateway / Router — ZTE · Huawei · ASUS · OpenWrt / ARMv7 / dnsmasq"]
        subgraph Daemon["⚙️ homeshield-daemon"]
            D1["408 kB VmRSS Rust"]
            D2["FNV-1a Flash Delta"]
            D3["5s Self-Healing"]
        end

        subgraph IPTables["🔒 iptables & ip6tables Anti-Bypass Rules"]
            IP4["IPv4: NAT REDIRECT\nUDP/TCP 53 → dnsmasq"]
            IP6["IPv6: FORWARD REJECT\nport 53 & TCP/UDP 853 (Anti-DoT/DoQ)"]
        end

        subgraph Dnsmasq["🛡️ dnsmasq Dual-Stack Sinkhole"]
            DS1["🚫 Blocked → 0.0.0.0 & ::"]
            DS2["✅ Whitelisted → Forward to WAN"]
        end
    end

    %% Client Connections
    subgraph Clients["📱 Protected Client Devices"]
        Mobile["💻 Mobile & PC Clients\niOS · Android · Mac\nZero Configuration"]
        SmartTV["📺 Smart TV / Android TV\nSony · TCL · Mi TV\nTelemetry Blocked"]
    end

    %% CleanYourTV Companion
    subgraph Companion["🖥️ CleanYourTV Companion — Workstation Python CLI"]
        CYT1["🔍 Zero-touch DHCP discovery"]
        CYT2["🧹 Debloats 1,100+ telemetry & ad packages"]
        CYT3["💾 Auto-creates backup & standalone rollback"]
    end

    %% Connections
    Daemon -->|"🔐 Anti-bypass enforcement"| IPTables
    IPTables -->|"↩️ DNS redirection"| Dnsmasq
    Dnsmasq -->|"Sinkhole / Forward"| Mobile
    Dnsmasq -->|"Sinkhole / Forward"| SmartTV
    SmartTV -.->|"📡 ADB over LAN"| Companion

    %% Styling
    classDef tier0 fill:#e3f2fd,stroke:#1565c0,stroke-width:2px,color:#0d47a1
    classDef router fill:#fff8e1,stroke:#f57f17,stroke-width:2px,color:#e65100
    classDef daemon fill:#fff3e0,stroke:#ef6c00,stroke-width:1px,color:#bf360c
    classDef client fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px,color:#1b5e20
    classDef companion fill:#fce4ec,stroke:#ad1457,stroke-width:2px,color:#880e4f

    class Tier0 tier0
    class Router router
    class Daemon,IPTables,Dnsmasq daemon
    class Mobile,SmartTV client
    class Companion companion
graph TD
    %% Rollback Hierarchy Overview
    subgraph Rollback["🔄 HomeShield 4-Tier Rollback Hierarchy"]
        L1["🟢 Level 1: Soft-Rollback (Toggle)\nInstant pause — < 100 ms"]
        L2["🟡 Level 2: Engine Switch (Rust → Shell)\nZero downtime fallback — < 5 s"]
        L3["🔴 Level 3: Full Gateway Revert\nClean uninstall & factory state — < 30 s"]
        L4["🔵 Level 4: Smart TV Rollback\n1-Click ADB restoration — < 10 s"]
    end

    %% Level 1 Details
    subgraph L1_Detail["🟢 Level 1: Instant Soft-Rollback"]
        L1_When["⚡ When: User reports website issue;\nimmediate unblocking needed"]
        L1_Action["💻 Action: python3 homeshield.py toggle\n--ip 192.168.1.1"]
        L1_Time["⏱️ Time: < 1 second"]
        L1_Impact["✅ Impact: Reverts DNS to unblocked\npass-through; daemon alive"]
    end

    %% Level 2 Details
    subgraph L2_Detail["🟡 Level 2: Engine Fallback Rollback"]
        L2_When["⚡ When: Daemon kernel panic or\narchitecture warning"]
        L2_Action["💻 Action: python3 homeshield.py deploy\n--ip 192.168.1.1 --engine shell"]
        L2_Time["⏱️ Time: < 5 seconds"]
        L2_Impact["✅ Impact: Kills Rust binary, activates\nadblock.sh loop + watchdog.sh"]
    end

    %% Level 3 Details
    subgraph L3_Detail["🔴 Level 3: Complete Gateway Rollback"]
        L3_When["⚡ When: Gateway firmware update,\nISP maintenance, or permanent removal"]
        L3_Action["💻 Action: python3 homeshield.py uninstall\n--ip 192.168.1.1"]
        L3_Time["⏱️ Time: < 30 seconds"]
        L3_Impact["✅ Impact: 100% factory state restored;\nzero leftover files on Flash ROM"]
    end

    %% Level 3 Manual Emergency
    subgraph L3_Manual["🚨 Level 3: Manual Emergency (Telnet)"]
        M1["1. killall homeshield-daemon\n    watchdog.sh adblock.sh"]
        M2["2. iptables/ip6tables -D\n    flush all DNS redirect rules"]
        M3["3. Restore /var/tmp/hosts.base\n    (fallback: 127.0.0.1 localhost)\n    killall -HUP dnsmasq"]
        M4["4. rm -rf /userconfig/homeshield-*\n    /userconfig/adblock.*\n    /userconfig/watchdog.sh\n    /userconfig/whitelist.txt"]
    end

    %% Level 4 Details
    subgraph L4_Detail["🔵 Level 4: Device & Smart TV Rollback"]
        L4_When["⚡ When: Debloated TV/device package\ncauses unwanted UI side-effect"]
        L4_Action1["🤖 Auto: sh backups/restore_ip_ts.sh"]
        L4_Action2["💻 CLI: cargo run --release --manifest-path rust/Cargo.toml\n-p homeshield-cli -- device restore --target device_ip"]
        L4_Impact["✅ Impact: Re-enables all disabled\nAndroid packages to original state"]
    end

    %% Connections
    L1 --> L1_When
    L1 --> L1_Action
    L1 --> L1_Time
    L1 --> L1_Impact

    L2 --> L2_When
    L2 --> L2_Action
    L2 --> L2_Time
    L2 --> L2_Impact

    L3 --> L3_When
    L3 --> L3_Action
    L3 --> L3_Time
    L3 --> L3_Impact
    L3_Detail --> L3_Manual

    L4 --> L4_When
    L4 --> L4_Action1
    L4 --> L4_Action2
    L4 --> L4_Impact

    %% Styling
    classDef hierarchy fill:#f3e5f5,stroke:#6a1b9a,stroke-width:2px,color:#4a148c
    classDef level1 fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px,color:#1b5e20
    classDef level2 fill:#fff8e1,stroke:#f57f17,stroke-width:2px,color:#e65100
    classDef level3 fill:#ffebee,stroke:#b71c1c,stroke-width:2px,color:#7f0000
    classDef level4 fill:#e3f2fd,stroke:#1565c0,stroke-width:2px,color:#0d47a1
    classDef manual fill:#fafafa,stroke:#757575,stroke-width:1px,stroke-dasharray: 5 5,color:#424242

    class Rollback hierarchy
    class L1,L1_When,L1_Action,L1_Time,L1_Impact level1
    class L2,L2_When,L2_Action,L2_Time,L2_Impact level2
    class L3,L3_When,L3_Action,L3_Time,L3_Impact,L3_Detail level3
    class L3_Manual,M1,M2,M3,M4 manual
    class L4,L4_When,L4_Action1,L4_Action2,L4_Impact level4

Architecture diagram also available as standalone file: docs/architecture.mermaid


🛠️ Quick Start

1. Prerequisites

  • Rust CLI (Recommended): Rust toolchain (cargo) on your management workstation (macOS / Linux / Windows)
  • Python CLI (Legacy Compat): Python 3.9+ (python3 homeshield.py ...)
  • Target Router reachable on LAN (default: 192.168.1.1) with Telnet or Factory Mode access

2. One-Command Deploy

Deploy the embedded Rust daemon to your router:

cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- deploy --ip 192.168.1.1 --engine auto
# Or via Python compatibility wrapper:
python3 homeshield.py deploy --ip 192.168.1.1 --engine rust

# Hardened ZTE F6107A (PON_6.0 / PON_7.0+) or custom Telnet credentials:
# (unlock-config defaults to LAN-only RemoteAccess=0 with RFC1918 whitelist & 0600 permissions; add --allow-remote-admin only if WAN access is required)
python3 homeshield.py unlock-config --config config.bin --serial <GPON_SN> --mac <MAC>
# After restoring config_unlocked.bin via Web UI (LAN ports 2-4):
python3 homeshield.py deploy --ip 192.168.1.1 --no-factory --telnet-user root --telnet-pass admin

(HomeShield automatically runs a Canary test in volatile RAM. If the binary fails verification, it seamlessly rolls back to the POSIX shell engine).

3. Check Live Status

cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- status --ip 192.168.1.1

Sample Output:

Executing 'status' on router 192.168.1.1...
STATUS: ACTIVE
BLOCKED_DOMAINS: 285865
LAST_UPDATE: 2026-11-25 03:06:17
NEXT_UPDATE: IN 0d 23h (autonomous)
ROUTER_AUTONOMY: FULLY_AUTONOMOUS (Rust Daemon PID 10789)

4. Toggle Protection (Active ⇄ Paused)

Temporarily pause or resume protection with zero network downtime, zero router reboots, and zero dropped connections:

HomeShield Toggle Feature

# Toggle state in a single command
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- toggle --ip 192.168.1.1

How It Works:

  • Atomic Memory Swap: Swaps the active hosts table in volatile RAM (/var/tmp) and signals dnsmasq via SIGHUP. The switch takes < 100 ms without dropping in-flight packets.
  • Daemon Stays Alive: The background autonomous supervisor and 24h update timer continue running unaffected.
  • Instant Diagnostic Verification: When PAUSED, blocked queries resolve to their genuine upstream IP (142.250.66.110). When ACTIVE, all 285k+ domains immediately drop to 0.0.0.0 & ::.

5. Whitelist Management & Lifecycle Controls

Custom domains can be whitelisted and protection started, paused, or verified at any time via either the Rust CLI or Python CLI:

# View active whitelist
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- whitelist list --ip 192.168.1.1
# Or via Python: python3 homeshield.py whitelist --whitelist-action list

# Add a domain
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- whitelist add custom-domain.com --ip 192.168.1.1
# Or via Python: python3 homeshield.py whitelist --whitelist-action add --domain custom-domain.com

# Remove a domain
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- whitelist remove custom-domain.com --ip 192.168.1.1
# Or via Python: python3 homeshield.py whitelist --whitelist-action remove --domain custom-domain.com

# Explicit lifecycle controls (start/resume, stop/pause, check)
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- stop --ip 192.168.1.1
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- start --ip 192.168.1.1
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- check --ip 192.168.1.1

6. Universal Device & Smart TV Telemetry Shield (device / tv)

Works across Android TVs, Smartphones/Tablets (Xiaomi, Samsung, Huawei, OPPO, Vivo), IP Cameras, and Smart Hubs — no app installation required:

# 1. Discover TVs, Phones, Cameras & IoT devices from router DHCP/ARP (parallel probing)
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- device discover --ip 192.168.1.1
# Or legacy alias: cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- tv discover --ip 192.168.1.1

# 2. Analyze installed bloatware & OEM telemetry packages on target device
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- device analyze --target 192.168.1.50

# 3. Simulate debloat without changing anything (Dry Run)
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- device clean --target 192.168.1.50 --dry-run

# 4. Perform safe debloat (creates JSON snapshot & standalone rollback script)
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- device clean --target 192.168.1.50

# 5. Restore original state at any time
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- device restore --target 192.168.1.50
# Or via Python: python3 homeshield.py device --tv-action restore --tv-ip 192.168.1.50

🌐 Threat Intelligence Sources & Update Lifecycle

HomeShield curates and synchronizes 29 active, verified upstream threat intelligence feeds, covering general ads, Thai/SEA scams, gambling traps, and native OEM telemetry across Smart TVs, smartphones, IoT cameras, smart speakers, and Windows/macOS PCs. All lists are compiled daily on GitHub Actions into a unified dual-stack DNS sinkhole table (hosts.txt) and published to GitHub Pages CDN.

🛡️ Verified Upstream Feed Taxonomy (29 Live Feeds)

Category / Layer Upstream Source & Provider Target Threats Blocked Upstream Update Cadence
Global Anti-Ad & Trackers • HaGeZi Multi NORMAL
• HaGeZi Ultimate
• HaGeZi Popup Ads
Cross-site advertising networks, pop-unders, telemetry beacons, aggressive trackers Daily
Financial Scam & Phishing • HaGeZi Fake Domains
• HaGeZi Threat Intelligence Feeds (TIF Mini)
• StevenBlack Fake News & Gambling
Phishing banking portals, fake government loan APKs, typosquatting domains, credential harvest Daily
Thai & Southeast Asia Regional • hostsVN (SEA Ads & Gambling)
• Thai Adblock List (PhyschicWinter9)
• AdBlock Thai Filters (Ads & NextDNS/ABP)
Thai & SEA deceptive popups, local illegal gambling portals, regional scam trackers Daily
Gambling & Adult Content • HaGeZi Gambling Medium
• StevenBlack Gambling Alternates
Illegal online casinos, gambling slot redirects, deceptive predatory game ads Daily
Universal IoT, Smart TV & Mobile OEM • HaGeZi Native Samsung, LG webOS & Roku
• HaGeZi Native Xiaomi, Huawei, OPPO/Realme & Vivo
• HaGeZi Native Amazon (Echo/FireTV) & Apple
• HaGeZi Native TikTok Telemetry
Smart TV voice/viewing analytics, smartphone OEM telemetry, Alexa/HomePod & IoT beacons Weekly / Daily
Windows & Desktop Telemetry • HaGeZi Native Windows & Office
• WindowsSpyBlocker (crazy-max)
Windows 10/11 diagnostic uploads, Microsoft Office & Edge telemetry beacons Weekly / Daily
Adblock Test Suite Parity • TurtleCute d3host.txt
• TurtleCute d3host.adblock
Continuous synchronization with independent TurtleCute 130-endpoint benchmark suite Weekly
Shadowrocket & Streaming • Johnshall Shadowrocket Ad Rules
• h2y Shadowrocket Top 500 Banlist
• Froggeric NoYouTubeAdsDNS
Streaming ad servers, Asian ad networks, mobile interstitial telemetry Weekly
Anti-Bypass & DoH Leak Defense • HaGeZi DoH / VPN / Proxy Bypass
• HomeShield Canary Injections (use-application-dns.net, mask.icloud.com)
Rogue encrypted DNS bypasses, Firefox DoH triggers, Apple Private Relay leaks Daily

🔄 How Updates Work & Performance Design Patterns

HomeShield delivers daily updates with zero downtime, minimal RAM (408 kB), and zero unnecessary Flash wear through clean systems design patterns:

graph TD
    %% Tier 0 Cloud Automation
    subgraph Tier0["☁️ Tier 0 Cloud Automation — Daily at 23:00 UTC / 06:00 ICT Bangkok"]
        GH["🤖 GitHub Actions"]
        Pull["📥 Pull 29 Feeds\nJoinSet Concurrent"]
        Dedup["🔄 Deduplicate\n285,865+ unique domains"]
        CDN["🚀 CDN publish\nhosts.txt on GitHub Pages"]
        GH --> Pull --> Dedup --> CDN
    end

    %% Daily HTTP Pull
    CDN -.->|"⬇️ Daily HTTP Pull (86400s)"| Supervisor

    %% Broadband Gateway Supervisor
    subgraph Supervisor["⚙️ Broadband Gateway Supervisor — Rust Daemon (Design-Pattern Optimized)"]
        Step1["🏗️ Step 1: Builder + Flyweight\nPre-size HashSet 300k+ & Arc-Whitelist — 0 clone"]
        Step2["🔐 Step 2: Integrity & FNV-1a\n128 KB streaming buffer delta check → Zero Flash Write"]
        Step3["📊 Step 3: Cache-Aside & Pool\nO(1) domain_count sidecar + reused String buffers"]
        Step4["⚡ Step 4: Atomic Memory Swap\nSIGHUP to dnsmasq — < 100 ms, zero dropped packets"]
        Step1 --> Step2 --> Step3 --> Step4
    end

    %% Styling
    classDef tier0 fill:#e3f2fd,stroke:#1565c0,stroke-width:2px,color:#0d47a1
    classDef supervisor fill:#fff8e1,stroke:#f57f17,stroke-width:2px,color:#e65100
    classDef step fill:#f5f5f5,stroke:#616161,stroke-width:1px,stroke-dasharray: 5 5,color:#212121

    class Tier0 tier0
    class Supervisor supervisor
    class Step1,Step2,Step3,Step4 step

Update lifecycle diagram also available as standalone file: docs/update-lifecycle.mermaid


Rollback Sequence Diagram

sequenceDiagram
    participant User as Administrator
    participant CLI as homeshield.py / CLI
    participant Router as Gateway Router
    participant TV as Smart TV / Device

    %% Level 1
    User->>CLI: python3 homeshield.py toggle --ip 192.168.1.1
    CLI->>Router: Atomic swap /var/tmp/hosts ← /var/tmp/hosts.base
    CLI->>Router: SIGHUP dnsmasq
    Router-->>User: PAUSED (< 100 ms)

    %% Level 2
    User->>CLI: python3 homeshield.py deploy --engine shell
    CLI->>Router: kill homeshield-daemon
    CLI->>Router: Start adblock.sh loop + watchdog.sh
    Router-->>User: Shell engine active (< 5 s)

    %% Level 3 (CLI)
    User->>CLI: python3 homeshield.py uninstall
    CLI->>Router: Kill processes, flush iptables, restore hosts
    CLI->>Router: rm -rf /userconfig/homeshield-*
    Router-->>User: Factory state (< 30 s)

    %% Level 3 (Manual Telnet)
    User->>Router: telnet 192.168.1.1
    User->>Router: killall + iptables -D + restore hosts + rm -rf
    Router-->>User: Factory state

    %% Level 4
    User->>CLI: cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- device restore --target 192.168.1.50
    CLI->>TV: ADB: pm enable packages...
    TV-->>User: All packages restored (< 10 s)

Update Sequence Diagram

sequenceDiagram
    participant GH as GitHub Actions
    participant CDN as Tier 0 CDN (GitHub Pages)
    participant Daemon as Rust Daemon (Router)
    participant DNS as dnsmasq

    GH->>GH: Pull 29 feeds concurrently (JoinSet)
    GH->>GH: Deduplicate 285k+ domains
    GH->>GH: Apply whitelist
    GH->>CDN: Publish hosts.txt to GitHub Pages

    Daemon->>CDN: Daily HTTP GET (86400s interval)
    CDN-->>Daemon: hosts.txt + ETag/Last-Modified

    alt Content unchanged (FNV-1a match)
        Daemon->>Daemon: Skip Flash write, skip dnsmasq reload
    else Content changed
        Daemon->>Daemon: Builder + Flyweight (pre-size HashSet)
        Daemon->>Daemon: Integrity check + FNV-1a streaming delta
        Daemon->>Daemon: Cache-Aside + Pool (O(1) sidecar)
        Daemon->>Daemon: Atomic memory swap to /var/tmp/hosts
        Daemon->>DNS: SIGHUP (reload < 100 ms, zero dropped packets)
    end

How to Trigger an Update Manually:

# Via Rust CLI:
cargo run --release --manifest-path rust/Cargo.toml -p homeshield-cli -- update --ip 192.168.1.1

# Via Python CLI:
python3 homeshield.py update --ip 192.168.1.1

🔒 Safe by Design

HomeShield follows strict embedded safety principles to ensure zero disruption to your broadband internet connection:

Safety Mechanism Implementation Details
Fail-Closed Fallback If the compiled blocklist is corrupted, HomeShield keeps existing rules intact and retries gracefully on the next cycle.
RAM-First Execution Binary testing, downloads, and filtering happen exclusively in volatile memory (/var/tmp). Flash ROM (/userconfig/) is only touched after verified integrity.
NTP Desync Guard If the router reboots before NTP time syncs (clock resets to 1970), updates are delayed until clock synchronization to prevent timestamp thrashing.
Zero-Touch TV Shield Operator set-top boxes and streaming media devices are automatically detected and preserved to prevent breaking live TV streams or OTT entitlements.

🔄 Multi-Tier Fail-Safe Rollback Strategy

Every deployment and configuration change is backed by an automated 4-tier recovery hierarchy:

Rollback Tier Recovery Trigger Command / Action Recovery Time
Level 1 False-positive block or ad-stream viewing python3 homeshield.py toggle < 100 ms
Level 2 Architecture / binary panic python3 homeshield.py deploy --engine shell < 5 s
Level 3 Gateway maintenance / full uninstall python3 homeshield.py uninstall < 30 s
Level 4 Smart TV debloat restoration python3 homeshield.py tv --tv-action restore --tv-ip <tv_ip> < 10 s

📖 For comprehensive incident response runbooks and manual emergency procedures, read the full Operations Playbook & Rollback Plan.


📡 Supported Hardware & Network Infrastructure

HomeShield supports embedded network devices across four major hardware categories: Optical Network Terminals (ONT / ONU), OpenWrt & Community Gateways, Consumer & Prosumer Wi-Fi Routers, and Managed Layer 3 / Access Switches.

1. Optical Network Terminals & Modems (GPON / EPON / XGS-PON)

Vendor & Series Chipset & Architecture Runtime Environment Compatibility Deployment Notes
ZTE ZXHN F6107A ARMv7 Cortex-A9 Dual-Core (ZXIC) Embedded Linux / BusyBox / dnsmasq 🟢 Grade S (10/10) Reference testbed (PON_2.0 one-click direct; PON_6.0 / PON_7.0+ via unlock-config Web UI restore, --factory-user/--factory-pass, or Bridge Mode + secondary router)
ZTE ZXHN F680 / F670L ARMv7 Cortex-A9 Dual-Core Embedded Linux / BusyBox / dnsmasq 🟢 Grade S (10/10) Factory Mode Telnet handshake supported out of the box
ZTE ZXHN F6600 / F6600P ARMv7 / ARMv8 (32-bit compat mode) Wi-Fi 6 AX3000 Embedded Linux 🟢 Grade A (9/10) High-throughput gateway; native daemon & shell fallback
Huawei EchoLife HG8145V5 / EG8145V5 HiSilicon SD5115 ARMv7-A Huawei V5 Embedded Linux 🟡 Grade B+ (8/10) Requires Telnet unlock via ONT maintenance utility
FiberHome HG6821M / HG6245D ARMv7 / MIPS32 BusyBox / dnsmasq 🟢 Grade A- (8.5/10) Supported via universal POSIX shell fallback engine
Nokia / Alcatel-Lucent G-240W-C / G-2425G-A Broadcom ARMv7-A / MIPS Broadcom Linux Gateway 🟡 Grade B (7.5/10) Broadcom ONT shell; supported via POSIX engine

2. OpenWrt & Community Embedded Gateways

Hardware Platform Chipset & Architecture Firmware / OS Compatibility Deployment Notes
GL.iNet GL-MT3000 (Beryl AX) / GL-AXT1800 MediaTek MT7981 / Qualcomm IPQ6000 OpenWrt 21.02 / 23.05 🟢 Grade S+ (10/10) Native musl Rust binary, opkg package manager, full SSH root
FriendlyElec NanoPi R2S / R4S / R5S / R6S Rockchip RK3328 / RK3399 / RK3568 OpenWrt / FriendlyWrt / DietPi 🟢 Grade S+ (10/10) Multi-Gigabit dual/triple port gateway; ultra-fast DNS sinkholing
Raspberry Pi 3B / 4B / CM4 Router Boards Broadcom BCM2837 / BCM2711 OpenWrt / Debian ARM 🟢 Grade S+ (10/10) Full native support; handles millions of queries with zero load

3. Consumer & Prosumer Wi-Fi Routers

Vendor & Model Series Architecture Firmware / OS Compatibility Deployment Notes
ASUS RT-AX88U / RT-AX86U / RT-AC86U Broadcom BCM4906 / BCM4908 (ARMv8/v7) Asuswrt-Merlin 🟢 Grade S+ (10/10) Native dnsmasq.postconf integration, JFFS partition persistence
Ubiquiti EdgeRouter X (ER-X) / ER-4 MediaTek MT7621 / Cavium Octeon EdgeOS (Debian-based) 🟢 Grade A (9/10) Universal POSIX shell engine; iptables NAT redirect
MikroTik hEX / hAP ac² / hAP ax² / RB5009 ARM32 / ARM64 / MMIPS RouterOS v7.x / Container 🟢 Grade A- (8.5/10) Runs via RouterOS Container package or Layer 3 DNS redirection
Linksys WRT3200ACM / Netgear R7000 / R7800 Marvell Armada 385 / Broadcom / Qualcomm OpenWrt / DD-WRT 🟢 Grade S (10/10) Broadcom/Marvell ARMv7 cores; native execution

4. Managed Layer 3 & Access Switches (Enterprise / Multi-VLAN)

HomeShield integrates seamlessly into managed switch environments through three standard network deployment topologies:

Switch Series Supported Features Integration Method Deployment Topology
Cisco Catalyst 3560 / 3750 / 3850 / 9200 L3 Routing, Port ACLs, PBR Policy-Based Routing (PBR) Redirects all inter-VLAN UDP/TCP port 53 traffic directly to HomeShield gateway IP
Aruba CX 6100 / 6200 / 2930F DHCP Snooping, Option 6, ACLs DHCP Option 6 & L3 Route Switch distributes HomeShield IP as primary DNS server across all access VLANs
MikroTik CRS3xx / Cloud Router Switch RouterOS L3 HW Offloading L3 HW Redirection / Bridge NAT Hardware-offloaded DNS redirection at wire speed across 10G/1G switch ports
Edgecore / Ubiquiti UniFi Pro Switches 802.1Q VLANs, DHCP Relay DHCP Relay / Option 6 Isolates IoT, Guest, and Office VLANs with centralized DNS ad/telemetry blocking

💻 Developers & Contributing

We welcome community contributions, additional OEM TV filters, and hardware porting!

Local Development & Verification

# 1. Run full Python & Rust test suites + POSIX shell syntax/lint checks
python3 -m pytest tests/ -v
cargo test --manifest-path rust/Cargo.toml --workspace
sh -n scripts/adblock.sh scripts/watchdog.sh && shellcheck -s sh scripts/adblock.sh scripts/watchdog.sh

# 2. Strict Rust formatting & static analysis (0 clippy warnings)
cd rust && cargo fmt --all -- --check && cargo clippy --workspace --all-targets -- -D warnings

# 3. Cross-compile ARMv7 binary via Docker
bash rust/build-armv7.sh

Please review our Contributing Guidelines and Security Policy before submitting pull requests.


📜 Privacy & Security

  • 100% Private: HomeShield operates strictly on your LAN. No DNS queries, device telemetry, or browsing history are ever logged or transmitted off the router.
  • Zero Cloud Backends: Cloud compilation runs publicly and transparently via GitHub Actions.
  • For complete details, see PRIVACY.md and SECURITY.md.

⚖️ Credits & License

🧪 Adblock TurtleCute Site Status

  • Apex domain https://adblock.turtlecute.org/ resolves correctly (HTTP 200) via GitHub Pages.
  • WWW sub‑domain https://www.adblock.turtlecute.org/ has no DNS record, resulting in ERR_NAME_NOT_RESOLVED.
  • Findings are documented in the investigation notes above.

This section documents the current accessibility of the TurtleCute test suite used in the verification steps.

Jelajahi proyek terkait

Memuat…