Skip to content

Instantly share code, notes, and snippets.

@alvaro893
Created September 4, 2019 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alvaro893/93c914259f785b9135ab9bea116d3384 to your computer and use it in GitHub Desktop.
Save alvaro893/93c914259f785b9135ab9bea116d3384 to your computer and use it in GitHub Desktop.
Scan network to get all IP addresses with their hostname in a ordered manner
#!/bin/bash
FILE=hosts.txt
sudo nmap -sP -PR 192.168.137.1/24 -oN $FILE
sed -i '/Host is/d' $FILE
sed -i '/MAC/d' $FILE
sed -i 's/Nmap scan report for//g' $FILE
sort $FILE -o $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment