2020-08-29 01:16:06 -07:00
|
|
|
# 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
|
2020-08-31 04:59:28 -07:00
|
|
|
"54.242.237.204",
|
|
|
|
"93.158.134.250",
|
|
|
|
"114.6.128.8",
|
|
|
|
"118.97.116.27",
|
|
|
|
"119.235.29.59",
|
|
|
|
"124.40.255.99",
|
|
|
|
"146.112.61.106",
|
|
|
|
"156.154.113.17",
|
|
|
|
"156.154.175.30",
|
|
|
|
"156.154.175.215",
|
|
|
|
"156.154.175.216",
|
|
|
|
"156.154.175.221",
|
|
|
|
"163.28.10.160",
|
|
|
|
"175.139.142.25",
|
|
|
|
"176.103.130.135",
|
|
|
|
"182.93.64.126",
|
|
|
|
"192.99.140.48",
|
|
|
|
"195.175.254.2",
|
|
|
|
"202.40.187.91",
|
|
|
|
"202.162.209.133",
|
|
|
|
"202.165.36.253",
|
|
|
|
"203.119.13.75",
|
|
|
|
"203.119.13.76",
|
|
|
|
"203.190.55.217",
|
2020-08-29 01:16:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
]
|
|
|
|
|
2020-08-29 06:34:46 -07:00
|
|
|
|
2020-08-29 01:16:06 -07:00
|
|
|
def is_bogon(ip):
|
|
|
|
return any(ip.startswith(check) for check in bogon_checks)
|