Skip to content

Instantly share code, notes, and snippets.

@JanGalek
Last active August 21, 2018 15:26
Show Gist options
  • Save JanGalek/b88ddb0ddbfa41721e2f8cffa54029f5 to your computer and use it in GitHub Desktop.
Save JanGalek/b88ddb0ddbfa41721e2f8cffa54029f5 to your computer and use it in GitHub Desktop.
spammer ip

After count >= 5 -> full range (x.x.x.1-x.x.x.254)

//31.220.43.x
iptables -I INPUT -s 31.220.43.11 -j REJECT
iptables -I INPUT -s 31.220.43.121 -j REJECT
iptables -I INPUT -s 31.220.43.153 -j REJECT

//58.62.167.x
iptables -I INPUT -s 58.62.167.119 -j REJECT

//116.85.33.x
iptables -I INPUT -s 116.85.33.248 -j REJECT

//116.85.50.x
iptables -I INPUT -s 116.85.50.74 -j REJECT

//142.93.17.x
iptables -I INPUT -s 142.93.17.146 -j REJECT

//167.99.107.x
iptables -I INPUT -s 167.99.107.45 -j REJECT

//172.96.12.x
iptables -I INPUT -s 172.96.12.76 -j REJECT
iptables -I INPUT -s 172.96.12.78 -j REJECT

//172.96.13.x
iptables -I INPUT -s 172.96.13.216 -j REJECT

//176.126.85.x
iptables -I INPUT -s 176.126.85.235 -j REJECT

//178.128.38.x
iptables -I INPUT -s 178.128.38.127 -j REJECT

//178.128.203.x
iptables -I INPUT -s 178.128.203.169 -j REJECT

//185.14.28.x
iptables -I INPUT -s 185.14.28.48 -j REJECT
iptables -I INPUT -s 185.14.28.109 -j REJECT

//185.14.29.x
iptables -I INPUT -s 185.14.29.24 -j REJECT

//185.140.109.x
iptables -I INPUT -s 185.140.109.36 -j REJECT
iptables -I INPUT -s 185.140.109.59 -j REJECT

//185.140.111.x
iptables -I INPUT -s 185.140.111.23 -j REJECT
iptables -I INPUT -s 185.140.111.31 -j REJECT
iptables -I INPUT -s 185.140.111.76 -j REJECT
iptables -I INPUT -s 185.140.111.79 -j REJECT

//185.198.26.x
iptables -I INPUT -s 185.198.26.84 -j REJECT
iptables -I INPUT -s 185.198.26.86 -j REJECT
iptables -I INPUT -s 185.198.26.87 -j REJECT
iptables -I INPUT -s 185.198.26.88 -j REJECT

//185.207.9.x
iptables -I INPUT -s 185.207.9.187 -j REJECT
iptables -I INPUT -s 185.207.9.216 -j REJECT

//185.207.11.x
iptables -I INPUT -s 185.207.11.245 -j REJECT

//192.188.88.x
iptables -I INPUT -s 192.188.88.133 -j REJECT
iptables -I INPUT -s 192.188.88.134 -j REJECT

//81.201.63.x
iptables -I INPUT -s 81.201.63.132 -j REJECT

Hacker

iptables -I INPUT -s 103.105.196.100 -j REJECT
iptables -I INPUT -s 185.250.206.56 -j REJECT
iptables -I INPUT -s 185.234.217.132 -j REJECT
iptables -I INPUT -s 185.234.217.109 -j REJECT
iptables -I INPUT -s x.x.x.x -j REJECT

or with range

iptables -I INPUT -m iprange --src-range 85.93.6.1-85.93.6.254 -j REJECT
iptables -I INPUT -m iprange --src-range 89.144.13.1-89.144.13.254 -j REJECT
iptables -I INPUT -m iprange --src-range 89.144.27.1-89.144.27.254 -j REJECT
iptables -I INPUT -m iprange --src-range 134.119.223.1-134.119.223.254 -j REJECT
iptables -I INPUT -m iprange --src-range 151.106.3.1-151.106.3.254 -j REJECT
iptables -I INPUT -m iprange --src-range 172.96.9.1-172.96.9.254 -j REJECT
iptables -I INPUT -m iprange --src-range 185.121.166.1-185.121.166.254 -j REJECT
iptables -I INPUT -m iprange --src-range 185.123.221.1-185.123.221.254 -j REJECT
iptables -I INPUT -m iprange --src-range 185.125.231.1-185.125.231.254 -j REJECT
iptables -I INPUT -m iprange --src-range 185.207.8.1-185.207.8.254 -j REJECT
iptables -I INPUT -m iprange --src-range 188.240.221.1-188.240.221.254 -j REJECT
iptables -I INPUT -m iprange --src-range 188.241.73.1-188.241.73.254 -j REJECT
iptables -I INPUT -m iprange --src-range 192.155.99.1-192.155.99.254 -j REJECT
iptables -I INPUT -m iprange --src-range 194.55.140.1-194.55.140.254 -j REJECT

Export and restore

iptables-save > iptables-export

do edit in iptables-export

iptables-restore < iptables-export

Persistent rules (ubuntu)

for load rules after reboot (normal after reboot its reset)

# install
sudo apt-get install iptables-persistent
# start
sudo service netfilter-persistent start
# add to startup
sudo invoke-rc.d netfilter-persistent save

#stop (if you need)
sudo service netfilter-persistent stop

after update

sudo dpkg-reconfigure iptables-persistent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment