Skip to content
SegMind25Public

About

NO CORN CONTENT ANYMORE !!!!

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

27 Commits

Folders and files

Repository files navigation

PBLOCK Logo

PBLOCK - Content Blocker

A self-accountability content blocking tool that prevents access to adult websites by modifying the system hosts file. Available for Linux, Windows, and Android.

Project Structure

PBLOCK/
├── README.md
├── .gitignore
│
├── LinuxVersion/
│   └── mainPBLOCK.cpp           # Linux CLI tool (C++)
│
├── WindowsVersion/
│   └── mainPBLOCK.cpp           # Windows CLI tool (C++)
│
├── AndroidVersion/              # Android app (Java, no root needed)
│   ├── build.gradle / settings.gradle / gradle.properties
│   └── app/src/main/
│       ├── AndroidManifest.xml
│       ├── java/com/pblock/app/
│       │   ├── MainActivity.java             # UI, password, unlock challenges
│       │   ├── PBlockVpnService.java         # Local DNS-filtering VPN (no root)
│       │   ├── PBlockService.java            # Foreground protection watchdog
│       │   ├── BootReceiver.java             # Restarts blocking after reboot
│       │   ├── BootHostsManager.java         # Root mode: hosts file re-apply
│       │   ├── PBlockDeviceAdminReceiver.java# Uninstall protection
│       │   ├── UninstallProtectionActivity.java, *PuzzleDialog.java
│       │   ├── ConsoleActivity.java          # Root console (root mode only)
│       │   └── PBlockHelper.java             # Blocklist + hosts helpers
│       └── res/                              # layouts, strings, themes, icons
│
└── scripts/                     # NSFW blocking scripts (no root needed)
    ├── README.md                # Detailed usage instructions
    ├── nsfw_hosts.txt           # Hosts file with 200+ blocked domains
    ├── block_nsfw_adb.sh        # ADB-based hosts file push script
    └── setup_private_dns.sh     # Private DNS setup (Android 9+, no root)

How It Works

  1. Set a password - You create a strong password (min 8 characters) that will be required to disable blocking
  2. Enable blocking - The tool adds entries to your system's hosts file, redirecting blocked domains to 127.0.0.1
  3. Intentional delay - When you try to disable blocking, there is a mandatory 30-second wait period to help you reconsider
  4. Password required - After the delay, you must enter your password to remove the blocks

The hosts file entries are wrapped with # CONTENT_BLOCKER_START and # CONTENT_BLOCKER_END markers for clean insertion and removal.

Features

  • System-level domain blocking via hosts file modification
  • Password-protected unblocking with SHA-256 hashing
  • 30-second intentional delay before unblocking (time to reconsider)
  • Status display showing active/inactive state and domain count
  • Cross-platform: Linux, Windows, and Android
  • NSFW blocking scripts for non-rooted Android phones (no root needed!)

Android NSFW Blocking (No Root Required)

Don't have a rooted phone? Use the scripts in the scripts/ folder to block NSFW content without root access.

Quick Start: Private DNS (Easiest Method)

Set this up directly on your phone — no computer needed:

  1. Open Settings → Network & Internet → Private DNS
  2. Select Private DNS provider hostname
  3. Enter: family-filter-dns.cleanbrowsing.org
  4. Tap Save

All adult content is now blocked on every app and browser. See scripts/README.md for more options.

Other Methods

Method Root Computer Details
Private DNS No No Set a family-safe DNS on your phone. Guide
ADB Hosts File No Yes Push a blocking hosts file via USB. Guide
PBLOCK App (VPN mode) No No Local DNS-filtering VPN, SafeSearch forced, survives reboot.
PBLOCK App (root mode) Yes No Writes /system/etc/hosts and re-applies it on boot.

📱 Android app: install guide

  1. Download the latest PBLOCK-x.y.z.apk from Releases.
  2. Follow docs/INSTALL.md step by step. It covers:
    • getting past "App blocked to protect your device" (Install anyway, Play Protect, Samsung/Xiaomi/Oppo/Vivo blockers, or adb install)
    • turning on protection
    • keeping it on after a restart (Always-on VPN + Autostart)
    • Search Shield ("This is not good for you" on adult searches), including Android 13+ "Allow restricted settings"
    • troubleshooting
  3. Optional: make it permanent until factory reset with docs/LOCK_MODE.md.

Roadmap: docs/ANDROID_PLAN.md.

Technology Stack

  • C++17 - Core blocking logic (all platforms)
  • Java - Android app (VpnService DNS filter, device admin, foreground services)
  • Android SDK 35 - Android build target (minSdk 21)
  • Gradle 8.8 + Android Gradle Plugin 8.5 - Android build tool (JDK 17+)

Prerequisites

Linux

  • g++ with C++17 support
  • Root/sudo access (required to modify /etc/hosts)

Windows

  • MSVC or MinGW with C++17 support
  • Administrator privileges (required to modify the hosts file)

Android (App)

  • Android Studio or the Android SDK, with JDK 17+
  • Any Android 5.0+ phone. Root is optional: without it the app uses VPN mode; with it, the app also writes /system/etc/hosts.

Android (Scripts - no root required)

  • Android 9+ for Private DNS method (no other requirements)
  • ADB for hosts file method (requires a computer with USB cable)

Build & Run

Linux

cd LinuxVersion
g++ -std=c++17 -o blocker mainPBLOCK.cpp -lcrypt -lpthread
sudo ./blocker setup    # Set password
sudo ./blocker block    # Enable blocking
sudo ./blocker unblock  # Disable blocking (requires password + 30s delay)
sudo ./blocker status   # Show current status

Windows

Compile WindowsVersion/mainPBLOCK.cpp with MSVC or MinGW (requires linking against advapi32):

cl /EHsc /std:c++17 mainPBLOCK.cpp /link advapi32.lib
# Run as Administrator:
blocker.exe setup
blocker.exe block
blocker.exe unblock
blocker.exe status

Android (App)

cd AndroidVersion
# Set your Android SDK path in local.properties
# Then build with Gradle:
chmod +x gradlew
./gradlew assembleDebug
# Or open the project in Android Studio

The APK will be generated at AndroidVersion/app/build/outputs/apk/debug/PBLOCK.apk.

To install on your phone:

  1. Transfer the APK to your phone
  2. Open it and tap Install (you may need to enable "Install from unknown sources")
  3. Open PBLOCK and follow the on-screen instructions

Android (Scripts - No Root)

cd scripts/

# Option 1: Set up Private DNS (recommended, Android 9+)
chmod +x setup_private_dns.sh
./setup_private_dns.sh

# Option 2: Push hosts file via ADB
chmod +x block_nsfw_adb.sh
./block_nsfw_adb.sh

See scripts/README.md for detailed instructions.

Security Notes

  1. Run with appropriate privileges - Linux requires sudo, Windows requires Administrator; the Android app needs root only for hosts-file mode
  2. Use a strong password - Minimum 8 characters, write it down somewhere safe
  3. The 30-second delay is intentional - It gives you time to reconsider before unblocking
  4. Hosts file modification - This app modifies system files; back up your hosts file before first use
  5. Private DNS is the safest method for non-rooted Android phones — it blocks content at the DNS level across all apps

Contributing

Contributions are welcome. If you find security vulnerabilities, please report them responsibly.

License

MIT License

Support

For issues or questions:

About

NO CORN CONTENT ANYMORE !!!!

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages