Skip to content

Instantly share code, notes, and snippets.

@noname1007
Last active April 13, 2023 09:22
Show Gist options
  • Save noname1007/377e407e11e936a73b5a4e4f66493d9e to your computer and use it in GitHub Desktop.
Save noname1007/377e407e11e936a73b5a4e4f66493d9e to your computer and use it in GitHub Desktop.
Blocks Shodan, Zoomeye, Censys IPs From Scanning Your Servers.
#!/usr/bin/python3
import os
shodan = [
"167.94.145.0/24", "167.94.146.0/24", "167.248.133.0/24",
"199.45.155.0/24", "199.45.154.0/24", "162.142.125.0/24", "167.94.138.0/24", # Censys
"104.131.0.69", "104.185.10.217", "104.236.198.48", "155.94.222.12", "155.94.254.133", "155.94.254.143", "159.203.176.62",
"162.159.244.38", "185.163.109.66", "185.181.102.18", "188.138.9.50", "198.20.69.74", "198.20.69.98", "198.20.70.114", "198.20.87.98",
"198.20.99.130", "208.180.20.97", "209.126.110.38", "216.117.2.180", "66.240.192.138", "66.240.219.146", "66.240.236.119", "71.6.135.131",
"71.6.146.185", "71.6.146.186", "71.6.158.166", "71.6.165.200", "71.6.167.142", "80.82.77.139", "80.82.77.33", "82.221.105.6", "82.221.105.7",
"85.25.103.50", "85.25.43.94", "89.248.167.131", "89.248.172.16", "93.120.27.62", "93.174.95.106", "94.102.49.190", "94.102.49.193", "98.143.148.107",
"98.143.148.135", # Shodan
"60.205.216.73", "47.98.57.19", "47.100.56.125", # ZoomEye
]
for ip in shodan:
if ":" in ip: # check if the IP address is IPv6
os.system("ip6tables -A INPUT -s {} -j DROP".format(ip))
else: # IPv4
os.system("iptables -A INPUT -s {} -j DROP".format(ip))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment