-
Notifications
You must be signed in to change notification settings - Fork 0
/
HTML JS FILE DECRYPT.txt
41 lines (33 loc) · 1.22 KB
/
HTML JS FILE DECRYPT.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## SPLASH.X
## How to encrypt js file html
1.npm install -g browserify
2.create decrypt-script.js with code
const CryptoJS = require("crypto-js");
const { secretjskey } = require("../../secretfile");
function decryptScript(encryptedScript) {
const decryptedScript = CryptoJS.AES.decrypt(
encryptedScript,
"yourkey"
).toString(CryptoJS.enc.Utf8);
return decryptedScript;
}
window.decryptScript = decryptScript;
3. You have to convert descrypt-script. into bundle.js
cmd: browserify public/custom/decrypt-script.js -o public/custom/prebook-bundle.js
4. Then render your html/ejs file like this
const scriptFilePath = __dirname + "/public/custom/footer.js";
const scriptContent = fs.readFileSync(scriptFilePath, "utf-8");
const encryptedScript = CryptoJS.AES.encrypt(
scriptContent,
"yourkey"
).toString();
res.render("pages/htmml", { script: encryptedScript });
5. In your HTML/EJS File you have to add
<script src="../../custom/bundle.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function (event) {
const dscript = `<%= script %>`;
let decryptedScript = decryptScript(dscript);
eval(decryptedScript);
});
</script>