0% found this document useful (0 votes)
47 views1 page

User File Script

This script runs an Nmap scan on a target IP address and port specified by the user. It saves the Nmap output to a file in the root folder with the name provided by the user. The script echoes whether the port is open or closed/filtered, along with the current time, and breaks out of the loop if the port is open.

Uploaded by

api-385391462
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views1 page

User File Script

This script runs an Nmap scan on a target IP address and port specified by the user. It saves the Nmap output to a file in the root folder with the name provided by the user. The script echoes whether the port is open or closed/filtered, along with the current time, and breaks out of the loop if the port is open.

Uploaded by

api-385391462
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

#!

/bin/bash

#Requesting a user file >> Placing in a root folder <<

read -p What us the name of output file to be saved? filename

#Request user enter port number


echo -e -n PORT: ; read portnum
p=-p
port=$p$portnum

#Request of target IP address input from user


echo -e -n IP: ; read ip

temp=/root/$filename
while :
do
nmap -sV $port $ip >> $temp #tailor nmap script to specific use
if grep -q open $temp && ! grep filtered $temp; then
time=$(date +%T)
echo -e PORT $portnum OPENED AT $time
break
else #Closed port selection results in spam. Type Ctrl+C in terminal to stop
echo PORT $portnum CLOSED OR FILTERED.
done

You might also like