# known IPs of any DNS located in China: china = { "1.1.8.8", "1.1.8.9", "1.2.4.8", "1.8.1.8", "1.8.8.8", "114.254.201.131", "218.107.55.108", "222.216.2.236", } # known IPs (not servers) that are used to deny access to websites: blocks = { "1.2.3.4", # timeout "54.242.237.204", # fake "93.158.134.250", # fake "114.6.128.8", # fake "118.97.116.27", # fake "119.235.29.59", # fake "124.40.255.99", # fake "146.112.61.106", # fake "156.154.113.17", # fake "156.154.175.30", # fake "156.154.175.215", # fake "156.154.175.216", # fake "156.154.175.221", # fake "163.28.10.160", # fake "175.139.142.25", # fake "176.103.130.135", # fake "182.93.64.126", # fake "192.99.140.48", # fake "195.175.254.2", # fake "202.40.187.91", # fake "202.162.209.133", # fake "202.165.36.253", # fake "203.119.13.75", # fake "203.119.13.76", # fake "203.190.55.217", # fake } bogon_checks = [ "0.", "10.", "127.", "169.254.", "192.0.0.", "192.0.2.", "192.168.", "198.18.", "198.19.", "198.51.100.", "203.0.113.", ] + [ "100.{}.".format(i) for i in range(64, 128) ] + [ "172.{}.".format(i) for i in range(16, 32) ] + [ "{}.".format(i) for i in range(224, 256) ] def is_bogon(ip): return any(ip.startswith(check) for check in bogon_checks)