Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Z4nzu
GitHub Repository: Z4nzu/hackingtool
Path: blob/master/tools/others/mix_tools.py
1781 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 TerminalMultiplexer(HackingTool):
17
TITLE = "Terminal Multiplexer"
18
DESCRIPTION = "Terminal Multiplexer is a tiling terminal emulator that " \
19
"allows us to open \n several terminal sessions inside one " \
20
"single window."
21
INSTALL_COMMANDS = ["sudo apt-get install tilix"]
22
23
def __init__(self):
24
super(TerminalMultiplexer, self).__init__(runnable = False)
25
26
27
class Crivo(HackingTool):
28
TITLE = "Crivo"
29
DESCRIPTION = "A tool for extracting and filtering URLs, IPs, domains, " \
30
"\n and subdomains from web pages or text, " \
31
"with built-in web scraping capabilities.\n" \
32
"See: python3 crivo_cli.py -h"
33
INSTALL_COMMANDS = [
34
"git clone https://github.com/GMDSantana/crivo.git",
35
"cd crivo;pip install -r requirements.txt"
36
]
37
PROJECT_URL = "https://github.com/GMDSantana/crivo"
38
39
def __init__(self):
40
super(Crivo, self).__init__(runnable = False)
41
42
43
class MixTools(HackingToolsCollection):
44
TITLE = "Mix tools"
45
TOOLS = [
46
TerminalMultiplexer(),
47
Crivo()
48
]
49
50
def pretty_print(self):
51
table = Table(title="Mix Tools", show_lines=True, expand=True)
52
table.add_column("Title", style="purple", no_wrap=True)
53
table.add_column("Description", style="purple")
54
table.add_column("Project URL", style="purple", no_wrap=True)
55
56
for t in self.TOOLS:
57
desc = getattr(t, "DESCRIPTION", "") or ""
58
url = getattr(t, "PROJECT_URL", "") or ""
59
table.add_row(t.TITLE, desc.strip().replace("\n", " "), url)
60
61
panel = Panel(table, title="[purple]Available Tools[/purple]", border_style="purple")
62
console.print(panel)
63
64
def show_options(self, parent=None):
65
console.print("\n")
66
panel = Panel.fit("[bold magenta]Mix Tools Collection[/bold magenta]\n"
67
"Select a tool to view details or run it.",
68
border_style="purple")
69
console.print(panel)
70
71
table = Table(title="[bold cyan]Available Tools[/bold cyan]", show_lines=True, expand=True)
72
table.add_column("Index", justify="center", style="bold yellow")
73
table.add_column("Tool Name", justify="left", style="bold green")
74
table.add_column("Description", justify="left", style="white")
75
76
for i, tool in enumerate(self.TOOLS):
77
title = getattr(tool, "TITLE", tool.__class__.__name__)
78
desc = getattr(tool, "DESCRIPTION", "—")
79
table.add_row(str(i + 1), title, desc or "—")
80
81
table.add_row("[red]99[/red]", "[bold red]Exit[/bold red]", "Return to previous menu")
82
console.print(table)
83
84
try:
85
choice = Prompt.ask("[bold cyan]Select a tool to view/run[/bold cyan]", default="99")
86
choice = int(choice)
87
if 1 <= choice <= len(self.TOOLS):
88
selected = self.TOOLS[choice - 1]
89
if hasattr(selected, "show_options"):
90
selected.show_options(parent=self)
91
elif hasattr(selected, "run"):
92
selected.run()
93
elif hasattr(selected, "show_info"):
94
selected.show_info()
95
else:
96
console.print("[bold yellow]Selected tool has no runnable interface.[/bold yellow]")
97
elif choice == 99:
98
return 99
99
except Exception:
100
console.print("[bold red]Invalid choice. Try again.[/bold red]")
101
return self.show_options(parent=parent)
102
103
104
if __name__ == "__main__":
105
tools = MixTools()
106
tools.pretty_print()
107
tools.show_options()
108