-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0Steno2.html
More file actions
254 lines (216 loc) · 11.2 KB
/
0Steno2.html
File metadata and controls
254 lines (216 loc) · 11.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Stego Stealth v2.0</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=JetBrains+Mono&display=swap" rel="stylesheet">
<style>
:root {
--bg-deep: #050505;
--card-bg: #0f0f0f;
--accent: #22c55e;
--border-color: #1f1f1f;
}
body {
background-color: var(--bg-deep);
color: #e5e7eb;
font-family: 'Inter', sans-serif;
overflow-x: hidden;
}
.next-card {
background: var(--card-bg);
border: 1px solid var(--border-color);
transition: border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.next-card:hover {
border-color: rgba(34, 197, 94, 0.4);
}
.custom-input {
background: #141414;
border: 1px solid #262626;
transition: all 0.3s;
}
.custom-input:focus-within {
border-color: var(--accent);
box-shadow: 0 0 15px rgba(34, 197, 94, 0.1);
}
.toast {
position: fixed;
bottom: 2rem;
right: 2rem;
background: #1a1a1a;
border-left: 4px solid var(--accent);
padding: 1rem 1.5rem;
border-radius: 8px;
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
transform: translateY(200%);
transition: transform 0.4s ease;
z-index: 1000;
}
.toast.active { transform: translateY(0); }
.btn-primary {
background: #fff;
color: #000;
font-weight: 600;
transition: all 0.2s;
}
.btn-primary:hover {
background: #d1d1d1;
transform: translateY(-1px);
}
.mono { font-family: 'JetBrains Mono', monospace; }
/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: #262626; border-radius: 10px; }
</style>
</head>
<body class="antialiased">
<main class="max-w-6xl mx-auto px-6 py-12">
<div class="text-center mb-16">
<h2 class="text-5xl md:text-6xl font-bold tracking-tighter mb-4 text-white">Hide files in plain sight.</h2>
<p class="text-gray-400 max-w-xl mx-auto text-lg">Military-grade LSB steganography tool. Pure client-side, your data never leaves your browser.</p>
</div>
<div class="grid md:grid-cols-2 gap-8">
<div class="next-card p-8 rounded-2xl">
<div class="flex items-center justify-between mb-8">
<span class="text-xs font-bold uppercase tracking-widest text-green-500 bg-green-500/10 px-3 py-1 rounded-full">Secure Encode</span>
<svg class="text-gray-600" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 15V3m0 0l-4 4m4-4l4 4M2 17l.621 2.485A2 2 0 004.561 21h14.878a2 2 0 001.94-1.515L22 17"/></svg>
</div>
<div class="space-y-6">
<div class="custom-input p-4 rounded-xl group">
<label class="block text-xs font-semibold text-gray-500 mb-2 uppercase">1. File to hide</label>
<input type="file" id="fileInput" class="text-sm text-gray-400 w-full file:hidden cursor-pointer">
</div>
<div class="custom-input p-4 rounded-xl group">
<label class="block text-xs font-semibold text-gray-500 mb-2 uppercase">2. Cover Image</label>
<input type="file" id="coverImage" accept="image/*" class="text-sm text-gray-400 w-full file:hidden cursor-pointer">
</div>
<button onclick="encodeFile()" class="btn-primary w-full py-4 rounded-xl shadow-xl shadow-white/5">
Download Encrypted PNG
</button>
</div>
</div>
<div class="next-card p-8 rounded-2xl border-blue-500/20">
<div class="flex items-center justify-between mb-8">
<span class="text-xs font-bold uppercase tracking-widest text-blue-500 bg-blue-500/10 px-3 py-1 rounded-full">Instant Decode</span>
<svg class="text-gray-600" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a7 7 0 10-14 0v2"/></svg>
</div>
<div class="space-y-6">
<div class="custom-input p-4 rounded-xl border-dashed">
<label class="block text-xs font-semibold text-gray-500 mb-2 uppercase text-center">Drag or Upload Stego Image</label>
<input type="file" id="stegoImage" accept="image/*" class="text-sm text-gray-400 w-full file:hidden cursor-pointer">
</div>
<button onclick="decodeFile()" class="w-full bg-[#1a1a1a] border border-[#262626] hover:bg-[#222] py-4 rounded-xl font-semibold transition">
Extract Secret Data
</button>
<div id="resultArea" class="hidden animate-in fade-in duration-500">
<div id="loader" class="flex items-center gap-3 text-sm text-gray-500 py-2">
<div class="w-4 h-4 border-2 border-blue-500 border-t-transparent animate-spin rounded-full"></div>
Processing bitstream...
</div>
<div id="downloadBox" class="hidden">
<a id="downloadLink" class="flex items-center justify-between p-4 bg-green-500/10 border border-green-500/20 rounded-xl text-green-400 text-sm hover:bg-green-500/20 transition cursor-pointer">
<span id="fileNameDisplay" class="truncate font-mono">secret_file.zip</span>
<span class="font-bold underline">Download</span>
</a>
</div>
</div>
</div>
</div>
</div>
</main>
<div id="toast" class="toast">
<span id="toastMsg" class="text-sm font-medium">Message here</span>
</div>
<canvas id="canvas" class="hidden"></canvas>
<script>
const END_TAG = "::X_STEGO_END_X::";
function showToast(msg, type = 'success') {
const toast = document.getElementById('toast');
const toastMsg = document.getElementById('toastMsg');
toastMsg.innerText = msg;
toast.style.borderLeftColor = type === 'success' ? '#22c55e' : '#ef4444';
toast.classList.add('active');
setTimeout(() => toast.classList.remove('active'), 3000);
}
async function encodeFile() {
const file = document.getElementById("fileInput").files[0];
const imgFile = document.getElementById("coverImage").files[0];
if (!file || !imgFile) return showToast("Select both files first!", "error");
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = (e) => {
const payload = file.name + "|" + e.target.result + END_TAG;
const bin = payload.split('').map(c => c.charCodeAt(0).toString(2).padStart(8, '0')).join('');
const img = new Image();
img.src = URL.createObjectURL(imgFile);
img.onload = () => {
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage(img, 0, 0);
const imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
if (bin.length > imgData.data.length * 0.75) return showToast("Image too small!", "error");
for (let i = 0; i < bin.length; i++) {
let idx = Math.floor(i/3)*4 + (i%3);
imgData.data[idx] = (imgData.data[idx] & 0xFE) | parseInt(bin[i]);
}
ctx.putImageData(imgData, 0, 0);
const link = document.createElement("a");
link.download = `stego_${imgFile.name.split('.')[0]}.png`;
link.href = canvas.toDataURL("image/png");
link.click();
showToast("File Encrypted Successfully!");
};
};
}
async function decodeFile() {
const stegoInput = document.getElementById("stegoImage");
if (!stegoInput.files[0]) return showToast("Upload an image first!", "error");
const resArea = document.getElementById("resultArea");
const loader = document.getElementById("loader");
const downloadBox = document.getElementById("downloadBox");
resArea.classList.remove("hidden");
loader.classList.remove("hidden");
downloadBox.classList.add("hidden");
const img = new Image();
img.src = URL.createObjectURL(stegoInput.files[0]);
img.onload = () => {
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage(img, 0, 0);
const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
let binary = "";
let extracted = "";
for (let i = 0; i < data.length; i++) {
if ((i + 1) % 4 === 0) continue;
binary += (data[i] & 1);
if (binary.length === 8) {
extracted += String.fromCharCode(parseInt(binary, 2));
binary = "";
if (extracted.endsWith(END_TAG)) {
const [name, content] = extracted.replace(END_TAG, "").split("|");
document.getElementById("fileNameDisplay").innerText = name;
document.getElementById("downloadLink").href = content;
document.getElementById("downloadLink").download = name;
loader.classList.add("hidden");
downloadBox.classList.remove("hidden");
showToast("Decoded successfully!");
return;
}
}
if (extracted.length > 5000000) break;
}
loader.classList.add("hidden");
showToast("No secret data found.", "error");
};
}
</script>
</body>
</html>