linux下将nmap扫描结果txt文件转换为excel表格内容所用命令

nmap扫描完保存为txt文件之后,有时需要将txt文件处理下,转换为excel表格,好进行统计对比输出,如下为转换命令

nmap扫描命令,将ip.txt中的ip扫描结果输出到rs.txt文件中保存

nmap -n -sT -sV -p 21,22,23,25,135,137,139,445,3389,80,443,8080,3306,1521,5900,5901 -iL ip.txt -oN rs.txt

shell命令如下:

cat rs.txt|grep -v "filtered"|grep -v "PORT"|grep -v "Host"|awk -F' ' '{ print $1,$2,$3,$5 }'|grep -B 2 "open"|awk NF|sed 's/Nmap scan report //g' > rs1.txt
cat rs1.txt |grep -v "\-\-"|grep -v "SF"|sed 's/ /\x09/g' > rs2.txt

记录

cat rs.txt |grep -v "filtered"|grep -v "PORT"|grep -v "Host is"|grep -v "closed"|grep -v "unrecognized"|grep -v "SF"|awk NF|sed 's/Nmap scan report for //g'|grep -B1 "open"|grep -v "\-\-"|more

直接将rs2.txt中的内容复制到excel表格中就行了,最终结果如下:
linux下将nmap扫描结果txt文件转换为excel表格内容所用命令_第1张图片

你可能感兴趣的:(linux下将nmap扫描结果txt文件转换为excel表格内容所用命令)