Last active
February 17, 2024 08:45
-
-
Save rightson/16b02d8855aa2308a22f6d7621c67aec to your computer and use it in GitHub Desktop.
Scanning IPv4 addresses in use
This file contains hidden or 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
if [ "$#" -eq 0 ]; then | |
targets="70 71 79 91 92 93 94" | |
else | |
targets=$* | |
fi | |
echo -e "Targets to scan:\n $targets" | |
in_use=() | |
for suffix in $targets; do | |
ip=140.113.216.$suffix | |
echo -e "\n> nmap -sn $ip -oG -" | |
nmap -sn $ip -oG - | grep "Up" | |
if [ $? -eq 0 ]; then | |
echo "$ip is in use (nmap)" | |
in_use+=(\\n$ip) | |
fi | |
done | |
echo "------" | |
echo -e "IPs in use: ${in_use[*]}"#!/bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usages:
bash scan-ipv4.sh
bash scan-ipv4.sh `seq 65 94`