forked from Largo-m/SecuSploitX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
1515 lines (1193 loc) · 56.6 KB
/
main.py
File metadata and controls
1515 lines (1193 loc) · 56.6 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
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 os
import sys
import requests
import subprocess
import urllib3
import argparse
from datetime import datetime
from Web.Basic_SQL.form_finder import find_forms
from Web.Basic_SQL.form_tester import test_form, load_sql_errors
from Web.Gain_information.Builder import SiteScanner, pretty_print
from Web.Header_Analyzer.Builder import HeaderAnalyzerBuilder
from Web.SSL_Chekcer.Builder import SSLCheckerBuilder
from Web.DNS_Enumeration.Builder import DNSEnumerationBuilder
import Web.Find_Login_Pages.Builder as BuilderModule
from Web.Firewall_Detector.firewall_detector import FirewallDetector
from Phishing_AI.Test import TestChatBot as PhishingChatBot
import joblib
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import re
import time
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class SploitTerminal:
def __init__(self):
self.running = True
self.current_module = None
self.stop_flag = {"stop": False}
def clear_screen(self):
os.system('cls' if os.name == 'nt' else 'clear')
def print_banner(self):
banner = """
███████╗██████╗ ██╗ ██████╗ ██╗████████╗
██╔════╝██╔══██╗██║ ██╔═══██╗██║╚══██╔══╝
███████╗██████╔╝██║ ██║ ██║██║ ██║
╚════██║██╔═══╝ ██║ ██║ ██║██║ ██║
███████║██║ ███████╗╚██████╔╝██║ ██║
╚══════╝╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝
🔐 SPLOIT PENETRATION TOOLKIT - TERMINAL MODE
"""
print(banner)
print("🌐 Comprehensive Security Testing Suite")
print("=" * 60)
time.sleep(3.5)
def print_menu(self):
print("\n📋 MAIN MENU:")
print("=" * 40)
print("🌐 Web Application Testing:")
print(" 1. Web Security Test (SQLi)")
print(" 2. Subdirectory Finder")
print(" 3. Full Site Scan")
print(" 4. Brute Force Simulator")
print(" 5. Admin Finder")
print(" 6. Deep Site Scanner")
print("\n🔧 Network & Infrastructure:")
print(" 7. Port Scanner")
print(" 8. Header Analyzer")
print(" 9. SSL/TLS Checker")
print(" 10. DNS Enumeration")
print(" 11. Firewall Detector")
print(" 12. Subdomain Enumeration")
print("\n💻 Penetration Windows Toolkits:")
print(" 13. InfoStealer (Trojan)")
print(" 14. RDP Sec (RAT) - CLI Only")
print(" 15. RansomApp (Encryption)")
print(" 16. PhishCapture (Fake Pages)")
print(" 17. PhishCreator (AI)")
print(" 18. SystemTroll (Crash)")
print("\n⚙️ Additional Tools:")
print(" 19. Sploit ChatBot")
print(" 20. Settings")
print(" 21. About")
print(" 22. Run GUI")
print(" 0. Exit")
print("=" * 40)
def get_user_choice(self):
try:
choice = input("\n🎯 Enter your choice (0-21): ").strip()
return int(choice)
except ValueError:
print("❌ Invalid input. Please enter a number.")
return -1
def run_module(self, choice):
self.stop_flag["stop"] = False
self.current_module = choice
if choice == 0:
self.running = False
print("👋 Exiting Sploit Toolkit. Goodbye!")
return
elif choice == 1:
self.web_security_test()
elif choice == 2:
self.subdirectory_finder()
elif choice == 3:
self.full_site_scan()
elif choice == 4:
self.brute_force_simulator()
elif choice == 5:
self.admin_finder()
elif choice == 6:
self.deep_site_scanner()
elif choice == 7:
self.port_scanner()
elif choice == 8:
self.header_analyzer()
elif choice == 9:
self.ssl_checker()
elif choice == 10:
self.dns_enumeration()
elif choice == 11:
self.firewall_detector()
elif choice == 12:
self.subdomain_enumeration()
elif choice == 13:
self.infostealer_builder()
elif choice == 14:
self.rdp_sec_info()
elif choice == 15:
self.ransomapp_builder()
elif choice == 16:
self.phishcapture()
elif choice == 17:
self.phishcreator_ai()
elif choice == 18:
self.systemtroll_builder()
elif choice == 19:
self.sploit_chatbot()
elif choice == 20:
self.settings()
elif choice == 21:
self.about()
elif choice == 22:
self.Run_GUI()
else:
print("❌ Invalid choice. Please try again.")
def prompt_for_input(self, prompt, default=""):
if default:
user_input = input(f"{prompt} [{default}]: ").strip()
return user_input if user_input else default
else:
return input(f"{prompt}: ").strip()
def web_security_test(self):
print("\n🔍 Web Security Test (SQL Injection)")
print("=" * 50)
url = self.prompt_for_input("Enter target URL")
if not url:
print("❌ URL is required.")
return
print(f"[+] Starting SQL injection test on: {url}")
try:
payload_file = os.path.join("Web","Basic_SQL","Payloads.txt")
sql_errors_file = os.path.join("Web","Basic_SQL","sql_errors.txt")
with open(payload_file, "r", encoding="utf-8") as f:
payloads = [line.strip() for line in f if line.strip()]
sql_errors = load_sql_errors(sql_errors_file)
print(f"[+] Loaded {len(payloads)} payload(s)")
print(f"[+] Loaded {len(sql_errors)} SQL error patterns")
forms = find_forms(url, debug=False)
print(f"[+] Found {len(forms)} form(s)")
vulnerabilities_found = 0
for form in forms:
for payload in payloads:
if self.stop_flag["stop"]:
print("[!] Test stopped by user")
return
found, error = test_form(form, payload, sql_errors, debug=False)
if found:
print(f"[!!!] VULNERABLE: Form #{form['form_number']} at {form['action']}")
print(f" Payload: {payload}")
print(f" Error: {error}")
vulnerabilities_found += 1
else:
print(f"[*] No SQLi detected with payload: {payload}")
if vulnerabilities_found > 0:
print(f"\n✅ Found {vulnerabilities_found} vulnerabilities!")
else:
print("\n✅ No vulnerabilities found.")
except Exception as e:
print(f"❌ Error: {str(e)}")
def subdirectory_finder(self):
print("\n📁 Subdirectory Finder")
print("=" * 50)
base_url = self.prompt_for_input("Enter base URL")
if not base_url:
print("❌ URL is required.")
return
wordlist_file = os.path.join("Web","Subdirectory_Finder", "Hidden_urls.txt")
output_file_path = os.path.join("Web","Subdirectory_Finder", "Found_Success.txt")
try:
with open(wordlist_file, "r", encoding="utf-8", errors="ignore") as f:
paths = [line.strip() for line in f if line.strip()]
except Exception as e:
print(f"❌ Failed to load wordlist: {e}")
return
print(f"[+] Starting subdirectory scan on: {base_url}")
print(f"[+] Using wordlist with {len(paths)} entries")
found_count = 0
try:
with open(output_file_path, "w", encoding="utf-8") as output_file:
for i, path in enumerate(paths):
if self.stop_flag["stop"]:
print("[!] Scan stopped by user")
return
final_url = base_url + path
try:
response = requests.get(final_url, timeout=5)
if response.status_code == 200:
print(f"[+ ✅] Found: {final_url}")
output_file.write(final_url + "\n")
found_count += 1
else:
print(f"[-] {final_url} - Status {response.status_code}")
except Exception as req_err:
print(f"[-] Error fetching {final_url} => {req_err}")
if (i + 1) % 100 == 0:
progress = (i + 1) / len(paths) * 100
print(f"[*] Progress: {progress:.1f}% ({i + 1}/{len(paths)})")
print(f"\n✅ Scan completed! Found {found_count} subdirectories.")
print(f"[+] Results saved to: {output_file_path}")
except Exception as e:
print(f"❌ Error: {str(e)}")
def full_site_scan(self):
print("\n🌐 Full Site Scanner")
print("=" * 50)
url = self.prompt_for_input("Enter target URL")
if not url:
print("❌ URL is required.")
return
print(f"[+] Starting full site scan on: {url}")
try:
scanner = SiteScanner(url)
results = scanner.run_all()
print("\n" + "=" * 60)
print(" 🌐 FULL SITE SCAN RESULTS 🌐")
print("=" * 60)
for section, data in results.items():
if self.stop_flag["stop"]:
print("[!] Scan stopped by user")
return
print(f"\n--- {section.upper()} ---")
pretty_print(data)
print("\n" + "=" * 60)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
output_file = f"site_scan_results_{timestamp}.txt"
with open(output_file, "w", encoding="utf-8") as f:
f.write("=" * 60 + "\n")
f.write(" 🌐 FULL SITE SCAN RESULTS 🌐\n")
f.write("=" * 60 + "\n")
for section, data in results.items():
f.write(f"\n--- {section.upper()} ---\n")
pretty_print(data, file=f)
f.write("\n" + "=" * 60 + "\n")
print(f"[+] Results saved to: {output_file}")
except Exception as e:
print(f"❌ Error: {str(e)}")
def brute_force_simulator(self):
print("\n🔑 Brute Force Simulator")
print("=" * 50)
url = self.prompt_for_input("Enter login URL")
if not url:
print("❌ URL is required.")
return
print(f"[+] Starting brute force simulation on: {url}")
try:
from Web.Brute_Force.Action import attempt_login, check_success
from Web.Brute_Force.Elements import extract_form_fields
import requests
import time
import os
base_dir = os.path.dirname(os.path.abspath(__file__))
usernames_file = os.path.join(base_dir, "Web", "Brute_Force", "Usernames.txt")
passwords_file = os.path.join(base_dir, "Web", "Brute_Force", "RockYou.txt")
if not os.path.exists(usernames_file):
print(f"❌ Usernames file not found: {usernames_file}")
return
if not os.path.exists(passwords_file):
print(f"❌ Passwords file not found: {passwords_file}")
return
print("[+] Loading usernames...")
with open(usernames_file, "r", encoding="utf-8", errors="ignore") as f:
usernames = [line.strip() for line in f if line.strip()]
print("[+] Loading passwords...")
with open(passwords_file, "r", encoding="utf-8", errors="ignore") as f:
passwords = [line.strip() for line in f if line.strip()]
print("[+] You can Set your Username list and Password in Brute_Force Directory Default is RockYou.txt "
"for Password and Usernames.txt for username .")
time.sleep(5)
print(f"[+] Loaded {len(usernames)} usernames")
print(f"[+] Loaded {len(passwords)} passwords")
print("[+] Extracting form fields...")
form_data = extract_form_fields(url)
print("[+] Form extracted successfully")
session = requests.Session()
credentials_found = False
max_usernames = min(10, len(usernames))
max_passwords = min(20, len(passwords))
print(f"🧪 Testing with {max_usernames} usernames and {max_passwords} passwords each")
for i, user in enumerate(usernames[:max_usernames]):
if self.stop_flag["stop"]:
print("[!] Brute force stopped by user")
return
for j, pwd in enumerate(passwords[:max_passwords]):
if self.stop_flag["stop"]:
print("[!] Brute force stopped by user")
return
print(f"[*] Trying {user}:{pwd} ({i + 1}/{max_usernames}, {j + 1}/{max_passwords})")
try:
response = attempt_login(session, form_data, user, pwd)
if check_success(response, form_data):
print(f"\n✅ LOGIN SUCCESSFUL: {user}:{pwd}")
credentials_found = True
self.save_credentials(url, user, pwd)
break
else:
print(" ❌ Login failed")
except Exception as e:
print(f" ⚠️ Error: {e}")
time.sleep(0.1)
if credentials_found:
break
if not credentials_found:
print("\n❌ No valid credentials found.")
if not credentials_found and (max_usernames < len(usernames) or max_passwords < len(passwords)):
choice = input("\nContinue with full scan? (y/n): ").lower().strip()
if choice == 'y':
print("🚀 Starting full brute force scan...")
except Exception as e:
print(f"❌ Failed to run brute force: {str(e)}")
import traceback
traceback.print_exc()
def save_credentials(self, url, username, password):
try:
import os
from datetime import datetime
base_dir = os.path.dirname(os.path.abspath(__file__))
results_dir = os.path.join(base_dir, "Brute_Force_Results")
os.makedirs(results_dir, exist_ok=True)
filename = os.path.join(results_dir, f"found_credentials_{datetime.now().strftime('%Y%m%d_%H%M%S')}.txt")
with open(filename, "w", encoding="utf-8") as f:
f.write("🔐 Brute Force Results\n")
f.write("=" * 50 + "\n")
f.write(f"URL: {url}\n")
f.write(f"Username: {username}\n")
f.write(f"Password: {password}\n")
f.write(f"Found at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
f.write("=" * 50 + "\n")
print(f"💾 Credentials saved to: {filename}")
except Exception as e:
print(f"⚠️ Could not save credentials: {e}")
def admin_finder(self):
print("\n👤 Admin Finder")
print("=" * 50)
url = self.prompt_for_input("Enter target URL")
if not url:
print("❌ URL is required.")
return
print(f"[+] Starting admin page search on: {url}")
try:
BuilderModule.Find_Admin(stop_flag=self.stop_flag, base_url=url)
print("\n✅ Admin page search completed.")
except Exception as e:
print(f"❌ Error: {str(e)}")
def deep_site_scanner(self):
print("\n🕵️ Deep Site Scanner")
print("=" * 50)
url = self.prompt_for_input("Enter target URL")
if not url:
print("❌ URL is required.")
return
print(f"[+] Starting deep site scan on: {url}")
try:
scanner = SiteScanner(url)
results = scanner.run_all()
print("\n" + "=" * 60)
print(" 🕵️ DEEP SITE SCAN RESULTS 🕵️")
print("=" * 60)
for section, data in results.items():
if self.stop_flag["stop"]:
print("[!] Scan stopped by user")
return
print(f"\n--- {section.upper()} ---")
pretty_print(data)
print("\n" + "=" * 60)
# ذخیره نتایج
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
output_file = f"deep_scan_results_{timestamp}.txt"
with open(output_file, "w", encoding="utf-8") as f:
f.write("=" * 60 + "\n")
f.write(" 🕵️ DEEP SITE SCAN RESULTS 🕵️\n")
f.write("=" * 60 + "\n")
for section, data in results.items():
f.write(f"\n--- {section.upper()} ---\n")
pretty_print(data, file=f)
f.write("\n" + "=" * 60 + "\n")
print(f"[+] Results saved to: {output_file}")
except Exception as e:
print(f"❌ Error: {str(e)}")
def port_scanner(self):
print("\n🔍 Port Scanner")
print("=" * 50)
target = self.prompt_for_input("Enter target host or IP")
if not target:
print("❌ Target is required.")
return
print("\n📊 Scan Options:")
print("1. Quick Scan (top 100 ports)")
print("2. Common Services (top 1000 ports)")
print("3. Full Scan (all 65535 ports)")
print("4. Custom Range")
choice = self.prompt_for_input("Select scan type (1-4)", "1")
top_100_ports = [21, 22, 23, 25, 53, 80, 110, 111, 135, 139, 143, 443, 445, 993, 995,
1723, 3306, 3389, 5900, 8080, 8443, 1, 2, 3, 7, 9, 13, 17, 19, 20, 26,
37, 53, 79, 81, 88, 106, 110, 111, 113, 119, 135, 139, 143, 144, 179,
199, 389, 427, 443, 444, 445, 465, 513, 514, 515, 543, 544, 548, 554,
587, 631, 646, 873, 990, 993, 995, 1025, 1026, 1027, 1028, 1029, 1110,
1433, 1720, 1723, 1755, 1900, 2000, 2001, 2049, 2121, 2717, 3000, 3128,
3306, 3389, 3986, 4899, 5000, 5009, 5051, 5060, 5101, 5190, 5357, 5432,
5631, 5666, 5800, 5900, 6000, 6001, 6646, 7070, 8000, 8008, 8009, 8080,
8081, 8443, 8888, 9100, 9999, 10000, 32768, 32771]
if choice == "1":
ports = top_100_ports
print(f"[+] Scanning top {len(ports)} ports...")
elif choice == "2":
ports = list(range(1, 1001))
print("[+] Scanning common ports (1-1000)...")
elif choice == "3":
ports = list(range(1, 65536))
print("[+] Scanning all ports (1-65535)...")
elif choice == "4":
custom_range = self.prompt_for_input("Enter port range (e.g., 20-80) or list (e.g., 80,443,8080)")
if "-" in custom_range:
start, end = map(int, custom_range.split("-"))
ports = list(range(start, end + 1))
elif "," in custom_range:
ports = [int(p.strip()) for p in custom_range.split(",")]
else:
ports = [int(custom_range)]
print(f"[+] Scanning {len(ports)} custom ports...")
else:
print("❌ Invalid choice. Using quick scan.")
ports = top_100_ports
max_threads = self.prompt_for_input("Enter number of threads (default: 50)", "50")
try:
max_threads = int(max_threads)
except:
max_threads = 50
print("⚠️ Using default 50 threads")
print(f"[+] Starting scan on {target} with {max_threads} threads...")
import socket
import concurrent.futures
from datetime import datetime
start_time = datetime.now()
open_ports = []
def check_port(port):
try:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.settimeout(1)
result = s.connect_ex((target, port))
if result == 0:
return port, True
return port, False
except:
return port, False
with concurrent.futures.ThreadPoolExecutor(max_workers=max_threads) as executor:
future_to_port = {executor.submit(check_port, port): port for port in ports}
for i, future in enumerate(concurrent.futures.as_completed(future_to_port)):
port, is_open = future.result()
if is_open:
open_ports.append(port)
print(f"✅ Port {port} - OPEN")
# نمایش پیشرفت
if (i + 1) % 100 == 0 or (i + 1) == len(ports):
progress = (i + 1) / len(ports) * 100
print(f"📊 Progress: {progress:.1f}% ({i + 1}/{len(ports)})")
end_time = datetime.now()
scan_duration = (end_time - start_time).total_seconds()
print(f"\n🎉 Scan completed in {scan_duration:.2f} seconds!")
print(f"✅ Found {len(open_ports)} open ports:")
if open_ports:
port_services = {
21: "FTP", 22: "SSH", 23: "Telnet", 25: "SMTP", 53: "DNS", 80: "HTTP",
110: "POP3", 111: "RPC", 135: "RPC", 139: "NetBIOS", 143: "IMAP",
443: "HTTPS", 445: "SMB", 993: "IMAPS", 995: "POP3S", 1723: "PPTP",
3306: "MySQL", 3389: "RDP", 5900: "VNC", 8080: "HTTP-Alt", 8443: "HTTPS-Alt"
}
for port in sorted(open_ports):
service = port_services.get(port, "Unknown")
print(f" 📍 Port {port} - {service}")
save_results = self.prompt_for_input("Save results to file? (y/n)", "y").lower()
if save_results == 'y':
filename = f"port_scan_{target}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.txt"
with open(filename, 'w') as f:
f.write(f"Port Scan Results for {target}\n")
f.write(f"Scan completed: {end_time}\n")
f.write(f"Duration: {scan_duration:.2f} seconds\n")
f.write(f"Open ports: {len(open_ports)}\n\n")
for port in sorted(open_ports):
service = port_services.get(port, "Unknown")
f.write(f"Port {port} - {service}\n")
print(f"💾 Results saved to {filename}")
else:
print("❌ No open ports found.")
if open_ports:
deep_scan = self.prompt_for_input("Perform service detection on open ports? (y/n)", "n").lower()
if deep_scan == 'y':
print("\n🔍 Performing service detection...")
self.service_detection(target, open_ports)
def service_detection(self, target, ports):
import socket
banner_messages = {
21: b"", 22: b"", 80: b"GET / HTTP/1.0\r\n\r\n", 443: b"",
25: b"EHLO example.com\r\n", 110: b"", 143: b""
}
for port in ports:
try:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.settimeout(2)
s.connect((target, port))
if port in banner_messages:
s.send(banner_messages[port])
banner = s.recv(1024).decode('utf-8', errors='ignore').strip()
if banner:
print(f" 🖥️ Port {port} Banner: {banner[:100]}{'...' if len(banner) > 100 else ''}")
except Exception as e:
print(f" ⚠️ Port {port}: Could not retrieve banner - {str(e)}")
def header_analyzer(self):
print("\n📋 Header Analyzer")
print("=" * 50)
url = self.prompt_for_input("Enter website URL")
if not url:
print("❌ URL is required.")
return
print(f"[+] Analyzing headers for: {url}")
try:
builder = HeaderAnalyzerBuilder(url)
results = builder.run()
if not results:
print("❌ No results returned")
return
if 'error' in results:
print(f"❌ {results['error']}")
return
status_code = results.get('status_code', 'Unknown')
server_info = results.get('server_info', 'Unknown')
powered_by = results.get('powered_by', 'Unknown')
print(f"[+] Status Code: {status_code}")
print(f"[+] Server: {server_info}")
print(f"[+] Powered By: {powered_by}")
print("\n[+] Security Headers Analysis:")
security_analysis = results.get('security_analysis', {})
for header, info in security_analysis.items():
status = "✅" if info.get('present') else "❌"
value = info.get('value') or 'Missing'
print(f" {status} {header}: {value}")
except Exception as e:
print(f"❌ Error: {str(e)}")
def ssl_checker(self):
print("\n🔒 SSL/TLS Checker")
print("=" * 50)
hostname = self.prompt_for_input("Enter website hostname")
if not hostname:
print("❌ Hostname is required.")
return
print(f"[+] Checking SSL/TLS for: {hostname}")
try:
builder = SSLCheckerBuilder(hostname)
results = builder.run()
if not results:
print("❌ No results returned")
return
ssl_version = results.get('ssl_version', 'None')
print(f"[+] SSL Version: {ssl_version}")
cipher = results.get('cipher')
cipher_text = cipher[0] if cipher else 'None'
print(f"[+] Cipher: {cipher_text}")
valid = results.get('valid', False)
print(f"[+] Certificate Valid: {valid}")
if valid and results.get('certificate'):
cert = results['certificate']
print(f"[+] Issuer: {cert.get('issuer', 'Unknown')}")
print(f"[+] Valid From: {cert.get('valid_from', 'Unknown')}")
print(f"[+] Valid To: {cert.get('valid_to', 'Unknown')}")
print(f"[+] Days Until Expiry: {cert.get('days_until_expiry', 'Unknown')}")
elif not valid and results.get('error'):
print(f"❌ Error: {results['error']}")
except Exception as e:
print(f"❌ Error: {str(e)}")
def dns_enumeration(self):
print("\n🌍 DNS Enumeration")
print("=" * 50)
domain = self.prompt_for_input("Enter domain")
if not domain:
print("❌ Domain is required.")
return
print(f"[+] Enumerating DNS for: {domain}")
try:
builder = DNSEnumerationBuilder(domain)
results = builder.run()
if not results:
print("❌ No results returned")
return
if 'error' in results:
print(f"❌ {results['error']}")
return
for record_type in ['a_records', 'aaaa_records', 'mx_records', 'ns_records', 'txt_records',
'cname_records', 'soa_record', 'ptr_records', 'srv_records']:
value = results.get(record_type)
if isinstance(value, list) or isinstance(value, dict):
value_text = ', '.join([str(v) for v in value]) if value else 'None'
else:
value_text = str(value) if value else 'None'
print(f"[+] {record_type.replace('_', ' ').upper()}: {value_text}")
except Exception as e:
print(f"❌ Error: {str(e)}")
def firewall_detector(self):
print("\n🛡️ Firewall Detector")
print("=" * 50)
target_ip = self.prompt_for_input("Enter target IP or URL", "127.0.0.1")
if not target_ip:
print("❌ Target is required.")
return
print(f"[+] Starting firewall detection for: {target_ip}")
try:
detector = FirewallDetector(target_ip)
results = detector.scan()
for k, v in results.items():
print(f"{k:<10} : {v}")
print(f"\n[+] Scan completed at {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
# ذخیره نتایج
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
output_file = f"firewall_results_{target_ip.replace(':', '_')}_{timestamp}.txt"
with open(output_file, "w") as f:
for k, v in results.items():
f.write(f"{k:<10} : {v}\n")
print(f"[+] Results saved to: {output_file}")
except Exception as e:
print(f"❌ Error: {str(e)}")
def subdomain_enumeration(self):
print("\n🌐 Subdomain Enumeration")
print("=" * 50)
domain = self.prompt_for_input("Enter target domain")
if not domain:
print("❌ Domain is required.")
return
threads_input = self.prompt_for_input("Threads", "20")
threads = int(threads_input) if threads_input.isdigit() else 20
wordlist_path = os.path.join("Web","Advanced_Subdomain", "SubDomains.txt")
try:
with open(wordlist_path, "r", encoding="utf-8") as f:
wordlist = [line.strip() for line in f if line.strip()]
except Exception as e:
print(f"❌ Failed to load wordlist: {e}")
return
print(f"[+] Starting subdomain enumeration for: {domain}")
print(f"[+] Using {threads} threads")
print(f"[+] Wordlist contains {len(wordlist)} subdomains")
found = []
total = len(wordlist)
def check_sub(sub, index):
urls = [f"http://{sub}.{domain}", f"https://{sub}.{domain}"]
for url in urls:
try:
r = requests.get(url, timeout=2)
if r.status_code < 400:
found.append(url)
print(f"[+ ✅] Found: {url}")
break
except:
continue
progress = int((index + 1) / total * 100)
if (index + 1) % 100 == 0:
print(f"[*] Progress: {progress}% | {index + 1}/{total} subdomains")
try:
from concurrent.futures import ThreadPoolExecutor, as_completed
with ThreadPoolExecutor(max_workers=threads) as executor:
futures = {executor.submit(check_sub, sub, i): sub for i, sub in enumerate(wordlist)}
for future in as_completed(futures):
if self.stop_flag["stop"]:
print("[!] Enumeration stopped by user")
executor.shutdown(wait=False)
return
except Exception as e:
print(f"❌ Error: {str(e)}")
print(f"\n✅ Enumeration completed! Found {len(found)} subdomains:")
for sub in found:
print(f" {sub}")
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
output_file = f"subdomains_{domain}_{timestamp}.txt"
with open(output_file, "w") as f:
for sub in found:
f.write(sub + "\n")
print(f"[+] Results saved to: {output_file}")
def open_directory(self, path):
try:
if os.path.exists(path):
if os.name == 'nt':
os.startfile(path)
print(f"📂 Opened Windows Explorer: {path}")
elif os.name == 'posix':
if sys.platform == 'darwin':
subprocess.run(['open', path])
print(f"📂 Opened Finder: {path}")
else:
subprocess.run(['xdg-open', path])
print(f"📂 Opened file manager: {path}")
else:
print(f"📁 Directory path: {path}")
print("⚠️ Unsupported operating system. Please open the directory manually.")
else:
print("❌ Directory does not exist.")
except Exception as e:
print(f"❌ Error opening directory: {str(e)}")
print(f"📁 You can manually navigate to: {path}")
def launch_gui_application(self):
try:
base_dir = os.path.dirname(os.path.abspath(__file__))
gui_path = os.path.join(base_dir, "GUI", "Application.py")
if os.path.exists(gui_path):
print("🚀 Launching GUI Application...")
# تشخیص پلتفرم برای اجرای بهینه
if os.name == 'nt':
os.system(f'python "{gui_path}"')
else:
os.system(f'python3 "{gui_path}"')
else:
print("❌ GUI application not found. Please check the installation.")
print(f"📁 Expected path: {gui_path}")
gui_dir = os.path.dirname(gui_path)
if os.path.exists(gui_dir):
choice = input("Open GUI directory? (y/n): ").lower().strip()
if choice == 'y':
self.open_directory(gui_dir)
except Exception as e:
print(f"❌ Error launching GUI: {str(e)}")
def infostealer_builder(self):
print("\n💀 InfoStealer Builder")
print("=" * 50)
print("This feature requires the GUI application.")
print("Would you like to launch the GUI version?")
choice = input("Launch GUI? (y/n): ").lower().strip()
if choice == 'y':
self.launch_gui_application()
else:
print("ℹ️ You can manually run the GUI from the GUI/Application.py directory")
print(f"📟 Detected platform: {sys.platform} ({os.name})")
open_dir = input("Open GUI directory? (y/n): ").lower().strip()
if open_dir == 'y':
base_dir = os.path.dirname(os.path.abspath(__file__))
gui_dir = os.path.join(base_dir, "GUI")
self.open_directory(gui_dir)
def rdp_sec_info(self):
print("\n🔒 RDP Security (RAT) Tool")
print("=" * 50)
print("This feature requires the GUI application.")
print("Would you like to launch the GUI version?")
choice = input("Launch GUI? (y/n): ").lower().strip()
if choice == 'y':
self.launch_gui_application()
else:
print("ℹ️ You can manually run the GUI from the GUI/Application.py directory")
print(f"📟 Detected platform: {sys.platform} ({os.name})")
open_dir = input("Open GUI directory? (y/n): ").lower().strip()
if open_dir == 'y':
base_dir = os.path.dirname(os.path.abspath(__file__))
gui_dir = os.path.join(base_dir, "GUI")
self.open_directory(gui_dir)
def ransomapp_builder(self):
print("\n💣 RansomApp Builder")
print("=" * 50)
print("This feature requires the GUI application.")
print("Would you like to launch the GUI version?")
choice = input("Launch GUI? (y/n): ").lower().strip()
if choice == 'y':
self.launch_gui_application()
else:
print("ℹ️ You can manually run the GUI from the GUI/Application.py directory")
print(f"📟 Detected platform: {sys.platform} ({os.name})")
open_dir = input("Open GUI directory? (y/n): ").lower().strip()
if open_dir == 'y':
base_dir = os.path.dirname(os.path.abspath(__file__))
gui_dir = os.path.join(base_dir, "GUI")
self.open_directory(gui_dir)
def phishcapture(self):
print("\n🎣 PhishCapture (Fake Pages)")
print("=" * 50)
while True:
print("\n📋 Select Phishing Page Type:")
print("1. Steam Phishing Page")
print("2. Instagram Phishing Page")
print("3. Picture Capture")
print("4. Location Capture")
print("5. Back to Main Menu")