-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
445 lines (408 loc) · 23 KB
/
index.html
File metadata and controls
445 lines (408 loc) · 23 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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<!DOCTYPE html>
<html lang="id" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Portfolio</title>
<link rel="icon" href="https://img.icons8.com/?size=100&id=Ttjsnau5W1jb&format=png&color=000000">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Fira Code', monospace;
overflow-x: hidden;
cursor: url('https://cdn.custom-cursor.com/db/7648/32/meme-pop-cat-cursor.png'), auto;
/*cursor: url('https://cdn.custom-cursor.com/db/18387/32/disney-big-hero-6-baymax-pointer.png'), auto;*/
}
#fullscreen-toggle, #theme-toggle {
cursor: url('https://cdn.custom-cursor.com/db/7647/32/meme-pop-cat-pointer.png'), pointer;
/*cursor: url('https://cdn.custom-cursor.com/db/18388/32/disney-big-hero-6-baymax-cursor.png'), pointer;*/
}
/* Warna text selection Default (Light Mode) */
::selection {
background-color: transparent;
color: #15803d;
}
/* Warna text selection Dark Mode */
html.dark ::selection {
background-color: transparent;
color: #4ade80;
}
/* Konfigurasi Scrollbar */
::-webkit-scrollbar {
width: 6px;
height: 0px;
}
/* Tampilan Scrollbar Default (Light Mode) */
::-webkit-scrollbar-track {
background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
background: #cbd5e1;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #94a3b8;
}
/* Tampilan Scrollbar (Dark Mode) */
html.dark ::-webkit-scrollbar-track {
background: #1e1e1e;
}
html.dark ::-webkit-scrollbar-thumb {
background: #4a4a4a;
}
html.dark ::-webkit-scrollbar-thumb:hover {
background: #6b7280;
}
/* Menghilangkan panah pada input number (jika ada) */
input[type="text"] {
caret-color: transparent;
color: transparent;
cursor: url('https://cdn.custom-cursor.com/db/7648/32/meme-pop-cat-cursor.png'), auto !important;
}
/* Efek kursor berkedip */
.blinking-cursor {
animation: blink 1s step-end infinite;
color: #16a34a;
}
html.dark .blinking-cursor {
color: #4ade80;
}
@keyframes blink {
from, to { opacity: 0; }
50% { opacity: 1; }
}
:screen {
background-color: transparent;
}
</style>
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
fontFamily: {
'fira-code': ['Fira Code', 'monospace'],
},
colors: {
'dark-bg': '#1a1b26',
'dark-fg': '#a9b1d6',
'dark-border': '#414868',
'dark-green': '#9ece6a',
'dark-blue': '#7aa2f7',
'dark-cyan': '#7dcfff',
'dark-red': '#f7768e',
'light-bg': '#fafafa',
'light-fg': '#26272b',
'light-border': '#cccccc',
'light-green': '#15803d',
'light-blue': '#1d4ed8',
'light-cyan': '#0e7490',
'light-red': '#b91c1c',
}
}
}
}
</script>
</head>
<body class="bg-light-bg dark:bg-dark-bg text-light-fg dark:text-dark-fg transition-colors duration-300" oncontextmenu="return false;">
<div id="terminal" class="p-2 sm:p-4 h-screen w-full flex flex-col">
<!-- Header Jendela Terminal -->
<div class="bg-gray-200 dark:bg-[#282a36] rounded-t-lg p-2 flex items-center gap-2 shadow-md">
<div class="w-3.5 h-3.5 bg-red-500 rounded-full"></div>
<div class="w-3.5 h-3.5 bg-yellow-500 rounded-full"></div>
<div class="w-3.5 h-3.5 bg-green-500 rounded-full"></div>
<div class="flex-grow text-center text-sm text-gray-600 dark:text-gray-400 overflow-hidden whitespace-nowrap text-ellipsis px-2">
root@localhost — yosh
</div>
<div class="flex items-center gap-3">
<!-- Tombol fullscreen -->
<button id="fullscreen-toggle" class="text-gray-600 dark:text-gray-400 hover:text-black dark:hover:text-white transition-colors">
<!-- Icon Expand -->
<svg id="fs-icon-expand" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"></path>
</svg>
<!-- Icon Compress (Hidden by default) -->
<svg id="fs-icon-compress" class="w-5 h-5 hidden" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4l5 5m11-5l-5 5m-11 11l5-5m11 5l-5-5M9 4v5H4m11-5v5h5M9 20v-5H4m11 5v-5h5"></path>
</svg>
</button>
<!-- Tombol Light/Dark Mode -->
<button id="theme-toggle" class="text-gray-600 dark:text-gray-400 hover:text-black dark:hover:text-white transition-colors">
<svg id="theme-icon-dark" class="w-5 h-5 hidden" fill="currentColor" viewBox="0 0 20 20"><path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"></path></svg>
<svg id="theme-icon-light" class="w-5 h-5 hidden" fill="currentColor" viewBox="0 0 20 20"><path d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm-.707 8.486a1 1 0 011.414 0l.707.707a1 1 0 01-1.414 1.414l-.707-.707a1 1 0 010-1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"></path></svg>
</>
</div>
</div>
<!-- Konten Terminal -->
<div id="terminal-body" class="w-full flex-grow bg-white dark:bg-dark-bg border-x-2 border-b-2 border-light-border dark:border-dark-border rounded-b-lg p-4 overflow-y-auto overflow-x-hidden text-sm sm:text-base">
<div id="output"></div>
<div class="flex items-center">
<div class="flex-shrink-0 mr-2">
<span class="text-light-green dark:text-dark-green">root@localhost</span><span class="text-light-fg dark:text-dark-fg">:</span><span class="text-light-blue dark:text-dark-blue">~</span><span class="text-light-fg dark:text-dark-fg">#</span>
</div>
<!-- Container untuk input dan overlay visualnya -->
<div class="relative flex-grow" onclick="commandInput.focus()">
<!-- Input field yang sebenarnya, teks dan kursornya transparan -->
<input type="text" id="command-input" class="w-full bg-transparent border-none outline-none" autofocus autocomplete="off" spellcheck="false">
<!-- Overlay visual untuk menampilkan teks dan kursor kustom -->
<div class="absolute inset-0 flex items-center pointer-events-none">
<span id="input-text-display" class="whitespace-pre"></span>
<span id="fake-cursor" class="blinking-cursor">_</span>
</div>
</div>
</div>
</div>
</div>
<script>
const terminalBody = document.getElementById('terminal-body');
const output = document.getElementById('output');
const commandInput = document.getElementById('command-input');
const themeToggle = document.getElementById('theme-toggle');
const themeIconDark = document.getElementById('theme-icon-dark');
const themeIconLight = document.getElementById('theme-icon-light');
const fakeCursor = document.getElementById('fake-cursor');
const inputTextDisplay = document.getElementById('input-text-display');
// Unsur baru untuk Fullscreen
const fullscreenToggle = document.getElementById('fullscreen-toggle');
const fsIconExpand = document.getElementById('fs-icon-expand');
const fsIconCompress = document.getElementById('fs-icon-compress');
const blogPosts = {
'1': { title: 'Lagi browsing ketemu CAPTCHA? Awas palsu!!!', url: 'https://medium.com/@nmwafa/lagi-browsing-ketemu-captcha-awas-palsu-c90586326b86' },
'2': { title: 'Kenalan dengan GNS3', url: 'https://medium.com/@nmwafa/kenalan-dengan-gns3-29c227e07d0d' },
'3': { title: 'Hardening Web Server di Linux Ubuntu', url: 'https://medium.com/@nmwafa/hardening-web-server-di-linux-ubuntu-66c7803d3d7e' },
'4': { title: 'Apa itu Fork bomb?', url: 'https://nmwafa.medium.com/apa-itu-fork-bomb-27a2a4d0ffe9' },
'5': { title: 'HTB Skills Assessment — SQL Injection Fundamentals', url: 'https://medium.com/@nmwafa/htb-skills-assessment-sql-injection-fundamentals-4584dc7568a5' },
'6': { title: 'Mengenal kerentanan desinkronisasi HTTP', url: 'https://nmwafa.medium.com/mengenal-kerentanan-desinkronisasi-http-7d59abef382b' },
'7': { title: 'Pengenalan SELinux', url: 'https://nmwafa.medium.com/pengenalan-selinux-4e97fb4eab0b' }
};
const projects = [
{ name: 'Recon & Pillage', description: 'Automation script for subdomain search, technology detection, and categorizing based on status code, URL, and technology.', url: 'https://github.com/nmwafa/recon-pillage' }
];
const certUrl = 'https://drive.google.com/drive/folders/1LydeHP-hpuWUZEipSZV-B0h8dJloc89W?usp=sharing';
const toolsUrl = 'https://nmwafa.github.io/tools/';
const commands = {
help: () => {
return `
<p class="mb-2">Available commands:</p>
<ul class="list-inside list-disc">
<li><span class="text-light-green dark:text-dark-green">about</span> - Show information about me</li>
<li><span class="text-light-green dark:text-dark-green">projects</span> - See the list of projects</li>
<li><span class="text-light-green dark:text-dark-green">blog</span> - List of blog articles.</li>
<li><span class="text-light-green dark:text-dark-green">cert</span> - See the certificate and letter of appreciation</li>
<li><span class="text-light-green dark:text-dark-green">tools</span> - See the list of tools</li>
<li><span class="text-light-green dark:text-dark-green">contact</span> - Show contact information</li>
<li><span class="text-light-green dark:text-dark-green">clear</span> - Clean the terminal screen</li>
<li><span class="text-light-green dark:text-dark-green">welcome</span> - Show the welcome message again</li>
</ul>
`;
},
about: () => {
return `
<p>Wafa is a cybersecurity specialist who is passionate about web application and infrastructure security.</p>
<p>He is dedicated to developing his skills and consistently keeping up with the latest trends in this area.</p>
<p>Occasionally, he also contributes by helping secure systems for educational institutions and other organizations.</p>
`;
},
projects: () => {
let projectList = '<p class="mb-2">This is a project that I created:</p>';
projects.forEach(p => {
projectList += `
<div class="mb-2">
<p class="text-light-cyan dark:text-dark-cyan font-bold">${p.name}</p>
<p class="pl-4"> ${p.description} <a href="${p.url}" target="_blank" class="underline">See project</a></p>
</div>
`;
});
return projectList;
},
blog: (args) => {
if (args.length === 0 || args[0] === 'list') {
let postList = '<p class="mb-2">Article in Indonesian. Use the command \'blog read [id]\' to read (e.g., blog read 1):</p>';
Object.entries(blogPosts).forEach(([id, post]) => {
postList += `<p><span class="text-light-cyan dark:text-dark-cyan">[${id}]</span> ${post.title} </p>`;
});
return postList;
}
if (args[0] === 'read' && args[1]) {
const post = blogPosts[args[1]];
if (post) {
window.open(post.url, '_blank');
return `<p>Opening article: "${post.title}" in a new tab...</p>`;
}
return `<p class="text-light-red dark:text-dark-red">Article with ID '${args[1]}' not found!</p>`;
}
return `<p class="text-light-red dark:text-dark-red">Invalid command! Use 'blog list' or 'blog read [id]'</p>`;
},
cert: () => {
window.open(certUrl, '_blank');
return `<p>Opening page in a new tab...</p>`;
},
tools: () => {
window.open(toolsUrl, '_self');
return '';
},
contact: () => {
return `
<p>Let's connect...</p>
<ul>
<li>• Email: <a href="mailto:nmw.exit045@passinbox.com" class="underline text-light-blue dark:text-dark-blue">nmw.exit045@passinbox.com</a></li>
<li>• GitHub: <a href="https://github.com/nmwafa" target="_blank" class="underline text-light-blue dark:text-dark-blue">nmwafa</a></li>
<li>• LinkedIn: <a href="https://www.linkedin.com/in/nmwafa" target="_blank" class="underline text-light-blue dark:text-dark-blue">nmwafa</a></li>
</ul>
`;
},
clear: () => {
output.innerHTML = '';
return '';
},
welcome: () => {
return getWelcomeMessage();
}
};
// --- Logika Terminal ---
commandInput.addEventListener('keydown', (e) => {
if (e.key === 'Enter' && !commandInput.disabled) {
commandInput.disabled = true;
const fullCommand = commandInput.value.trim();
// Selalu buat dan tampilkan baris prompt baru (meskipun input kosong)
const promptLine = document.createElement('div');
promptLine.innerHTML = `
<div class="flex">
<div class="flex-shrink-0 mr-2">
<span class="text-light-green dark:text-dark-green">root@localhost</span><span class="text-light-fg dark:text-dark-fg">:</span><span class="text-light-blue dark:text-dark-blue">~</span><span class="text-light-fg dark:text-dark-fg">#</span>
</div>
<div class="flex-grow break-all">${fullCommand}</div>
</div>`;
output.appendChild(promptLine);
// Reset input
commandInput.value = '';
inputTextDisplay.textContent = '';
// Eksekusi pencarian perintah hanya jika ada teks
if (fullCommand) {
const [command, ...args] = fullCommand.split(' ');
const resultDiv = document.createElement('div');
output.appendChild(resultDiv);
if (commands[command]) {
const result = commands[command](args);
resultDiv.innerHTML = result;
} else {
resultDiv.innerHTML = `<p class="text-light-red dark:text-dark-red">${command}: command not found!<br>Type 'help' to see the list of commands</p>`;
}
}
terminalBody.scrollTop = terminalBody.scrollHeight;
commandInput.disabled = false;
commandInput.focus();
}
});
// Sinkronkan teks dari input yang tersembunyi ke tampilan visual
commandInput.addEventListener('input', () => {
if (inputTextDisplay) {
inputTextDisplay.textContent = commandInput.value;
}
});
// --- Tema ---
const setTheme = (theme) => {
if (theme === 'dark') {
document.documentElement.classList.add('dark');
themeIconLight.classList.remove('hidden');
themeIconDark.classList.add('hidden');
localStorage.setItem('theme', 'dark');
} else {
document.documentElement.classList.remove('dark');
themeIconDark.classList.remove('hidden');
themeIconLight.classList.add('hidden');
localStorage.setItem('theme', 'light');
}
};
themeToggle.addEventListener('click', () => {
const currentTheme = localStorage.getItem('theme') || 'dark';
setTheme(currentTheme === 'dark' ? 'light' : 'dark');
});
// --- Logika Fullscreen (Cross-Browser) ---
function toggleFullscreen() {
if (!document.fullscreenElement && !document.webkitFullscreenElement && !document.mozFullScreenElement && !document.msFullscreenElement) {
// Masuk Fullscreen
const elem = document.documentElement;
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
}
} else {
// Keluar Fullscreen
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}
}
}
fullscreenToggle.addEventListener('click', toggleFullscreen);
// Update icon saat status fullscreen berubah (termasuk jika user tekan ESC)
function updateFullscreenIcons() {
const isFullscreen = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement;
if (isFullscreen) {
fsIconExpand.classList.add('hidden');
fsIconCompress.classList.remove('hidden');
} else {
fsIconExpand.classList.remove('hidden');
fsIconCompress.classList.add('hidden');
}
}
document.addEventListener('fullscreenchange', updateFullscreenIcons);
document.addEventListener('webkitfullscreenchange', updateFullscreenIcons);
document.addEventListener('mozfullscreenchange', updateFullscreenIcons);
document.addEventListener('MSFullscreenChange', updateFullscreenIcons);
// --- Inisialisasi ---
function getWelcomeMessage() {
return `
<p class="text-2xl font-bold text-light-green dark:text-dark-green mb-4">Welcome to the Interactive Portfolio!</p>
<p>Type <span class="text-light-cyan dark:text-dark-cyan">'help'</span> to see the list of available commands</p>
<br>
`;
}
function initialize() {
const preferredTheme = localStorage.getItem('theme');
setTheme(preferredTheme || 'dark');
output.innerHTML = getWelcomeMessage();
// Saat terminal diklik di mana saja, fokuskan ke input
terminalBody.addEventListener('click', (e) => {
// Hindari re-focus jika yang diklik adalah link
if (e.target.tagName !== 'A') {
commandInput.focus();
}
});
commandInput.focus();
}
initialize();
</script>
<!-- Block -->
<script>
document.addEventListener('keydown', function(e) {
const isControlOrCommand = e.ctrlKey || e.metaKey;
const key = e.key ? e.key.toUpperCase() : '';
const k = e.keyCode;
if (isControlOrCommand && key === 'F') {
e.preventDefault();
toggleFullscreen();
return false;
}
if (k === 9 || k === 35 || k === 36 || k === 37 || k === 38 || k === 39 || k === 40 || k === 123 || (isControlOrCommand && key === 'D') || (isControlOrCommand && key === 'K') || (isControlOrCommand && key === 'P') || (isControlOrCommand && key === 'O') || (isControlOrCommand && key === 'E') || (isControlOrCommand && key === 'H') || (isControlOrCommand && key === 'S') || (isControlOrCommand && key === 'U') || (isControlOrCommand && key === 'G') || (isControlOrCommand && key === 'V') || (isControlOrCommand && e.shiftKey && (key === 'I' || key === 'J' || key === 'C'))) {
e.preventDefault();
return false;
}
});
</script>
</body>
</html>