I’m happy to release FixHosts, a small open-source Python utility for toggling managed Windows hosts-file entries on and off without manually editing the file every time.
FixHosts is built for a simple workflow: take active entries like 127.0.0.1 example.local # auto and flip them into disabled entries like # auto: 127.0.0.1 example.local, then flip them back when needed. It also supports named switch groups, creates a backup before writing, requests elevation on Windows when necessary, and flushes DNS after changes so updates take effect immediately.
- Toggle managed Windows hosts entries on and off
- Support for default and named switch groups
- Dry-run mode to preview changes
- Automatic backup creation before writes
- Windows elevation prompt when admin rights are required
- DNS flush after successful updates
Active:
127.0.0.1 mysite.local # auto
127.0.0.1 api.mysite.local # auto: devDisabled:
# auto: 127.0.0.1 mysite.local
# auto: dev: 127.0.0.1 api.mysite.localThis project is for developers and power users who want a cleaner way to enable and disable local vhost-style host mappings without constantly hand-editing the Windows hosts file.
- Project Page: https://github.com/tibberous/FixHosts
- Website: http://trenttompkins.com
- MIT License: https://opensource.org/licenses/MIT
Trenton Tompkins
TrentTompkins@gmail.com
For custom Python development, call 724 431 5207.
This is open-source software released under the MIT License and provided as is, without warranty of any kind. The author is not responsible for damages, misconfiguration, downtime, data loss, or any other issues resulting from use of this software.