π A modern, secure DNS management tool for Windows with an intuitive GUI
NetSwitch is a comprehensive DNS management application built with Python and CustomTkinter that provides an easy-to-use interface for switching between different DNS providers, managing network adapters, and optimizing internet connectivity on Windows systems.
- π¨ Modern UI: Beautiful, responsive interface with light/dark theme support
- π Enhanced Security: Comprehensive input sanitization and validation
- β‘ Performance Focused: Built-in DNS speed testing and optimization
- π IPv4 & IPv6 Support: Full support for both IP protocols
- π‘οΈ Safe Operations: Prevents command injection and malicious inputs
- π― User-Friendly: Intuitive design inspired by DNS Jumper
- π DNS Switching: Quickly switch between popular DNS providers
- π‘ Network Adapter Detection: Automatic detection of available network interfaces
- π§Ή DNS Cache Management: Flush DNS cache with one click
- β‘ Speed Testing: Find the fastest DNS server for your connection
- ποΈ Custom DNS: Support for custom DNS server configurations
- π‘οΈ Input Sanitization: Comprehensive sanitization of all user inputs
- β IP Validation: Enhanced IPv4 and IPv6 address validation
- π« Injection Prevention: Protection against command injection attacks
- β±οΈ Timeout Protection: Prevents hanging operations with timeout controls
- π Error Handling: Robust error handling with user-friendly messages
- π¨ Modern Design: Clean, professional interface using CustomTkinter
- π Theme Support: Light and dark mode themes
- π£ Custom Branding: Purple NetSwitch branding with light grey background
- π΄ Clear Actions: Red exit button for clear visual distinction
- π Status Updates: Real-time status bar with operation feedback
- π IPv6 Support: Full IPv6 DNS configuration support
- π§ Options Panel: Customizable settings for themes and display
- π§΅ Threaded Operations: Non-blocking operations for smooth user experience
- πΎ Persistent Settings: Remember user preferences between sessions
- π Multiple Adapters: Support for multiple network interfaces
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NetSwitch Exit β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π NetSwitch β
β β
β Select Network Adapter β
β [All Network Adapters βΌ] β
β β
β Choose a DNS Server β
β [AU - Cloudflare (1.1.1.1, 1.0.0.1) βΌ] β
β β
β [πΎ Apply DNS] [β‘ Fastest DNS] [π§Ή Flush DNS] [βοΈ Options] β
β β
β Ready. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
When "Custom..." is selected, additional fields appear for manual DNS entry with IPv6 support.
- Windows 10/11 (Required for netsh commands)
- Python 3.11.9+
- Administrator privileges (for DNS changes)
# Clone or download the repository
git clone https://github.com/kernferm/netswitch.git
cd netswitch
# Install dependencies
pip install customtkinter
# Run the application
python net-switch.py# Install from requirements.txt (if available)
pip install -r requirements.txt
python net-switch.pycustomtkinter>=5.2.2- Modern UI frameworktkinter- Built-in GUI library (included with Python)
- Select Network Adapter: Choose your network interface from the dropdown
- Choose DNS Provider: Select from Cloudflare, Google, Quad9, or Custom
- Apply Changes: Click "πΎ Apply DNS" to apply the settings
- Verify: Check the status bar for confirmation
- Select "Custom..." from the DNS dropdown
- Enter primary and secondary DNS addresses
- Optionally enable IPv6 and enter IPv6 DNS addresses
- Click "πΎ Apply DNS" to apply
- Click "β‘ Fastest DNS" button
- Wait for speed testing to complete
- Review results in the popup dialog
- Optionally apply the fastest DNS found
- Click "π§Ή Flush DNS" button
- Wait for operation to complete
- Check status bar for confirmation
- Click "βοΈ Options" button
- Select Light or Dark theme
- Toggle status bar visibility
- Click "Save" to apply changes
- Select "Custom..." DNS option
- Check "Use IPv6 DNS" checkbox
- Enter IPv6 DNS addresses in the format:
2001:4860:4860::8888 - Apply settings as usual
| Provider | Primary DNS | Secondary DNS | Features |
|---|---|---|---|
| Cloudflare | 1.1.1.1 | 1.0.0.1 | Fast, privacy-focused, global |
| 8.8.8.8 | 8.8.4.4 | Reliable, widely used, feature-rich | |
| Quad9 | 9.9.9.9 | 149.112.112.112 | Security-focused, malware blocking |
| Custom | User-defined | User-defined | Your choice of DNS servers |
All providers support IPv6 DNS servers when using custom configuration:
- Cloudflare IPv6:
2606:4700:4700::1111,2606:4700:4700::1001 - Google IPv6:
2001:4860:4860::8888,2001:4860:4860::8844 - Quad9 IPv6:
2620:fe::fe,2620:fe::9
- String Sanitization: Removes control characters and limits length
- Network Adapter Validation: Validates adapter names against injection
- Command Argument Sanitization: Cleans command-line arguments
- DNS Server Validation: Ensures only valid DNS selections
- IPv4 Validation: Comprehensive IPv4 address validation
- IPv6 Validation: Support for IPv6 address formats
- Length Limits: Prevents buffer overflow attacks
- Character Filtering: Removes dangerous characters
- Command Injection Prevention: Sanitizes all subprocess arguments
- Timeout Protection: Prevents hanging operations
- Error Handling: Safe error handling with sanitized messages
- Safe Defaults: Fallback to safe values on validation failure
- Operating System: Windows 10/11
- Python Version: 3.11.9 or higher
- Memory: 50MB RAM minimum
- Storage: 10MB disk space
- Network: Internet connection for DNS testing
- Administrator Rights: Required for changing DNS settings
- Network Access: Needed for DNS testing and validation
- Registry Access: For persistent settings (future feature)
NetSwitch-v1.0/
βββ net-switch.py # Main application file
βββ README.md # This documentation
βββ requirements.txt # Python dependencies (optional)
# Input Sanitization Functions
βββ sanitize_string() # General string sanitization
βββ sanitize_network_adapter_name() # Network adapter validation
βββ validate_dns_server_name() # DNS server selection validation
βββ sanitize_command_args() # Command argument sanitization
# Core DNS Functions
βββ is_valid_ip() # IPv4 validation
βββ is_valid_ipv6() # IPv6 validation
βββ apply_dns() # DNS application logic
βββ flush_dns() # DNS cache flushing
βββ test_dns() # DNS speed testing
βββ find_fastest_dns() # Fastest DNS detection
# GUI Components
βββ NetSwitchApp # Main application class
βββ __init__() # UI initialization
βββ get_adapters() # Network adapter detection
βββ show_options() # Options dialog
βββ apply_dns_action() # DNS application handler
βββ flush_dns_action() # DNS flush handler
βββ fastest_dns_action() # Fastest DNS handler- MVC Pattern: Separation of UI, logic, and data
- Singleton Pattern: Single application instance
- Observer Pattern: Status updates and threading
- Factory Pattern: DNS provider configurations
Cause: Insufficient permissions to modify DNS settings Solution:
- Right-click on Command Prompt/PowerShell
- Select "Run as Administrator"
- Navigate to NetSwitch directory
- Run
python net-switch.py
Cause: Network adapter name mismatch Solution:
- Select correct network adapter from dropdown
- Try "All Network Adapters" option
- Verify adapter is enabled in Network Settings
Cause: Missing dependencies or Python version Solution:
# Check Python version
python --version
# Install/upgrade customtkinter
pip install --upgrade customtkinter
# Run with UTF-8 encoding
python -X utf8 net-switch.pyCause: System encoding issues with emojis Solution:
# Run with explicit UTF-8 encoding
python -X utf8 net-switch.py
# Or set environment variable
set PYTHONIOENCODING=utf-8
python net-switch.py| Error | Meaning | Solution |
|---|---|---|
| "Invalid Input" | IP address format error | Check IP address format |
| "Command timed out" | Network operation timeout | Check internet connection |
| "Failed to apply DNS" | System-level error | Run as administrator |
| "No DNS servers reachable" | Network connectivity issue | Check network connection |
- Network Speed: Use ethernet connection for fastest results
- Firewall: Ensure DNS traffic isn't blocked
- Antivirus: Add NetSwitch to exclusions if needed
- Background Apps: Close unnecessary network applications
We welcome contributions to NetSwitch! Here's how you can help:
# Clone the repository
git clone https://github.com/kernferm/netswitch.git
cd netswitch
# Create virtual environment
python -m venv netswitch-env
netswitch-env\Scripts\activate
# Install dependencies
pip install customtkinter- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Test your changes thoroughly
- Commit with clear messages:
git commit -m "Add feature description" - Push to your fork:
git push origin feature-name - Submit a pull request
- π Additional DNS providers
- π§ Enhanced IPv6 support
- π¨ UI/UX improvements
- π Security enhancements
- π Documentation updates
- π Bug fixes and testing
- PEP 8: Follow Python style guidelines
- Type Hints: Use type annotations where possible
- Documentation: Include docstrings for functions
- Security: Maintain input sanitization standards
- Testing: Test on multiple Windows versions
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Copyright 2025 NetSwitch Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
- CustomTkinter - Modern UI framework
- DNS Jumper - Inspiration for UI design
- Python Community - Excellent documentation and support
- Contributors - Everyone who helps improve NetSwitch
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: This README and inline code comments
Made with β€οΈ by BubblesTheDev
NetSwitch v1.1.1 - Simplifying DNS management for Windows users