Advertisement
GArayaR

nmap S4vitar

Feb 11th, 2022
2,315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Extract nmap information
  2. function extractPorts(){
  3.     ports="$(cat $1 | grep -oP '\d{1,5}/open' | awk '{print $1}' FS='/' | xargs | tr ' ' ',')"
  4.     ip_address="$(cat $1 | grep -oP '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' | sort -u | head -n 1)"
  5.     echo -e "\n[*] Extracting information...\n" > extractPorts.tmp
  6.     echo -e "\t[*] IP Address: $ip_address"  >> extractPorts.tmp
  7.     echo -e "\t[*] Open ports: $ports\n"  >> extractPorts.tmp
  8.     echo $ports | tr -d '\n' | xclip -sel clip
  9.     echo -e "[*] Ports copied to clipboard\n"  >> extractPorts.tmp
  10.     cat extractPorts.tmp; rm extractPorts.tmp
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement