Bash 是否使用nmap在每个ip上循环?
我正在寻找一种方法来清理nmap的输出,并在每个ip上循环运行Bash 是否使用nmap在每个ip上循环?,bash,loops,nmap,Bash,Loops,Nmap,我正在寻找一种方法来清理nmap的输出,并在每个ip上循环运行ssh pi@,直到找到匹配项为止。这可能吗?我一直在四处搜索,但我找不到任何有人在nmap输出上循环的案例 最接近我的是: ➜ nmap -n -sP xxx.xxx.x.13/24 | grep "Nmap scan report for" Nmap scan report for xxx.xxx.x.1 Nmap scan report for xxx.xxx.x.2 Nmap scan report f
ssh pi@
,直到找到匹配项为止。这可能吗?我一直在四处搜索,但我找不到任何有人在nmap输出上循环的案例
最接近我的是:
➜ nmap -n -sP xxx.xxx.x.13/24 | grep "Nmap scan report for"
Nmap scan report for xxx.xxx.x.1
Nmap scan report for xxx.xxx.x.2
Nmap scan report for xxx.xxx.x.6
Nmap scan report for xxx.xxx.x.7
Nmap scan report for xxx.xxx.x.9
Nmap scan report for xxx.xxx.x.10
Nmap scan report for xxx.xxx.x.11
Nmap scan report for xxx.xxx.x.13
Nmap scan report for xxx.xxx.x.19
Nmap scan report for xxx.xxx.x.22
我正在寻找一种方法来清理nmap的输出
并在每个ip上循环运行ssh pi@,直到找到匹配项。这可能吗
也许读一会儿
#/usr/bin/env bash
读时-ru9ips;做
ssh“pi@$ips”
完成9<
nmap -n -sP xxx.xxx.x.13/24 | awk '/^Nmap scan report for [[:digit:].]+$/ {print $NF}'