Created
May 18, 2021 01:02
-
-
Save anibalardid/5e05b6472feb3d31116729dc24e6d3e2 to your computer and use it in GitHub Desktop.
Revisions
-
anibalardid created this gist
May 18, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ # Used: # nmap -p- --open -T5 -v -n ip -oG allPorts # Extract nmap information # Run as: # extractPorts allPorts function extractPorts(){ ports="$(cat $1 | grep -oP '\d{1,5}/open' | awk '{print $1}' FS='/' | xargs | tr ' ' ',')" ip_address="$(cat $1 | grep -oP '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' | sort -u | head -n 1)" echo -e "\n[*] Extracting information...\n" > extractPorts.tmp echo -e "\t[*] IP Address: $ip_address" >> extractPorts.tmp echo -e "\t[*] Open ports: $ports\n" >> extractPorts.tmp echo $ports | tr -d '\n' | xclip -sel clip echo -e "[*] Ports copied to clipboard\n" >> extractPorts.tmp cat extractPorts.tmp; rm extractPorts.tmp }