مضى على الشبكة و يوم من العطاء.

سكربت بسيط لتنفيذ فحص المنافذ باستخدام باش سكربت

spnl48

./عضو جديد

السمعة:

#!/bin/bash if [ "$#" -ne 3 ]; then echo "Usage: $0 <target_host> <start_port> <end_port>" exit 1 fi target_host="$1" start_port="$2" end_port="$3" check_port() { # Redirect stdout and stderr to /dev/null, and set a timeout of 1 second timeout 1 bash -c "echo >/dev/tcp/$target_host/$1" 2>/dev/null if [ $? -eq 0 ]; then echo "Port $1 is open" else echo "Port $1 is closed" fi } for ((port = start_port; port <= end_port; port++)); do check_port "$port" & done wait
احفظ السكربت وغير صلاحيته:
chmod +x port_scanner.sh
شغل السكربت بهذا:
./port_scanner.sh 192.168.181.1 80 100
 
التعديل الأخير بواسطة المشرف:

آخر المشاركات

عودة
أعلى