mirror of
https://github.com/itdoginfo/allow-domains.git
synced 2026-04-06 21:01:11 +03:00
Compare commits
9 Commits
2025-02-08
...
2025-02-09
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b75eb3aaec | ||
|
|
bdfb0cf815 | ||
|
|
0170df9089 | ||
|
|
493dab4a54 | ||
|
|
9b99ebbd6b | ||
|
|
52a521e9ff | ||
|
|
ca9854a92b | ||
|
|
238ff0532e | ||
|
|
024b2975f3 |
2
.github/workflows/create-lists.yml
vendored
2
.github/workflows/create-lists.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
-v ${{ github.workspace }}/Services:/app/Services \
|
-v ${{ github.workspace }}/Services:/app/Services \
|
||||||
-v ${{ github.workspace }}/SRS:/app/SRS \
|
-v ${{ github.workspace }}/SRS:/app/SRS \
|
||||||
-v ${{ github.workspace }}/DAT:/app/DAT \
|
-v ${{ github.workspace }}/DAT:/app/DAT \
|
||||||
itdoginfo/compilesrs:0.1.6
|
itdoginfo/compilesrs:0.1.9
|
||||||
|
|
||||||
- name: Check Russia/inside-dnsmasq-ipset
|
- name: Check Russia/inside-dnsmasq-ipset
|
||||||
uses: itdoginfo/dnsmasq-action@0.1
|
uses: itdoginfo/dnsmasq-action@0.1
|
||||||
|
|||||||
@@ -634,7 +634,6 @@ svtv.org
|
|||||||
swagger.io
|
swagger.io
|
||||||
swissinfo.ch
|
swissinfo.ch
|
||||||
synoforum.com
|
synoforum.com
|
||||||
t.co
|
|
||||||
tableau.com
|
tableau.com
|
||||||
tayga.info
|
tayga.info
|
||||||
te-st.org
|
te-st.org
|
||||||
@@ -699,7 +698,6 @@ twtrdns.net
|
|||||||
twttr.com
|
twttr.com
|
||||||
twttr.net
|
twttr.net
|
||||||
twvid.com
|
twvid.com
|
||||||
ua
|
|
||||||
ui.ill.in.ua
|
ui.ill.in.ua
|
||||||
ukr.net
|
ukr.net
|
||||||
ukr.radio
|
ukr.radio
|
||||||
|
|||||||
9
Subnets/IPv4/telegram.lst
Normal file
9
Subnets/IPv4/telegram.lst
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
91.108.56.0/22
|
||||||
|
91.108.4.0/22
|
||||||
|
91.108.8.0/22
|
||||||
|
91.108.16.0/22
|
||||||
|
91.108.12.0/22
|
||||||
|
149.154.160.0/20
|
||||||
|
91.105.192.0/23
|
||||||
|
91.108.20.0/22
|
||||||
|
185.76.151.0/24
|
||||||
5
Subnets/IPv6/telegram.lst
Normal file
5
Subnets/IPv6/telegram.lst
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
2001:b28:f23d::/48
|
||||||
|
2001:b28:f23f::/48
|
||||||
|
2001:67c:4e8::/48
|
||||||
|
2001:b28:f23c::/48
|
||||||
|
2a0a:f280::/32
|
||||||
103
convert.py
103
convert.py
@@ -19,6 +19,7 @@ uaDomainsOut='Ukraine/inside'
|
|||||||
DiscordSubnets = 'Subnets/IPv4/discord.lst'
|
DiscordSubnets = 'Subnets/IPv4/discord.lst'
|
||||||
MetaSubnets = 'Subnets/IPv4/meta.lst'
|
MetaSubnets = 'Subnets/IPv4/meta.lst'
|
||||||
TwitterSubnets = 'Subnets/IPv4/twitter.lst'
|
TwitterSubnets = 'Subnets/IPv4/twitter.lst'
|
||||||
|
TelegramSubnets = 'Subnets/IPv4/telegram.lst'
|
||||||
|
|
||||||
def raw(src, out):
|
def raw(src, out):
|
||||||
domains = set()
|
domains = set()
|
||||||
@@ -133,6 +134,7 @@ def kvas(src, out, remove={'google.com'}):
|
|||||||
if not tldextract.extract(line).domain and tldextract.extract(line).suffix:
|
if not tldextract.extract(line).domain and tldextract.extract(line).suffix:
|
||||||
domains.add(tldextract.extract(line.rstrip()).suffix)
|
domains.add(tldextract.extract(line.rstrip()).suffix)
|
||||||
|
|
||||||
|
domains = domains - remove
|
||||||
domains = sorted(domains)
|
domains = sorted(domains)
|
||||||
|
|
||||||
with open(f'{out}-kvas.lst', 'w') as file:
|
with open(f'{out}-kvas.lst', 'w') as file:
|
||||||
@@ -215,8 +217,12 @@ def generate_srs_for_categories(directories, output_json_directory='JSON', compi
|
|||||||
os.makedirs(output_json_directory, exist_ok=True)
|
os.makedirs(output_json_directory, exist_ok=True)
|
||||||
os.makedirs(compiled_output_directory, exist_ok=True)
|
os.makedirs(compiled_output_directory, exist_ok=True)
|
||||||
|
|
||||||
|
exclude = {"meta", "twitter", "discord"}
|
||||||
|
|
||||||
for directory in directories:
|
for directory in directories:
|
||||||
for filename in os.listdir(directory):
|
for filename in os.listdir(directory):
|
||||||
|
if any(keyword in filename for keyword in exclude):
|
||||||
|
continue
|
||||||
file_path = os.path.join(directory, filename)
|
file_path = os.path.join(directory, filename)
|
||||||
|
|
||||||
if os.path.isfile(file_path):
|
if os.path.isfile(file_path):
|
||||||
@@ -266,28 +272,14 @@ def generate_srs_subnets(input_file, output_json_directory='JSON', compiled_outp
|
|||||||
subnet = line.strip()
|
subnet = line.strip()
|
||||||
if subnet:
|
if subnet:
|
||||||
subnets.append(subnet)
|
subnets.append(subnet)
|
||||||
|
data = {
|
||||||
if input_file == "Subnets/IPv4/discord.lst":
|
"version": 2,
|
||||||
data = {
|
"rules": [
|
||||||
"version": 2,
|
{
|
||||||
"rules": [
|
"ip_cidr": subnets
|
||||||
{
|
}
|
||||||
"network": ["udp"],
|
]
|
||||||
"ip_cidr": subnets,
|
}
|
||||||
"port_range": ["50000:65535"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
else:
|
|
||||||
data = {
|
|
||||||
"version": 2,
|
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"ip_cidr": subnets
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
filename = os.path.splitext(os.path.basename(input_file))[0]
|
filename = os.path.splitext(os.path.basename(input_file))[0]
|
||||||
output_file_path = os.path.join(output_json_directory, f"{filename}_subnets.json")
|
output_file_path = os.path.join(output_json_directory, f"{filename}_subnets.json")
|
||||||
@@ -306,6 +298,63 @@ def generate_srs_subnets(input_file, output_json_directory='JSON', compiled_outp
|
|||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"Compile error {output_file_path}: {e}")
|
print(f"Compile error {output_file_path}: {e}")
|
||||||
|
|
||||||
|
def generate_srs_combined(input_subnets_file, input_domains_file, output_json_directory='JSON', compiled_output_directory='SRS'):
|
||||||
|
os.makedirs(output_json_directory, exist_ok=True)
|
||||||
|
os.makedirs(compiled_output_directory, exist_ok=True)
|
||||||
|
|
||||||
|
domains = []
|
||||||
|
if os.path.exists(input_domains_file):
|
||||||
|
with open(input_domains_file, 'r', encoding='utf-8') as file:
|
||||||
|
domains = [line.strip() for line in file if line.strip()]
|
||||||
|
|
||||||
|
subnets = []
|
||||||
|
if os.path.exists(input_subnets_file):
|
||||||
|
with open(input_subnets_file, 'r', encoding='utf-8') as file:
|
||||||
|
subnets = [line.strip() for line in file if line.strip()]
|
||||||
|
|
||||||
|
if input_subnets_file == "Subnets/IPv4/discord.lst":
|
||||||
|
data = {
|
||||||
|
"version": 2,
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"domain_suffix": domains
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"network": ["udp"],
|
||||||
|
"ip_cidr": subnets,
|
||||||
|
"port_range": ["50000:65535"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
data = {
|
||||||
|
"version": 2,
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"domain_suffix": domains,
|
||||||
|
"ip_cidr": subnets
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
filename = os.path.splitext(os.path.basename(input_subnets_file))[0]
|
||||||
|
output_file_path = os.path.join(output_json_directory, f"{filename}.json")
|
||||||
|
|
||||||
|
with open(output_file_path, 'w', encoding='utf-8') as output_file:
|
||||||
|
json.dump(data, output_file, indent=4)
|
||||||
|
|
||||||
|
print(f"JSON file generated: {output_file_path}")
|
||||||
|
|
||||||
|
srs_file_path = os.path.join(compiled_output_directory, f"{filename}.srs")
|
||||||
|
try:
|
||||||
|
subprocess.run(
|
||||||
|
["sing-box", "rule-set", "compile", output_file_path, "-o", srs_file_path], check=True
|
||||||
|
)
|
||||||
|
print(f"Compiled .srs file: {srs_file_path}")
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(f"Compile error {output_file_path}: {e}")
|
||||||
|
|
||||||
|
|
||||||
def prepare_dat_domains(domains_or_dirs, output_name):
|
def prepare_dat_domains(domains_or_dirs, output_name):
|
||||||
output_lists_directory = 'geosite_data'
|
output_lists_directory = 'geosite_data'
|
||||||
|
|
||||||
@@ -347,7 +396,7 @@ if __name__ == '__main__':
|
|||||||
Path("Russia").mkdir(parents=True, exist_ok=True)
|
Path("Russia").mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
removeDomains = {'google.com', 'googletagmanager.com', 'github.com', 'githubusercontent.com', 'githubcopilot.com', 'microsoft.com', 'cloudflare-dns.com', 'parsec.app' }
|
removeDomains = {'google.com', 'googletagmanager.com', 'github.com', 'githubusercontent.com', 'githubcopilot.com', 'microsoft.com', 'cloudflare-dns.com', 'parsec.app' }
|
||||||
removeDomainsKvas = {'google.com', 'googletagmanager.com', 'github.com', 'githubusercontent.com', 'githubcopilot.com', 'microsoft.com', 'cloudflare-dns.com', 'parsec.app', 't.co' }
|
removeDomainsKvas = {'google.com', 'googletagmanager.com', 'github.com', 'githubusercontent.com', 'githubcopilot.com', 'microsoft.com', 'cloudflare-dns.com', 'parsec.app', 't.co', 'ua' }
|
||||||
|
|
||||||
inside_lists = [rusDomainsInsideCategories, rusDomainsInsideServices]
|
inside_lists = [rusDomainsInsideCategories, rusDomainsInsideServices]
|
||||||
|
|
||||||
@@ -396,9 +445,11 @@ if __name__ == '__main__':
|
|||||||
generate_srs_for_categories(directories)
|
generate_srs_for_categories(directories)
|
||||||
|
|
||||||
# Sing-box subnets
|
# Sing-box subnets
|
||||||
generate_srs_subnets(DiscordSubnets)
|
generate_srs_subnets(TelegramSubnets)
|
||||||
generate_srs_subnets(TwitterSubnets)
|
|
||||||
generate_srs_subnets(MetaSubnets)
|
generate_srs_combined(DiscordSubnets, "Services/discord.lst")
|
||||||
|
generate_srs_combined(TwitterSubnets, "Services/twitter.lst")
|
||||||
|
generate_srs_combined(MetaSubnets, "Services/meta.lst")
|
||||||
|
|
||||||
# Xray domains
|
# Xray domains
|
||||||
prepare_dat_domains(directories, 'russia-inside')
|
prepare_dat_domains(directories, 'russia-inside')
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ AS_META = '32934'
|
|||||||
AS_TWITTER = '13414'
|
AS_TWITTER = '13414'
|
||||||
META = 'meta.lst'
|
META = 'meta.lst'
|
||||||
TWITTER = 'twitter.lst'
|
TWITTER = 'twitter.lst'
|
||||||
|
TELEGRAM = 'telegram.lst'
|
||||||
|
|
||||||
# From https://iplist.opencck.org/
|
# From https://iplist.opencck.org/
|
||||||
DISCORD_VOICE_V4='https://iplist.opencck.org/?format=text&data=cidr4&site=discord.gg&site=discord.media'
|
DISCORD_VOICE_V4='https://iplist.opencck.org/?format=text&data=cidr4&site=discord.gg&site=discord.media'
|
||||||
@@ -22,6 +23,8 @@ DISCORD_VOICE_V6='https://iplist.opencck.org/?format=text&data=cidr6&site=discor
|
|||||||
|
|
||||||
DISCORD = 'discord.lst'
|
DISCORD = 'discord.lst'
|
||||||
|
|
||||||
|
TELEGRAM_CIDR_URL = 'https://core.telegram.org/resources/cidr.txt'
|
||||||
|
|
||||||
subnet_list = []
|
subnet_list = []
|
||||||
|
|
||||||
def subnet_summarization(subnet_list):
|
def subnet_summarization(subnet_list):
|
||||||
@@ -76,6 +79,15 @@ def download_ready_subnets(url_v4, url_v6):
|
|||||||
|
|
||||||
return ipv4_subnets, ipv6_subnets
|
return ipv4_subnets, ipv6_subnets
|
||||||
|
|
||||||
|
def download_ready_split_subnets(url):
|
||||||
|
req = urllib.request.Request(url)
|
||||||
|
with urllib.request.urlopen(req) as response:
|
||||||
|
subnets = response.read().decode('utf-8').splitlines()
|
||||||
|
|
||||||
|
ipv4_subnets = [cidr for cidr in subnets if isinstance(ipaddress.ip_network(cidr, strict=False), ipaddress.IPv4Network)]
|
||||||
|
ipv6_subnets = [cidr for cidr in subnets if isinstance(ipaddress.ip_network(cidr, strict=False), ipaddress.IPv6Network)]
|
||||||
|
|
||||||
|
return ipv4_subnets, ipv6_subnets
|
||||||
|
|
||||||
def write_subnets_to_file(subnets, filename):
|
def write_subnets_to_file(subnets, filename):
|
||||||
with open(filename, 'w') as file:
|
with open(filename, 'w') as file:
|
||||||
@@ -111,6 +123,11 @@ if __name__ == '__main__':
|
|||||||
write_subnets_to_file(ipv4_discord, f'{IPv4_DIR}/{DISCORD}')
|
write_subnets_to_file(ipv4_discord, f'{IPv4_DIR}/{DISCORD}')
|
||||||
write_subnets_to_file(ipv6_discord, f'{IPv6_DIR}/{DISCORD}')
|
write_subnets_to_file(ipv6_discord, f'{IPv6_DIR}/{DISCORD}')
|
||||||
|
|
||||||
|
# Telegram
|
||||||
|
ipv4_telegram, ipv6_telegram = download_ready_split_subnets(TELEGRAM_CIDR_URL)
|
||||||
|
write_subnets_to_file(ipv4_telegram, f'{IPv4_DIR}/{TELEGRAM}')
|
||||||
|
write_subnets_to_file(ipv6_telegram, f'{IPv6_DIR}/{TELEGRAM}')
|
||||||
|
|
||||||
# Legacy name
|
# Legacy name
|
||||||
copy_file_legacy(f'{IPv4_DIR}/{META}')
|
copy_file_legacy(f'{IPv4_DIR}/{META}')
|
||||||
copy_file_legacy(f'{IPv6_DIR}/{META}')
|
copy_file_legacy(f'{IPv6_DIR}/{META}')
|
||||||
|
|||||||
Reference in New Issue
Block a user