This documentation describes how to use the protect.bat script to manage domain blocking and DNS settings on Windows systems.
- Windows Operating System
- Administrator privileges
- Required files in the same directory as protect.bat:
domains.txt: Contains the list of domains to blockyoutube.txt: Contains YouTube-specific domains (used when YouTube blocking is enabled)
protect.bat [subcommand] [options]-
apply: Apply protection with specified settings
protect.bat apply [level] [youtube]
level: Either "high" or "low"youtube: Either "true" or "false" to enable/disable YouTube safe mode
Example:
protect.bat apply high true
-
deactivate: Remove protection and reset DNS settings
protect.bat deactivate
-
add_domain: Add a single domain to the hosts file
protect.bat add_domain [IP] [domain]
Example:
protect.bat add_domain "216.239.38.120 www.google.com"To block a specific domain, run the
protect.batscript with theadd_domainsubcommand and use0.0.0.0as the IP address for the domain you want to block. For example:protect.bat add_domain "0.0.0.0 example.com"This command will add an entry to the hosts file that blocks
example.comon your system.
- Checks for administrator privileges
- Modifies the hosts file (
C:\Windows\System32\drivers\etc\hosts) - Configures DNS settings for network adapters
- Sets up DNS-over-HTTPS for Chrome and Brave browsers
- If YouTube blocking is enabled, adds YouTube-specific domains
-
domains.txt
- Must exist in the same directory as protect.bat
- Must start with
#mafazaa-hosts-start - Must end with
#mafazaa-hosts-end - Each line should contain IP and domain(s)
-
youtube.txt
- Must exist in the same directory as protect.bat
- Must start with
#mafazaa-youtube-enable-start - Must end with
#mafazaa-youtube-enable-end - Contains YouTube-specific domain entries
Contains the main list of domains to block. Must follow this format:
#mafazaa-hosts-start
216.239.38.120 www.google.com
216.239.38.120 www.google.ad
...other domains...
20.207.72.188 duckduckgo.com
204.79.197.220 www.bing.com bing.com
#mafazaa-hosts-end
Contains YouTube-specific domains. Must follow this format:
#mafazaa-youtube-enable-start
172.217.19.142 www.youtube.com
142.250.200.238 m.youtube.com
172.217.21.10 youtubei.googleapis.com
172.217.21.10 youtube.googleapis.com
142.250.201.46 www.youtube-nocookie.com
#mafazaa-youtube-enable-end