#!/bin/bash
welcome() {
cat <<EOF
1. 需要用到的命令nmap -p +ip
2. nmap -p80,443 10.0.0.11 |awk '/report|tcp/{print $0}'
3. 需要用到的循环:while read line
EOF
}
start1() {
file_dir=/home/gegewu/shell/端口开放.txt
dizhi="地址"
while read line
do
echo "开始检测80端口"
ip=${line% *}
jiance_port="80"
check_JG="/home/gegewu/shell/namp检测结果.txt"
check_open=`echo -e '\x1dclose\x0d' |timeout --signal=9 2 nmap -sS -Pn -n -T4 -p${jiance_port} ${ip} |awk '/report|tcp/{print $0}' |awk 'NR==2{print $2}'`
check_port=`echo -e '\x1dclose\x0d' |timeout --signal=9 2 nmap -sS -Pn -n -T4 -p${jiance_port} ${ip} |awk '/report|tcp/{print $0}' |awk 'NR==2{print $1}'`
echo "ip是:${ip}"
echo "检测端口是: ${check_port} 状态是:${check_open} "
echo "开始检测端口----------------------------------->"
if [ "${
批量扫描端口shell脚本
于 2022-06-15 10:42:26 首次发布