Created
February 13, 2024 19:59
-
-
Save rxerium/3e1640d79f2e4060610eb07ff2e08fc3 to your computer and use it in GitHub Desktop.
Script to find online hosts on the network then check for ports / services running on online hosts
This file contains 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 characters
#!/bin/bash | |
echo "script starting..." | |
# installs nmap | |
apt update | |
apt install nmap -y | |
echo "nmap has been installed" | |
# finds hosts that are online on the network and outputs it to a online-hosts.txt file in the current dir | |
nmap -sn 192.168.1.0/24 -oG - | awk '/Up$/{print $2}' > online-hosts.txt | |
# runs nmap again to find open ports | |
nmap -iL online-hosts.txt -p- -oN port-scan-results.txt | |
echo "script complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment