Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Z4nzu
GitHub Repository: Z4nzu/hackingtool
Path: blob/master/tools/remote_administration.py
1753 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
11
_theme = Theme({"purple": "#7B61FF"})
12
console = Console(theme=_theme)
13
14
15
class Stitch(HackingTool):
16
TITLE = "Stitch"
17
DESCRIPTION = "Stitch is a cross platform python framework.\n" \
18
"which allows you to build custom payloads\n" \
19
"For Windows, Mac and Linux."
20
INSTALL_COMMANDS = [
21
"sudo git clone https://github.com/nathanlopez/Stitch.git",
22
"cd Stitch;sudo pip install -r lnx_requirements.txt"
23
]
24
RUN_COMMANDS = ["cd Stitch;python main.py"]
25
PROJECT_URL = "https://github.com/nathanlopez/Stitch"
26
27
28
class Pyshell(HackingTool):
29
TITLE = "Pyshell"
30
DESCRIPTION = "Pyshell is a Rat Tool that can be able to download & upload " \
31
"files,\n Execute OS Command and more.."
32
INSTALL_COMMANDS = [
33
"sudo git clone https://github.com/knassar702/Pyshell.git;"
34
"sudo pip install pyscreenshot python-nmap requests"
35
]
36
RUN_COMMANDS = ["cd Pyshell;./Pyshell"]
37
PROJECT_URL = "https://github.com/knassar702/pyshell"
38
39
40
class RemoteAdministrationTools(HackingToolsCollection):
41
TITLE = "Remote Administrator Tools (RAT)"
42
TOOLS = [
43
Stitch(),
44
Pyshell()
45
]
46
47
def _get_attr(self, obj, *names, default=""):
48
for n in names:
49
if hasattr(obj, n):
50
return getattr(obj, n)
51
return default
52
53
def pretty_print(self):
54
table = Table(title="Remote Administration Tools (RAT)", show_lines=True, expand=True)
55
table.add_column("Title", style="purple", no_wrap=True)
56
table.add_column("Description", style="purple")
57
table.add_column("Project URL", style="purple", no_wrap=True)
58
59
for t in self.TOOLS:
60
title = self._get_attr(t, "TITLE", "Title", "title", default=t.__class__.__name__)
61
desc = self._get_attr(t, "DESCRIPTION", "Description", "description", default="").strip().replace("\n", " ")
62
url = self._get_attr(t, "PROJECT_URL", "PROJECT_URL", "PROJECT", "project_url", "projectUrl", default="")
63
table.add_row(str(title), str(desc or "—"), str(url))
64
65
panel = Panel(table, title="[purple]Available Tools[/purple]", border_style="purple")
66
console.print(panel)
67
68
def show_options(self, parent=None):
69
console.print("\n")
70
panel = Panel.fit("[bold magenta]Remote Administration Tools (RAT) Collection[/bold magenta]\n"
71
"Select a tool to view options or run it.",
72
border_style="purple")
73
console.print(panel)
74
75
table = Table(title="[bold cyan]Available Tools[/bold cyan]", show_lines=True, expand=True)
76
table.add_column("Index", justify="center", style="bold yellow")
77
table.add_column("Tool Name", justify="left", style="bold green")
78
table.add_column("Description", justify="left", style="white")
79
80
for i, tool in enumerate(self.TOOLS):
81
title = self._get_attr(tool, "TITLE", "Title", "title", default=tool.__class__.__name__)
82
desc = self._get_attr(tool, "DESCRIPTION", "Description", "description", default="—")
83
table.add_row(str(i + 1), title, desc or "—")
84
85
table.add_row("[red]99[/red]", "[bold red]Exit[/bold red]", "Return to previous menu")
86
console.print(table)
87
88
try:
89
choice = Prompt.ask("[bold cyan]Select a tool to run[/bold cyan]", default="99")
90
choice = int(choice)
91
if 1 <= choice <= len(self.TOOLS):
92
selected = self.TOOLS[choice - 1]
93
# If tool exposes show_options (collection-style), delegate to it
94
if hasattr(selected, "show_options"):
95
selected.show_options(parent=self)
96
# Otherwise, if runnable, call its run method
97
elif hasattr(selected, "run"):
98
selected.run()
99
# Preserve any before_run hooks if present
100
elif hasattr(selected, "before_run"):
101
selected.before_run()
102
else:
103
console.print("[bold yellow]Selected tool has no runnable interface.[/bold yellow]")
104
elif choice == 99:
105
return 99
106
except Exception:
107
console.print("[bold red]Invalid choice. Try again.[/bold red]")
108
return self.show_options(parent=parent)
109
110
111
if __name__ == "__main__":
112
tools = RemoteAdministrationTools()
113
tools.pretty_print()
114
tools.show_options()
115
116