From 28c327b2aaf284399f22fba7d8d3f8a3cc3aba80 Mon Sep 17 00:00:00 2001 From: jc Date: Tue, 24 Jun 2025 06:16:12 +0000 Subject: [PATCH] added a --threads flag for specifying the number of threads --- portradar.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/portradar.sh b/portradar.sh index 76e9e76..0dcc3af 100755 --- a/portradar.sh +++ b/portradar.sh @@ -15,6 +15,7 @@ options: --force scan open ports even if ping is disabled --pointers only scan key ports --httpx run httpx + -t, --threads specify the number of threads (default:50, max:500) SYNTAX exit } @@ -92,7 +93,8 @@ scan_tcp(){ handle & pid=$! # scan residual ports - k=0; for c in $(seq 1 65535); do [[ ! ${top_1000[$c]} ]] && { tcp_scan & ((k++)); [[ $k -eq 500 ]] && { sleep .248; k=0; }; }; done + [[ ! $threads ]] && threads=50 + k=0; for c in $(seq 1 65535); do [[ ! ${top_1000[$c]} ]] && { tcp_scan & ((k++)); [[ $k -eq $threads ]] && { sleep .248; k=0; }; }; done # wait kill -TERM $pid 2>/dev/null; wait @@ -265,6 +267,10 @@ while [ "$1" != "" ]; do --httpx) HTTPX=true ;; + -t | --threads) + shift + [[ $1 =~ ^[0-9]+ ]] && { [[ $1 -gt 500 ]] && { cg_color bby "So now you just want to blow up the CPU?"; help; } || { threads=$1; }; } || help + ;; *) [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] && { ip=$1; } || { [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+$ ]] && { cidr=$1; }; } || { [[ -f $1 ]] && { ipocalypse=($(<$1)); }; } || help ;; @@ -281,4 +287,4 @@ cl keyports=([21]=0 [22]=0 [80]=0 [88]=0 [135]=0 [443]=0 [445]=0 [554]=0 [1433]=0 [1521]=0 [2049]=0 [2375]=0 [3000]=0 [3306]=0 [4786]=0 [5000]=0 [5432]=0 [5984]=0 [6379]=0 [8000]=0 [8009]=0 [8080]=0 [8443]=0 [9090]=0 [9100]=0 [9200]=0 [10050]=0 [15672]=0 [27017]=0) [[ $POINTERS == true ]] && { a=${!keyports[@]}; mports=${a// /,}; } [[ $ipocalypse ]] && { for line in ${ipocalypse[@]}; do [[ $line =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] && { ip=$line; do_ip; } || { [[ $line =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+$ ]] && { cidr=$line; do_cidr; }; } || { continue; }; done; exit; } -[[ $ip ]] && { do_ip; } || { [[ $cidr ]] && { do_cidr; }; } \ No newline at end of file +[[ $ip ]] && { do_ip; } || { [[ $cidr ]] && { do_cidr; }; }