Skip to content

Instantly share code, notes, and snippets.

@gfrn
Created November 20, 2021 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfrn/1aeb0149d481fc78d9d34c82381b87a5 to your computer and use it in GitHub Desktop.
Save gfrn/1aeb0149d481fc78d9d34c82381b87a5 to your computer and use it in GitHub Desktop.
Get possible IPs for new devices in network
#!/bin/bash
read -p "Enter your network mask: "
IP=${REPLY}
OLD=$(nmap -sn $IP | grep 'Nmap scan report for' | cut -f 5 -d ' ')
read -n 1 -p "Plug in the device and press enter"
NEW=$(nmap -sn $IP | grep 'Nmap scan report for' | cut -f 5 -d ' ')
echo Possible IPs:
echo ${OLD[@]} ${NEW[@]} | tr ' ' '\n' | sort | uniq -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment