Last active
January 23, 2025 20:46
-
-
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 hidden or 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. (2025-01-24 updated) | |
import os | |
# https://www.ipfire.org/docs/configuration/firewall/blockshodan | |
shodan_ips = ['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','165.227.62.247','165.227.55.4','195.144.21.56','185.165.190.17','207.90.244.0/24','185.142.236.36','185.142.236.40','185.142.236.41','185.142.236.43','185.142.239.16','198.20.69.96/29','198.20.70.112/29','198.20.87.96/29','198.20.99.128/29','66.240.205.34','71.6.146.130','71.6.147.198','71.6.147.254','71.6.150.153','71.6.167.125','89.248.172.7','143.198.50.234','137.184.180.190','137.184.112.103','137.184.94.133','137.184.13.100','137.184.9.17','137.184.190.246','137.184.190.194','71.6.199.23','185.142.236.34','185.165.190.34','71.6.135.131','185.142.236.35','66.240.219.133','143.198.225.197','137.184.95.216','64.227.90.185','143.198.238.87','137.184.190.205','137.184.112.192','137.184.190.188','167.172.219.157','143.110.239.2','143.198.68.20'] #Shodan.io Scanner IP list | |
for i in shodan_ips: | |
os.system("/sbin/iptables -A INPUT -s {} -j DROP".format(i)) | |
# https://support.censys.io/hc/en-us/articles/360043177092-Opt-Out-of-Data-Collection | |
censys_ip_ranges = ["66.132.159.0/24", "162.142.125.0/24", "167.94.138.0/24", "167.94.145.0/24", "167.94.146.0/24", "167.248.133.0/24", "199.45.154.0/24", "199.45.155.0/24", "206.168.34.0/24", "206.168.35.0/24" | |
for i in censys_ip_ranges: | |
os.system("/sbin/iptables -A INPUT -s {} -j DROP".format(i)) | |
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/sudo-gecko/0738053dcb2d0a7e3f7b5c41f82ea57a/raw/2fd1a134830c5b173069d335d6b26db128c0d491/Scanner-drop.py | python3
Available on Debian / Ubuntu / other Linux systems