nmap -p- mirai.htb | awk -F/ '/^[[:digit:]]/ {ports=ports$1","} END{print ports}' | xargs -I{} nmap -sV -sC -p{} mirai.htb -oA tcp_all
Cute??? The Awk part???
awk -F/ '/^[[:digit:]]/ {ports=ports$1","} END{print ports}'
compared with grep ^[0-9] | cut -d '/' -f 1 | tr '\n' ','
?
(i guess the point of the latter one is to introduce three tools at once so im not gonna complain hehehe and whoa i just realize it’s shorter)