This repository was archived by the owner on May 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPySecurity.py
More file actions
360 lines (320 loc) Β· 13.1 KB
/
PySecurity.py
File metadata and controls
360 lines (320 loc) Β· 13.1 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
import requests
import os
import json
from colorama import Fore, init
init(autoreset=True)
def clear():
os.system("cls" if os.name == "nt" else "clear")
clear()
class Settings:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 OPR/112.0.0.0",
"Pragma": "no-cache",
"Accept": "*/*",
"Content-Type": "application/x-www-form-urlencoded",
}
headers2 = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 OPR/112.0.0.0",
"Pragma": "no-cache",
"Accept": "*/*",
"Content-Type": "application/json",
}
def print_menu():
menu = f"""
πΎ Forensic Tool / PySecurity πΎ
π¬ Telegram: {Fore.CYAN}@CleinKelvinn{Fore.RESET} π¬
β¨ {Fore.LIGHTGREEN_EX}If you see {Fore.RED}'Quota Limit'{Fore.LIGHTGREEN_EX}, change your IP Address. β¨
{Fore.YELLOW}βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[0] > Close PySecurity. [10] > DMARC Lookup.
[1] > Reverse DNS. [11] > TLS Scan.
[2] > DNS Lookup. [12] > DNS Record.
[3] > Geolocation IP. [13] > DNS Security Extensions Check.
[4] > Zone Transfer. [14] > Privacy Detection API.
[5] > DNS Host Records. [15] > Check if your site can accept IPv6 Proxies.
[6] > Reverse IP Lookup. [16] > Check Front-End JavaScript Vulnerabilities.
[7] > ASN Lookup. [17] > URL Shortener Bypasser.
[8] > Email Validator.
[9] > Have I been Pwned?
{Fore.YELLOW}βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ{Fore.RESET}
"""
print(menu)
def make_request(url, params=None, data=None, headers=None, method="GET"):
try:
if method == "GET":
response = requests.get(url, params=params, headers=headers)
elif method == "POST":
response = requests.post(url, data=data, headers=headers)
response.raise_for_status()
return response.text
except requests.RequestException as e:
print(f"{Fore.RED}Error: {e}{Fore.RESET}")
return None
def process_and_print_request(url, params=None, data=None, headers=None, method="GET"):
response = make_request(url, params, data, headers, method)
if response:
print("\n", response, "\n| >> Press ENTER to continue.")
input()
clear()
def get_validated_input(prompt, validation_func):
while True:
user_input = input(prompt).strip()
if validation_func(user_input):
return user_input
else:
print(f"{Fore.RED}Invalid input. Please try again.{Fore.RESET}")
def reverseDNS():
dns = get_validated_input("Enter the IP Address: ", lambda x: x)
process_and_print_request(f"https://api.hackertarget.com/reversedns/?q={dns}")
def IpPrivacy():
ipaddress = get_validated_input("Enter the IP Address: ", lambda x: x)
process_and_print_request(f"https://ipinfo.io/widget/demo/{ipaddress}?dataset=proxy-vpn-detection")
def DNSLookup():
lookup = get_validated_input("Enter the Domain Name: ", lambda x: x)
process_and_print_request(f"https://api.hackertarget.com/dnslookup/?q={lookup}")
def geoip():
geoip = get_validated_input("Enter the IP Address: ", lambda x: x)
process_and_print_request(f"https://api.hackertarget.com/geoip/?q={geoip}")
def zonetransfer():
zonetransfer = get_validated_input("Enter the Domain Name: ", lambda x: x)
process_and_print_request(f"https://api.hackertarget.com/zonetransfer/?q={zonetransfer}")
def dnssubdomain():
subdomain = get_validated_input("Enter the Domain Name: ", lambda x: x)
process_and_print_request(f"https://api.hackertarget.com/hostsearch/?q={subdomain}")
def reverseip():
reverseip = get_validated_input("Enter the IP Address: ", lambda x: x)
process_and_print_request(f"https://api.hackertarget.com/reverseiplookup/?q={reverseip}")
def ASN():
asnlookup = get_validated_input("Enter the IP Address or ASN: ", lambda x: x)
process_and_print_request(f"https://api.hackertarget.com/aslookup/?q={asnlookup}")
def emailvalid():
mailvalid = get_validated_input("Enter the Email Address: ", lambda x: x)
data = f"address=&email={mailvalid}&submit=Verify+Email+Address"
response = make_request(
"https://tools.iplocation.net/verify-email-address",
data=data,
headers=Settings.headers,
method="POST"
)
if response:
if "is a valid email" in response:
print("[+] This email is valid and active.")
elif "is an invalid email" in response:
print(f"{Fore.RED}[-] This email is not working.{Fore.LIGHTGREEN_EX}")
input("\nPress ENTER to continue.")
clear()
def proxycheck():
proxy = get_validated_input("Enter the Email Address: ", lambda x: x.replace("@", "%40"))
data = f"email={proxy}&submit=Breached%3F"
response = make_request(
"https://tools.iplocation.net/data-breach-check",
data=data,
headers=Settings.headers,
method="POST"
)
if response:
if "Congratulations" in response:
print("[+] Private email address")
elif "We found" in response:
print(f"{Fore.RED}[-] Email is public!{Fore.LIGHTGREEN_EX}")
input("\nPress ENTER to continue.")
clear()
def DMARC():
domain = get_validated_input("Enter the Domain Address: ", lambda x: x)
data = f"url={domain}&submit="
response = make_request(
"https://tools.iplocation.net/dmarc-lookup",
data=data,
headers=Settings.headers,
method="POST"
)
if response:
if "v=DMARC1" in response:
print("[+] DMARC record found")
elif "No record found" in response:
print(f"{Fore.RED}[-] No DMARC record found!{Fore.LIGHTGREEN_EX}")
input("\nPress ENTER to continue.")
clear()
def TLS():
domain = get_validated_input("Enter the Domain Address: ", lambda x: x)
data = json.dumps({"url": f"https://{domain}"})
response = make_request(
"https://siterelic.com/siterelic-api/tlsscan",
data=data,
headers=Settings.headers2,
method="POST"
)
if response:
tls_info = json.loads(response).get("data", {}).get("protocols", {})
print("TLS Information: ", tls_info)
input("\nPress ENTER to continue.")
clear()
def DNSRECORD():
domain = get_validated_input("Enter the Domain Address: ", lambda x: x)
data = json.dumps({"url": f"https://{domain}"})
response = make_request(
"https://siterelic.com/siterelic-api/dnsrecord",
data=data,
headers=Settings.headers2,
method="POST"
)
if response:
dns_info = json.loads(response).get("data", {})
print("DNS Records Info: ", dns_info)
input("\nPress ENTER to continue.")
clear()
def DNSSEC():
domain = get_validated_input("Enter the Domain Address: ", lambda x: x)
data = json.dumps({"url": f"https://{domain}"})
response = make_request(
"https://siterelic.com/siterelic-api/dnssec",
data=data,
headers=Settings.headers2,
method="POST"
)
if response:
dnssec_info = json.loads(response).get("data", {})
print("DNSSEC Info: ", dnssec_info)
input("\nPress ENTER to continue.")
clear()
def CF():
domain = get_validated_input("Enter the Domain Address: ", lambda x: x)
data = json.dumps({"url": f"https://{domain}"})
response = make_request(
"https://siterelic.com/siterelic-api/cloudflare",
data=data,
headers=Settings.headers2,
method="POST"
)
if response:
cf_info = json.loads(response).get("data", {})
print("CloudFlare Info: ", cf_info)
input("\nPress ENTER to continue.")
clear()
def ipv6():
domain = get_validated_input("Enter the Domain Address: ", lambda x: x)
print(f"{Fore.LIGHTYELLOW_EX}\n > Wait for result...{Fore.LIGHTGREEN_EX}")
access_token = make_request(
"https://domsignal.com/tools/api/api-accessToken/",
data=json.dumps({"serviceType": "ipv6-test"}),
headers={"Content-Type": "application/json"},
method="POST"
)
if not access_token:
print(f"{Fore.RED}Error retrieving access token.{Fore.RESET}")
return
token = json.loads(access_token)["credentials"]["accessToken"]
headers = {
"Host": "domsignal.com",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0",
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"public-authorization": token,
"Origin": "https://domsignal.com",
"Referer": "https://domsignal.com/ipv6-test",
}
response = make_request(
"https://domsignal.com/tools/api/gf/dnsrecord/",
data=json.dumps({"url": f"{domain}", "type": "ipv6-test"}),
headers=headers,
method="POST"
)
if response:
if "AAAA" in json.loads(response)["data"]:
print(f"{Fore.GREEN}[+] This website supports IPv6 proxy connections --> {domain}{Fore.LIGHTGREEN_EX}")
else:
print(f"{Fore.RED}[-] No IPv6 proxy support for this website --> {domain}{Fore.LIGHTGREEN_EX}")
input("Press ENTER to continue.")
clear()
def JSVuln():
domain = get_validated_input("Enter the Domain Address: ", lambda x: x)
print(f"{Fore.LIGHTYELLOW_EX}\n > Wait for result...{Fore.LIGHTGREEN_EX}")
access_token = make_request(
"https://domsignal.com/tools/api/api-accessToken/",
data=json.dumps({"serviceType": "js-vulnerability-scanner"}),
headers={"Content-Type": "application/json"},
method="POST"
)
if not access_token:
print(f"{Fore.RED}Error retrieving access token.{Fore.RESET}")
return
token = json.loads(access_token)["credentials"]["accessToken"]
headers = {
"Host": "domsignal.com",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0",
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"public-authorization": token,
"Origin": "https://domsignal.com",
"Referer": "https://domsignal.com/ipv6-test",
}
response = make_request(
"https://domsignal.com/tools/api/gf/lighthouse/",
data=json.dumps({"url": f"{domain}", "type": "js-vulnerability-scanner"}),
headers=headers,
method="POST"
)
if not response:
print(f"{Fore.RED}Error: No response received for vulnerability scan.{Fore.RESET}")
return
try:
lighthouse_url = json.loads(response).get("data")
if not lighthouse_url:
print(f"{Fore.RED}Error: Lighthouse URL not found in response.{Fore.RESET}")
return
vuln_response = requests.get(lighthouse_url).json()
vulnerabilities = vuln_response["audits"]["no-vulnerable-libraries"]["details"]["items"]
if vulnerabilities:
print(json.dumps(vulnerabilities, indent=3))
else:
print(f"{Fore.RED}\n[-] No vulnerable libraries found for this website --> {domain}{Fore.LIGHTGREEN_EX}")
except (KeyError, requests.RequestException, json.JSONDecodeError) as e:
print(f"{Fore.RED}Error processing vulnerability scan for domain: {domain} - {e}{Fore.RESET}")
input("\nPress ENTER to continue.")
clear()
def ShortURL():
url = get_validated_input("Enter the URL: ", lambda x: x)
print(f"{Fore.LIGHTYELLOW_EX}\n > Wait for result...{Fore.LIGHTGREEN_EX}")
try:
response = requests.get(url, allow_redirects=True)
if response.status_code == 200:
print("\n", response.url)
else:
print("\n", response.status_code, response.reason, response.url)
except requests.RequestException as e:
print(f"{Fore.RED}Error: {e}{Fore.RESET}")
input("\n Press ENTER to continue.")
clear()
while True:
print_menu()
try:
choice = int(input(f"{Fore.MAGENTA}π Choose an option: {Fore.RESET}"))
except ValueError:
clear()
continue
if choice == 0:
exit()
clear()
functions = {
1: reverseDNS,
2: DNSLookup,
3: geoip,
4: zonetransfer,
5: dnssubdomain,
6: reverseip,
7: ASN,
8: emailvalid,
9: proxycheck,
10: DMARC,
11: TLS,
12: DNSRECORD,
13: DNSSEC,
14: IpPrivacy,
15: ipv6,
16: JSVuln,
17: ShortURL
}
func = functions.get(choice)
if func:
func()
else:
clear()