Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check if an IP is owned by Cloudflare
#!/bin/env python
# Credits goes to @sw33tLie
from ipaddress import ip_network, ip_address
cidrs = ["","","","","","","","","","","","","",""]
def is_cloudflare(ip):
for cidr in cidrs:
net = ip_network(cidr)
if (ip_address(ip) in net):
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment