General-Scripts/projects/ports-scanner

19 lines
654 B
Bash
Executable file

#!/usr/bin/env bash
clear
targethost=$1
report="$PWD/OpenedPorts.$targethost.txt"
echo "| Scanning Open Ports on $targethost target ..."
echo "===========================================================" > $report
echo " Open Ports Scan Report on $targethost " >> $report
echo "===========================================================" >> $report
for port in {1..65535};
do
sleep 0.10
(echo >/dev/tcp/$targethost/$port) >& /dev/null && echo "Found : $targethost:$port" >> $report
echo -n "> Scanned $port/65535 on $targethost | "
echo "$(grep $port $report)"
done
echo "===========================================================" >> $report