From 3b31919f75223da2c822fc2758a14ae6600487b9 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Tue, 1 Sep 2020 08:20:48 +0200 Subject: [PATCH] add more known GFW and China IPs --- respodns/dns.py | 22 +++++------------- respodns/ips.py | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 16 deletions(-) diff --git a/respodns/dns.py b/respodns/dns.py index b7e15cc..9f6b39b 100644 --- a/respodns/dns.py +++ b/respodns/dns.py @@ -1,4 +1,5 @@ from .structs import Options +from .ips import gfw_ips def detect_gfw(r, ip, check): @@ -14,26 +15,15 @@ def detect_gfw(r, ip, check): if ( (rs("31.13.") and not hosted) or - (rs("66.220.")) or - (rs("69.63.")) or + rs("66.220.") or + rs("69.63.") or (rs("69.171.") and not rs("69.171.250.")) or - (rs("74.86.")) or - (rs("75.126.")) or - (r == "64.13.192.74") + rs("74.86.") or + rs("75.126.") or + r in gfw_ips ): return True - # more non-facebook GFW stuff: - # 31.13.64.33 - # 31.13.70.1 - # 31.13.70.20 - # 31.13.76.16 - # 31.13.86.1 - # 173.252.110.21 - # 192.99.140.48 - # 199.16.156.40 - # 199.16.158.190 - return False diff --git a/respodns/ips.py b/respodns/ips.py index 2c0e197..5ff85c8 100644 --- a/respodns/ips.py +++ b/respodns/ips.py @@ -5,8 +5,15 @@ china = { "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", } @@ -80,6 +87,59 @@ for i in range(1, 255): 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.",