Untitled
unknown
plain_text
10 months ago
2.5 kB
36
Indexable
import subprocess
import re
import math
from rich.console import Console
from rich.table import Table
# Konfiguration
prefix = "apple" # <-- DEIN gewünschtes Präfix
prefix_length = len(prefix)
keys_per_second_estimate = 1_000_000 # Nur für ersten Moment (live-Wert kommt aus Log)
p = 1 / (58 ** prefix_length)
console = Console()
def prob_no_match(n, p):
return math.exp(-p * n)
def format_duration(seconds):
mins = int(seconds // 60)
secs = int(seconds % 60)
return f"{mins}m {secs}s"
def main():
command = ["solana-keygen", "grind", f"--starts-with", f"{prefix}:1"]
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1)
console.print(f"[bold green]Starte: {' '.join(command)}[/bold green]")
console.print(f"Suche nach Präfix: [bold yellow]{prefix}[/bold yellow] ({prefix_length} Zeichen)\n")
total_keys = 0
elapsed = 0
try:
for line in process.stdout:
print(line, end="") # Zeige Originalausgabe mit
match = re.search(r"Searched (\d+) keypairs in ([\d.]+)s", line)
if match:
total_keys = int(match.group(1))
elapsed = float(match.group(2))
expected_keys = int(1 / p)
p_no_match = prob_no_match(total_keys, p)
p_match = 1 - p_no_match
actual_kps = total_keys / elapsed
table = Table(title="📊 Live Statistik", show_lines=True)
table.add_column("Metrik", justify="left", style="cyan")
table.add_column("Wert", justify="right", style="magenta")
table.add_row("Gesuchte Präfixe", str(prefix_length))
table.add_row("Geprüfte Schlüssel", f"{total_keys:,}")
table.add_row("Laufzeit", format_duration(elapsed))
table.add_row("Keys/Sekunde", f"{actual_kps:,.0f}")
table.add_row("Erwartung bei", f"{expected_keys:,} Keys (~{format_duration(expected_keys / actual_kps)})")
table.add_row("Trefferwahrscheinlichkeit", f"{p_match:.2%}")
table.add_row("Kein Treffer bisher", f"{p_no_match:.2%}")
console.print(table)
except KeyboardInterrupt:
process.terminate()
console.print("\n[bold red]Beendet.[/bold red]")
if __name__ == "__main__":
main()
Editor is loading...
Leave a Comment