Last active
August 4, 2021 20:39
-
-
Save bmuskbytewolf/95855d29d1e3b78080211855cba80a83 to your computer and use it in GitHub Desktop.
Port discovery without NMAP
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 | |
subnet="192.168.30" | |
top10=(20 21 22 23 25 80 110 139 443 445 3389) | |
for host in {1..255}; do | |
for port in "${top10[@]}"; do | |
(echo > /dev/tcp/"${subnet}.${host}/${port}") > /dev/null 2>&1 && echo "Host ${subnet}.${host} has ${port} open" || echo "Host ${subnet}.${host} has ${port} closed" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment