forked from Clats97/ClatScope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClatScope(1.12)CLI.py
3142 lines (2969 loc) · 140 KB
/
ClatScope(1.12)CLI.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
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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import http.client
import urllib.parse
from urllib.parse import quote
import requests
from pystyle import Colors, Write
from phonenumbers import geocoder, carrier
import phonenumbers
import os
import socket
import ssl
from concurrent.futures import ThreadPoolExecutor, as_completed
import dns.resolver
from dns import reversename
from email_validator import validate_email, EmailNotValidError
from urllib.parse import quote
import secrets
import json
from bs4 import BeautifulSoup
import re
from email.parser import Parser
import whois
from tqdm import tqdm
from datetime import datetime
import openai
import magic
import stat
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
import PyPDF2
import openpyxl
import docx
from docx.opc.constants import RELATIONSHIP_TYPE as RT
from pptx import Presentation
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3
from mutagen.mp4 import MP4
from mutagen.id3 import ID3
from mutagen.flac import FLAC
import wave
from mutagen.oggvorbis import OggVorbis
from tinytag import TinyTag
default_color = Colors.red
API_KEY = "INSERT API KEY HERE"
CX = "INSERT API KEY HERE"
CLIENT_ID = "INSERT API KEY HERE"
HIBP_API_KEY = "INSERT API KEY HERE"
_global_session = requests.Session()
default_color = Colors.light_red
requests.get = _global_session.get
import multiprocessing
MAX_WORKERS = min(32, (multiprocessing.cpu_count() or 1) * 5)
def validate_domain_input(domain):
if not domain or len(domain) > 253 or ".." in domain:
return False
pattern = r"^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
return bool(re.match(pattern, domain))
def log_option(output_text):
print()
print("[?] Would you like to save this output to a log file? (Y/N): ", end="")
choice = input().strip().upper()
if choice == 'Y':
stamp = datetime.now().strftime("[%Y-%m-%d %H:%M:%S] ")
with open("clatscope_log.txt", "a", encoding="utf-8") as log_file:
log_file.write(f"{stamp}{output_text}\n\n")
Write.Print("[!] > Output has been saved to clatscope_log.txt\n", default_color, interval=0)
def export_json(data, filename_prefix="output"):
stamp = datetime.now().strftime("%Y%m%d_%H%M%S")
filename = f"{filename_prefix}_{stamp}.json"
try:
with open(filename, "w", encoding="utf-8") as f:
json.dump(data, f, indent=2)
Write.Print(f"[!] > JSON Export complete: {filename}\n", Colors.green, interval=0)
except Exception as e:
Write.Print(f"[!] > Failed to write JSON file: {str(e)}\n", Colors.red, interval=0)
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
def restart():
Write.Input("\nPress Enter to return to the main menu...", default_color, interval=0)
clear()
def get_ip_details(ip):
try:
response = requests.get(f"https://ipinfo.io/{ip}/json", timeout=60)
response.raise_for_status()
return response.json()
except:
return None
def ip_info(ip):
url = f"https://ipinfo.io/{ip}/json"
try:
response = requests.get(url)
response.raise_for_status()
data = response.json()
loc = data.get('loc', 'None')
ip_details = f"""
╭─{' '*78}─╮
|{' '*34} IP Details {' '*34}|
|{'='*80}|
| [+] > IP Address || {data.get('ip', 'None'):<51}|
| [+] > City || {data.get('city', 'None'):<51}|
| [+] > Region || {data.get('region', 'None'):<51}|
| [+] > Country || {data.get('country', 'None'):<51}|
| [+] > Postal/ZIP Code || {data.get('postal', 'None'):<51}|
| [+] > ISP || {data.get('org', 'None'):<51}|
| [+] > Coordinates || {loc:<51}|
| [+] > Timezone || {data.get('timezone', 'None'):<51}|
| [+] > Location || {maps_link:<51}|
╰─{' '*24}─╯╰─{' '*50}─╯
"""
Write.Print(ip_details, Colors.white, interval=0)
log_option(ip_details)
print("[?] Export IP details in JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json(data, filename_prefix="ip_info")
except:
clear()
Write.Print("\n[!] > Error retrieving IP address info.", default_color, interval=0)
restart()
def subdomain_enumeration(domain):
import requests
from datetime import datetime
url = f"https://crt.sh/?q=%.{domain}&output=json"
Write.Print(f"\n[!] Subdomain enumeration for: {domain}\n", Colors.white, interval=0)
try:
resp = requests.get(url, timeout=60)
if resp.status_code == 200:
try:
data = resp.json()
except json.JSONDecodeError:
msg = "[!] > Error: crt.sh returned non-JSON or empty data.\n"
Write.Print(msg, Colors.red, interval=0)
return
found_subs = set()
for entry in data:
if 'name_value' in entry:
for subd in entry['name_value'].split('\n'):
subd_strip = subd.strip()
if subd_strip and subd_strip != domain:
found_subs.add(subd_strip)
elif 'common_name' in entry:
c = entry['common_name'].strip()
if c and c != domain:
found_subs.add(c)
if found_subs:
out_text = f"\n[+] Found {len(found_subs)} subdomains for {domain}:\n"
for s in sorted(found_subs):
out_text += f" {s}\n"
Write.Print(out_text, Colors.green, interval=0)
print()
print("[?] Would you like to save this output to a log file? (Y/N): ", end="")
choice = input().strip().upper()
if choice == 'Y':
stamp = datetime.now().strftime("[%Y-%m-%d %H:%M:%S] ")
with open("clatscope_log.txt", "a", encoding="utf-8") as f:
f.write(stamp + out_text + "\n")
Write.Print("[!] > Subdomains saved to clatscope_log.txt\n", Colors.white, interval=0)
print("[?] Export subdomains as JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json(list(found_subs), filename_prefix="subdomains")
else:
Write.Print("[!] > No subdomains found.\n", Colors.red, interval=0)
else:
err = f"[!] > HTTP {resp.status_code} from crt.sh\n"
Write.Print(err, Colors.red, interval=0)
except Exception as exc:
Write.Print(f"[!] > Subdomain enumeration error: {exc}\n", Colors.red, interval=0)
def person_search(first_name, last_name, city):
query = f"{first_name} {last_name} {city}"
payload_person_search = {
"model": "sonar-reasoning-pro",
"messages": [
{
"role": "system",
"content": (
"When searching for information about [PERSON NAME], please provide a comprehensive analysis that includes:"
"their full name including any variations or aliases; date and place of birth (if known); current location or"
"place of death if deceased; educational background including institutions and years of attendance; professional"
"history with dates and notable achievements; any significant public roles or positions held; major life events"
"or controversies; family connections and relationships relevant to their public life; and their current status"
"or most recent known activities. For any claims made, include specific citations using [Source X] notation"
"within the text, where X corresponds to the numbered source in the reference list. Each piece of information"
"should be attributed to at least one credible source, with preference given to primary sources, official records,"
"reputable news organizations, and peer-reviewed academic works where applicable. Avoid speculation beyond verifiable"
"data. When researching [PERSON NAME], first verify the specific individual by their distinguishing characteristics"
"(occupation, time period, location, or notable achievements). If the person has appeared in a news article or public interview, discuss the details of it."
"If multiple people share similar names, acknowledge their existence at the beginning of your response like this: Note: There are other notable individuals named"
"[Similar Name], including [Brief one-line identifier for each]. This analysis focuses on [Target Person] who is known for [Key Identifier]."
"Then proceed with the detailed analysis of only the target individual, including their background, achievements, and current status."
"If you cannot confidently distinguish between similarly named individuals based on the available context, state this uncertainty clearly"
"and list the potential matches with their key identifiers, requesting additional details to ensure accurate identification. All information"
"should be properly cited using numbered references, and only include verified information about the specific target individual. At the end of the analysis,"
"provide a numbered list of all sources cited, including full bibliographic information (author, title, publication, date, URL if applicable) in Chicago style format."
"If any critical information is missing or unverifiable, explicitly note these gaps in the analysis. Include information about their current job, employment status, and other relevant professional information."
)
},
{
"role": "user",
"content": f"Provide detailed background or publicly known information about: {query}"
}
],
"max_tokens": 8000,
"temperature": 1.1
}
PERPLEXITY_API_URL = "https://api.perplexity.ai/chat/completions"
PERPLEXITY_API_KEY = "INSERT API KEY HERE"
perplexity_headers = {
"Authorization": f"Bearer {PERPLEXITY_API_KEY}",
"Content-Type": "application/json",
}
results_text = ""
try:
response = requests.post(PERPLEXITY_API_URL, headers=perplexity_headers, json=payload_person_search)
if response.status_code == 200:
data = response.json()
info_content = data["choices"][0]["message"]["content"]
results_text = (
f"\nPERSON SEARCH RESULTS\n"
f"=====================\n\n"
f"NAME:\n{first_name} {last_name}\n\n"
f"LOCATION:\n{city}\n\n"
f"PUBLIC INFORMATION:\n{info_content}\n"
)
else:
results_text = f"[!] > Error from Perplexity: HTTP {response.status_code}\n{response.text}\n"
except Exception as e:
results_text = f"[!] > Error: {str(e)}\n"
clear()
Write.Print(results_text, Colors.white, interval=0)
log_option(results_text)
print("[?] Export person search as JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json({"search_query": query, "results": results_text}, filename_prefix="person_search")
restart()
def deep_account_search(nickname):
sites = [
"https://youtube.com/@{target}",
"https://facebook.com/{target}",
"https://wikipedia.org/wiki/User:{target}",
"https://instagram.com/{target}",
"https://reddit.com/user/{target}",
"https://medium.com/@{target}",
"https://www.quora.com/profile/{target}",
"https://bing.com/{target}",
"https://x.com/{target}",
"https://yandex.ru/{target}",
"https://whatsapp.com/{target}",
"https://yahoo.com/{target}",
"https://amazon.com/{target}",
"https://duckduckgo.com/{target}",
"https://yahoo.co.jp/{target}",
"https://tiktok.com/@{target}",
"https://msn.com/{target}",
"https://netflix.com/{target}",
"https://weather.com/{target}",
"https://live.com/{target}",
"https://naver.com/{target}",
"https://microsoft.com/{target}",
"https://twitch.tv/{target}",
"https://office.com/{target}",
"https://vk.com/{target}",
"https://pinterest.com/{target}",
"https://discord.com/{target}",
"https://aliexpress.com/{target}",
"https://github.com/{target}",
"https://adobe.com/{target}",
"https://rakuten.co.jp/{target}",
"https://ikea.com/{target}",
"https://bbc.co.uk/{target}",
"https://amazon.co.jp/{target}",
"https://speedtest.net/{target}",
"https://samsung.com/{target}",
"https://healthline.com/{target}",
"https://medlineplus.gov/{target}",
"https://roblox.com/users/{target}/profile",
"https://cookpad.com/{target}",
"https://indiatimes.com/{target}",
"https://mercadolivre.com.br/{target}",
"https://britannica.com/{target}",
"https://merriam-webster.com/{target}",
"https://hurriyet.com.tr/{target}",
"https://steamcommunity.com/user/{target}",
"https://booking.com/{target}",
"https://support.google.com/{target}",
"https://bbc.com/{target}",
"https://playstation.com/{target}",
"https://ebay.com/usr/{target}",
"https://poki.com/{target}",
"https://walmart.com/{target}",
"https://medicalnewstoday.com/{target}",
"https://gov.uk/{target}",
"https://nhs.uk/{target}",
"https://detik.com/{target}",
"https://cricbuzz.com/{target}",
"https://nih.gov/{target}",
"https://uol.com.br/{target}",
"https://ilovepdf.com/{target}",
"https://clevelandclinic.org/{target}",
"https://cnn.com/{target}",
"https://globo.com/{target}",
"https://nytimes.com/{target}",
"https://taboola.com/{target}",
"https://pornhub.com/users/{target}",
"https://redtube.com/users/{target}",
"https://xnxx.com/profiles/{target}",
"https://brazzers.com/profile/{target}",
"https://xhamster.com/users/{target}",
"https://onlyfans.com/{target}",
"https://xvideos.es/profiles/{target}",
"https://chaturbate.com/{target}",
"https://redgifs.com/users/{target}",
"https://tinder.com/{target}",
"https://pof.com/{target}",
"https://match.com/{target}",
"https://eharmony.com/{target}",
"https://bumble.com/{target}",
"https://okcupid.com/{target}",
"https://Badoo.com/{target}",
"https://dating.com/{target}",
"https://trello.com/{target}",
"https://mapquest.com/{target}",
"https://zoom.com/{target}",
"https://apple.com/{target}",
"https://dropbox.com/{target}",
"https://weibo.com/{target}",
"https://wordpress.com/{target}",
"https://cloudflare.com/{target}",
"https://salesforce.com/{target}",
"https://fandom.com/{target}",
"https://paypal.com/{target}",
"https://soundcloud.com/{target}",
"https://forbes.com/{target}",
"https://theguardian.com/{target}",
"https://hulu.com/{target}",
"https://stackoverflow.com/users/{target}",
"https://businessinsider.com/{target}",
"https://huffpost.com/{target}",
"https://booking.com/{target}",
"https://pastebin.com/u/{target}",
"https://producthunt.com/@{target}",
"https://pypi.org/user/{target}",
"https://slideshare.com/{target}",
"https://strava.com/athletes/{target}",
"https://tldrlegal.com/{target}",
"https://t.me/{target}",
"https://last.fm/user{target}",
"https://data.typeracer.com/pit/profile?user={target}",
"https://tryhackme.com/p/{target}",
"https://trakt.tv/users/{target}",
"https://scratch.mit.edu/users/{target}",
"https://replit.com?{target}",
"https://hackaday.io/{target}",
"https://freesound.org/people/{target}",
"https://hub.docker.com/u/{target}",
"https://disqus.com/{target}",
"https://www.codecademy.com/profiles/{target}",
"https://www.chess.com/member/{target}",
"https://bitbucket.org/{target}",
"https://www.twitch.tv?{target}",
"https://wikia.com/wiki/User:{target}",
"https://steamcommunity.com/groups{target}",
"https://keybase.io?{target}",
"http://en.gravatar.com/{target}",
"https://vk.com/{target}",
"https://deviantart.com/{target}",
"https://www.behance.net/{target}",
"https://vimeo.com/{target}",
"https://www.youporn.com/user/{target}",
"https://profiles.wordpress.org/{target}",
"https://tryhackme.com/p/{target}",
"https://www.scribd.com/{target}",
"https://myspace.com/{target}",
"https://genius.com/{target}",
"https://genius.com/artists/{target}",
"https://www.flickr.com/people/{target}",
"https://www.fandom.com/u/{target}",
"https://www.chess.com/member/{target}",
"https://buzzfeed.com/{target}",
"https://www.buymeacoffee.com/{target}",
"https://about.me/{target}",
"https://discussions.apple.com/profile/{target}",
"https://giphy.com/{target}",
"https://scholar.harvard.edu/{target}",
"https://www.instructables.com/member/{target}",
"http://www.wikidot.com/user:info/{target}",
"https://erome.com/{target}",
"https://www.alik.cz/u/{target}",
"https://rblx.trade/p/{target}",
"https://www.paypal.com/paypalme/{target}",
"https://hackaday.io/{target}",
"https://connect.garmin.com/modern/profile/{target}"
]
urls = [site_format.format(target=nickname) for site_format in sites]
def check_url(url):
try:
response = requests.get(url, timeout=60)
status_code = response.status_code
if status_code == 200:
return f"[+] > {url:<50}|| Found"
elif status_code == 404:
return f"[-] > {url:<50}|| Not found"
else:
return f"[-] > {url:<50}|| Error: {status_code}"
except requests.exceptions.Timeout:
return f"[-] > {url:<50}|| Timeout"
except requests.exceptions.ConnectionError:
return f"[-] > {url:<50}|| Connection error"
except requests.exceptions.RequestException:
return f"[-] > {url:<50}|| Request error"
except Exception:
return f"[-] > {url:<50}|| Unexpected error"
title = "Deep Account Search"
def fetch_social_urls(urls, title):
result_str = f"""
╭─{' '*78}─╮
|{' '*27}{title}{' '*27}|
|{'='*80}|
"""
with ThreadPoolExecutor() as executor:
executor._max_workers = MAX_WORKERS
results = list(executor.map(check_url, urls))
for result in results:
result_str += f"| {result:<78} |\n"
result_str += f"╰─{' '*78}─╯"
return result_str
search_results = fetch_social_urls(urls, "Deep Account Search")
Write.Print(search_results, Colors.white, interval=0)
log_option(search_results)
print("[?] Export deep account search to JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json({"nickname": nickname, "results": search_results}, filename_prefix="deep_account_search")
restart()
def phone_info(phone_number):
try:
parsed_number = phonenumbers.parse(phone_number)
country = geocoder.country_name_for_number(parsed_number)
region = geocoder.description_for_number(parsed_number, "en")
operator = carrier.name_forNumber(parsed_number, "en") if carrier else ""
valid = phonenumbers.is_valid_number(parsed_number)
validity = "Valid" if valid else "Invalid"
phonetext = f"""
╭─{' '*50}─╮
|{' '*17}Phone number info{' '*18}|
|{'='*52}|
| [+] > Number || {phone_number:<33}|
| [+] > Country || {country:<33} |
| [+] > Region || {region:<33} |
| [+] > Operator || {operator:<33} |
| [+] > Validity || {validity:<33} |
╰─{' '*15}─╯╰─{' '*31}─╯
"""
Write.Print(phonetext, Colors.white, interval=0)
log_option(phonetext)
print("[?] Export phone info to JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json({
"phone_number": phone_number,
"country": country,
"region": region,
"operator": operator,
"validity": validity
}, filename_prefix="phone_info")
except phonenumbers.phonenumberutil.NumberParseException:
clear()
Write.Print(f"\n[!] > Error: invalid phone number format (+1-000-000-0000)", default_color, interval=0)
restart()
def reverse_phone_lookup(phone_number):
base_prompt = (
"You are a specialized reverse phone lookup assistant that provides bidirectional search capabilities between phone numbers"
"and individual/business names across public directories and databases. You search for phone numbers from a name or business name,"
"or search for a name or business name based on a phone number. You help users find associated contact information. You clarify search"
"parameters when needed and provide relevant contextual details about found associations."
)
payload = {
"model": "sonar-reasoning-pro",
"messages": [
{"role": "system", "content": base_prompt},
{"role": "user", "content": f"Perform a reverse lookup for: {phone_number}"}
],
"max_tokens": 8000,
"temperature": 1.1
}
PERPLEXITY_API_URL = "https://api.perplexity.ai/chat/completions"
PERPLEXITY_API_KEY = "INSERT API KEY HERE"
perplexity_headers = {
"Authorization": f"Bearer {PERPLEXITY_API_KEY}",
"Content-Type": "application/json",
}
try:
response = requests.post(PERPLEXITY_API_URL, headers=perplexity_headers, json=payload, timeout=60)
if response.status_code == 200:
data = response.json()
info_content = data["choices"][0]["message"]["content"]
else:
info_content = f"[!] > Error from Perplexity: HTTP {response.status_code}\n{response.text}\n"
except Exception as e:
info_content = f"[!] > Error: {str(e)}\n"
clear()
info_text = f"""
╭─{' '*78}─╮
|{' '*28}Reverse Phone Lookup{' '*28}|
|{'='*80}|
| [+] > Query: {phone_number:<66}|
|{'-'*80}|
{info_content}
╰─{' '*78}─╯
"""
Write.Print(info_text, Colors.white, interval=0)
log_option(info_text)
print("[?] Export reverse phone lookup to JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json({"phone_number": phone_number, "data": info_content}, filename_prefix="reverse_phone_lookup")
restart()
def dns_lookup(domain):
record_types = ['A', 'CNAME', 'MX', 'NS']
result_output = f"""
╭─{' '*78}─╮
|{' '*33} DNS Lookup {' '*33}|
|{'='*80}|
"""
for rtype in record_types:
result_output += f"| [+] > {rtype} Records: {' '*62}|\n"
try:
answers = dns.resolver.resolve(domain, rtype)
for ans in answers:
if rtype == 'MX':
result_output += f"| {ans.preference:<4} {ans.exchange:<70}|\n"
else:
result_output += f"| {str(ans):<76}|\n"
except dns.resolver.NoAnswer:
result_output += "| No records found.\n"
except dns.resolver.NXDOMAIN:
result_output += "| Domain does not exist.\n"
except Exception:
result_output += "| Error retrieving records.\n"
result_output += f"|{'='*80}|\n"
result_output += f"╰─{' '*78}─╯"
Write.Print(result_output, Colors.white, interval=0)
log_option(result_output)
print("[?] Export DNS lookup to JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json({"domain": domain, "dns_records_raw": result_output}, filename_prefix="dns_lookup")
restart()
def email_lookup(email_address):
try:
v = validate_email(email_address)
email_domain = v.domain
except EmailNotValidError as e:
Write.Print(f"[!] > Invalid email address format: {str(e)}", default_color, interval=0)
restart()
return
mx_records = []
try:
answers = dns.resolver.resolve(email_domain, 'MX')
for rdata in answers:
mx_records.append(str(rdata.exchange))
except:
mx_records = []
validity = "Mx Found (Might be valid)" if mx_records else "No MX found (Might be invalid)"
email_text = f"""
╭─{' '*78}─╮
|{' '*34}Email Info{' '*34}|
|{'='*80}|
| [+] > Email: || {email_address:<52}|
| [+] > Domain: || {email_domain:<52}|
| [+] > MX Records: || {", ".join(mx_records) if mx_records else "None":<52}|
| [+] > Validity: || {validity:<52}|
╰─{' '*23}─╯╰─{' '*51}─╯
"""
Write.Print(email_text, Colors.white, interval=0)
log_option(email_text)
print("[?] Export email lookup to JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json({
"email": email_address,
"domain": email_domain,
"mx_records": mx_records,
"validity": validity
}, filename_prefix="email_lookup")
restart()
def reverse_dns(ip):
try:
rev_name = reversename.from_address(ip)
answers = dns.resolver.resolve(rev_name, "PTR")
ptr_record = str(answers[0]).strip('.')
except:
ptr_record = "No PTR record found"
rdns_text = f"""
╭─{' '*78}─╮
|{' '*33}Reverse DNS Lookup{' '*33}|
|{'='*80}|
| [+] > IP: || {ip:<60}|
| [+] > Host: || {ptr_record:<60}|
╰─{' '*23}─╯╰─{' '*51}─╯
"""
Write.Print(rdns_text, Colors.white, interval=0)
log_option(rdns_text)
print("[?] Export reverse DNS to JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json({"ip": ip, "ptr_record": ptr_record}, filename_prefix="reverse_dns")
restart()
def analyze_email_header(raw_headers):
parser = Parser()
msg = parser.parsestr(raw_headers)
from_ = msg.get("From", "")
to_ = msg.get("To", "")
subject_ = msg.get("Subject", "")
date_ = msg.get("Date", "")
received_lines = msg.get_all("Received", [])
found_ips = []
if received_lines:
for line in received_lines:
potential_ips = re.findall(r'\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b', line)
for ip in potential_ips:
if ip not in found_ips:
found_ips.append(ip)
header_text = f"""
╭─{' '*78}─╮
|{' '*31}Email Header Analysis{' '*31}|
|{'='*80}|
| [+] > From: || {from_:<55}|
| [+] > To: || {to_:<55}|
| [+] > Subject: || {subject_:<55}|
| [+] > Date: || {date_:<55}|
|{'-'*80}|
"""
if found_ips:
header_text += "| [+] > Received Path (IPs found):\n"
for ip in found_ips:
header_text += f"| {ip:<76}|\n"
else:
header_text += "| [+] > No IPs found in Received headers.\n"
header_text += f"╰─{' '*78}─╯"
Write.Print(header_text, Colors.white, interval=0)
ip_details_full = ""
if found_ips:
ip_details_header = f"""
╭─{' '*78}─╮
|{' '*30}IP Geolocation Details{' '*30}|
|{'='*80}|
"""
ip_details_summary = ""
for ip in found_ips:
data = get_ip_details(ip)
if data is not None:
loc = data.get('loc', 'None')
ip_details_summary += f"| IP: {ip:<14}|| City: {data.get('city','N/A'):<15} Region: {data.get('region','N/A'):<15} Country: {data.get('country','N/A'):<4}|\n"
ip_details_summary += f"| Org: {data.get('org','N/A'):<63}|\n"
ip_details_summary += f"| Loc: {loc:<63}|\n"
ip_details_summary += "|" + "-"*78 + "|\n"
else:
ip_details_summary += f"| IP: {ip:<14}|| [!] Could not retrieve details.\n"
ip_details_summary += "|" + "-"*78 + "|\n"
ip_details_footer = f"╰─{' '*78}─╯"
ip_details_full = ip_details_header + ip_details_summary + ip_details_footer
Write.Print(ip_details_full, Colors.white, interval=0)
spf_result, dkim_result, dmarc_result = None, None, None
spf_domain, dkim_domain = None, None
auth_results = msg.get_all("Authentication-Results", [])
from_domain = ""
if "@" in from_:
from_domain = from_.split("@")[-1].strip(">").strip()
if auth_results:
for entry in auth_results:
spf_match = re.search(r'spf=(pass|fail|softfail|neutral)', entry, re.IGNORECASE)
if spf_match:
spf_result = spf_match.group(1)
spf_domain_match = re.search(r'envelope-from=([^;\s]+)', entry, re.IGNORECASE)
if spf_domain_match:
spf_domain = spf_domain_match.group(1)
dkim_match = re.search(r'dkim=(pass|fail|none|neutral)', entry, re.IGNORECASE)
if dkim_match:
dkim_result = dkim_match.group(1)
dkim_domain_match = re.search(r'd=([^;\s]+)', entry, re.IGNORECASE)
if dkim_domain_match:
dkim_domain = dkim_domain_match.group(1)
dmarc_match = re.search(r'dmarc=(pass|fail|none)', entry, re.IGNORECASE)
if dmarc_match:
dmarc_result = dmarc_match.group(1)
spf_align = False
dkim_align = False
if from_domain and spf_domain:
spf_align = from_domain.lower() == spf_domain.lower()
if from_domain and dkim_domain:
dkim_align = from_domain.lower() == dkim_domain.lower()
alignment_text = f"""
╭─{' '*78}─╮
|{' '*30}SPF / DKIM / DMARC Checks{' '*29}|
|{'='*80}|
| [+] > SPF Result: {spf_result if spf_result else 'Not found':<20} Domain: {spf_domain if spf_domain else 'N/A':<20} Aligned: {spf_align}|
| [+] > DKIM Result: {dkim_result if dkim_result else 'Not found':<20} Domain: {dkim_domain if dkim_domain else 'N/A':<20} Aligned: {dkim_align}|
| [+] > DMARC Result: {dmarc_result if dmarc_result else 'Not found':<20}|
╰─{' '*78}─╯
"""
Write.Print(alignment_text, Colors.white, interval=0)
full_output = header_text + "\n" + ip_details_full + "\n" + alignment_text
log_option(full_output)
print("[?] Export email header analysis to JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json({
"raw_headers": raw_headers,
"from": from_,
"to": to_,
"subject": subject_,
"date": date_,
"found_ips": found_ips,
"spf_result": spf_result,
"spf_domain": spf_domain,
"spf_aligned": spf_align,
"dkim_result": dkim_result,
"dkim_domain": dkim_domain,
"dkim_aligned": dkim_align,
"dmarc_result": dmarc_result
}, filename_prefix="email_header_analysis")
restart()
def haveibeenpwned_check(email):
headers = {
"hibp-api-key": HIBP_API_KEY,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
}
url = f"https://haveibeenpwned.com/api/v3/breachedaccount/{email}?truncateResponse=false"
try:
resp = requests.get(url, headers=headers, timeout=60)
if resp.status_code == 200:
breaches = resp.json()
clear()
results_text = f"""
╭─{' '*78}─╮
|{' '*30}Have I Been Pwned?{' '*30}|
|{'='*80}|
| [!] > Bad news! Your email was found in {len(breaches)} breach(es) |
|{'-'*80}|
"""
for index, breach in enumerate(breaches, start=1):
breach_name = breach.get('Name', 'Unknown')
domain = breach.get('Domain', 'Unknown')
breach_date = breach.get('BreachDate', 'Unknown')
added_date = breach.get('AddedDate', 'Unknown')
pwn_count = breach.get('PwnCount', 'Unknown')
data_classes = ", ".join(breach.get('DataClasses', []))
results_text += f"| Breach #{index}: {breach_name:<66}|\n"
results_text += f"| Domain: {domain:<71}|\n"
results_text += f"| Breach Date: {breach_date:<65}|\n"
results_text += f"| Added Date: {added_date:<65}|\n"
results_text += f"| PwnCount: {pwn_count:<65}|\n"
results_text += f"| Data Types: {data_classes:<65}|\n"
results_text += f"|{'='*80}|\n"
results_text += f"╰─{' '*78}─╯"
Write.Print(results_text, Colors.white, interval=0)
log_option(results_text)
print("[?] Export breach info to JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json({"email": email, "breaches": breaches}, filename_prefix="breach_info")
elif resp.status_code == 404:
clear()
msg = f"""
╭─{' '*78}─╮
|{' '*30}Have I Been Pwned?{' '*30}|
|{'='*80}|
| [!] > Good news! No breaches found for: {email:<48}|
╰─{' '*78}─╯
"""
Write.Print(msg, Colors.white, interval=0)
log_option(msg)
else:
clear()
error_msg = f"[!] > An error occurred: HTTP {resp.status_code}\nResponse: {resp.text}\n"
Write.Print(error_msg, Colors.red, interval=0)
log_option(error_msg)
except requests.exceptions.Timeout:
clear()
Write.Print("[!] > Request timed out when contacting Have I Been Pwned.", default_color, interval=0)
except Exception as e:
clear()
Write.Print(f"[!] > An error occurred: {str(e)}", default_color, interval=0)
restart()
def whois_lookup(domain):
try:
w = whois.whois(domain)
clear()
domain_name = w.domain_name if w.domain_name else "N/A"
registrar = w.registrar if w.registrar else "N/A"
creation_date = w.creation_date if w.creation_date else "N/A"
expiration_date = w.expiration_date if w.expiration_date else "N/A"
updated_date = w.updated_date if w.updated_date else "N/A"
name_servers = ", ".join(w.name_servers) if w.name_servers else "N/A"
status = ", ".join(w.status) if w.status else "N/A"
whois_text = f"""
╭─{' '*78}─╮
|{' '*34}WHOIS Lookup{' '*34}|
|{'='*80}|
| [+] > Domain Name: || {str(domain_name):<52}|
| [+] > Registrar: || {str(registrar):<52}|
| [+] > Creation Date: || {str(creation_date):<52}|
| [+] > Expiration Date: || {str(expiration_date):<52}|
| [+] > Updated Date: || {str(updated_date):<52}|
| [+] > Name Servers: || {name_servers:<52}|
| [+] > Status: || {status:<52}|
╰─{' '*23}─╯╰─{' '*51}─╯
"""
Write.Print(whois_text, Colors.white, interval=0)
log_option(whois_text)
print("[?] Export WHOIS to JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
data = {
"domain": domain,
"domain_name": str(domain_name),
"registrar": str(registrar),
"creation_date": str(creation_date),
"expiration_date": str(expiration_date),
"updated_date": str(updated_date),
"name_servers": name_servers,
"status": status
}
export_json(data, filename_prefix="whois_lookup")
except Exception as e:
clear()
Write.Print(f"[!] > WHOIS lookup error: {str(e)}", default_color, interval=0)
restart()
def check_password_strength(password):
txt_file_path = os.path.join(os.path.dirname(__file__), "passwords.txt")
if os.path.isfile(txt_file_path):
try:
with open(txt_file_path, "r", encoding="utf-8") as f:
common_words = f.read().splitlines()
for word in common_words:
if word and word in password:
return "Weak password (may contain a common phrase, etc.)"
except Exception:
pass
score = 0
if len(password) >= 8:
score += 1
if len(password) >= 12:
score += 1
if re.search(r'[A-Z]', password):
score += 1
if re.search(r'[a-z]', password):
score += 1
if re.search(r'\d', password):
score += 1
if re.search(r'[^a-zA-Z0-9]', password):
score += 1
if score <= 2:
return "Weak password (consider using more complexity. DO NOT use this password)"
elif 3 <= score <= 4:
return "Moderate password (password may be okay for non-critical applications)"
else:
return "Strong password (good job, use this password)"
def password_strength_tool():
clear()
Write.Print("[!] > Enter password to evaluate strength:\n", default_color, interval=0)
password = Write.Input("[?] > ", default_color, interval=0)
if not password:
clear()
Write.Print("[!] > Password cannot be empty.\n", default_color, interval=0)
restart()
return
strength = check_password_strength(password)
clear()
output_text = f"Password Strength: {strength}\n"
Write.Print(output_text, Colors.white, interval=0)
log_option(output_text)
restart()
def username_check():
clear()
Write.Print("[!] > Conducting Username Check...\n", default_color, interval=0)
username = Write.Input("[?] > Enter the username: ", default_color, interval=0).strip()
if not username:
clear()
Write.Print("[!] > No username provided.\n", Colors.red, interval=0)
restart()
return
def fetch_wmn_data():
try:
response = requests.get("https://raw.githubusercontent.com/WebBreacher/WhatsMyName/main/wmn-data.json", timeout=60)
response.raise_for_status()
return response.json()
except:
Write.Print("[!] > Failed to fetch data from WhatsMyName repository.\n", Colors.red, interval=0)
return None
data = fetch_wmn_data()
if not data:
restart()
return
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.9",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
}
sites = data["sites"]
total_sites = len(sites)
found_sites = []
output_accumulated = ""
def check_site(site, username, headers):
site_name = site["name"]
uri_check = site["uri_check"].format(account=username)
try:
res = requests.get(uri_check, headers=headers, timeout=60)
estring_pos = site["e_string"] in res.text
estring_neg = site["m_string"] in res.text
if res.status_code == site["e_code"] and estring_pos and not estring_neg:
return site_name, uri_check
except:
pass
return None
try:
with ThreadPoolExecutor(max_workers=20) as executor:
futures = {executor.submit(check_site, site, username, headers): site for site in sites}
with tqdm(total=total_sites, desc="Checking sites") as pbar:
for future in as_completed(futures):
try:
result = future.result()
if result:
site_name, uri_check = result
found_sites.append((site_name, uri_check))
found_str = f"[+] Found on: {site_name}\n[+] Profile URL: {uri_check}\n"
output_accumulated += found_str
Write.Print(found_str, Colors.green, interval=0)
except Exception:
pass
finally:
pbar.update(1)
if found_sites:
summary_str = f"\n[!] > Username found on {len(found_sites)} sites!\n"
output_accumulated += summary_str
Write.Print(summary_str, Colors.green, interval=0)
generate_html_report(username, found_sites)
report_msg = f"\n[!] > Report saved: username_check_report_{username}.html\n"
output_accumulated += report_msg
Write.Print(report_msg, Colors.green, interval=0)
else:
no_result_str = f"[!] > No results found for {username}.\n"
output_accumulated += no_result_str
Write.Print(no_result_str, Colors.red, interval=0)
except Exception as e:
err_str = f"[!] > An error occurred: {str(e)}\n"
output_accumulated += err_str
Write.Print(err_str, Colors.red, interval=0)
log_option(output_accumulated)
print("[?] Export username check to JSON? (Y/N): ", end="")
if input().strip().upper() == "Y":
export_json({"username": username, "found_sites": found_sites}, filename_prefix="username_check")
restart()
def generate_html_report(username, found_sites):
html_content = f"""