Repository navigation
Expand file tree
/
Copy pathmenu.py
More file actions
1393 lines (1179 loc) · 59.1 KB
/
Copy pathmenu.py
File metadata and controls
1393 lines (1179 loc) · 59.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
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
#!/usr/bin/env python3
"""
╔══════════════════════════════════════════════════════════════════════╗
║ S·H·I·V — recon_toolkit — INTERACTIVE MENU ║
║ Security Hunting · Intelligence · Vulnerability Assessment ║
║ 1. DNS Enumeration — zone transfer, records, subdomain brute ║
║ 2. Host Discovery — ARP, ICMP, TCP, UDP multi-method ║
║ 3. OS Scan — TTL, TCP stack, banners, ICMP quirks ║
║ 4. Ping Sweep — threaded ICMP/TCP with evasion options ║
║ 5. Port Scan — SYN/Connect/FIN/XMAS/ACK/UDP + services ║
║ 6. Vulnerability Scan — CVE DB, SSL audit, default creds ║
║ 7. Wireless Adapter — auto-detect, monitor mode, hop channels ║
║ P. PCAP Settings — toggle capture, set output directory ║
║ 0. Exit ║
╚══════════════════════════════════════════════════════════════════════╝
Usage:
sudo python3 menu.py (root recommended)
python3 menu.py (non-root, reduced feature set)
"""
import sys
import os
import re
import time
import threading
import socket
from datetime import datetime
# ── Path setup: SCRIPT_DIR is the project root (recon-toolkit/) ──────────────
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, SCRIPT_DIR) # makes recon pkg importable
sys.path.insert(0, os.path.join(SCRIPT_DIR, "tools")) # makes standalone tools importable
try:
from recon.core.logger import print_banner as _full_banner, print_compact_header
_HAS_LOGGER = True
except Exception:
_HAS_LOGGER = False
# ── Optional Scapy (needed for PCAP) ─────────────────────────────────────────
try:
from scapy.all import wrpcap, sniff, conf as _scapy_conf
_scapy_conf.verb = 0
SCAPY = True
except ImportError:
SCAPY = False
# ═════════════════════════════════════════════════════════════════════════════
# COLOURS & UI HELPERS
# ═════════════════════════════════════════════════════════════════════════════
class C:
RED = "\033[91m"; GRN = "\033[92m"; YLW = "\033[93m"
CYN = "\033[96m"; MAG = "\033[95m"; BLU = "\033[94m"
BOLD = "\033[1m"; DIM = "\033[2m"; R = "\033[0m"
LINE = "\033[90m" + "─" * 70 + "\033[0m"
def banner():
"""Compact header shown at the top of every menu screen (not the full launch banner)."""
os.system('cls' if os.name == 'nt' else 'clear')
if _HAS_LOGGER:
try:
print_compact_header()
return
except Exception:
pass
# Fallback: plain header
ts = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"\033[1;38;5;51m SHIV-recon_toolkit\033[0m"
f"\033[38;5;238m ◈ \033[0m"
f"\033[2;38;5;240m{ts}\033[0m\n")
def hdr(title, description=""):
print(f"\n{C.LINE}")
print(f" {C.BOLD}{C.CYN}{title}{C.R}")
if description:
print(f" {C.DIM}{description}{C.R}")
print(f"{C.LINE}\n")
def info(m): print(f"{C.CYN} [*]{C.R} {m}")
def ok(m): print(f"{C.GRN} [+]{C.R} {m}")
def warn(m): print(f"{C.YLW} [!]{C.R} {m}")
def err(m): print(f"{C.RED} [✗]{C.R} {m}")
def sep(): print(f" {C.DIM}{'─' * 50}{C.R}")
def ask(prompt, default=""):
try:
v = input(f" {C.YLW}→{C.R} {prompt} [{C.BOLD}{default}{C.R}]: ").strip()
return v if v else default
except (KeyboardInterrupt, EOFError):
print()
return default
def ask_int(prompt, default, lo=1, hi=65535):
while True:
raw = ask(prompt, str(default))
try:
v = int(raw)
if lo <= v <= hi:
return v
warn(f"Must be between {lo} and {hi}")
except ValueError:
warn("Please enter a whole number")
def ask_float(prompt, default):
while True:
raw = ask(prompt, str(default))
try:
return float(raw)
except ValueError:
warn("Please enter a number (e.g. 1.0)")
def pause():
input(f"\n {C.DIM}Press Enter to return to menu…{C.R}")
# ═════════════════════════════════════════════════════════════════════════════
# PCAP CAPTURE ENGINE
# Passive background sniffer — captures ALL traffic while a scan runs.
# ═════════════════════════════════════════════════════════════════════════════
_pcap_enabled = False # globally toggled from PCAP Settings menu
_pcap_dir = "./pcaps" # output directory
_pcap_active = False # True only during an active scan
_pcap_packets = [] # accumulated packet buffer
_pcap_lock = threading.Lock()
_pcap_stop_evt = None # threading.Event to stop the sniffer thread
_pcap_thread = None # background sniff thread
class PCAPCapture:
"""
Inline passive PCAP capture.
Sniffs all traffic on the default interface in a background thread
while a scan runs, then flushes to a named file on stop().
Filename format:
<ScanName>_<YYYYMMDD>_<HHMMSS>.pcap
e.g. DNS_Enumeration_20240427_143022.pcap
"""
path = None # path of the current output file
_label = "" # scan name used for logging
# ── start ──────────────────────────────────────────────────────────
@classmethod
def start(cls, scan_name: str):
"""Begin capture. No-op if PCAP is disabled or Scapy unavailable."""
global _pcap_active, _pcap_packets, _pcap_stop_evt, _pcap_thread
if not _pcap_enabled:
return
if not SCAPY:
warn("Scapy not installed — PCAP unavailable. pip3 install scapy")
return
# Build filename
safe = re.sub(r"[^A-Za-z0-9_-]", "_", scan_name.strip())
safe = re.sub(r"_+", "_", safe).strip("_")
ts = datetime.now().strftime("%Y%m%d_%H%M%S")
filename = f"{safe}_{ts}.pcap"
os.makedirs(_pcap_dir, exist_ok=True)
cls.path = os.path.join(_pcap_dir, filename)
cls._label = scan_name
with _pcap_lock:
_pcap_packets = []
_pcap_active = True
_pcap_stop_evt = threading.Event()
def _sniffer():
try:
sniff(
prn = _pcap_record,
store = False,
stop_filter = lambda _: _pcap_stop_evt.is_set(),
)
except Exception:
pass
_pcap_thread = threading.Thread(target=_sniffer, daemon=True)
_pcap_thread.start()
info(f"PCAP capture started → {C.BOLD}{cls.path}{C.R}")
# ── stop ───────────────────────────────────────────────────────────
@classmethod
def stop(cls):
"""Stop capture and flush packets to disk."""
global _pcap_active, _pcap_packets, _pcap_stop_evt, _pcap_thread
if not _pcap_active:
return
# Signal sniffer to stop and wait briefly for it to drain
if _pcap_stop_evt:
_pcap_stop_evt.set()
if _pcap_thread:
_pcap_thread.join(timeout=3)
with _pcap_lock:
_pcap_active = False
pkts = list(_pcap_packets)
_pcap_packets = []
if not pkts:
if cls.path:
warn(f"No packets captured for '{cls._label}'")
return
try:
wrpcap(cls.path, pkts)
size = os.path.getsize(cls.path)
ok(f"PCAP saved → {C.BOLD}{cls.path}{C.R} "
f"({len(pkts):,} packets · {size:,} bytes)")
except Exception as e:
warn(f"wrpcap failed: {e}")
def _pcap_record(pkt):
"""Callback for every packet sniffed during a scan."""
global _pcap_active, _pcap_packets
if _pcap_active:
with _pcap_lock:
_pcap_packets.append(pkt)
def _pcap_status():
"""One-line status string shown on every menu screen."""
if _pcap_enabled:
return (f" {C.GRN}{C.BOLD}PCAP ON{C.R} "
f"{C.DIM}→ {_pcap_dir} "
f"(ScanName_YYYYMMDD_HHMMSS.pcap){C.R}")
else:
return (f" {C.YLW}PCAP OFF{C.R} "
f"{C.DIM}— press P to configure / "
f"each scan will prompt you{C.R}")
def _maybe_start_pcap(label: str) -> bool:
"""
Start capture if PCAP is globally ON.
If PCAP is globally OFF, ask the user for a one-off capture.
Returns True if a capture session was started.
"""
global _pcap_enabled
if _pcap_enabled:
PCAPCapture.start(label)
return True
# One-off prompt
sep()
ans = ask("Save this scan to a PCAP file? (y/n)", "n").lower()
if ans == "y":
# Temporarily enable for this run only
_pcap_enabled = True
PCAPCapture.start(label)
return True # caller restores _pcap_enabled via _stop_pcap(True)
return False
def _stop_pcap(was_temp: bool):
"""Stop capture; restore OFF state if PCAP was only temporarily enabled."""
global _pcap_enabled
PCAPCapture.stop()
if was_temp:
_pcap_enabled = False
# ═════════════════════════════════════════════════════════════════════════════
# PCAP SETTINGS SUBMENU
# ═════════════════════════════════════════════════════════════════════════════
def menu_pcap_settings():
global _pcap_enabled, _pcap_dir
while True:
banner()
hdr("PCAP Settings", "Configure inline packet capture for scan sessions")
print(_pcap_status())
print()
print(f" {C.CYN}1.{C.R} Toggle PCAP "
f"({'currently ' + C.GRN + 'ON' + C.R if _pcap_enabled else 'currently ' + C.YLW + 'OFF' + C.R})")
print(f" {C.CYN}2.{C.R} Set output directory "
f"{C.DIM}(current: {_pcap_dir}){C.R}")
print(f" {C.CYN}0.{C.R} Back to main menu")
print()
choice = ask("Select", "0")
if choice == "1":
_pcap_enabled = not _pcap_enabled
state = f"{C.GRN}ENABLED{C.R}" if _pcap_enabled else f"{C.YLW}DISABLED{C.R}"
print(f"\n PCAP capture {state}")
if _pcap_enabled:
info(f"Files will be saved to: {C.BOLD}{_pcap_dir}{C.R}")
info("Format: ScanName_YYYYMMDD_HHMMSS.pcap")
time.sleep(1)
elif choice == "2":
new_dir = ask("Output directory", _pcap_dir).strip()
if new_dir:
_pcap_dir = new_dir
try:
os.makedirs(_pcap_dir, exist_ok=True)
ok(f"PCAP directory set → {C.BOLD}{_pcap_dir}{C.R}")
except Exception as e:
warn(f"Could not create directory: {e}")
time.sleep(1)
elif choice == "0":
break
else:
warn("Enter 1, 2 or 0")
# ═════════════════════════════════════════════════════════════════════════════
# TOOL 1 — DNS ENUMERATION
# ═════════════════════════════════════════════════════════════════════════════
def menu_dns_enum():
while True:
banner()
hdr("DNS Enumeration",
"Zone transfers · Subdomain brute-force · Record enumeration · Cache snooping")
print(_pcap_status())
print()
print(f" {C.CYN}1.{C.R} Full enumeration — all methods combined")
print(f" {C.CYN}2.{C.R} Zone transfer only — AXFR attempt against all NS")
print(f" {C.CYN}3.{C.R} DNS records only — A/AAAA/MX/NS/TXT/SOA/SRV/CAA")
print(f" {C.CYN}4.{C.R} Subdomain brute-force")
print(f" {C.CYN}5.{C.R} Reverse DNS sweep — PTR lookups over CIDR")
print(f" {C.CYN}0.{C.R} Back")
print()
choice = ask("Select attack", "0")
if choice == "0":
break
elif choice in ("1","2","3","4","5"):
domain = ask("Target domain", "example.com")
threads = ask_int("Threads", 10, 1, 200)
timeout = ask_int("Timeout (s)", 3, 1, 30)
wordlist = None
if choice in ("1","4"):
wl_default = os.path.join(SCRIPT_DIR, "wordlists", "subdomains.txt")
wl = ask("Subdomain wordlist (Enter = built-in)", wl_default)
wordlist = wl if wl and os.path.exists(wl) else None
cidr = None
if choice == "5":
cidr = ask("CIDR range for reverse sweep", "192.168.1.0/24")
was_temp = _maybe_start_pcap("DNS_Enumeration")
try:
from dns_enum import DNSEnumerator
e = DNSEnumerator(domain, threads, timeout, wordlist)
if choice == "1":
e.run_full(wordlist)
elif choice == "2":
e.zone_transfer()
elif choice == "3":
e.enumerate_records()
elif choice == "4":
e.wildcard_check()
e.subdomain_bruteforce(wordlist)
elif choice == "5":
e.reverse_lookup_range(cidr)
except ImportError as ex:
err(f"Could not import dns_enum: {ex}")
except KeyboardInterrupt:
warn("Interrupted.")
finally:
_stop_pcap(was_temp)
pause()
else:
warn("Enter 1–5 or 0")
# ═════════════════════════════════════════════════════════════════════════════
# TOOL 2 — HOST DISCOVERY
# ═════════════════════════════════════════════════════════════════════════════
def menu_host_discovery():
while True:
banner()
hdr("Host Discovery",
"ARP sweep · ICMP echo · TCP port probing · UDP service probing")
print(_pcap_status())
print()
print(f" {C.CYN}1.{C.R} Full discovery — ARP + ICMP + TCP fallback")
print(f" {C.CYN}2.{C.R} ARP sweep only — Layer 2, local network only")
print(f" {C.CYN}3.{C.R} ICMP sweep only — ping sweep")
print(f" {C.CYN}4.{C.R} TCP sweep only — no root needed")
print(f" {C.CYN}5.{C.R} UDP probe sweep — DNS/NTP/SNMP probes")
print(f" {C.CYN}0.{C.R} Back")
print()
choice = ask("Select attack", "0")
if choice == "0":
break
elif choice in ("1","2","3","4","5"):
target = ask("Target (IP / CIDR / range e.g. 192.168.1.0/24)",
"192.168.1.0/24")
threads = ask_int("Threads", 50, 1, 500)
timeout = ask_float("Timeout (s)", 1.0)
was_temp = _maybe_start_pcap("Host_Discovery")
try:
from host_discovery import HostDiscovery
from recon_utils import expand_cidr
disc = HostDiscovery(target, threads, timeout)
if choice == "1":
disc.run_full()
elif choice == "2":
disc.arp_sweep(target)
elif choice == "3":
hosts = expand_cidr(target) if "/" in target else [target]
disc.icmp_sweep(hosts)
elif choice == "4":
hosts = expand_cidr(target) if "/" in target else [target]
disc.tcp_sweep(hosts)
elif choice == "5":
hosts = expand_cidr(target) if "/" in target else [target]
disc.udp_sweep(hosts)
except ImportError as ex:
err(f"Could not import host_discovery: {ex}")
except KeyboardInterrupt:
warn("Interrupted.")
finally:
_stop_pcap(was_temp)
pause()
else:
warn("Enter 1–5 or 0")
# ═════════════════════════════════════════════════════════════════════════════
# TOOL 3 — OS SCAN
# ═════════════════════════════════════════════════════════════════════════════
def menu_os_scan():
while True:
banner()
hdr("OS Scan",
"TTL fingerprinting · TCP stack analysis · Banner grabbing · ICMP quirks")
print(_pcap_status())
print()
print(f" {C.CYN}1.{C.R} Full OS scan — all methods, best confidence")
print(f" {C.CYN}2.{C.R} TTL fingerprint — fast, no root needed")
print(f" {C.CYN}3.{C.R} TCP stack analysis — window/options/DF (root needed)")
print(f" {C.CYN}4.{C.R} Banner grabbing — service version extraction")
print(f" {C.CYN}5.{C.R} ICMP quirk probes — type 13/17 responses")
print(f" {C.CYN}0.{C.R} Back")
print()
choice = ask("Select attack", "0")
if choice == "0":
break
elif choice in ("1","2","3","4","5"):
target = ask("Target IP / hostname", "192.168.1.100")
timeout = ask_int("Timeout (s)", 3, 1, 30)
ports = None
if choice in ("1","4"):
raw = ask("Ports for banner scan (comma-sep, Enter = default)",
"21,22,80,443,3306,6379")
ports = [int(p) for p in raw.split(",")
if p.strip().isdigit()] or None
tcp_port = 80
if choice == "3":
tcp_port = ask_int("Port to probe for TCP fingerprint", 80, 1, 65535)
was_temp = _maybe_start_pcap("OS_Scan")
try:
from os_scan import OSScanner
scanner = OSScanner(target, timeout)
if choice == "1":
scanner.run_full(ports)
elif choice == "2":
scanner.ttl_fingerprint()
elif choice == "3":
scanner.tcp_fingerprint(tcp_port)
elif choice == "4":
scanner.banner_fingerprint(ports)
elif choice == "5":
scanner.icmp_quirks()
except ImportError as ex:
err(f"Could not import os_scan: {ex}")
except KeyboardInterrupt:
warn("Interrupted.")
finally:
_stop_pcap(was_temp)
pause()
else:
warn("Enter 1–5 or 0")
# ═════════════════════════════════════════════════════════════════════════════
# TOOL 4 — PING SWEEP
# ═════════════════════════════════════════════════════════════════════════════
def menu_ping_sweep():
while True:
banner()
hdr("Ping Sweep",
"Fast multi-threaded ICMP + TCP sweep · OS hints · Reverse DNS")
print(_pcap_status())
print()
print(f" {C.CYN}1.{C.R} Standard sweep — ICMP → sys ping → TCP fallback")
print(f" {C.CYN}2.{C.R} Randomized sweep — shuffled order, evades IDS")
print(f" {C.CYN}3.{C.R} Fast sweep — high thread count, low timeout")
print(f" {C.CYN}4.{C.R} Custom sweep — full parameter control")
print(f" {C.CYN}0.{C.R} Back")
print()
choice = ask("Select attack", "0")
if choice == "0":
break
elif choice in ("1","2","3","4"):
target = ask("Target (IP / CIDR / range)", "192.168.1.0/24")
# Set defaults by mode
if choice == "1":
threads, timeout, randomize = 100, 1.0, False
elif choice == "2":
threads, timeout, randomize = 100, 1.0, True
elif choice == "3":
threads, timeout, randomize = 300, 0.3, False
else: # custom
threads = ask_int("Threads", 100, 1, 1000)
timeout = ask_float("Timeout (s)", 1.0)
randomize = ask("Randomize order? (y/n)", "n").lower() == "y"
was_temp = _maybe_start_pcap("Ping_Sweep")
try:
from ping_sweep import PingSweep
sweep = PingSweep(target, threads, timeout, randomize)
sweep.run()
except ImportError as ex:
err(f"Could not import ping_sweep: {ex}")
except KeyboardInterrupt:
warn("Interrupted.")
finally:
_stop_pcap(was_temp)
pause()
else:
warn("Enter 1–4 or 0")
# ═════════════════════════════════════════════════════════════════════════════
# TOOL 5 — PORT SCAN
# ═════════════════════════════════════════════════════════════════════════════
def menu_port_scan():
while True:
banner()
hdr("Port Scan",
"SYN · Connect · FIN · XMAS · ACK · UDP + service/version detection")
print(_pcap_status())
print()
print(f" {C.BOLD}TCP Scans:{C.R}")
print(f" {C.CYN}1.{C.R} SYN scan — stealth half-open (root needed)")
print(f" {C.CYN}2.{C.R} Connect scan — full TCP, no root needed")
print(f" {C.CYN}3.{C.R} FIN scan — stealth, evades some firewalls")
print(f" {C.CYN}4.{C.R} XMAS scan — FIN+PSH+URG flags")
print(f" {C.CYN}5.{C.R} ACK scan — firewall rule detection")
print()
print(f" {C.BOLD}UDP & Combined:{C.R}")
print(f" {C.CYN}6.{C.R} UDP scan — DNS/SNMP/NTP/NetBIOS probes")
print(f" {C.CYN}7.{C.R} Full scan — SYN + UDP combined (root needed)")
print()
print(f" {C.BOLD}Port Presets:{C.R} "
f"{C.DIM}top20 · top100 · all · 1-1024 · custom{C.R}")
print()
print(f" {C.CYN}0.{C.R} Back")
print()
choice = ask("Select scan type", "0")
if choice == "0":
break
elif choice in ("1","2","3","4","5","6","7"):
target = ask("Target IP / hostname", "192.168.1.100")
# Port range selection sub-prompt
print()
print(f" {C.DIM}Port presets: top20 · top100 · all · 1-1024 · "
f"or enter e.g. 80,443,8080{C.R}")
port_range = ask("Port range / preset", "top100")
threads = ask_int("Threads", 200, 1, 1000)
timeout = ask_float("Timeout (s)", 1.0)
scan_map = {
"1": "syn", "2": "connect",
"3": "fin", "4": "xmas",
"5": "ack", "6": "udp",
"7": "syn", # full = syn + udp
}
scan_type = scan_map[choice]
include_udp = (choice == "7")
was_temp = _maybe_start_pcap("Port_Scan")
try:
from port_scan import PortScanner
scanner = PortScanner(target, threads, timeout, scan_type)
if "," in port_range:
port_list = [int(p) for p in port_range.split(",")
if p.strip().isdigit()]
proto = "udp" if choice == "6" else "tcp"
scanner.scan_ports(port_list, proto)
else:
scanner.run_full(port_range, include_udp=include_udp)
except ImportError as ex:
err(f"Could not import port_scan: {ex}")
except KeyboardInterrupt:
warn("Interrupted.")
finally:
_stop_pcap(was_temp)
pause()
else:
warn("Enter 1–7 or 0")
# ═════════════════════════════════════════════════════════════════════════════
# TOOL 6 — VULNERABILITY SCAN
# ═════════════════════════════════════════════════════════════════════════════
def menu_vuln_scan():
while True:
banner()
hdr("Vulnerability Scan",
"CVE detection · SSL/TLS audit · Default credentials · Misconfigurations")
print(_pcap_status())
print()
print(f" {C.CYN}1.{C.R} Full vulnerability scan — auto port scan + all checks")
print(f" {C.CYN}2.{C.R} Specific ports only — run all checks on chosen ports")
print(f" {C.CYN}3.{C.R} SSL/TLS audit only — protocol, cipher, certificate")
print(f" {C.CYN}4.{C.R} CVE banner check — match banner against CVE DB")
print(f" {C.CYN}5.{C.R} Default credential test — FTP / Redis default logins")
print(f" {C.CYN}6.{C.R} Misconfiguration check — Telnet, anon FTP, open Redis/Mongo")
print()
print(f" {C.DIM} CVE DB covers: OpenSSH · Apache · nginx · OpenSSL · MySQL")
print(f" {C.DIM} vsftpd · Log4j · Struts · ProFTPD · Samba{C.R}")
print()
print(f" {C.CYN}0.{C.R} Back")
print()
choice = ask("Select attack", "0")
if choice == "0":
break
elif choice in ("1","2","3","4","5","6"):
target = ask("Target IP / hostname", "192.168.1.100")
timeout = ask_int("Timeout (s)", 5, 1, 60)
ssl_port = 443
ports = []
service = ""
banner_text = ""
if choice == "2":
raw = ask("Ports (comma-separated)", "22,80,443,21,6379")
ports = [int(p) for p in raw.split(",") if p.strip().isdigit()]
elif choice == "3":
ssl_port = ask_int("SSL/TLS port", 443, 1, 65535)
elif choice == "4":
raw = ask("Ports to banner-check (comma-sep)", "22,80,21,3306")
ports = [int(p) for p in raw.split(",") if p.strip().isdigit()]
elif choice == "5":
print(f"\n {C.DIM}Services: ftp · redis{C.R}")
service = ask("Service to test", "ftp").lower()
port = ask_int("Port", 21 if service == "ftp" else 6379, 1, 65535)
elif choice == "6":
raw = ask("Ports to check (comma-sep)", "21,23,80,6379,27017")
ports = [int(p) for p in raw.split(",") if p.strip().isdigit()]
was_temp = _maybe_start_pcap("Vuln_Scan")
try:
from vuln_scan import VulnerabilityScanner
from recon_utils import grab_banner
scanner = VulnerabilityScanner(target, timeout=timeout)
if choice == "1":
scanner.run_full()
elif choice == "2":
fake_ports = []
for p in ports:
b = grab_banner(target, p, timeout) or ""
fake_ports.append({"port": p, "service": "", "banner": b})
scanner.run_full(fake_ports)
elif choice == "3":
scanner.ssl_audit(ssl_port)
elif choice == "4":
for p in ports:
b = grab_banner(target, p, timeout) or ""
if b:
info(f"Port {p}: {b[:80]}")
scanner.check_service_vulns(p, b)
else:
warn(f"Port {p}: no banner received")
elif choice == "5":
scanner.test_default_credentials(service, port)
elif choice == "6":
for p in ports:
b = grab_banner(target, p, timeout) or ""
# Infer service name
svc_map = {21: "ftp", 23: "telnet", 80: "http",
6379: "redis", 27017: "mongodb"}
svc = svc_map.get(p, "")
scanner.check_misconfigurations(p, svc, b)
except ImportError as ex:
err(f"Could not import vuln_scan: {ex}")
except KeyboardInterrupt:
warn("Interrupted.")
finally:
_stop_pcap(was_temp)
pause()
else:
warn("Enter 1–6 or 0")
# ═════════════════════════════════════════════════════════════════════════════
# TOOL 7 — WIRELESS ADAPTER
# ═════════════════════════════════════════════════════════════════════════════
def menu_wireless():
banner()
hdr("Wireless Adapter",
"Auto-detect · Monitor mode · Channel hopping")
if os.name != "posix" or os.geteuid() != 0:
warn("Monitor mode requires root on Linux.")
warn("Run with: sudo python3 menu.py")
pause()
return
try:
from recon.modules.wireless import WirelessManager
wm = WirelessManager()
print()
print(f" {C.CYN}1.{C.R} Auto-setup (detect + enable monitor mode)")
print(f" {C.CYN}2.{C.R} List wireless interfaces")
print(f" {C.CYN}3.{C.R} Enable monitor mode on specific interface")
print(f" {C.CYN}4.{C.R} Disable monitor mode")
print(f" {C.CYN}5.{C.R} Start channel hopping")
print(f" {C.CYN}0.{C.R} Back")
print()
choice = ask("Select", "0")
if choice == "0":
return
elif choice == "1":
monitor = wm.auto_setup()
if monitor:
ok(f"Monitor interface ready: {C.BOLD}{monitor}{C.R}")
hop = ask("Start channel hopping? (y/n)", "n").lower()
if hop == "y":
try:
info("Press Ctrl+C to stop hopping")
wm.hop_channels(monitor)
except KeyboardInterrupt:
pass
input(f"\n {C.DIM}Press Enter to disable monitor mode and return…{C.R}")
wm.disable_monitor_mode(wm.get_monitor_interface() or monitor)
else:
err("Monitor mode setup failed")
elif choice == "2":
ifaces = wm.discover_interfaces()
if ifaces:
print(f"\n Detected {len(ifaces)} wireless interface(s):")
for iface_info in ifaces:
iface = iface_info["name"]
mode = wm.get_interface_mode(iface)
mac = iface_info.get("mac", "unknown")
print(f" {C.CYN}•{C.R} {iface:<12} mode={mode:<10} mac={mac}")
else:
warn("No wireless interfaces detected")
elif choice == "3":
ifaces = wm.discover_interfaces()
if not ifaces:
warn("No wireless interfaces found")
else:
iface = ask("Interface name",
ifaces[0]["name"] if ifaces else "wlan0")
monitor = wm.enable_monitor_mode(iface)
if monitor:
ok(f"Monitor mode enabled: {C.BOLD}{monitor}{C.R}")
else:
err("Failed to enable monitor mode")
elif choice == "4":
wm.disable_monitor_mode(wm.get_monitor_interface() or "wlan0mon")
elif choice == "5":
iface = ask("Monitor interface", wm.get_monitor_interface() or "wlan0mon")
bands_input = ask("Bands (2.4ghz / 5ghz / both)", "2.4ghz")
interval = ask_float("Seconds per channel", 0.5)
if "both" in bands_input.lower():
bands = ["2.4ghz", "5ghz"]
elif "5" in bands_input:
bands = ["5ghz"]
else:
bands = ["2.4ghz"]
try:
info("Press Ctrl+C to stop hopping")
wm.hop_channels(iface, bands, interval)
except KeyboardInterrupt:
pass
except ImportError as ex:
err(f"Could not import wireless: {ex}")
except SystemExit:
pass
pause()
# ═════════════════════════════════════════════════════════════════════════════
# TOOL 8 — HTTP / WEB PROBE
# ═════════════════════════════════════════════════════════════════════════════
def menu_http_probe():
while True:
banner()
hdr("HTTP / Web Probe",
"WAF · CDN · tech stack · security headers · path discovery · method enum")
print(_pcap_status())
print()
print(f" {C.CYN}1.{C.R} Full probe — all checks combined")
print(f" {C.CYN}2.{C.R} WAF / CDN detection — identify firewall and CDN provider")
print(f" {C.CYN}3.{C.R} Tech stack — CMS · framework · server · JS libs")
print(f" {C.CYN}4.{C.R} Security headers — HSTS · CSP · X-Frame · cookie flags")
print(f" {C.CYN}5.{C.R} Path discovery — admin panels · APIs · config leaks")
print(f" {C.CYN}6.{C.R} HTTP method enum — OPTIONS/PUT/DELETE/TRACE")
print(f" {C.CYN}0.{C.R} Back")
print()
choice = ask("Select", "0")
if choice == "0":
break
elif choice in ("1","2","3","4","5","6"):
target = ask("Target hostname / IP", "192.168.1.100")
port_s = ask("Port (80/443/8080/…)", "80")
port = int(port_s) if port_s.isdigit() else 80
use_ssl = port == 443 or ask("HTTPS? (y/n)", "n").lower() == "y"
was_temp = _maybe_start_pcap("HTTP_Probe")
try:
from recon.modules.http_probe import HTTPProbe
probe = HTTPProbe(target, port=port, use_ssl=use_ssl)
if choice == "1":
fp = probe.probe_all(path_discovery=True)
probe.print_results(fp)
elif choice == "2":
code, hdrs, body = probe._get("/")
waf = probe.detect_waf(code, hdrs, body, hdrs.get("set-cookie",""))
cdn = probe.detect_cdn(hdrs)
ok(f"WAF: {waf or 'none detected'}")
ok(f"CDN: {cdn or 'none detected'}")
elif choice == "3":
code, hdrs, body = probe._get("/")
techs = probe.fingerprint_tech(hdrs, body, "")
ok(f"Technologies: {', '.join(techs) if techs else 'none detected'}")
elif choice == "4":
code, hdrs, body = probe._get("/")
issues = probe.audit_security_headers(hdrs, probe.scheme)
if issues:
for i in issues:
warn(f"[{i['severity']}] {i['header']}: {i['issue']}")
else:
ok("All security headers present")
elif choice == "5":
info("Scanning sensitive paths (this may take a moment)…")
found = probe.discover_paths()
for p in found:
fn = ok if p["status"] == 200 else warn
fn(f"[{p['severity']}] {p['status']} {p['path']} — {p['description']}")
if not found:
ok("No interesting paths found")
elif choice == "6":
methods = probe.enumerate_methods()
ok(f"Allowed methods: {', '.join(methods) or 'unable to determine'}")
except ImportError as ex:
err(f"Could not import http_probe: {ex}")
except KeyboardInterrupt:
warn("Interrupted.")
finally:
_stop_pcap(was_temp)
pause()
else:
warn("Enter 1–6 or 0")
# ═════════════════════════════════════════════════════════════════════════════
# TOOL 9 — TLS / SSL DEEP SCAN
# ═════════════════════════════════════════════════════════════════════════════
def menu_tls_probe():
while True:
banner()
hdr("TLS / SSL Deep Scan",
"Cipher enumeration · cert chain · JA3S fingerprint · CT log discovery")
print(_pcap_status())
print()
print(f" {C.CYN}1.{C.R} Full TLS scan — all checks")
print(f" {C.CYN}2.{C.R} Certificate info — subject · SANs · expiry · key size")
print(f" {C.CYN}3.{C.R} Protocol versions — TLS 1.0/1.1/1.2/1.3 support matrix")
print(f" {C.CYN}4.{C.R} Cipher suites — broken / weak / strong cipher audit")
print(f" {C.CYN}5.{C.R} CT log lookup — enumerate subdomains via crt.sh")
print(f" {C.CYN}0.{C.R} Back")
print()
choice = ask("Select", "0")
if choice == "0":
break
elif choice in ("1","2","3","4","5"):
target = ask("Target hostname / IP", "192.168.1.100")
port = ask_int("Port", 443, 1, 65535)
try:
from recon.modules.tls_probe import TLSProbe
probe = TLSProbe(target, port=port)
if choice == "1":
ct = ask("Query crt.sh CT logs? (y/n)", "n").lower() == "y"
r = probe.scan_all(ct=ct)
probe.print_results(r)
elif choice == "2":
ci = probe.extract_cert()
ok(f"Subject: {ci.subject}")
ok(f"Issuer: {ci.issuer}")
ok(f"Expires: {ci.not_after} ({ci.days_remaining}d remaining)")
ok(f"Key: {ci.key_type} {ci.key_bits}-bit")
ok(f"SHA-256: {ci.fingerprint_sha256[:32]}…")
if ci.san:
info(f"SANs: {', '.join(ci.san[:10])}")
if ci.expired:
err("Certificate is EXPIRED!")
if ci.self_signed:
warn("Self-signed certificate")
elif choice == "3":
probe.probe_protocol_versions()
ok(f"Supported: {', '.join(probe._result.protocols_supported) or 'none'}")
warn(f"Rejected: {', '.join(probe._result.protocols_rejected) or 'none'}")
elif choice == "4":
probe.enumerate_ciphers()