83 lines
3.2 KiB
JavaScript
83 lines
3.2 KiB
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
const inputArea = document.getElementById('input-code');
|
|
const outputArea = document.getElementById('output-code');
|
|
const protectBtn = document.getElementById('protect-btn');
|
|
const terminal = document.getElementById('terminal');
|
|
const copyBtn = document.getElementById('copy-btn');
|
|
|
|
function log(message, type = 'info') {
|
|
const entry = document.createElement('div');
|
|
entry.className = `log-entry log-${type}`;
|
|
const time = new Date().toLocaleTimeString([], { hour12: false });
|
|
entry.textContent = `[${time}] ${message}`;
|
|
terminal.appendChild(entry);
|
|
terminal.scrollTop = terminal.scrollHeight;
|
|
}
|
|
|
|
async function sleep(ms) {
|
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
}
|
|
|
|
protectBtn.addEventListener('click', async () => {
|
|
const code = inputArea.value.trim();
|
|
if (!code) {
|
|
log('Error: Source code is empty.', 'warn');
|
|
return;
|
|
}
|
|
|
|
const preset = document.getElementById('vm-preset').value;
|
|
const junk = document.getElementById('junk-code').value;
|
|
const encrypt = document.getElementById('encrypt-strings').value;
|
|
|
|
protectBtn.disabled = true;
|
|
protectBtn.textContent = 'Processing...';
|
|
|
|
terminal.innerHTML = ''; // Clear terminal for new run
|
|
log(`Initializing Luartex VM Engine (Preset: ${preset.toUpperCase()})...`, 'info');
|
|
await sleep(400);
|
|
log(`Analyzing source AST (${code.length} bytes)...`, 'info');
|
|
await sleep(300);
|
|
log(`Mapping opcodes to virtual registers...`, 'info');
|
|
await sleep(500);
|
|
log(`Injecting Anti-Tamper & Anti-Hook logic...`, 'info');
|
|
await sleep(400);
|
|
|
|
if (preset === 'obsidian' || preset === 'iron') {
|
|
log(`Applying high-entropy encryption layer...`, 'info');
|
|
await sleep(600);
|
|
}
|
|
|
|
try {
|
|
const response = await fetch('process.php', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ code, preset, junk, encrypt })
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (data.success) {
|
|
outputArea.value = data.protected_code;
|
|
log('Bytecode generation complete.', 'success');
|
|
log(`Final Entropy: ${data.stats.entropy}`, 'info');
|
|
log(`Protected Size: ${data.stats.protected_size} bytes`, 'info');
|
|
log('VM successfully virtualized and locked.', 'success');
|
|
} else {
|
|
log(`Error: ${data.error}`, 'warn');
|
|
}
|
|
} catch (err) {
|
|
log(`Critical Failure: ${err.message}`, 'warn');
|
|
} finally {
|
|
protectBtn.disabled = false;
|
|
protectBtn.textContent = 'Protect Script';
|
|
}
|
|
});
|
|
|
|
copyBtn.addEventListener('click', () => {
|
|
if (!outputArea.value) return;
|
|
navigator.clipboard.writeText(outputArea.value);
|
|
const originalText = copyBtn.textContent;
|
|
copyBtn.textContent = 'COPIED!';
|
|
setTimeout(() => copyBtn.textContent = originalText, 2000);
|
|
});
|
|
}); |