Last active
July 11, 2023 11:50
-
-
Save sudo-gecko/0738053dcb2d0a7e3f7b5c41f82ea57a to your computer and use it in GitHub Desktop.
Block Shodan, Censys scanner Python code for Linux server.
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
#Block Shodan.io, Censys.io scanner. | |
import os | |
shodan_ip = ['208.180.20.97','198.20.69.74','198.20.69.98','198.20.70.114','198.20.99.130','93.120.27.62','66.240.236.119','71.6.135.131','66.240.192.138','71.6.167.142','82.221.105.6','82.221.105.7','71.6.165.200','188.138.9.50','85.25.103.50','85.25.43.94','71.6.146.185','71.6.158.166','198.20.87.98','66.240.219.146','209.126.110.38','104.236.198.48','104.131.0.69','162.159.244.38','93.174.95.106','94.102.49.193','80.82.77.139','94.102.49.190','185.163.109.66','89.248.172.16','71.6.146.186','89.248.167.131','159.203.176.62','185.181.102.18','80.82.77.33','216.117.2.180','98.143.148.107','155.94.254.133','155.94.254.143','155.94.222.12','98.143.148.135'] #Shodan.io Scanner IP list | |
for i in shodan_ip: | |
os.system("/sbin/iptables -A INPUT -s {} -j DROP".format(i)) | |
os.system("/sbin/iptables -A INPUT -s 198.108.66.0/24 -j DROP") #Censys.io Scanner IP range 1 | |
os.system("/sbin/iptables -A INPUT -s 74.120.14.0/24 -j DROP") #Censys.io Scanner IP range 2 | |
os.system("/sbin/iptables -A INPUT -s 162.142.125.0/24 -j DROP") #Censys.io Scanner IP range 3 | |
os.system("/sbin/iptables -A INPUT -s 167.248.133.0/24 -j DROP") #Censys.io Scanner IP range 4 | |
os.system("/sbin/iptables -A INPUT -s 192.35.168.0/23 -j DROP") #Censys.io Scanner IP range 5 | |
print("Done.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl -sSL https://gist.githubusercontent.com/cool-doge/0738053dcb2d0a7e3f7b5c41f82ea57a/raw/ebfc267ca1e761aa96db818d76efdbd812a868b7/Scanner-drop.py | python3
Available on Debian 9,10,11 / Ubuntu 14.04, 16.04, 18.04, and 20.04.