我创建了以下bash脚本:
#!/bin/bash
for ip in $(cat targets.txt); do
"curl -I -k https://"${ip};
"curl -I http://"${ip}
done但是,我没有收到预期的输出,这是来自targets.txt中列出的IP地址的header响应。
我不确定curl如何在一个命令中同时尝试HTTP和HTTPS (80/443),所以我设置了两个单独的curl命令。
发布于 2018-11-07 01:49:53
nmap可能更适合该任务:nmap -iL targets.txt -p T:80,443 -sV --script=banner --open
使用服务/版本检测(nmap)从TCP端口80和443 (-p T:80,443)上的输入列表(-iL targets.txt)执行主机的网络映射(-sV),并使用横幅抓取脚本(--script=banner,ref )。https://nmap.org/nsedoc/scripts/banner.html)。返回开放端口(--open)的结果。
..。或masscan (参考文献)( https://github.com/robertdavidgraham/masscan):masscan $(cat targets.txt) -p 80,443 --banners
质量扫描(masscan)所有目标端口80和443 (-p 80,443)和抓取横幅(--banners)。
发布于 2018-11-06 22:30:56
删除您的curl命令周围的引号。在第一次卷曲之后,您也不需要;。
#!/bin/bash
for ip in $(cat targets.txt); do
curl -I -k https://${ip}
curl -I http://${ip}
done发布于 2022-04-21 13:22:38
我在@John的答案中添加了一些echo,以便能够更好地显示curl执行的结果,还添加了端口8080作为代理。
#!/bin/bash
for ip in $(cat $1); do
echo "> Webserver Port Scan on IP ${ip}."
echo "Attempting IP ${ip} on port 443..."
curl -I -k https://${ip}
echo "Attempting IP ${ip} on port 80..."
curl -I http://${ip}
echo "Attempting IP ${ip} on port 8080..."
curl -I http://${ip}:8080
donehttps://stackoverflow.com/questions/53181007
复制相似问题