-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
783 lines (678 loc) · 31.2 KB
/
Copy pathmain.py
File metadata and controls
783 lines (678 loc) · 31.2 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
import sys
import os
import json
import time
import asyncio
import platform
import socket
import collections
from datetime import datetime
from typing import Optional, Dict, Any
# Force UTF-8 encoding on Windows to prevent charmap errors with ASCII art
if os.name == "nt":
os.system("chcp 65001 > nul 2>&1")
sys.stdout.reconfigure(encoding="utf-8")
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
from rich.console import Console
from rich.panel import Panel
from rich.table import Table
from rich import box
from core.tor_handler import TorHandler
from core.banner import (
show_screen, clear_screen, print_banner, render_menu,
get_input, ask_target, ask_optional,
is_global_command, handle_global,
wait_enter, print_error, print_success, print_info, print_warning,
GLOBAL_HELP,
)
from modules.darkweb_scraper import DarkWebScraper, display_results
from modules.identity_recon import IdentityRecon
from modules.network_intel import NetworkIntel
from modules.onion_scanner import OnionScanner
from modules.credential_hunt import CredentialHunt
from modules.crypto_tracker import CryptoTracker
console = Console()
# Memory-safe bounded buffer to prevent RAM leaks during long-running sessions
scan_history: collections.deque = collections.deque(maxlen=10000)
tor_instance: Optional[TorHandler] = None
def log_scan(category: str, target: str) -> None:
"""Appends a scan event to the bounded history buffer."""
scan_history.append({
"time": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"category": category,
"target": target,
})
def process_choice(choice: str, menu_key: str) -> Optional[str]:
"""Evaluates user input against global commands and returns a navigation directive."""
glob = is_global_command(choice)
if glob == "back" or glob == "home":
return "back"
if glob == "exit":
handle_global("exit", tor_instance)
return None
if glob:
handle_global(glob, tor_instance)
wait_enter()
return "refresh"
return None
async def menu_darkweb(scraper: DarkWebScraper) -> None:
"""Handles the Dark Web search menu interaction loop."""
while True:
show_screen("darkweb")
choice = get_input("darkweb")
action = process_choice(choice, "darkweb")
if action == "back":
return
if action == "refresh":
continue
prompts = {
"1": ("E-posta adresi girin", "E-posta Arama"),
"2": ("Kullanıcı adı girin", "Kullanıcı Adı Arama"),
"3": ("Telefon numarası girin", "Telefon Arama"),
"4": ("IP adresi girin", "IP Arama"),
"5": ("Domain girin (ör: example.com)", "Domain Arama"),
"6": ("Anahtar kelime girin", "Anahtar Kelime Arama"),
"7": ("Dork sorgusu girin (ör: \"hedef\" site:.onion filetype:sql)", "Dork Arama"),
}
if choice == "8":
targets_input = ask_target("Hedefleri virgülle ayırarak girin")
if targets_input:
targets = [t.strip() for t in targets_input.split(",") if t.strip()]
for t in targets:
console.print(f"\n [bold white]━━━ Hedef: {t} ━━━[/bold white]")
start = time.time()
results = await scraper.scan_all(t)
display_results(t, "Çoklu Tarama", results, time.time() - start)
log_scan("Çoklu Tarama", t)
wait_enter()
continue
if choice in prompts:
prompt_text, label = prompts[choice]
target = ask_target(prompt_text)
if target:
start = time.time()
results = await scraper.scan_all(target)
display_results(target, label, results, time.time() - start)
log_scan(label, target)
wait_enter()
else:
print_error("Geçersiz seçim. Numara girin veya 'help' yazın.")
time.sleep(1.5)
async def menu_identity(identity: IdentityRecon) -> None:
"""Handles the Identity Reconnaissance menu interaction loop."""
while True:
show_screen("identity")
choice = get_input("identity")
action = process_choice(choice, "identity")
if action == "back":
return
if action == "refresh":
continue
actions = {
"1": ("E-posta adresi girin", identity.search_email, "E-posta OSINT"),
"2": ("Kullanıcı adı girin", identity.search_username, "Kullanıcı Profilleme"),
"3": ("Telefon numarası girin", identity.search_phone, "Telefon İzleme"),
"4": ("İsim girin (ör: John Doe)", identity.search_name, "İsim Araştırma"),
"5": ("Domain veya kurum adı girin", identity.search_domain, "Domain OSINT"),
"6": ("Hash girin (MD5/SHA-256)", identity.search_hash, "Hash Kontrolü"),
"7": ("Sosyal medya handle girin (ör: @user)", identity.search_username, "Sosyal Medya"),
"8": ("Adres bilgisi girin", identity.search_name, "Fiziksel Adres"),
}
if choice in actions:
prompt_text, func, label = actions[choice]
target = ask_target(prompt_text)
if target:
await func(target)
log_scan(label, target)
wait_enter()
else:
print_error("Geçersiz seçim.")
time.sleep(1.5)
async def menu_network(network: NetworkIntel) -> None:
"""Handles the Network Intelligence menu interaction loop."""
while True:
show_screen("network")
choice = get_input("network")
action = process_choice(choice, "network")
if action == "back":
return
if action == "refresh":
continue
if choice == "1":
target = ask_target("IP adresi girin")
if target:
await network.ip_geolocation(target)
log_scan("IP Geolocation", target)
wait_enter()
elif choice == "2":
target = ask_target("IP adresi girin")
if target:
await network.reverse_dns(target)
log_scan("Reverse DNS", target)
wait_enter()
elif choice == "3":
target = ask_target("Hedef IP veya hostname girin")
if target:
port_input = ask_optional("Portlar (virgülle ayır, boş = yaygın 25 port)")
ports = None
if port_input:
try:
ports = [int(p.strip()) for p in port_input.split(",") if p.strip()]
except ValueError:
print_error("Geçersiz port formatı. Sayıları virgülle ayırın.")
wait_enter()
continue
await network.port_scan(target, ports)
log_scan("Port Tarama", target)
wait_enter()
elif choice == "4":
target = ask_target("IP adresi girin")
if target:
await network.tor_exit_check(target)
log_scan("Tor Exit Check", target)
wait_enter()
elif choice == "5":
target = ask_target("IP adresi girin")
if target:
await network.ip_reputation(target)
log_scan("IP İtibar", target)
wait_enter()
elif choice == "6":
target = ask_target("URL girin (http:// veya https://)")
if target:
await network.fetch_headers(target)
log_scan("HTTP Header", target)
wait_enter()
elif choice == "7":
target = ask_target("IP veya domain girin")
if target:
await network.whois_lookup(target)
log_scan("WHOIS", target)
wait_enter()
elif choice == "8":
target = ask_target("Domain girin (ör: example.com)")
if target:
console.print(f"\n [bold white][ DNS ] DNS kayıtları sorgulanıyor: {target}[/bold white]")
try:
records = []
for qtype in ["A", "AAAA", "MX", "NS", "TXT"]:
try:
if qtype == "A":
ips = socket.getaddrinfo(target, None, socket.AF_INET)
for ip in set(addr[4][0] for addr in ips):
records.append((qtype, ip))
elif qtype == "AAAA":
ips = socket.getaddrinfo(target, None, socket.AF_INET6)
for ip in set(addr[4][0] for addr in ips):
records.append((qtype, ip))
except socket.gaierror:
pass
resp = await network.tor.get(f"https://dns.google/resolve?name={target}&type=MX", timeout=15)
if resp and resp.status == 200:
data = await resp.json()
for answer in data.get("Answer", []):
records.append(("MX" if answer.get("type") == 15 else "DNS", answer.get("data", "?")))
resp = await network.tor.get(f"https://dns.google/resolve?name={target}&type=NS", timeout=15)
if resp and resp.status == 200:
data = await resp.json()
for answer in data.get("Answer", []):
records.append(("NS", answer.get("data", "?")))
table = Table(
title=f"[bold]DNS KAYITLARI: {target}[/bold]",
box=box.ROUNDED, show_lines=True,
border_style="cyan", header_style="bold cyan", width=70,
)
table.add_column("Tür", style="bold yellow", width=10, justify="center")
table.add_column("Değer", style="white", width=56)
if records:
for rtype, rval in records:
table.add_row(rtype, rval)
else:
table.add_row("-", "[dim]Kayıt bulunamadı[/dim]")
console.print()
console.print(table)
except Exception as e:
print_error(str(e))
log_scan("DNS Kayıt", target)
wait_enter()
elif choice == "9":
target = ask_target("CIDR bloğu girin (ör: 192.168.1.0/24)")
if target:
console.print(f"\n [bold white][ SUBNET ] Subnet tarama: {target}[/bold white]")
try:
import ipaddress
net = ipaddress.ip_network(target, strict=False)
hosts = list(net.hosts())[:20]
console.print(f" [dim]İlk {len(hosts)} host taranıyor (Tor SOCKS)...[/dim]\n")
table = Table(
title=f"[bold]SUBNET TARAMA: {target}[/bold]",
box=box.ROUNDED, show_lines=True,
border_style="cyan", header_style="bold cyan", width=60,
)
table.add_column("#", style="dim", width=4, justify="center")
table.add_column("IP", style="white", width=20)
table.add_column("Port 80", width=12, justify="center")
table.add_column("Port 443", width=12, justify="center")
for idx, ip in enumerate(hosts, 1):
ip_str = str(ip)
console.print(f" [dim]→ {ip_str}[/dim]", end="")
p80 = await network._socks5_connect(ip_str, 80, timeout=5)
p443 = await network._socks5_connect(ip_str, 443, timeout=5)
s80 = "[green]AÇIK[/green]" if p80 else "[dim]kapalı[/dim]"
s443 = "[green]AÇIK[/green]" if p443 else "[dim]kapalı[/dim]"
table.add_row(str(idx), ip_str, s80, s443)
console.print(f" {'✓' if p80 or p443 else '·'}")
console.print()
console.print(table)
except ValueError as e:
print_error(f"Geçersiz CIDR formatı: {e}")
except Exception as e:
print_error(str(e))
log_scan("Subnet Tarama", target)
wait_enter()
else:
print_error("Geçersiz seçim.")
time.sleep(1.5)
async def menu_onion(onion: OnionScanner) -> None:
"""Handles the Onion Scanner menu interaction loop."""
while True:
show_screen("onion")
choice = get_input("onion")
action = process_choice(choice, "onion")
if action == "back":
return
if action == "refresh":
continue
actions = {
"1": ("check_status", ".onion adresi girin"),
"2": ("http_headers", ".onion adresi girin"),
"3": ("page_meta", ".onion adresi girin"),
"4": ("detect_tech", ".onion adresi girin"),
"7": ("extract_links", ".onion adresi girin"),
"8": ("save_text", ".onion adresi girin"),
}
if choice in actions:
method_name, prompt_text = actions[choice]
target = ask_target(prompt_text)
if target:
await getattr(onion, method_name)(target)
log_scan(method_name, target)
wait_enter()
elif choice == "5":
target = ask_target("Onion listesi dosya yolu girin")
if target:
await onion.bulk_scan(target)
log_scan("Toplu Onion", target)
wait_enter()
elif choice == "6":
target = ask_target(".onion adresi girin")
if target:
out = ask_optional("Çıktı dosya adı (boş = otomatik)")
await onion.download_page(target, out or "")
log_scan("Onion İndir", target)
wait_enter()
else:
print_error("Geçersiz seçim.")
time.sleep(1.5)
async def menu_credential(cred: CredentialHunt) -> None:
"""Handles the Credential Hunt menu interaction loop."""
while True:
show_screen("credential")
choice = get_input("credential")
action = process_choice(choice, "credential")
if action == "back":
return
if action == "refresh":
continue
actions = {
"1": ("email_leak", "E-posta adresi girin", "E-posta Leak"),
"2": ("user_pass", "Kullanıcı adı girin", "User:Pass"),
"3": ("combo_search", "Hedef veri girin (email, domain vb.)", "Combo List"),
"4": ("database_dump", "Domain veya tablo adı girin", "DB Dump"),
"5": ("paste_search", "Aranacak veri girin", "Paste Tarama"),
"6": ("hash_search", "Hash girin (MD5/SHA-1/SHA-256)", "Hash Arama"),
"7": ("stealer_search", "E-posta veya domain girin", "Stealer Log"),
"8": ("forum_search", "Hedef veri girin", "Forum Sızıntı"),
}
if choice == "9":
filepath = ask_target("E-posta listesi dosya yolu girin (.txt)")
if filepath:
if not os.path.isfile(filepath):
print_error(f"Dosya bulunamadı: {filepath}")
else:
with open(filepath, "r", encoding="utf-8") as f:
emails = [l.strip() for l in f if l.strip() and "@" in l]
console.print(f"\n [bold white]{len(emails)} e-posta taranacak...[/bold white]")
for idx, email in enumerate(emails, 1):
console.print(f"\n [bold]━━━ [{idx}/{len(emails)}] {email} ━━━[/bold]")
await cred.email_leak(email)
log_scan("Toplu E-posta Leak", email)
wait_enter()
elif choice == "10":
domain = ask_target("Domain girin (ör: example.com)")
if domain:
await cred.email_leak(f"@{domain}")
log_scan("Wildcard Domain", domain)
wait_enter()
elif choice in actions:
method_name, prompt_text, label = actions[choice]
target = ask_target(prompt_text)
if target:
await getattr(cred, method_name)(target)
log_scan(label, target)
wait_enter()
else:
print_error("Geçersiz seçim.")
time.sleep(1.5)
async def menu_crypto(crypto: CryptoTracker) -> None:
"""Handles the Cryptocurrency Tracking menu interaction loop."""
while True:
show_screen("crypto")
choice = get_input("crypto")
action = process_choice(choice, "crypto")
if action == "back":
return
if action == "refresh":
continue
actions = {
"1": ("search_btc", "Bitcoin adresi girin", "BTC Arama"),
"2": ("search_eth", "Ethereum adresi girin (0x...)", "ETH Arama"),
"3": ("search_xmr", "Monero adresi girin", "XMR Arama"),
"4": ("wallet_association", "Cüzdan adresi girin", "Cüzdan İlişki"),
"5": ("ransomware_check", "Cüzdan adresi girin", "Ransomware Check"),
"6": ("wallet_association", "Cüzdan adresi girin", "Mixer/Tumbler"),
}
if choice in actions:
method_name, prompt_text, label = actions[choice]
target = ask_target(prompt_text)
if target:
await getattr(crypto, method_name)(target)
log_scan(label, target)
wait_enter()
else:
print_error("Geçersiz seçim.")
time.sleep(1.5)
async def menu_tools(tor: TorHandler) -> None:
"""Handles the Tools and Settings menu interaction loop."""
from core import database as scan_db
from core import reporter
while True:
show_screen("tools")
choice = get_input("tools")
action = process_choice(choice, "tools")
if action == "back":
return
if action == "refresh":
continue
if choice == "1":
console.print(" [dim]Durum kontrol ediliyor...[/dim]", end="\r")
if tor.session and tor.tor_ip:
console.print(Panel(
f" [bold green]● Tor Bağlantısı Aktif[/bold green]\n\n"
f" [white]Çıkış IP:[/white] {tor.tor_ip}\n"
f" [white]Oturum:[/white] Açık",
title="[bold cyan]TOR DURUMU[/bold cyan]",
border_style="green", box=box.ROUNDED,
))
else:
console.print(Panel(
" [bold red]● Tor Bağlantısı Yok veya Koptu[/bold red]",
title="[bold cyan]TOR DURUMU[/bold cyan]",
border_style="red", box=box.ROUNDED,
))
wait_enter()
elif choice == "2":
# Tor IP Yenileme genelde telnet/SOCKS auth uzerinden yapilir.
# Eger root erişimi yoksa çalışmayabilir. Sadece bilgi mesaji verildi.
console.print("\n [bold cyan][ TOR ] Docker tabanlı kurulumda IP yenileme için container'ı yeniden başlatın.[/bold cyan]")
wait_enter()
elif choice == "3":
console.print("\n [bold cyan][ TEST ] Proxy test ediliyor...[/bold cyan]")
await tor.verify_tor_connection()
wait_enter()
elif choice == "4":
history = scan_db.get_history(limit=50)
if not history:
print_warning("Henüz veritabanında tarama kaydı yok.")
else:
table = Table(
title="[bold]TARAMA GEÇMİŞİ (Veritabanı)[/bold]",
box=box.ROUNDED, show_lines=True,
border_style="cyan", header_style="bold cyan", width=110,
)
table.add_column("ID", style="dim", width=5, justify="center")
table.add_column("Tarih", style="white", width=20)
table.add_column("Kategori", style="bold yellow", width=22)
table.add_column("Hedef", style="white", width=30)
table.add_column("Tespit", style="red", width=7, justify="center")
table.add_column("Temiz", style="green", width=7, justify="center")
table.add_column("Süre", style="dim", width=8, justify="center")
for scan in history:
table.add_row(
str(scan["id"]),
scan["timestamp"],
scan["category"],
scan["target"][:28],
str(scan["found_count"]),
str(scan["clean_count"]),
f"{scan['duration']:.1f}s",
)
console.print()
console.print(table)
wait_enter()
elif choice == "5":
scan_id = ask_target("Tarama ID girin")
if scan_id and scan_id.isdigit():
detail = scan_db.get_scan_detail(int(scan_id))
if not detail:
print_error(f"ID {scan_id} bulunamadı.")
else:
scan = detail["scan"]
console.print(Panel(
f" [white]Hedef:[/white] {scan['target']}\n"
f" [white]Kategori:[/white] {scan['category']}\n"
f" [white]Tarih:[/white] {scan['timestamp']}\n"
f" [white]Süre:[/white] {scan['duration']:.1f}s\n"
f" [white]Kaynak:[/white] {scan['source_count']} | Sorgu: {scan['query_count']}",
title=f"[bold cyan]TARAMA #{scan['id']}[/bold cyan]",
border_style="cyan", box=box.ROUNDED,
))
table = Table(
box=box.ROUNDED, show_lines=True,
border_style="bright_black", header_style="bold cyan", width=100,
)
table.add_column("#", style="dim", width=4, justify="center")
table.add_column("Kaynak", style="bold", width=20)
table.add_column("Durum", width=14, justify="center")
table.add_column("Detay", width=58)
for idx, r in enumerate(detail["results"], 1):
if r["found"]:
status = "[bold red]● BULUNDU[/bold red]"
snippets = ""
if r["snippets"]:
try:
snips = json.loads(r["snippets"])
snippets = "\n".join(snips[:3])
except Exception:
snippets = r["snippets"]
detail_text = snippets or "Eşleşme tespit edildi"
elif r["error"]:
status = "[yellow]● HATA[/yellow]"
detail_text = r["error"]
else:
status = "[green]● TEMİZ[/green]"
detail_text = "Eşleşme bulunamadı"
table.add_row(str(idx), r["source_name"], status, detail_text)
console.print(table)
wait_enter()
elif choice == "6":
target = ask_target("Fark analizi için hedef girin")
if target:
diff = scan_db.get_scan_diff(target)
if not diff:
print_warning("Bu hedef için en az 2 tarama gerekli.")
else:
console.print(Panel(
f" [white]Son Tarama:[/white] {diff['latest']['timestamp']}\n"
f" [white]Önceki Tarama:[/white] {diff['previous']['timestamp']}\n\n"
f" [bold red]Yeni Tespitler:[/bold red] {len(diff['new_findings'])}\n"
f" [bold green]Çözülenler:[/bold green] {len(diff['resolved'])}\n"
f" [dim]Değişmeyen:[/dim] {len(diff['unchanged'])}",
title="[bold cyan]FARK ANALİZİ[/bold cyan]",
border_style="cyan", box=box.ROUNDED,
))
if diff["new_findings"]:
console.print("\n [bold red]⚠ YENİ TESPİTLER:[/bold red]")
for r in diff["new_findings"]:
console.print(f" [red]● {r['source_name']}[/red]")
if diff["resolved"]:
console.print("\n [bold green]✓ ÇÖZÜLEN TESPİTLER:[/bold green]")
for r in diff["resolved"]:
console.print(f" [green]● {r['source_name']}[/green]")
wait_enter()
elif choice == "7":
stats = scan_db.get_stats()
table = Table(
title="[bold]GENEL İSTATİSTİKLER[/bold]",
box=box.ROUNDED, show_lines=True,
border_style="cyan", header_style="bold cyan", width=60,
)
table.add_column("Metrik", style="bold white", width=30)
table.add_column("Değer", style="white", width=26)
table.add_row("Toplam Tarama", str(stats["total_scans"]))
table.add_row("Toplam Tespit", str(stats["total_findings"]))
table.add_row("Benzersiz Hedef", str(stats["unique_targets"]))
console.print()
console.print(table)
if stats["categories"]:
cat_table = Table(
title="[bold]KATEGORİ DAĞILIMI[/bold]",
box=box.ROUNDED, border_style="bright_black",
header_style="bold cyan", width=60,
)
cat_table.add_column("Kategori", style="yellow", width=30)
cat_table.add_column("Tarama Sayısı", style="white", width=26, justify="center")
for cat in stats["categories"]:
cat_table.add_row(cat["category"], str(cat["c"]))
console.print(cat_table)
wait_enter()
elif choice == "8":
path = reporter.export_html()
print_success(f"HTML rapor oluşturuldu: {path}")
wait_enter()
elif choice == "9":
path = reporter.export_json()
print_success(f"JSON dosyası oluşturuldu: {path}")
wait_enter()
elif choice == "10":
path = reporter.export_csv()
print_success(f"CSV dosyası oluşturuldu: {path}")
wait_enter()
elif choice == "11":
confirm = ask_target("Tüm geçmiş silinecek. Emin misiniz? (evet/hayır)")
if confirm and confirm.lower() in ("evet", "e", "yes", "y"):
scan_db.clear_history()
print_success("Veritabanı tamamen temizlendi.")
else:
print_info("İptal edildi.")
wait_enter()
elif choice == "12":
table = Table(
title="[bold]SİSTEM BİLGİSİ[/bold]",
box=box.ROUNDED, show_lines=True,
border_style="cyan", header_style="bold cyan", width=60,
)
table.add_column("Alan", style="bold white", width=22)
table.add_column("Değer", style="white", width=34)
table.add_row("Platform", platform.platform())
table.add_row("Python", platform.python_version())
table.add_row("İşlemci", platform.processor() or "?")
table.add_row("Hostname", platform.node())
table.add_row("Tor IP", tor.tor_ip or "?")
stats = scan_db.get_stats()
table.add_row("Veritabanı Tarama", str(stats["total_scans"]))
table.add_row("Oturum Başlangıcı", datetime.now().strftime("%H:%M:%S"))
console.print()
console.print(table)
wait_enter()
elif choice == "13":
# PDF Rapor oluşturma eklemesi
try:
path = reporter.export_pdf()
print_success(f"PDF rapor oluşturuldu: {path}")
except AttributeError:
print_error("PDF export fonksiyonu reporter modülünde henüz mevcut değil.")
except Exception as e:
print_error(f"PDF raporlanırken hata: {e}")
wait_enter()
else:
print_error("Geçersiz seçim.")
time.sleep(1.5)
async def main() -> None:
"""Application entry point. Initializes Tor connection and module instances."""
clear_screen()
print_banner()
console.print()
tor = TorHandler()
try:
if not await tor.verify_tor_connection():
console.print("\n [bold red]Tor servisi bulunamadı. Program sonlandırılıyor.[/bold red]\n")
return
from core import database as scan_db
scan_db.init_db()
scraper = DarkWebScraper(tor)
identity = IdentityRecon(tor)
network = NetworkIntel(tor)
onion = OnionScanner(tor)
cred = CredentialHunt(tor)
crypto = CryptoTracker(tor)
print_success("LeakRecon asenkron motoru hazır.")
time.sleep(1)
while True:
show_screen("main")
choice = get_input("leakrecon")
glob = is_global_command(choice)
if glob == "exit":
handle_global("exit", tor)
break
elif glob == "back" or glob == "home":
continue
elif glob:
handle_global(glob, tor)
wait_enter()
continue
routes = {
"1": lambda: menu_darkweb(scraper),
"2": lambda: menu_identity(identity),
"3": lambda: menu_network(network),
"4": lambda: menu_onion(onion),
"5": lambda: menu_credential(cred),
"6": lambda: menu_crypto(crypto),
"7": lambda: menu_tools(tor),
}
if choice in routes:
try:
await routes[choice]()
except KeyboardInterrupt:
console.print("\n [bold yellow]İşlem iptal edildi (Ctrl+C). Ana menüye dönülüyor...[/bold yellow]")
time.sleep(1)
except Exception as e:
print_error(f"Beklenmeyen bir hata oluştu: {e}")
time.sleep(2)
else:
print_error("Geçersiz seçim. Numara girin veya 'help' yazın.")
time.sleep(1.5)
finally:
await tor.close()
def cli_entry() -> None:
"""Console script entry point for `leakrecon` command (pip install)."""
try:
asyncio.run(main())
except KeyboardInterrupt:
console.print("\n\n [bold yellow]Oturum sonlandırıldı (Ctrl+C).[/bold yellow]")
sys.exit(0)
except Exception as e:
console.print(f"\n\n [bold red]Kritik hata: {e}[/bold red]")
sys.exit(1)
if __name__ == "__main__":
cli_entry()