Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Z4nzu
GitHub Repository: Z4nzu/hackingtool
Path: blob/master/tools/others/hash_crack.py
1778 views
1
# coding=utf-8
2
from core import HackingTool
3
from core import HackingToolsCollection
4
5
from rich.console import Console
6
from rich.theme import Theme
7
from rich.table import Table
8
from rich.panel import Panel
9
from rich.prompt import Prompt
10
from rich import box
11
12
_theme = Theme({"purple": "#7B61FF"})
13
console = Console(theme=_theme)
14
15
16
class HashBuster(HackingTool):
17
TITLE = "Hash Buster"
18
DESCRIPTION = "Features: \n " \
19
"Automatic hash type identification \n " \
20
"Supports MD5, SHA1, SHA256, SHA384, SHA512"
21
INSTALL_COMMANDS = [
22
"git clone https://github.com/s0md3v/Hash-Buster.git",
23
"cd Hash-Buster;make install"
24
]
25
RUN_COMMANDS = ["buster -h"]
26
PROJECT_URL = "https://github.com/s0md3v/Hash-Buster"
27
28
29
class HashCrackingTools(HackingToolsCollection):
30
TITLE = "Hash cracking tools"
31
TOOLS = [HashBuster()]
32
33
def pretty_print(self):
34
table = Table(title="Hash Cracking Tools", show_lines=True, expand=True)
35
table.add_column("Title", style="purple", no_wrap=True)
36
table.add_column("Description", style="purple")
37
table.add_column("Project URL", style="purple", no_wrap=True)
38
39
for t in self.TOOLS:
40
desc = getattr(t, "DESCRIPTION", "") or ""
41
url = getattr(t, "PROJECT_URL", "") or ""
42
table.add_row(t.TITLE, desc.strip().replace("\n", " "), url)
43
44
panel = Panel(table, title="[purple]Available Tools[/purple]", border_style="purple")
45
console.print(panel)
46
47
def show_options(self, parent=None):
48
console.print("\n")
49
panel = Panel.fit("[bold magenta]Hash Cracking Tools Collection[/bold magenta]\n"
50
"Select a tool to view details or run it.",
51
border_style="purple")
52
console.print(panel)
53
54
table = Table(title="[bold cyan]Available Tools[/bold cyan]", show_lines=True, expand=True)
55
table.add_column("Index", justify="center", style="bold yellow")
56
table.add_column("Tool Name", justify="left", style="bold green")
57
table.add_column("Description", justify="left", style="white")
58
59
for i, tool in enumerate(self.TOOLS):
60
title = getattr(tool, "TITLE", tool.__class__.__name__)
61
desc = getattr(tool, "DESCRIPTION", "—")
62
table.add_row(str(i + 1), title, desc or "—")
63
64
table.add_row("[red]99[/red]", "[bold red]Exit[/bold red]", "Return to previous menu")
65
console.print(table)
66
67
try:
68
choice = Prompt.ask("[bold cyan]Select a tool to view/run[/bold cyan]", default="99")
69
choice = int(choice)
70
if 1 <= choice <= len(self.TOOLS):
71
selected = self.TOOLS[choice - 1]
72
if hasattr(selected, "show_options"):
73
selected.show_options(parent=self)
74
elif hasattr(selected, "run"):
75
selected.run()
76
elif hasattr(selected, "show_info"):
77
selected.show_info()
78
else:
79
console.print("[bold yellow]Selected tool has no runnable interface.[/bold yellow]")
80
elif choice == 99:
81
return 99
82
except Exception:
83
console.print("[bold red]Invalid choice. Try again.[/bold red]")
84
return self.show_options(parent=parent)
85
86
87
if __name__ == "__main__":
88
tools = HashCrackingTools()
89
tools.pretty_print()
90
tools.show_options()
91
92