Русификация config.
Добавлен автоматический запуск проверки если имена сервисов указаны в конфигурационном файле.
This commit is contained in:
Ground-Zerro
2024-03-26 14:30:26 +11:00
parent 7b1d010569
commit a80c687082
2 changed files with 53 additions and 46 deletions

View File

@@ -1,31 +1,31 @@
[DomainMapper]
# Number of scanning threads
# if empty will be used 20 threads (default)
threads = 20
# Имена сервисов, разделенные запятыми, для преобразования их доменных имен в IP-адреса без запроса их выбора у пользователя
# доступные варианты: 'Antifilter community edition', 'Youtube', 'Facebook', 'Openai', 'Tik-Tok', 'Instagram', 'Twitter', 'Netflix', 'Bing', 'Adobe', 'Apple', 'Google', 'Tor-Truckers', 'Search-engines'
# 'all' - проверить все сервисы, если значение пустое (по умолчанию) - пользователю будет выведено меню выбора
service =
# Output file name
# available options: 'filename', 'full path to the filename', if not specified the default value will be used (domain-ip-resolve.txt)
outfilename = domain-ip-resolve.txt
# Enable cloudflare IP address filtering and not write them to the results file
# available options: 'yes', 'no', if empty will be display an interactive prompt to the user (default)
# Включить фильтрацию IP-адресов cloudflare и не записывать их в файл результатов
# доступные опции: 'yes', 'no', если значение пусте (по умолчанию) - пользователю будет выведен запрос с подсказкой
cloudflare =
# Command for the console after all operations have been completed
# an executable command to run another script, code or program
# Имя выходного файла
# доступные опции: 'имя_файла', 'полный_путь/имя_файла', если не указано - будет использоваться имя фала "domain-ip-resolve.txt" в папке со скриптом
outfilename =
# Количество потоков сканирования
# если не указано (по умолчанию) - будет использоваться 20 потоков
threads = 20
# Команда для консоли после завершения скриптом всех операций
# может быть полезно для автоматизации и комбинирования с другим скриптом, кодом или программой
# доступные опции: 'исполняемая_команда_для_консоли'
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'
# 'all' - to chek all services, if empty will be displayed a request to the user (default)
service = all
# Output file type
# available options: 'ip' or blank - IP address only (default), 'vlsm' - IP/mask, 'win' - "rote add %IP% mask %mask% %gateway%"
# Тип выходного файла
# доступные опции: 'ip' или пустое значение - только "IP" адрес (по умолчанию), 'vlsm' - "IP/маска", 'win' - "rote add %IP% mask %mask% %gateway%"
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)
# адрес шлюза - используется, только если опция "type" установлена в 'win'
# если не указан, будет использоваться значение по умолчанию (0.0.0.0.0)
gateway = 0.0.0.0

55
main.py
View File

@@ -103,7 +103,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', 'echo "Ground_Zerro 2024"')
default_values = ('', 20, 'domain-ip-resolve.txt', '', 'ip', '0.0.0.0', 'echo "Ground_Zerro 2024"')
try:
config = configparser.ConfigParser()
@@ -112,7 +112,7 @@ def read_config(filename):
if 'DomainMapper' in config:
domain_mapper_config = config['DomainMapper']
service = domain_mapper_config.get('service', default_values[0]) or 'all'
service = domain_mapper_config.get('service', default_values[0]) or ''
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 ''
@@ -136,28 +136,35 @@ def main():
total_errors = 0
selected_services = []
# Interactive service selection
while True:
os.system('clear')
print("Выберите сервисы:\n")
print("0 - Отметить все")
for idx, (service, url) in enumerate(urls.items(), 1):
checkbox = "[*]" if service in selected_services else "[ ]"
print(f"{idx}. {service.capitalize()} {checkbox}")
# Check if 'service' is specified in the configuration file
if service:
if service.strip().lower() == "all":
selected_services = list(urls.keys()) # Select all available services
else:
selected_services = [s.strip() for s in service.split(',')]
else:
# Interactive service selection
while True:
os.system('clear')
print("Выберите сервисы:\n")
print("0 - Отметить все")
for idx, (service, url) in enumerate(urls.items(), 1):
checkbox = "[*]" if service in selected_services else "[ ]"
print(f"{idx}. {service.capitalize()} {checkbox}")
selection = input("\nВведите номер сервиса и нажмите Enter (Пустая строка и Enter для старта): ")
if selection == "0":
selected_services = list(urls.keys())
elif selection.isdigit():
idx = int(selection) - 1
if 0 <= idx < len(urls):
service = list(urls.keys())[idx]
if service in selected_services:
selected_services.remove(service)
else:
selected_services.append(service)
elif selection == "":
break
selection = input("\nВведите номер сервиса и нажмите Enter (Пустая строка и Enter для старта): ")
if selection == "0":
selected_services = list(urls.keys())
elif selection.isdigit():
idx = int(selection) - 1
if 0 <= idx < len(urls):
service = list(urls.keys())[idx]
if service in selected_services:
selected_services.remove(service)
else:
selected_services.append(service)
elif selection == "":
break
# Check if to include Cloudflare IPs based on configuration or user input
if cloudflare.lower() == 'yes':
@@ -186,7 +193,7 @@ def main():
print(f"Не удалось обработать доменных имен: {total_errors}")
print("Результаты проверки сохранены в файл:", outfilename)
# Executing the command after the program is completed, if it is specified in the configuration file
# 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)