-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathngerev.py
77 lines (71 loc) · 3.66 KB
/
ngerev.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import requests
from concurrent.futures import ThreadPoolExecutor
import os
banner = '''\033[92m
███╗ ██╗ ██████╗ ███████╗██████╗ ███████╗██╗ ██╗
████╗ ██║██╔════╝ ██╔════╝██╔══██╗██╔════╝██║ ██║
██╔██╗ ██║██║ ███╗█████╗ ██████╔╝█████╗ ██║ ██║
██║╚██╗██║██║ ██║██╔══╝ ██╔══██╗██╔══╝ ╚██╗ ██╔╝
██║ ╚████║╚██████╔╝███████╗██║ ██║███████╗ ╚████╔╝
╚═╝ ╚═══╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═══╝
\033[97m[ \033[92mCoded By \033[92m'/Mine7 \033[97m||\033[92m github.com/InMyMine7 \033[97m||\033[92m t.me/InMyMineee \033[97m]
\033[97m[\033[92m~\033[97m] 1. SINGGEL IP
\033[97m[\033[92m~\033[97m] 2. LIST IP TXT
'''
def reverse_ip(ip_address):
url = f"https://reverseip.rei.my.id/{ip_address}"
try:
response = requests.get(url)
data = response.json()
if data["RequestStatus"] == "success":
return data["RequestResult"]["ResultDomainList"]
else:
return []
except requests.RequestException as e:
print(f"An error occurred during the request for IP {ip_address}: {str(e)}")
return None
except Exception as e:
print(f"An unexpected error occurred for IP {ip_address}: {str(e)}")
return None
def read_ip_addresses_from_file(file_path):
try:
with open(file_path, "r") as file:
ip_addresses = file.readlines()
ip_addresses = [ip.strip() for ip in ip_addresses if ip.strip()] # Remove empty lines
return ip_addresses
except Exception as e:
print("An error occurred while reading the file:", str(e))
return []
def save_to_result_file(ip_address, domains):
with open("result.txt", "a") as result_file:
result_file.write(f"Domains for IP {ip_address} are:\n")
for domain in domains:
result_file.write(domain + "\n")
result_file.write("\n") # Add a blank line after each IP's domains
def process_ip(ip_address):
domains = reverse_ip(ip_address)
if domains:
print("Domains for IP", ip_address, "are:")
for domain in domains:
print("\033[97m[\033[92m+\033[97m] " + domain)
save_to_result_file(ip_address, domains)
print(f"\033[97m[\033[92m~\033[97m] Results for IP {ip_address} have been saved to result.txt")
else:
print("No domains found for the IP address:", ip_address)
if __name__ == "__main__":
os.system("cls" if os.name == 'nt' else "clear")
print(banner)
source_choice = input("\033[97m[\033[92m~\033[97m] ")
if source_choice == "1":
ip_address = input("\033[97m[\033[92m~\033[97m] Enter the IP address to reverse: ")
process_ip(ip_address)
elif source_choice == "2":
file_path = input("\033[97m[\033[92m~\033[97m] Enter the path to the file containing IP addresses (.txt): ")
ip_addresses = read_ip_addresses_from_file(file_path)
if ip_addresses:
with ThreadPoolExecutor(max_workers=5) as executor:
executor.map(process_ip, ip_addresses)
else:
print("No IP addresses found in the specified file.")
else:
print("Invalid choice. Please enter '1' or '2'.")