Skip to content

Instantly share code, notes, and snippets.

@Chan9390
Last active March 4, 2020 08:21
Show Gist options
  • Save Chan9390/a3c69ca3a8c9a28d97aa1345f42599c8 to your computer and use it in GitHub Desktop.
Save Chan9390/a3c69ca3a8c9a28d97aa1345f42599c8 to your computer and use it in GitHub Desktop.
Faster nmap scanning with the help of GNU parallel - Part 2
for dirname in logs/*;
do
for filename in ${dirname}/*.gnmap;
do
project=`echo $filename | cut -d/ -f2`;
ip=`echo $filename | cut -d/ -f3`;
ip=${ip::-6};
cat $filename | cut -d' ' -f2,4- | sed -n -e 's/Ignored.*//p' | awk -v ip="$ip" -v project="$project" '{$1=""; for(i=2; i<=NF; i++) { a=a" "$i; }; split(a,s,","); for(e in s) { split(s[e],v,"/"); if (v[2] == "closed") { printf project "," ip ",%s,%s\n" , v[1], v[5]}}; a="" }';
done;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment