linux - 从列表中读取并打印主机名在特定端口上打开

标签 linux bash nmap

我编写了 nmap 命令,如下所示:

nmap -oX test.xml -p 23 -il list.txt > out.txt

我如何告诉 nmap 从我的 list.txt 打印在端口 23 上打开的主机?

最佳答案

你不能要求 nmap 只打印它们,但你可以 grep nmap 结果:

nmap -p 23 -i list.txt | grep '^23.*open' -B3 | grep '^Nmap scan' | cut -d\( -f2 | cut -d\) -f1

关于linux - 从列表中读取并打印主机名在特定端口上打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21338338/

相关文章:

bash - Makefiles中 '@'命令中 "@set -e"的含义

bash - 如何使用 nmap 确定给定范围内的哪些 IP 具有端口 80?

perl - 我应该使用 Nmap::Parser 还是 Nmap::Scanner 来审计网络?

linux - Bash 脚本 - 如何在文本文件中匹配模式后插入变量值作为新行,第 2 行

linux - 用硬链接(hard link)替换重复文件的功能

linux - 如何预填充命令行输入

output - nmap不显示,正常吗

java - 在 linux 中执行 java 程序时 Xterm 显示不正确

linux - 创建一个由两个头文件编译的头文件 - makefile

linux - 在 R ("No such file or directory"中安装包(AlgDesign 和 ggplot2)时出现问题