Randomize port (part 2)

This commit is contained in:
Chipmunk 2024-10-13 00:25:27 -04:00
parent 9b8cf7eb57
commit 049866de88
2 changed files with 5 additions and 5 deletions

View file

@ -1,9 +1,9 @@
# IPv4 # IPv4
iptables -t nat -A INPUT -p tcp --dport 42069 -j SNAT --to-source 192.168.1.0-192.168.100.100 iptables -t nat -A INPUT -p tcp --dport 27801 -j SNAT --to-source 192.168.1.0-192.168.100.100
iptables -A INPUT -p tcp --syn --dport 42069 -m connlimit --connlimit-above 5 --connlimit-mask 32 -j REJECT --reject-with tcp-reset iptables -A INPUT -p tcp --syn --dport 27801 -m connlimit --connlimit-above 5 --connlimit-mask 32 -j REJECT --reject-with tcp-reset
iptables-save > /etc/iptables/rules.v4 iptables-save > /etc/iptables/rules.v4
# IPv6 # IPv6
ip6tables -t nat -A INPUT -p tcp --dport 42069 -j SNAT --to-source 2001:db8::1-2001:db8::6464 ip6tables -t nat -A INPUT -p tcp --dport 27801 -j SNAT --to-source 2001:db8::1-2001:db8::6464
ip6tables -A INPUT -p tcp --syn --dport 42069 -m connlimit --connlimit-above 5 --connlimit-mask 64 -j REJECT --reject-with tcp-reset ip6tables -A INPUT -p tcp --syn --dport 27801 -m connlimit --connlimit-above 5 --connlimit-mask 64 -j REJECT --reject-with tcp-reset
ip6tables-save > /etc/iptables/rules.v6 ip6tables-save > /etc/iptables/rules.v6

View file

@ -10,7 +10,7 @@ while true; do
# If the server doesn't respond to ping, kill it # If the server doesn't respond to ping, kill it
if [ "$(env printf '\xFE' | nc -w 15 0.0.0.0 42069 | wc -m)" -eq 0 ]; then if [ "$(env printf '\xFE' | nc -w 15 0.0.0.0 27801 | wc -m)" -eq 0 ]; then
pkill -9 java pkill -9 java
echo $(date) >> ~/kill.log echo $(date) >> ~/kill.log
else else