增加超时值以获得更可靠的扫描
在本步骤中,你将通过设置一个合适的超时值来纠正上一步中的问题。为了确保扫描的可靠性,超时时间必须长于服务器最长的预期响应时间。
从第一步的 curl 测试中,我们知道服务器大约需要 5 秒才能响应。为了安全起见,我们应该增加一点缓冲。让我们将超时设置为 7 秒。这为服务器处理请求并发送响应提供了足够的时间。
再次运行 Nikto 扫描,但这次将超时设置为 7 秒:
nikto -h localhost -p 8000 -timeout 7
这次,你应该会看到不同的结果。扫描将正常进行,不会出现“Connection timed out”错误。Nikto 现在将能够与服务器正常通信并执行其测试。
输出将更像一次正常的、成功的扫描:
- Nikto v2.5.0
---------------------------------------------------------------------------
+ Target IP: 127.0.0.1
+ Target Hostname: localhost
+ Target Port: 8000
+ Start Time: ...
---------------------------------------------------------------------------
+ Server: Python/3.10.6 http.server/0.6
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ No CGI directories found (use '-C all' to force check all possible dirs)
+ "robots.txt" not found.
...
请注意没有超时错误,并且出现了服务器 banner。这表明扫描现在正在可靠地运行。