mirror of
https://github.com/Ground-Zerro/DomainMapper.git
synced 2025-12-10 01:47:18 +07:00
update
This commit is contained in:
28
config.txt
Normal file
28
config.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
[DomainMapper]
|
||||||
|
|
||||||
|
# Names of services comma-separated to convert their domain names to IP address
|
||||||
|
# available options: 'all', 'Antifilter community edition', 'Youtube', 'Facebook', 'Openai', 'Tik-Tok', 'Instagram', 'Twitter', 'Netflix', 'Bing', 'Adobe', 'Apple', 'Google', 'Tor-Truckers', 'Search-engines'
|
||||||
|
# if empty will be displayed a request to the user (default)
|
||||||
|
service = all
|
||||||
|
|
||||||
|
# Number of scanning streams
|
||||||
|
# if empty will be used 50 threads (default)
|
||||||
|
workers = 50
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
[/DomainMapper]
|
||||||
|
|
||||||
|
# Include or exclude cloudflare IP addresses to result file
|
||||||
|
# available options: 'exclude', 'include' or blank (default)
|
||||||
|
cloudflare = include
|
||||||
|
|
||||||
|
# Output file type
|
||||||
|
# available options: 'ip' or blank - IP address only (default), 'vlsm' - IP/mask, '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)
|
||||||
|
gateway = 0.0.0.0
|
||||||
77
main.py
77
main.py
@@ -4,7 +4,6 @@ import requests
|
|||||||
import dns.resolver
|
import dns.resolver
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from progress.bar import Bar
|
from progress.bar import Bar
|
||||||
from io import StringIO
|
|
||||||
|
|
||||||
# URLs
|
# URLs
|
||||||
urls = {
|
urls = {
|
||||||
@@ -24,18 +23,8 @@ 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 display interactive service selection
|
|
||||||
def display_service_selection(selected_services):
|
|
||||||
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}")
|
|
||||||
|
|
||||||
|
|
||||||
# Function to resolve DNS and write to file
|
# Function to resolve DNS and write to file
|
||||||
def resolve_dns_and_write(service, url):
|
def resolve_dns_and_write(service, url, unique_ips_all_services):
|
||||||
try:
|
try:
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
@@ -46,47 +35,43 @@ def resolve_dns_and_write(service, url):
|
|||||||
resolver.timeout = 1
|
resolver.timeout = 1
|
||||||
resolver.lifetime = 1
|
resolver.lifetime = 1
|
||||||
|
|
||||||
output_string = StringIO()
|
unique_ips_current_service = set() # Set to store unique IP addresses for the current service
|
||||||
|
|
||||||
resolved_domains = 0
|
|
||||||
errors = 0
|
|
||||||
|
|
||||||
with Bar(f"Scanning: {service}", max=len(dns_names)) as bar:
|
with Bar(f"Scanning: {service}", max=len(dns_names)) as bar:
|
||||||
with ThreadPoolExecutor(max_workers=50) as executor:
|
with ThreadPoolExecutor(max_workers=50) as executor:
|
||||||
futures = []
|
futures = []
|
||||||
for domain in dns_names:
|
for domain in dns_names:
|
||||||
if domain.strip():
|
if domain.strip():
|
||||||
futures.append(executor.submit(resolve_domain, resolver, domain, output_string))
|
futures.append(executor.submit(resolve_domain, resolver, domain, unique_ips_current_service, unique_ips_all_services))
|
||||||
for future in futures:
|
for future in futures:
|
||||||
resolved, error = future.result()
|
|
||||||
resolved_domains += resolved
|
|
||||||
errors += error
|
|
||||||
bar.next()
|
bar.next()
|
||||||
|
|
||||||
bar.finish()
|
bar.finish()
|
||||||
|
|
||||||
return output_string.getvalue(), resolved_domains, errors
|
return '\n'.join(unique_ips_current_service) + '\n'
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Не удалось загрузить список доменных имен сервиса: {service}.\n")
|
print(f"Не удалось загрузить список доменных имен сервиса: {service}.\n")
|
||||||
return "", 0, 0
|
return ""
|
||||||
|
|
||||||
# Function to resolve domain and write result to file
|
# Function to resolve domain and write result to file
|
||||||
def resolve_domain(resolver, domain, output_string):
|
def resolve_domain(resolver, domain, unique_ips_current_service, unique_ips_all_services):
|
||||||
try:
|
try:
|
||||||
ips = resolver.resolve(domain)
|
ips = resolver.resolve(domain)
|
||||||
unique_ips = set(ip.address for ip in ips if ip.address not in ('127.0.0.1', '0.0.0.1') and ip.address not in resolver.nameservers)
|
for ip in ips:
|
||||||
for ip in unique_ips:
|
ip_address = ip.address
|
||||||
output_string.write(ip + '\n')
|
if (ip_address not in ('127.0.0.1', '0.0.0.1') and
|
||||||
return len(unique_ips), 0
|
ip_address not in resolver.nameservers and
|
||||||
|
ip_address not in unique_ips_all_services): # Check for uniqueness
|
||||||
|
unique_ips_current_service.add(ip_address)
|
||||||
|
unique_ips_all_services.add(ip_address)
|
||||||
except dns.resolver.NoAnswer:
|
except dns.resolver.NoAnswer:
|
||||||
return 0, 1
|
pass
|
||||||
except dns.resolver.NXDOMAIN:
|
except dns.resolver.NXDOMAIN:
|
||||||
return 0, 1
|
pass
|
||||||
except dns.resolver.Timeout:
|
except dns.resolver.Timeout:
|
||||||
return 0, 1
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Ошибка при разрешении доменного имени {domain}: {e}")
|
print(f"Ошибка при разрешении доменного имени {domain}: {e}")
|
||||||
return 0, 1
|
|
||||||
|
|
||||||
# Main function
|
# Main function
|
||||||
def main():
|
def main():
|
||||||
@@ -97,7 +82,13 @@ def main():
|
|||||||
|
|
||||||
# Interactive service selection
|
# Interactive service selection
|
||||||
while True:
|
while True:
|
||||||
display_service_selection(selected_services)
|
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())
|
||||||
@@ -112,17 +103,18 @@ def main():
|
|||||||
elif selection == "":
|
elif selection == "":
|
||||||
break
|
break
|
||||||
|
|
||||||
|
unique_ips_all_services = set() # Set to store unique IP addresses across all services
|
||||||
|
|
||||||
# Check if domain-ip-resolve.txt exists and clear it if it does
|
# Check if domain-ip-resolve.txt exists and clear it if it does
|
||||||
if os.path.exists('domain-ip-resolve.txt'):
|
if os.path.exists('domain-ip-resolve.txt'):
|
||||||
os.remove('domain-ip-resolve.txt')
|
os.remove('domain-ip-resolve.txt')
|
||||||
|
|
||||||
# DNS resolution for selected services
|
# DNS resolution for selected services
|
||||||
for service in selected_services:
|
with open('domain-ip-resolve.txt', 'w') as file: # Open file for writing
|
||||||
result, resolved_domains, errors = resolve_dns_and_write(service, urls[service])
|
for service in selected_services:
|
||||||
with open('domain-ip-resolve.txt', 'a') as file:
|
result = resolve_dns_and_write(service, urls[service], unique_ips_all_services)
|
||||||
file.write(result)
|
file.write(result) # Write unique IPs directly to the file
|
||||||
total_resolved_domains += resolved_domains
|
total_resolved_domains += len(result.split('\n')) - 1
|
||||||
total_errors += errors
|
|
||||||
|
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
elapsed_time = end_time - start_time
|
elapsed_time = end_time - start_time
|
||||||
@@ -135,10 +127,3 @@ def main():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
# Deleting repetitions
|
|
||||||
with open("domain-ip-resolve.txt", "r+") as file:
|
|
||||||
unique_lines = set(file.readlines())
|
|
||||||
file.seek(0)
|
|
||||||
file.truncate()
|
|
||||||
file.writelines(unique_lines)
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ community.openai.com
|
|||||||
contest.openai.com
|
contest.openai.com
|
||||||
debate-game.openai.com
|
debate-game.openai.com
|
||||||
discuss.openai.com
|
discuss.openai.com
|
||||||
|
files.oaiusercontent.com
|
||||||
gpt3-openai.com
|
gpt3-openai.com
|
||||||
gym.openai.com
|
gym.openai.com
|
||||||
help.openai.com
|
help.openai.com
|
||||||
|
|||||||
Reference in New Issue
Block a user