Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Z4nzu
GitHub Repository: Z4nzu/hackingtool
Path: blob/master/tools/steganography.py
1771 views
1
# coding=utf-8
2
import subprocess
3
4
from core import HackingTool
5
from core import HackingToolsCollection
6
from core import validate_input
7
8
from rich.console import Console
9
from rich.theme import Theme
10
from rich.table import Table
11
from rich.panel import Panel
12
from rich.prompt import Prompt
13
14
_theme = Theme({"purple": "#7B61FF"})
15
console = Console(theme=_theme)
16
17
18
class SteganoHide(HackingTool):
19
TITLE = "SteganoHide"
20
INSTALL_COMMANDS = ["sudo apt-get install steghide -y"]
21
22
def run(self):
23
choice_run = input(
24
"[1] Hide\n"
25
"[2] Extract\n"
26
"[99]Cancel\n"
27
">> "
28
)
29
choice_run = validate_input(choice_run, [1, 2, 99])
30
if choice_run is None:
31
console.print("[bold red]Please choose a valid input[/bold red]")
32
return self.run()
33
34
if choice_run == 99:
35
return
36
37
if choice_run == 1:
38
file_hide = input("Enter Filename to Embed (1.txt) >> ")
39
file_to_be_hide = input("Enter Cover Filename (test.jpeg) >> ")
40
subprocess.run(["steghide", "embed", "-cf", file_to_be_hide, "-ef", file_hide])
41
42
elif choice_run == 2:
43
from_file = input("Enter Filename to Extract Data From >> ")
44
subprocess.run(["steghide", "extract", "-sf", from_file])
45
46
47
class StegnoCracker(HackingTool):
48
TITLE = "StegnoCracker"
49
DESCRIPTION = "SteganoCracker uncovers hidden data inside files using brute-force utility"
50
INSTALL_COMMANDS = ["pip3 install stegcracker && pip3 install stegcracker -U --force-reinstall"]
51
52
def run(self):
53
filename = input("Enter Filename >> ")
54
passfile = input("Enter Wordlist Filename >> ")
55
subprocess.run(["stegcracker", filename, passfile])
56
57
58
class StegoCracker(HackingTool):
59
TITLE = "StegoCracker"
60
DESCRIPTION = "StegoCracker lets you hide and retrieve data in image or audio files"
61
INSTALL_COMMANDS = [
62
"sudo git clone https://github.com/W1LDN16H7/StegoCracker.git",
63
"sudo chmod -R 755 StegoCracker"
64
]
65
RUN_COMMANDS = [
66
"cd StegoCracker && python3 -m pip install -r requirements.txt",
67
"./install.sh"
68
]
69
PROJECT_URL = "https://github.com/W1LDN16H7/StegoCracker"
70
71
72
class Whitespace(HackingTool):
73
TITLE = "Whitespace"
74
DESCRIPTION = "Use whitespace and unicode characters for steganography"
75
INSTALL_COMMANDS = [
76
"sudo git clone https://github.com/beardog108/snow10.git",
77
"sudo chmod -R 755 snow10"
78
]
79
RUN_COMMANDS = ["cd snow10 && ./install.sh"]
80
PROJECT_URL = "https://github.com/beardog108/snow10"
81
82
83
class SteganographyTools(HackingToolsCollection):
84
TITLE = "Steganography Tools"
85
TOOLS = [SteganoHide(), StegnoCracker(), StegoCracker(), Whitespace()]
86
87
def _get_attr(self, obj, *names, default=""):
88
for n in names:
89
if hasattr(obj, n):
90
return getattr(obj, n)
91
return default
92
93
def pretty_print(self):
94
table = Table(title="Steganography Tools", show_lines=True, expand=True)
95
table.add_column("Title", style="purple", no_wrap=True)
96
table.add_column("Description", style="purple")
97
table.add_column("Project URL", style="purple", no_wrap=True)
98
99
for t in self.TOOLS:
100
title = self._get_attr(t, "TITLE", "Title", "title", default=t.__class__.__name__)
101
desc = self._get_attr(t, "DESCRIPTION", "Description", "description", default="").strip().replace("\n", " ")
102
url = self._get_attr(t, "PROJECT_URL", "PROJECT_URL", "project_url", "projectUrl", default="")
103
table.add_row(str(title), str(desc or "—"), str(url))
104
105
panel = Panel(table, title="[purple]Available Tools[/purple]", border_style="purple")
106
console.print(panel)
107
108
def show_options(self, parent=None):
109
console.print("\n")
110
panel = Panel.fit("[bold magenta]Steganography Tools Collection[/bold magenta]\nSelect a tool to run or view options.", border_style="purple")
111
console.print(panel)
112
113
table = Table(title="[bold cyan]Available Tools[/bold cyan]", show_lines=True, expand=True)
114
table.add_column("Index", justify="center", style="bold yellow")
115
table.add_column("Tool Name", justify="left", style="bold green")
116
table.add_column("Description", justify="left", style="white")
117
118
for i, tool in enumerate(self.TOOLS):
119
title = self._get_attr(tool, "TITLE", "Title", "title", default=tool.__class__.__name__)
120
desc = self._get_attr(tool, "DESCRIPTION", "Description", "description", default="—")
121
table.add_row(str(i + 1), title, desc or "—")
122
123
table.add_row("[red]99[/red]", "[bold red]Exit[/bold red]", "Return to previous menu")
124
console.print(table)
125
126
try:
127
choice = int(Prompt.ask("[bold cyan]Select a tool to run[/bold cyan]", default="99"))
128
if 1 <= choice <= len(self.TOOLS):
129
selected = self.TOOLS[choice - 1]
130
if hasattr(selected, "show_options"):
131
selected.show_options(parent=self)
132
elif hasattr(selected, "run"):
133
selected.run()
134
elif hasattr(selected, "before_run"):
135
selected.before_run()
136
else:
137
console.print("[bold yellow]Selected tool has no runnable interface.[/bold yellow]")
138
elif choice == 99:
139
return 99
140
except Exception:
141
console.print("[bold red]Invalid choice. Try again.[/bold red]")
142
return self.show_options(parent=parent)
143
144
145
if __name__ == "__main__":
146
tools = SteganographyTools()
147
tools.pretty_print()
148
tools.show_options()
149
150