Русификация 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] [DomainMapper]
# Number of scanning threads # Имена сервисов, разделенные запятыми, для преобразования их доменных имен в IP-адреса без запроса их выбора у пользователя
# if empty will be used 20 threads (default) # доступные варианты: 'Antifilter community edition', 'Youtube', 'Facebook', 'Openai', 'Tik-Tok', 'Instagram', 'Twitter', 'Netflix', 'Bing', 'Adobe', 'Apple', 'Google', 'Tor-Truckers', 'Search-engines'
threads = 20 # 'all' - проверить все сервисы, если значение пустое (по умолчанию) - пользователю будет выведено меню выбора
service =
# Output file name # Включить фильтрацию IP-адресов cloudflare и не записывать их в файл результатов
# available options: 'filename', 'full path to the filename', if not specified the default value will be used (domain-ip-resolve.txt) # доступные опции: 'yes', 'no', если значение пусте (по умолчанию) - пользователю будет выведен запрос с подсказкой
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)
cloudflare = 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 "Все будет О'кей!" run = echo "Все будет О'кей!"
[InWork] [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' # доступные опции: 'ip' или пустое значение - только "IP" адрес (по умолчанию), 'vlsm' - "IP/маска", 'win' - "rote add %IP% mask %mask% %gateway%"
# '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%"
type = ip type = ip
# Gateway address - used only if option "type" set to 'win' # адрес шлюза - используется, только если опция "type" установлена в 'win'
# if not specified the default value will be used (0.0.0.0.0) # если не указан, будет использоваться значение по умолчанию (0.0.0.0.0)
gateway = 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 # Function to read configuration file
def read_config(filename): def read_config(filename):
# Default values # 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: try:
config = configparser.ConfigParser() config = configparser.ConfigParser()
@@ -112,7 +112,7 @@ def read_config(filename):
if 'DomainMapper' in config: if 'DomainMapper' in config:
domain_mapper_config = config['DomainMapper'] 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) 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' outfilename = domain_mapper_config.get('outfilename', default_values[2]) or 'domain-ip-resolve.txt'
cloudflare = domain_mapper_config.get('cloudflare', default_values[3]) or '' cloudflare = domain_mapper_config.get('cloudflare', default_values[3]) or ''
@@ -136,28 +136,35 @@ def main():
total_errors = 0 total_errors = 0
selected_services = [] selected_services = []
# Interactive service selection # Check if 'service' is specified in the configuration file
while True: if service:
os.system('clear') if service.strip().lower() == "all":
print("Выберите сервисы:\n") selected_services = list(urls.keys()) # Select all available services
print("0 - Отметить все") else:
for idx, (service, url) in enumerate(urls.items(), 1): selected_services = [s.strip() for s in service.split(',')]
checkbox = "[*]" if service in selected_services else "[ ]" else:
print(f"{idx}. {service.capitalize()} {checkbox}") # 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 для старта): ") selection = input("\nВведите номер сервиса и нажмите Enter (Пустая строка и Enter для старта): ")
if selection == "0": if selection == "0":
selected_services = list(urls.keys()) selected_services = list(urls.keys())
elif selection.isdigit(): elif selection.isdigit():
idx = int(selection) - 1 idx = int(selection) - 1
if 0 <= idx < len(urls): if 0 <= idx < len(urls):
service = list(urls.keys())[idx] service = list(urls.keys())[idx]
if service in selected_services: if service in selected_services:
selected_services.remove(service) selected_services.remove(service)
else: else:
selected_services.append(service) selected_services.append(service)
elif selection == "": elif selection == "":
break break
# Check if to include Cloudflare IPs based on configuration or user input # Check if to include Cloudflare IPs based on configuration or user input
if cloudflare.lower() == 'yes': if cloudflare.lower() == 'yes':
@@ -186,7 +193,7 @@ def main():
print(f"Не удалось обработать доменных имен: {total_errors}") print(f"Не удалось обработать доменных имен: {total_errors}")
print("Результаты проверки сохранены в файл:", outfilename) 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: if run_command:
print("\nВыполнение команды после завершения программы...") print("\nВыполнение команды после завершения программы...")
os.system(run_command) os.system(run_command)