added a --force flag

This commit is contained in:
jc
2024-11-04 21:54:37 +03:00
parent a3f7f63fa4
commit c355f9064f
+7 -3
View File
@@ -1,7 +1,5 @@
#!/bin/bash
# fingerprint some ports and try out some basic enumeration: For Example SMB Null Authentication
help() {
cat <<SYNTAX
usage: $0 [-p port] [--nmap] locale
@@ -14,6 +12,7 @@ options:
--nmap run nmap after port scan
--open only print hosts with atleast one open port
--hosts only print live hosts in the subnet
--force scan open ports even if ping is disabled
SYNTAX
exit
}
@@ -73,6 +72,7 @@ udp_scan(){
}
fast_ping(){
[[ $FORCE == true ]] && { echo $ip >> /tmp/ips; return; }
nn=$(ping -n -w2 -c1 $ip >/dev/null 2>&1; echo $?)
[[ $nn == 0 ]] && { echo $ip >> /tmp/ips; }
}
@@ -177,6 +177,7 @@ cidr_to_ips() {
RUN_NMAP=false
HOST_SCAN=false
PRINT_OPEN=false
FORCE=false
while [ "$1" != "" ]; do
case $1 in
-p | --port)
@@ -197,6 +198,9 @@ while [ "$1" != "" ]; do
--hosts)
HOST_SCAN=true
;;
--force)
FORCE=true
;;
*)
if [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
ip=$1
@@ -236,4 +240,4 @@ elif [[ $cidr ]]; then
[[ ($RUN_NMAP == true) && -f /tmp/tcp_ports ]] && echo
cl
done
fi
fi