commit 3b600ba262ad5989d461aed00971afb250f4da1b Author: Maxim Slipenko Date: Fri Aug 26 13:02:52 2022 +0300 стартует проект diff --git a/README.md b/README.md new file mode 100644 index 0000000..3596187 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Список заблокированных в ДНР сайтов \ No newline at end of file diff --git a/domains.txt b/domains.txt new file mode 100644 index 0000000..6c988ce --- /dev/null +++ b/domains.txt @@ -0,0 +1,15 @@ +# +# Драйвера Nvidia +# +us.download.nvidia.com + +# +# Habitica +# +habitica.com + +# +# Nestjs +# +docs.nestjs.com +nestjs.com \ No newline at end of file diff --git a/ips.txt b/ips.txt new file mode 100644 index 0000000..7163e6b --- /dev/null +++ b/ips.txt @@ -0,0 +1,24 @@ +192.229.221.58 +34.120.25.175 +104.198.14.52 +35.190.247.0/24 +64.233.160.0/19 +66.102.0.0/20 +66.249.80.0/20 +72.14.192.0/18 +74.125.0.0/16 +108.177.8.0/21 +173.194.0.0/16 +209.85.128.0/17 +216.58.192.0/19 +216.239.32.0/19 +172.217.0.0/19 +172.217.32.0/20 +172.217.128.0/19 +172.217.160.0/20 +172.217.192.0/19 +172.253.56.0/21 +172.253.112.0/20 +108.177.96.0/19 +35.191.0.0/16 +130.211.0.0/22 \ No newline at end of file diff --git a/scripts/1_ips_from_domains_txt.py b/scripts/1_ips_from_domains_txt.py new file mode 100644 index 0000000..8044d6e --- /dev/null +++ b/scripts/1_ips_from_domains_txt.py @@ -0,0 +1,17 @@ +import socket + +ips = [] + +with open('ips.txt', 'w') as out: + for line in open('domains.txt'): + l = line.strip() + + if l.startswith('#') or l == '': + continue + + ips.append(socket.gethostbyname(l)) + + ips = list(dict.fromkeys(ips)) + + for ip in ips: + out.write(ip + '\n') \ No newline at end of file diff --git a/scripts/2_google_ips.py b/scripts/2_google_ips.py new file mode 100644 index 0000000..338b9ac --- /dev/null +++ b/scripts/2_google_ips.py @@ -0,0 +1,30 @@ +import subprocess + +def resolve_by_spf(domain): + output = subprocess.run(["nslookup", "-q=TXT", domain], capture_output=True) + lines = output.stdout.decode().split('\n') + + result = [] + + for line in lines: + res = line.find('v=spf') + + if res == -1: + continue + + values = line[res:].split() + + for val in values: + if val.startswith("include:"): + result += resolve_by_spf(val[8:].strip()) + + if val.startswith("ip4:"): + result.append(val[4:].strip()) + + return list(dict.fromkeys(result)) + +ips = resolve_by_spf("_spf.google.com") + +with open('ips.txt', 'a') as out: + for ip in ips: + out.write(ip + '\n') \ No newline at end of file diff --git a/scripts/z_remove_duplicates.py b/scripts/z_remove_duplicates.py new file mode 100644 index 0000000..0367950 --- /dev/null +++ b/scripts/z_remove_duplicates.py @@ -0,0 +1,7 @@ +inp = open('ips.txt', 'r') +uniqlines = list(dict.fromkeys(inp.readlines())) +inp.close() +out = open('ips.txt', 'w') +out.writelines(uniqlines) +out.truncate(out.tell()-1) +out.close() \ No newline at end of file diff --git a/update.py b/update.py new file mode 100644 index 0000000..7d94aac --- /dev/null +++ b/update.py @@ -0,0 +1,10 @@ +import glob +import subprocess +import sys + +scripts = glob.glob("./scripts/*") +scripts.sort() + +for script in scripts: + print(script) + subprocess.call([sys.executable, script]) \ No newline at end of file