Skip to content

Commit 090d49f

Browse files
authored
Refactor notification and minification logic
1 parent 0adc35c commit 090d49f

1 file changed

Lines changed: 97 additions & 106 deletions

File tree

script.js

Lines changed: 97 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,112 @@
11
(function() {
2-
// Pobfus 1.11.02 "Anti-Patch" Build
3-
window.onload = () => {
4-
const iEl = document.getElementById('in');
5-
const oEl = document.getElementById('out');
6-
const nContainer = document.getElementById('notif-container');
2+
const iel = document.getElementById('in');
3+
const oel = document.getElementById('out');
4+
const log = document.getElementById('log');
5+
const upInput = document.getElementById('up');
6+
const mob = document.getElementById('mob');
77

8-
/**
9-
* NOTIFICATION SYSTEM
10-
* Parses and displays engine status or errors.
11-
*/
12-
const notify = (msg, type = "info") => {
13-
const toast = document.createElement('div');
14-
toast.className = `toast ${type}`;
15-
// Parse error objects or raw strings
16-
const content = msg.message ? `[ENGINE]: ${msg.message}` : `[LOG]: ${msg}`;
17-
toast.innerText = content;
18-
19-
nContainer.appendChild(toast);
20-
21-
// Auto-remove after 4 seconds
22-
setTimeout(() => {
23-
toast.style.opacity = '0';
24-
setTimeout(() => toast.remove(), 300); // 300ms for fade animation
25-
}, 4000);
26-
};
8+
const push = (t) => {
9+
log.innerText = `> ${t}`;
10+
setTimeout(() => { if(log.innerText === `> ${t}`) log.innerText = ''; }, 4000);
11+
};
2712

28-
/**
29-
* MINIFIER & COMMENT STRIPPER
30-
* Removes all spaces and comments to break static analysis.
31-
*/
32-
const minify = (c) => {
33-
return c
34-
.replace(/--\[\[[\s\S]*?\]\]/g, '') // Multi-line
35-
.replace(/--.*$/gm, '') // Single-line
36-
.replace(/\s+/g, ' ') // Collapse whitespace
37-
.trim();
38-
};
13+
// --- the auto-minify engine ---
14+
const minifyLogic = (src) => {
15+
return src
16+
.replace(/--\[\[[\s\S]*?\]\]/g, '') // remove multi-line comments
17+
.replace(/--.*$/gm, '') // remove single-line comments
18+
.replace(/\s+/g, ' ') // collapse whitespace
19+
.trim();
20+
};
3921

40-
/**
41-
* HONEYPOT TRAP
42-
* Creates a recursive loop to crash automated constant dumpers.
43-
*/
44-
const getHoneypot = () => {
45-
const id = "_0x" + Math.random().toString(16).slice(2, 6);
46-
return `local ${id};${id}=function()return ${id}()end;`;
47-
};
22+
const todec = (s) => s.split('').map(c => "\\" + c.charCodeAt(0)).join('');
23+
24+
const handleFile = (file) => {
25+
if (!file) return;
26+
const ext = file.name.split('.').pop().toLowerCase();
27+
if (['lua', 'js', 'txt'].indexOf(ext) === -1) return push("err_type_refused");
28+
const reader = new FileReader();
29+
reader.onload = (f) => { iel.value = f.target.result; push("stream_imported"); };
30+
reader.readAsText(file);
31+
};
4832

49-
/**
50-
* CORE OBFUSCATION ENGINE
51-
*/
52-
document.getElementById('go').onclick = () => {
53-
let src = iEl.value.trim();
54-
if (!src) {
55-
notify("No source detected. Please input Luau code.", "error");
56-
return;
57-
}
33+
upInput.onchange = (e) => { handleFile(e.target.files[0]); upInput.value = ''; };
5834

59-
// Phase 1: Initiation
60-
notify("Initializing Pobfus 1.11.02 Virtualizer...", "info");
35+
iel.addEventListener('dragover', (e) => { e.preventDefault(); iel.style.background = "#111"; });
36+
iel.addEventListener('dragleave', () => { iel.style.background = ""; });
37+
iel.addEventListener('drop', (e) => {
38+
e.preventDefault();
39+
iel.style.background = "";
40+
handleFile(e.dataTransfer.files[0]);
41+
});
6142

62-
// Phase 2: Processing (1500ms buffer for "Heavy Lifting" feel)
63-
setTimeout(() => {
64-
try {
65-
const min = minify(src);
66-
const key = Math.floor(Math.random() * 50) + 15;
67-
const bytes = Array.from(min).map(x => x.charCodeAt(0) ^ key);
43+
// --- core processing ---
44+
document.getElementById('go').onclick = () => {
45+
let src = iel.value.trim();
46+
if(!src) return push("err_buffer_null");
6847

69-
// Start Building the Lua Result
70-
let res = `--[[ Protected by Pobfus 1.11.02 ]] `;
71-
72-
// Layer: Honeypot & Silent Scream
73-
res += getHoneypot();
74-
75-
// Layer: Selective Byte Compression (No space encryption)
76-
res += `local _S="${bytes.map(b => "\\" + b).join('')}";`;
77-
78-
// Layer: Anti-Hook & Metatable Sandbox
79-
res += `local _H=pcall(function()`;
80-
res += `local _D="";for i=1,#_S do _D=_D..string.char(bit32.bxor(_S:sub(i,i):byte(),${key}))end;`;
81-
res += `local _M=setmetatable({},{__index=function(t,k)`;
82-
83-
// Anti-Hook Logic: Block sensitive calls from Patch Coders
84-
res += `if k=="getfenv" or k=="setfenv" or k=="getreg" or k=="debug" then warn("Pobfus: Security Breach Detected") return function()end end;`;
85-
res += `return (getgenv and getgenv()[k] or _G[k]) end,__metatable="Pobfus_Locked"});`;
86-
87-
// Final Execution via Protected Thread
88-
res += `local _L=loadstring(_D);setfenv(_L,_M);(task and task.spawn or spawn)(_L)end);`;
89-
res += `if not _H then warn("Pobfus_Error: "..tostring(_E))end;`;
48+
push("minifying_stream...");
49+
50+
setTimeout(() => {
51+
try {
52+
// step 1: auto-minify
53+
src = minifyLogic(src);
54+
push("building_void...");
9055

91-
// Output Minification: Remove all logic-breaking spaces
92-
oEl.value = res.replace(/\s+/g, '');
93-
94-
notify("Obfuscation Complete. Anti-Hook layer active.", "success");
56+
// step 2: godly virtualization
57+
const k = Math.floor(Math.random() * 45) + 32;
58+
const d = Array.from(src).map(x => x.charCodeAt(0) ^ k).join(',');
59+
const h = todec("pobfus: logic active");
9560

96-
} catch (e) {
97-
notify(e, "error"); // Parses engine failures
61+
let res = `--[[\n pobfus // v1.11.05\n auto-minified godly build\n]]\n\n`;
62+
res += `task.spawn(function() while task.wait(120) do print("${h}") end end);\n\n`;
63+
res += `local _0x_mem = {${d}}; \n`;
64+
res += `local _success, _error = pcall(function() \n`;
65+
66+
if (mob && mob.checked) {
67+
res += ` local _0x_buf = {}; for _, v in pairs(_0x_mem) do table.insert(_0x_buf, string.char(bit32.bxor(v, ${k}))) end; local _0x_str = table.concat(_0x_buf); \n`;
68+
} else {
69+
res += ` local _0x_str = ""; for _, v in pairs(_0x_mem) do _0x_str = _0x_str .. string.char(bit32.bxor(v, ${k})) end; \n`;
9870
}
99-
}, 1500); // 1.5s delay for engine simulation
100-
};
101-
102-
/**
103-
* CLIPBOARD SYSTEM
104-
*/
105-
document.getElementById('cp').onclick = () => {
106-
if (!oEl.value) {
107-
notify("Output is empty. Obfuscate a script first.", "error");
108-
return;
71+
72+
res += ` local _0x_env = setmetatable({}, { \n`;
73+
res += ` __index = function(_, k) \n`;
74+
res += ` if k == "debug" or k == "getfenv" then return function() end end; \n`;
75+
res += ` return (getgenv and getgenv()[k] or _G[k]) \n`;
76+
res += ` end, \n`;
77+
res += ` __metatable = "locked" \n`;
78+
res += ` }); \n`;
79+
80+
res += ` local _0x_vm = loadstring(_0x_str); \n`;
81+
res += ` setfenv(_0x_vm, _0x_env); \n`;
82+
res += ` task.spawn(_0x_vm); \n`;
83+
res += `end); \n`;
84+
85+
oel.value = res;
86+
push("build_complete");
87+
} catch (e) {
88+
push("build_fault");
10989
}
110-
navigator.clipboard.writeText(oEl.value);
111-
notify("Virtualized Brick copied to clipboard!", "success");
112-
};
90+
}, 1200);
91+
};
92+
93+
document.getElementById('cp').onclick = () => {
94+
if(!oel.value) return push("err_empty");
95+
navigator.clipboard.writeText(oel.value);
96+
push("buffer_copied");
97+
};
98+
99+
document.getElementById('dl').onclick = () => {
100+
if(!oel.value) return push("err_empty");
101+
const blob = new Blob([oel.value], {type: "text/plain"});
102+
const a = document.createElement('a');
103+
a.href = URL.createObjectURL(blob);
104+
a.download = "pobfus_build.lua";
105+
a.click();
106+
push("file_dispatched");
107+
};
113108

114-
// Clear functionality
115-
document.getElementById('cl').onclick = () => {
116-
iEl.value = "";
117-
oEl.value = "";
118-
notify("Workspace cleared.");
119-
};
109+
document.getElementById('cl').onclick = () => {
110+
iel.value = ""; oel.value = ""; push("buffer_purged");
120111
};
121112
})();

0 commit comments

Comments
 (0)