mirror of
https://github.com/Ground-Zerro/DomainMapper.git
synced 2025-12-10 01:47:18 +07:00
update
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
[DomainMapper]
|
[DomainMapper]
|
||||||
# Number of scanning threads
|
# Number of scanning threads
|
||||||
# if empty will be used 20 threads (default)
|
# if empty will be used 20 threads (default)
|
||||||
threads = 20
|
threads = 20
|
||||||
@@ -15,7 +15,7 @@ cloudflare =
|
|||||||
# Names of services comma-separated to convert their domain names to IP address
|
# Names of services comma-separated to convert their domain names to IP address
|
||||||
# available options: 'Antifilter community edition', 'Youtube', 'Facebook', 'Openai', 'Tik-Tok', 'Instagram', 'Twitter', 'Netflix', 'Bing', 'Adobe', 'Apple', 'Google', 'Tor-Truckers', 'Search-engines'
|
# available options: 'Antifilter community edition', 'Youtube', 'Facebook', 'Openai', 'Tik-Tok', 'Instagram', 'Twitter', 'Netflix', 'Bing', 'Adobe', 'Apple', 'Google', 'Tor-Truckers', 'Search-engines'
|
||||||
# 'all' - to chek all services, if empty will be displayed a request to the user (default)
|
# 'all' - to chek all services, if empty will be displayed a request to the user (default)
|
||||||
service = Antifilter community edition
|
service = all
|
||||||
|
|
||||||
# Output file type
|
# Output file type
|
||||||
# available options: 'ip' or blank - IP address only (default), 'vlsm' - IP/mask, 'win' - "rote add %IP% mask %mask% %gateway%"
|
# available options: 'ip' or blank - IP address only (default), 'vlsm' - IP/mask, 'win' - "rote add %IP% mask %mask% %gateway%"
|
||||||
|
|||||||
42
main.py
42
main.py
@@ -24,7 +24,7 @@ urls = {
|
|||||||
'Search-engines': "https://raw.githubusercontent.com/Ground-Zerro/DomainMapper/main/platforms/dns-search-engines.txt",
|
'Search-engines': "https://raw.githubusercontent.com/Ground-Zerro/DomainMapper/main/platforms/dns-search-engines.txt",
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to resolve DNS and write to file
|
# Function to resolve DNS
|
||||||
def resolve_dns_and_write(service, url, unique_ips_all_services, include_cloudflare, threads):
|
def resolve_dns_and_write(service, url, unique_ips_all_services, include_cloudflare, threads):
|
||||||
try:
|
try:
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
@@ -43,7 +43,7 @@ def resolve_dns_and_write(service, url, unique_ips_all_services, include_cloudfl
|
|||||||
|
|
||||||
unique_ips_current_service = set() # Set to store unique IP addresses for the current service
|
unique_ips_current_service = set() # Set to store unique IP addresses for the current service
|
||||||
|
|
||||||
print(f"Проверка сервиса: {service}")
|
print(f"Анализ DNS имен платформы: {service}")
|
||||||
|
|
||||||
with ThreadPoolExecutor(max_workers=threads) as executor:
|
with ThreadPoolExecutor(max_workers=threads) as executor:
|
||||||
futures = []
|
futures = []
|
||||||
@@ -76,7 +76,7 @@ def get_cloudflare_ips():
|
|||||||
print("Ошибка при получении IP адресов Cloudflare:", e)
|
print("Ошибка при получении IP адресов Cloudflare:", e)
|
||||||
return set()
|
return set()
|
||||||
|
|
||||||
# Function to resolve domain and write result to file
|
# Function to write result to file
|
||||||
def resolve_domain(resolver, domain, unique_ips_current_service, unique_ips_all_services, cloudflare_ips):
|
def resolve_domain(resolver, domain, unique_ips_current_service, unique_ips_all_services, cloudflare_ips):
|
||||||
try:
|
try:
|
||||||
ips = resolver.resolve(domain)
|
ips = resolver.resolve(domain)
|
||||||
@@ -99,23 +99,33 @@ def resolve_domain(resolver, domain, unique_ips_current_service, unique_ips_all_
|
|||||||
|
|
||||||
# Function to read configuration file
|
# Function to read configuration file
|
||||||
def read_config(filename):
|
def read_config(filename):
|
||||||
config = configparser.ConfigParser()
|
# Default values
|
||||||
config.read(filename)
|
default_values = ('all', 20, 'domain-ip-resolve.txt', '', 'ip', '0.0.0.0', '')
|
||||||
|
|
||||||
domain_mapper_config = config['DomainMapper']
|
try:
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read(filename)
|
||||||
|
|
||||||
# Get parameters from the configuration file or use default values
|
if 'DomainMapper' in config:
|
||||||
service = domain_mapper_config.get('service', 'all')
|
domain_mapper_config = config['DomainMapper']
|
||||||
threads_value = domain_mapper_config.get('threads', '20') # Get value as string
|
|
||||||
threads = int(threads_value) if threads_value else 20 # Convert to int if not empty, otherwise use default value
|
|
||||||
outfilename = domain_mapper_config.get('outfilename', '') or 'domain-ip-resolve.txt'
|
|
||||||
cloudflare = domain_mapper_config.get('cloudflare', '')
|
|
||||||
type_ = domain_mapper_config.get('type', 'ip')
|
|
||||||
gateway = domain_mapper_config.get('gateway', '0.0.0.0')
|
|
||||||
run_command = domain_mapper_config.get('run', '')
|
|
||||||
|
|
||||||
return service, threads, outfilename, cloudflare, type_, gateway, run_command
|
service = domain_mapper_config.get('service', default_values[0])
|
||||||
|
threads_value = domain_mapper_config.get('threads', default_values[1])
|
||||||
|
threads = int(threads_value)
|
||||||
|
outfilename = domain_mapper_config.get('outfilename', default_values[2])
|
||||||
|
cloudflare = domain_mapper_config.get('cloudflare', default_values[3])
|
||||||
|
type_ = domain_mapper_config.get('type', default_values[4])
|
||||||
|
gateway = domain_mapper_config.get('gateway', default_values[5])
|
||||||
|
run_command = domain_mapper_config.get('run', default_values[6])
|
||||||
|
|
||||||
|
return service, threads, outfilename, cloudflare, type_, gateway, run_command
|
||||||
|
else:
|
||||||
|
print("Секция 'DomainMapper' отсутствует в конфигурационном файле. Будут использованы значения по умолчанию.")
|
||||||
|
return default_values
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print("Ошибка при чтении конфигурационного файла:", e)
|
||||||
|
return default_values
|
||||||
|
|
||||||
# Main function
|
# Main function
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user