MyHosts is a utility that helps you edit and manage the Windows hosts file for network configuration and blocking. It's a lightweight Windows Forms application for managing the local hosts file on Windows systems.
- Easy Host Management - Add, edit, and remove host entries with a user-friendly interface
- Real-time Editing - Direct editing of the hosts file with syntax validation
- Backup & Restore - Automatic backup creation before modifications
- Search & Filter - Quickly find specific host entries
- Clean Architecture - Built with pure .NET Framework, no third-party dependencies
MyHosts interface showing hosts file management functionality
- Operating System: Windows 7 SP1 or later
- Framework: .NET Framework 4.8
- Permissions: Administrator privileges (required for hosts file modification)
- Build Tools: MSBuild (included with Visual Studio or .NET Framework SDK)
# Clone the repository
git clone https://github.com/ropean/MyHosts
cd MyHosts
# Build in Release mode
scripts\build.cmd
# Or build in Debug mode (edit scripts\build.cmd)- Navigate to
MyHosts\bin\Release\ - Run
MyHosts.exeas Administrator - Start managing your hosts file
MyHosts/
├── assets/ # Project assets
│ ├── screenshot.png # Application screenshot
│ ├── app.ico # Application icon
│ └── top_backgroud.png # Background image
├── CHANGELOG.md # Project changelog
├── LICENSE # MIT license
├── README.md # This file
├── MyHosts/ # Main application
│ ├── App.config # Application configuration
│ ├── app.manifest # Application manifest
│ ├── Program.cs # Application entry point
│ ├── FrmMain.cs # Main form
│ ├── FrmEdit.cs # Edit form
│ ├── CustomNotificationForm.cs # Notification form
│ ├── Utility.cs # Helper utilities
│ └── Properties/ # Application properties
└── scripts/ # Build and utility scripts
├── build.cmd # Build script (Release mode)
├── clean.cmd # Clean script (Debug & Release)
└── Scripts.md # Scripts documentation
The project includes convenient build scripts:
- Builds the project in Release configuration only
- Optimized for production deployment
- Automatic NuGet package restore
- Removes both Debug and Release build artifacts
- Cleans cached NuGet packages
- Prepares for clean rebuilds
None! This project uses only the .NET Framework 4.8 and standard Windows APIs.
RestSharp(removed due to security vulnerabilities)Fody(removed to eliminate third-party dependencies)Costura.Fody(removed to eliminate third-party dependencies)
- No External Dependencies - Eliminates supply chain attack vectors
- Administrator Required - Appropriate permission model for system file editing
- Backup Creation - Automatic backup before any modifications
- Input Validation - Proper validation of host entries
The application performs the following operations on the hosts file:
- Location:
%SystemRoot%\System32\drivers\etc\hosts - Backup: Creates timestamped backups before modifications
- Validation: Ensures proper hosts file format
- Permissions: Requires administrator privileges
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- IDE: Developed with Visual Studio
- Language: C# with Windows Forms
- Target Framework: .NET Framework 4.8
- Architecture: x86/x64 compatible
- UI: Windows Forms with custom styling
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include your Windows version and .NET Framework version
See CHANGELOG.md for detailed version history and changes.
-
v0.2.0 - Current release
- Enhanced hosts file management
- Improved user interface
- Better backup and restore features
- Performance optimizations
-
v1.0.0 - Initial release
- Basic hosts file management
- Add, edit, remove functionality
- Backup and restore features
Note: This application modifies system files and requires administrator privileges. Always backup your hosts file before making changes.
