![Say Thanks!]()
This AutoUpdate project is maintained by ScriptTiger:
The Unified Hosts project is maintained by Ste:
Further project contributors are noted with their contributions in the Unified Hosts data, both a online from Ste's project as well as in the data injected into the local hosts file by this script, as it is downloaded directly from Ste's most recently pre-generated Unified Hosts files.
You can download this repo from the below link to get started:
If your script worked in the past but has stopped working since, please update your repo files and try again before posting a new issue.
Extract the contents to the same directory and run the Hosts_Update.cmd script. There is also an option to remove the Unified Hosts from your local hosts file. In the event critical changes are made to either the AutoUpdate repo or to the Unified Hosts repo, this script is also capable of automatically updating itself.
If you experience problems with performance or seemingly unrelated networking issues after running this script, please try adjusting your compression level to one that best suits your needs.
This script requires either BITS or PowerShell to function. While both are native to modern Microsoft Windows installations, there are also compatible which can be manually installed for older systems.
If you want to ignore or whitelist certain entries from the Unified Hosts and prevent them from appearing in your local hosts, just add them to the ignore.txt. These entries are made with literal expressions and can match all or only part of an entry. So if you want to only ignore one specific URL, it's better to put the whole line just in case. For example, if you want to ignore the www.google.com domain specifically, put this:
0.0.0.0 www.google.com
If you want to ignore all .de websites, you can simply put:
.de
If you want to ignore all subdomains of google.com, you can put:
.google.com
If you want to ignore all google subdomains in any top le:
.google.
If you would also like to manage custom hosts file entries with this script, you can do so using the custom.txt. As this script does not alter custom entries in the hosts file itself, this is simply an option to make things easier if you would prefer to manage custom entries this way rather than manually managing them in the hosts file.
Also, if you send your preferred URL to the script as a parameter, it will bypass all the prompts and automatically install/update the Unified Hosts in the local hosts file. This is useful for things like scheduling a task to update your Unified Hosts daily or weekly, etc. You can e your hosts randomly throughout the day at certain times to switch between Unified Hosts to, for example, only allow social in the e or on the weekends. And if you would like to remove the Unified Hosts from your hosts file, you can just enter "remove" as the URL. If you do decide to make a scheduled task, also remember the account issuing the task must still ha pri to be able to write to the local hosts file. You can optionally add your preferred compression level as a second parameter, as well, but this must always accompany a URL as the first parameter.
Because no backup of your local hosts file is needed, entries in the Unified Hosts relating to the localhost and other loopback addresses have been removed to prevent possible conflict with preexisting entries. No backup is needed because this script implements the Unified Hosts within opening and closing tags to clearly segment it from the user's preexisting entries and allow the script to know what area of the file to o during an update or remo removal.
If you are deploying the update script across an organization via a shared network location and group policies, edit the "" file by adding an X to the end of the number like this:
1.10X
This will disable the script from checking for script updates and attempting to update itself. This does not affect updates to the hosts file or whate tasks you may have in place, this strictly disables the Hosts_Update.cmd from updating itself within the shared network location which remote system accounts running the scheduled tasks may not ha access to.
By default, the script forces the command processor instance to close upon completion just to ensure you don't have an unattended command prompt with administrati lingering where it's not needded. However, for debugging or other purposes you can send /DFC as an initial argument to prevent the command prompt from closing after script completion. For further debugging, please reference the following error code table.
By default, log entries are only kept from the most recent scheduled task in the log.txt within the script home directory. If script updates are disabled, there will be no automatic logging since the assumption is the script directory is read-only. However, to force persistent logging to the script directory, you can also send /LOG as an initial argument to force writing a persistent log that always logs e and ne the log. You also have the option of alternatively using /LOG:<file> to write a persistent log to a directory and file of your choosing, which is recommended to be set to a local machine directory for deployments across networks so that logs are not written to the shared script directory which should be read-only. If you choose to configure persistent logging, please remember that managing that logging and associated file sizes then becomes your own responsibility.
Please note, all initial arguments (/DFC,/LOG:<file>, etc.) must be placed before the URL and compression parameters (i.e. Hosts_update.cmd /DFC <URL>).
Decimal Error Code | Hexadecimal Error Code | Explanation
-------------------|------------------------|-----------------------------------------------------------------------------------
0 | 0x0 | The operation completed successfully. (No errors)
1 | 0x1 | Must be run with administrati
2 | 0x2 | "#### END UNIFIED HOSTS ####" not properly marked in hosts file
3 | 0x3 | Hosts file is not properly marked
4 | 0x4 | Currently disabled due to maintenance, please try again later
5 | 0x5 | Your system cannot connect to GitHub
6 | 0x6 | Neither BITS nor PowerShell installed
7 | 0x7 | Download mechanism cannot connect to GitHub
8 | 0x8 | Download failed
255 | 0xFF | The script terminated unexpectedly
This script is in acti, so please share your feedback on what you like and don't like so we know what direction to take and don't inad make things worse
For more ScriptTiger scripts and goodies, check out ScriptTiger's GitHub Pages website:
开发语言:Batchfile
Star 数:344
该项目属于病毒分析方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕Quickly and easily install, uninstall, and set up automatic updates for any of Steven Black's unified hosts files.展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。
从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。
1. 下载源码压缩包,解压到本地环境。
2. 根据项目类型准备对应的运行环境与依赖。
3. 按照 README 中的步骤完成配置与部署。
4. 在隔离的测试环境中运行验证,避免影响生产系统。
本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。
| 资源标题 | Unified-Hosts-AutoUpdate - Quickly and easily install, uninstall, and set up |
| 所属分类 | 病毒分析 |
| 发布作者 | admin |
| 发布时间 | 2026-10-05 23:22:06 |
| 下载权限 | 免费下载 |
| 附件数量 | 2 个下载链接 |
| 浏览次数 | 81 |
| 讨论数量 | 0 |
| 主题状态 | 正常讨论中 |