diff options
author | doc <doc@filenotfound.org> | 2025-06-30 20:14:17 +0000 |
---|---|---|
committer | doc <doc@filenotfound.org> | 2025-06-30 20:14:17 +0000 |
commit | a8cd1c324c0541b0d26542168aeced085ec13201 (patch) | |
tree | a99d398008b46aa4df5dcae997e1690298d2fc70 /functions/disable_ip.sh |
Diffstat (limited to 'functions/disable_ip.sh')
-rw-r--r-- | functions/disable_ip.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/functions/disable_ip.sh b/functions/disable_ip.sh new file mode 100644 index 0000000..0021b74 --- /dev/null +++ b/functions/disable_ip.sh @@ -0,0 +1,18 @@ +disable_ip() { + local ip="$1" + + if [[ -z "$ip" ]]; then + echo "[!] No IP specified." + exit 1 + fi + + echo "[*] Disabling access to VPS with IP: $ip" + + # Block all traffic to/from that IP via iptables + iptables -A INPUT -s "$ip" -j DROP + iptables -A OUTPUT -d "$ip" -j DROP + + echo "$ip - disabled on $(date)" >> /var/log/genesis-disabled.log + + echo "[✓] $ip has been blocked and logged." +} |