我是bash脚本的新手,我正在努力让这个工作:
扫描IP范围以查找打开端口80的设备...我认为它必须如下所示:
#!/bin/bash
echo -----------------------------------
for ip in 192.168.0.{1,.255}; do
nmap -p80 192.168.0.1
if #open; then
echo "{ip} has the port 80 open"
else
#do nothing
fi
done
echo -----------------------------------
exit 0
Run Code Online (Sandbox Code Playgroud)
我也想看到这样的结果:
-----------------------------------
192.168.0.1 has the port 80 open
192.168.0.10 has the port 80 open
192.168.0.13 has the port 80 open
192.168.0.15 has the port 80 open
-----------------------------------
Run Code Online (Sandbox Code Playgroud)
(所以没有错误或nmap正常输出..)
有人可以帮助我吗?