Http 发送给Squid的请求相同,但在使用masscan时收到400个错误请求

Http 发送给Squid的请求相同,但在使用masscan时收到400个错误请求,http,squid,http-status-code-400,Http,Squid,Http Status Code 400,我有一个hello.txt文件,包含以下内容: GET http://www.google.com/ HTTP/1.1 Host: www.google.com 使用netcat,它可以工作: cat hello.txt | nc 212.8.251.116 62138 但当我使用masscan时,我会得到400个错误: # bin/masscan 207.180.212.139 -p62138 --banners --source-port 61000 --hello-file[62138

我有一个hello.txt文件,包含以下内容:

GET http://www.google.com/ HTTP/1.1
Host: www.google.com
使用netcat,它可以工作:

cat hello.txt | nc 212.8.251.116 62138
但当我使用masscan时,我会得到400个错误:

# bin/masscan 207.180.212.139 -p62138 --banners --source-port 61000 --hello-file[62138] hello.txt

Starting masscan 1.0.6 at 2019-09-06 12:48:57 GMT
 -- forced options: -sS -Pn -n --randomize-hosts -v --send-eth
Initiating SYN Stealth Scan
Scanning 1 hosts [1 port/host]
Discovered open port 62138/tcp on 207.180.212.139
Banner on port 62138/tcp on 207.180.212.139: [title] ERROR: The requested URL could not be retrieved
Banner on port 62138/tcp on 207.180.212.139: [http] HTTP/1.1 400 Bad Request\x0d\x0aServer: squid/3.5.27\x0d\x0aMime-Version: 1.0\x0d\x0aDate: Fri, 06 Sep 2019 12:48:59 GMT\x0d\x0aContent-Type: text/html;charset=utf-8\x0d\x0aContent-Length: 3548\x0d\x0aX-Squid-Error: ERR_INVALID_URL 0\x0d\x0aVary: Accept-Language\x0d\x0aContent-Language: en\x0d\x0aX-Cache: MISS from de8g.t1ip.com\x0d\x0aX-Cache-Lookup: NONE from de8g.t1ip.com:62138\x0d\x0aConnection: close\x0d\x0a\x0d
但是,使用wireshark,我看到发送的内容是相同的:

我用十六进制对发送的数据进行了区分,结果是一样的


如果请求相同,为什么其中一个会导致错误?

首先,您使用的可选语法(位置中的绝对url)可能在所有实例上都不受支持,而您请求的域(
www.google.com
)可能不在该主机上。我很确定,您可以将squid配置为拒绝未注册的域,错误为400。squid中有很多配置选项,因此行为不同,并且您的两个示例不在同一IP上。首先,您使用的可选语法(位置中的绝对url)可能在所有实例上都不受支持,而您请求的域(
www.google.com
)可能不在该主机上。我很确定,您可以将squid配置为拒绝未注册的域,错误为400。squid中有很多配置选项,因此行为不同,并且您的两个示例不在同一IP上。