Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Z4nzu
GitHub Repository: Z4nzu/hackingtool
Path: blob/master/tools/others/payload_injection.py
1775 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 DebInject(HackingTool):
17
TITLE = "Debinject"
18
DESCRIPTION = "Debinject is a tool that inject malicious code into *.debs"
19
INSTALL_COMMANDS = [
20
"sudo git clone https://github.com/UndeadSec/Debinject.git"]
21
RUN_COMMANDS = ["cd Debinject;python debinject.py"]
22
PROJECT_URL = "https://github.com/UndeadSec/Debinject"
23
24
25
class Pixload(HackingTool):
26
TITLE = "Pixload"
27
DESCRIPTION = "Pixload -- Image Payload Creating tools \n " \
28
"Pixload is Set of tools for creating/injecting payload into images."
29
INSTALL_COMMANDS = [
30
"sudo apt install libgd-perl libimage-exiftool-perl libstring-crc32-perl",
31
"sudo git clone https://github.com/chinarulezzz/pixload.git"
32
]
33
PROJECT_URL = "https://github.com/chinarulezzz/pixload"
34
35
def __init__(self):
36
super(Pixload, self).__init__(runnable = False)
37
38
39
class PayloadInjectorTools(HackingToolsCollection):
40
TITLE = "Payload Injector"
41
TOOLS = [
42
DebInject(),
43
Pixload()
44
]
45
46
def pretty_print(self):
47
table = Table(title="Payload Injector Tools", show_lines=True, expand=True)
48
table.add_column("Title", style="purple", no_wrap=True)
49
table.add_column("Description", style="purple")
50
table.add_column("Project URL", style="purple", no_wrap=True)
51
52
for t in self.TOOLS:
53
desc = getattr(t, "DESCRIPTION", "") or ""
54
url = getattr(t, "PROJECT_URL", "") or ""
55
table.add_row(t.TITLE, desc.strip().replace("\n", " "), url)
56
57
panel = Panel(table, title="[purple]Available Tools[/purple]", border_style="purple")
58
console.print(panel)
59
60
def show_options(self, parent=None):
61
console.print("\n")
62
panel = Panel.fit("[bold magenta]Payload Injector Collection[/bold magenta]\n"
63
"Select a tool to view details or run it.",
64
border_style="purple")
65
console.print(panel)
66
67
table = Table(title="[bold cyan]Available Tools[/bold cyan]", show_lines=True, expand=True)
68
table.add_column("Index", justify="center", style="bold yellow")
69
table.add_column("Tool Name", justify="left", style="bold green")
70
table.add_column("Description", justify="left", style="white")
71
72
for i, tool in enumerate(self.TOOLS):
73
title = getattr(tool, "TITLE", tool.__class__.__name__)
74
desc = getattr(tool, "DESCRIPTION", "—")
75
table.add_row(str(i + 1), title, desc or "—")
76
77
table.add_row("[red]99[/red]", "[bold red]Exit[/bold red]", "Return to previous menu")
78
console.print(table)
79
80
try:
81
choice = Prompt.ask("[bold cyan]Select a tool to view/run[/bold cyan]", default="99")
82
choice = int(choice)
83
if 1 <= choice <= len(self.TOOLS):
84
selected = self.TOOLS[choice - 1]
85
if hasattr(selected, "show_options"):
86
selected.show_options(parent=self)
87
elif hasattr(selected, "run"):
88
selected.run()
89
elif hasattr(selected, "show_info"):
90
selected.show_info()
91
else:
92
console.print("[bold yellow]Selected tool has no runnable interface.[/bold yellow]")
93
elif choice == 99:
94
return 99
95
except Exception:
96
console.print("[bold red]Invalid choice. Try again.[/bold red]")
97
return self.show_options(parent=parent)
98
99
100
if __name__ == "__main__":
101
tools = PayloadInjectorTools()
102
tools.pretty_print()
103
tools.show_options()
104