利用windows hosts檔案實現URL重定向
windows在解析一個URL時,首先會檢查 %systemroot%/system32/drivers/etc/hosts檔案(2K,XP),查詢與目標URL匹配的IP地址,如果沒有,才會向DNS Server查詢。能過修改hosts檔案,可以將目標URL重定向到一個虛假或惡意位置。
host 檔案內容如下:
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
試驗:
在IE位址列輸入www.test.com,回車. 192.168.0.1上的Serv-U登入介面就出來了。。