This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function to generate a random port number excluding common ports | |
generate_random_port() { | |
local port | |
local common_ports=(22 80 443 8080 3306 5432 25 110 995 993 21 20 23 161 162 5060 5061) | |
while true; do | |
port=$((RANDOM % 65535 + 1)) | |
if [[ ! " ${common_ports[@]} " =~ " ${port} " ]]; then |