Burada, çeşitli spam veritabanlarında bir IP adresinin varlığını kontrol eden bir Python betiği bulunmaktadır. ipaddress
IP adresini doğrulamak için modül ve requests
HTTP istekleri yapmak için modül:
import requests
import ipaddress
def check_spam(ip_address):
# Validate the IP address
try:
ipaddress.ip_address(ip_address)
except ValueError:
print("Invalid IP address format")
return
# List of spam databases to check
spam_databases = [
"b.barracudacentral.org",
"bl.spamcop.net",
"dnsbl.sorbs.net",
"zen.spamhaus.org"
]
# Check each database for the IP address
for db in spam_databases:
query = ip_address + '.' + db
try:
response = requests.get("http://"+query)
if response.text.startswith("127.0.0"):
print(f"{ip_address} found in {db}")
else:
print(f"{ip_address} not found in {db}")
except requests.RequestException as e:
print(f"Error checking {ip_address} in {db}: {e}")
# Example usage
ip_to_check = "123.456.789.10" # Replace this with the IP address you want to check
check_spam(ip_to_check)
Bu komut dosyası, giriş olarak bir IP adresi alır, biçimini doğrular ve ardından DNSBL (DNS Kara Listesi) aramalarını kullanarak IP adresini çeşitli spam veritabanlarına karşı kontrol eder. IP adresi herhangi bir veri tabanında bulunursa, nerede bulunduğunu belirten bir mesaj yazdıracaktır. Aksi takdirde, IP adresinin belirli bir veritabanında bulunamadığını belirten bir mesaj yazdıracaktır.
Yorumlar (0)
Burada henüz yorum yok, ilk siz olabilirsiniz!