#!/bin/bash
subnet="10.0.0.0/24"
delay=60
count=1
start_time=$(date +%s)

while true; do
    current_time=$(date +%s)
    elapsed_time=$((current_time - start_time))
    elapsed_minutes=$((elapsed_time / 60))
    echo -e "\ndate $(date) elapsed_mins $elapsed_minutes count $count delay $delay subnet $subnet\n"
    nmap -sV -O -p22 $subnet -oG - | grep -n '22/open/tcp' # fast on port 22 only with ping sweep
    # nmap -sV -O -Pn -p22 $subnet -oG - | grep -n '22/open/tcp' # pingless search
    # nmap -sV -O $subnet -oG - | grep -n '22/open/tcp' # lots of ports search
    # nmap -sV -O -Pn $subnet -oG - | grep -n '22/open/tcp' # all ports search, pingless, slow
    # sleep $delay
    count=$((count + 1))
done
