When the scans take too much time, you can limit ports, number of probe retries and disable RTT prolongation. It make sense to chose the top 1000 ports or more, instead of 65535. Ping your asset to retrieve current response time in milliseconds.
#!/bin/bash
# Check if the user provided an IP address
if [ -z "$1" ]; then
echo "Usage: $0 <IP_ADDRESS>"
exit 1
fi
# Assign params
IP_ADDRESS=$1
LOG_DIR="_automap_logs"
# Check if the directory exists
if [ -d "$LOG_DIR" ]; then
echo "(i) Directory '$LOG_DIR' already exists."
else
# Create the directory
echo "(i) Directory '$LOG_DIR' creating..."
mkdir "$LOG_DIR"
# Check if the directory was created successfully
if [ $? -eq 0 ]; then
echo "(i) Directory '$LOG_DIR' created successfully."
else
echo "Failed to create directory '$LOG_DIR'."
exit 1
fi
fi
# functions
print_line() {
echo ""
echo "-"
echo ""
}
# Run nmap scan on the provided IP address
echo "-------------------------"
echo " Automap v1.0"
echo " target: $IP_ADDRESS"
echo "-------------------------"
echo ""
echo "[DNS] PTR?"
dig -x $IP_ADDRESS | grep PTR
print_line
echo "[TCP] nmap scan on $IP_ADDRESS..."
nmap -v -p- -A $IP_ADDRESS -oA ./${LOG_DIR}/TCP_${IP_ADDRESS}
print_line
echo "[UDP] nmap fast scan on $IP_ADDRESS..."
nmap -v -sUV -F -A $IP_ADDRESS -oA ./${LOG_DIR}/UDP_${IP_ADDRESS}
# End of script