стартует проект

This commit is contained in:
Maxim Slipenko 2022-08-26 13:02:52 +03:00
commit 3b600ba262
7 changed files with 104 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
# Список заблокированных в ДНР сайтов

15
domains.txt Normal file
View File

@ -0,0 +1,15 @@
#
# Драйвера Nvidia
#
us.download.nvidia.com
#
# Habitica
#
habitica.com
#
# Nestjs
#
docs.nestjs.com
nestjs.com

24
ips.txt Normal file
View File

@ -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

View File

@ -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')

30
scripts/2_google_ips.py Normal file
View File

@ -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')

View File

@ -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()

10
update.py Normal file
View File

@ -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])