接到个任务,要对大量的主机ip进行扫描:
扫描加过滤脚本贴到底下
#!/bin/bash ### use nmap scan aliyun echo "********Start scan********" cat aliyun.txt | grep -Ev '^(#|$)' | while read line; do nmap -Pn $line |awk '/Nmap scan/ {printf " "" 33[1;32m" $5 " 33[0m "" "} /Host/ {print $0} /PORT/ {print $0} /tcp/ {print $0}' >> check.txt echo "scan $line ok!" done echo "********All done********"
过滤前的格式:
过滤后的格式: