mirror of
https://github.com/Ground-Zerro/DomainMapper.git
synced 2025-12-10 01:47:18 +07:00
cfg file
This commit is contained in:
@@ -11,6 +11,10 @@ outfilename = domain-ip-resolve.txt
|
||||
# available options: 'yes', 'no', if empty will be display an interactive prompt to the user (default)
|
||||
cloudflare =
|
||||
|
||||
# Command for the console after all operations have been completed
|
||||
# an executable command to run another script, code or program
|
||||
run = echo "Все будет О'кей!"
|
||||
|
||||
[InWork]
|
||||
# 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'
|
||||
@@ -24,8 +28,3 @@ type = ip
|
||||
# Gateway address - used only if option "type" set to 'win'
|
||||
# if not specified the default value will be used (0.0.0.0.0)
|
||||
gateway = 0.0.0.0
|
||||
|
||||
# Command for the console after all operations have been completed
|
||||
# an executable command to run another script, code or program
|
||||
# nothing (default)
|
||||
run =
|
||||
28
main.py
28
main.py
@@ -1,4 +1,4 @@
|
||||
import os
|
||||
import os
|
||||
import requests
|
||||
import dns.resolver
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
@@ -100,7 +100,7 @@ def resolve_domain(resolver, domain, unique_ips_current_service, unique_ips_all_
|
||||
# Function to read configuration file
|
||||
def read_config(filename):
|
||||
# Default values
|
||||
default_values = ('all', 20, 'domain-ip-resolve.txt', '', 'ip', '0.0.0.0', '')
|
||||
default_values = ('all', 20, 'domain-ip-resolve.txt', '', 'ip', '0.0.0.0', 'echo "Ground_Zerro 2024"')
|
||||
|
||||
try:
|
||||
config = configparser.ConfigParser()
|
||||
@@ -109,14 +109,13 @@ def read_config(filename):
|
||||
if 'DomainMapper' in config:
|
||||
domain_mapper_config = config['DomainMapper']
|
||||
|
||||
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])
|
||||
service = domain_mapper_config.get('service', default_values[0]) or 'all'
|
||||
threads = int(domain_mapper_config.get('threads', default_values[1]) or 20)
|
||||
outfilename = domain_mapper_config.get('outfilename', default_values[2]) or 'domain-ip-resolve.txt'
|
||||
cloudflare = domain_mapper_config.get('cloudflare', default_values[3]) or ''
|
||||
type_ = domain_mapper_config.get('type', default_values[4]) or 'ip'
|
||||
gateway = domain_mapper_config.get('gateway', default_values[5]) or '0.0.0.0'
|
||||
run_command = domain_mapper_config.get('run', default_values[6]) or 'echo "Ground_Zerro 2024"'
|
||||
|
||||
return service, threads, outfilename, cloudflare, type_, gateway, run_command
|
||||
else:
|
||||
@@ -132,10 +131,6 @@ def main():
|
||||
# Read parameters from the configuration file
|
||||
service, threads, outfilename, cloudflare, type_, gateway, run_command = read_config('config.txt')
|
||||
|
||||
# If outfilename is empty, set it to the default value
|
||||
if not outfilename:
|
||||
outfilename = 'domain-ip-resolve.txt'
|
||||
|
||||
total_resolved_domains = 0
|
||||
total_errors = 0
|
||||
selected_services = []
|
||||
@@ -190,5 +185,10 @@ def main():
|
||||
print(f"Не удалось сопоставить доменов IP адресу: {total_errors}")
|
||||
print("Результаты проверки сохранены в файл:", outfilename)
|
||||
|
||||
# Executing the command after the program is completed, if it is specified in the configuration file
|
||||
if run_command:
|
||||
print("\nВыполнение команды после завершения программы...")
|
||||
os.system(run_command)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user