Currently, many websites are deployed separately on the front and back ends, which is relatively secure. Even if hackers get the foreground shell, they cannot find the background management address to increase security.
You should know the functions of the hosts file. When you access a website, you need to resolve the domain name to an IP address to connect and obtain the content, when resolving a domain name, you usually first check whether there are related records in hosts. If there is a direct return IP address, if no DNS resolution is used. If the hosts file is modified, the specified IP address can be returned even if the domain name is not resolved. Other users cannot access the service.
The backend management address is generally used only within the management team. If this domain name is not resolved, it can be accessed only by modifying a hosts file, and the security will be higher. As normal editors cannot modify the hosts file on their own, I wrote a bat script to automatically modify the hosts file. In this way, the administrator can modify the script and send it to internal sharing. You can download and run the script during editing.
This script can automatically determine whether the script is run or manually modified. If it is modified, it will not automatically add new records. If it is not modified, a new row of records will be added at the bottom.
Note: If the IP address is pointed to by multiple domain names, add judgment rules so that they can correctly identify the added records. If you are prompted that you do not have permission during the operation, right-click to run as an administrator. If the security software prompts a warning, please agree to modify the hosts file.
The script content is as follows:
@echo offpushd %windir%\system32\drivers\etccopy /y hosts hosts.bak findstr "127.0.0.1" hosts >nul&&(findstr "#127.0.0.1" hosts >nul&&(echo. >> hosts & echo 127.0.0.1 www.jishubu.net>>hosts)||echo 系统没问题)||(echo. >> hosts & echo 127.0.0.1 www.jishubu.net>>hosts) findstr "127.0.0.1" hosts echo 清空IE临时文件目录...del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"del /f /s /q "%temp%\*.*"echo 清除系统完成! echo 处理完成【按任意键退出】pause>nulexit
The batch processing script modifies the specified domain name resolution IP address of the hosts file