# 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", "58.213.28.126", "58.221.250.86", "58.222.226.146", "114.254.201.131", # "204.13.152.3", # not china but seems to be poisoned "218.94.128.126", "218.94.193.170", "218.107.55.108", "221.231.0.210", "222.216.2.236", } # known IPs (not servers) that are used to deny access to websites: blocks = { "1.2.3.4", # timeout "5.129.186.222", "31.204.161.41", "34.218.72.125", "36.86.63.185", "49.128.177.13", "52.15.96.207", "54.242.237.204", "62.77.154.37", "62.85.160.222", "62.113.48.25", "85.214.151.164", "91.195.127.75", "93.158.134.250", "95.77.94.80", "114.6.128.8", "118.97.116.27", "119.235.29.59", "124.40.255.99", "146.112.61.104", "146.112.61.105", "146.112.61.106", "146.112.61.107", "146.112.61.108", "146.112.61.109", "146.112.61.110", "146.112.61.111", "146.112.61.112", "146.112.61.113", "163.28.10.160", "165.21.74.4", "175.139.142.25", "176.103.130.130", "176.103.130.131", "176.103.130.132", "176.103.130.133", "176.103.130.134", "176.103.130.135", "182.93.64.126", "188.186.157.49", "192.99.140.48", "193.58.251.1", "195.46.39.1", "195.175.254.2", "195.186.208.169", "195.208.152.206", "195.234.22.137", "202.40.187.91", "202.162.209.133", "202.165.36.253", "202.169.44.80", "203.119.13.75", "203.119.13.76", "203.119.13.77", "203.119.13.78", "203.190.55.217", "203.195.99.1", "213.177.28.90", "213.224.83.39", "217.175.53.72", } for i in range(1, 255): blocks.add(f"156.154.112.{i}") blocks.add(f"156.154.113.{i}") blocks.add(f"156.154.175.{i}") blocks.add(f"156.154.176.{i}") gfw_ips = { "4.36.66.178", "8.7.198.45", "8.7.198.46", "46.82.174.68", "46.82.174.69", "49.2.123.56", "54.76.135.1", "59.24.3.173", "59.24.3.174", "64.13.192.74", "67.15.100.252", "67.15.129.210", "67.228.102.32", "67.228.235.91", "67.228.235.93", "77.4.7.92", "78.16.49.15", "88.191.249.182", "88.191.249.183", "88.191.253.157", "93.46.8.89", "93.46.8.90", "173.252.73.48", "173.252.100.21", "173.252.100.32", "173.252.102.16", "173.252.102.241", "173.252.103.64", "173.252.110.21", "174.36.196.242", "174.36.228.136", "174.37.54.20", "174.37.154.236", "174.37.175.229", "199.16.158.190" "199.59.148.97", "199.59.148.209", "199.59.149.136", "199.59.149.244", "199.59.150.49", "203.98.7.65", "203.161.230.171", "205.186.152.122", "208.43.170.231", "208.43.237.140", "208.101.21.43", "208.101.60.87", "243.185.187.39", "249.129.46.48", "253.157.14.165", } 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)