A powerful and elegant tool to filter and block distracting websites on your Mac. Filtora works at both the DNS and network level to ensure your digital space stays clean and focused, helping you maintain a positive digital aura.
- Blocks distracting websites at both DNS and network level
- Works with both IPv4 and IPv6 addresses
- Blocks all protocols (HTTP, HTTPS, etc.)
- Beautiful and intuitive user interface
- Includes backup and restore functionality
- Customizable filtering rules
- Support for wildcards and subdomains
- macOS operating system
- Administrator access (for running with sudo)
- Basic terminal knowledge
- Network interface access
-
Download or clone this repository:
git clone [repository-url] cd website-blocker
-
Make the scripts executable:
chmod +x blocker.sh unblocker.sh
-
Verify the scripts are executable:
ls -l blocker.sh unblocker.sh
-
Open
list.txt
in a text editor:nano list.txt
-
Add the websites you want to block, one per line:
youtube.com tiktok.com example.com
Add specific subdomains to block:
www.youtube.com
m.youtube.com
api.youtube.com
For broader blocking, use wildcards:
*.youtube.com
*.tiktok.com
Add specific paths to block:
youtube.com/watch
tiktok.com/@username
sudo ./blocker.sh
sudo ./unblocker.sh
# View IPv4 blocked addresses
sudo pfctl -t adult_sites -T show
# View IPv6 blocked addresses
sudo pfctl -t adult_sites6 -T show
# Check if PF is enabled
sudo pfctl -s info
# View current PF rules
sudo pfctl -s rules
# Flush DNS cache
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
-
Edit
blocker.sh
to customize blocking behavior:nano blocker.sh
-
Common modifications:
- Change the interface name (default: auto-detected)
- Modify DNS resolution timeout
- Add custom PF rules
- Change backup file location
Add custom rules to the PF configuration section in blocker.sh
:
# Example: Block specific ports
block in quick on $INTERFACE proto tcp from any to <adult_sites> port {80,443}
The script automatically creates backups, but you can manually backup:
# Backup hosts file
sudo cp /etc/hosts /etc/hosts.backup
# Backup PF rules
sudo pfctl -s rules > pf_rules.backup
- Try accessing blocked websites in your browser
- Check if they're inaccessible
- Verify in different browsers
# Check hosts file entries
cat /etc/hosts | grep "0.0.0.0"
# Test DNS resolution
dig blocked-site.com
# Check network connections
sudo lsof -i -n
- Always run the scripts with
sudo
- The blocker modifies system files:
/etc/hosts
- PF firewall rules
- DNS cache
- Keep backups of original configurations
- Test changes in a controlled environment first
-
Websites still accessible:
# Run unblocker first sudo ./unblocker.sh # Clear browser cache # Chrome: chrome://settings/clearBrowserData # Safari: Preferences > Privacy > Manage Website Data # Run blocker again sudo ./blocker.sh
-
PF not working:
# Check PF status sudo pfctl -s info # Reload PF rules sudo pfctl -f /etc/pf.conf
-
DNS issues:
# Flush DNS cache sudo dscacheutil -flushcache sudo killall -HUP mDNSResponder # Check DNS resolution dig example.com
-
Check system logs:
# View system logs log show --predicate 'process == "pfctl"'
-
Monitor network traffic:
# Install tcpdump if needed brew install tcpdump # Monitor traffic to blocked sites sudo tcpdump -i en0 host youtube.com
This project is open source and available for personal use. Commercial use requires permission.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
- Add GUI interface
- Create scheduled blocking
- Add whitelist functionality
- Implement category-based blocking
- Add logging and monitoring