html-obfuscator-v2
v0.0.3
Published
Enhance HTML obfuscation tool. Converts HTML into obfuscated JavaScript.
Maintainers
Readme
html-obfuscator-v2
Extreme HTML obfuscation tool. Converts your HTML into heavily obfuscated JavaScript that writes the original HTML to the page. Useful for basic protection against code scraping and source viewing.
Installation
npm install html-obfuscator-v2Basic Usage
const { obfuscate } = require('html-obfuscator-v2');
const html = `<h1>Hello, World!</h1>`;
const obfuscatedHTML = obfuscate(html);
// Output: a <script> tag that writes obfuscated HTML to the document
console.log(obfuscatedHTML);Express Example
Below is a simple example of using html-obfuscator-v2 in an Express route to serve obfuscated HTML:
const express = require('express');
const fs = require('fs');
const path = require('path');
const { obfuscate } = require('html-obfuscator-v2');
const app = express();
app.get('/', (req, res) => {
const htmlPath = path.join(__dirname, 'web', 'docs.html');
fs.readFile(htmlPath, 'utf-8', (err, html) => {
if (err) return res.status(500).send('Failed to load HTML');
try {
const obfuscated = obfuscate(html);
res.type('html').send(obfuscated);
} catch (e) {
console.error('Obfuscation failed, sending original HTML:', e.message);
res.type('html').send(html);
}
});
});
app.listen(3000, () => {
console.log('Server running on http://localhost:3000');
});Support
If you have a problem you can open an issue,
or contact me here: (づ ̄ ³ ̄)づ
License
MIT
