Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-obfuscator

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-obfuscator - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

lib/index.js

58

main.js

@@ -1,57 +0,1 @@

(function(){
let fs = require('fs')
let path = require('path')
let i, o = {}
let obfuscator = function(file){
let encrypted = o.obfuscate(fs.readFileSync(path.join(file), 'utf8'));
let html = "<script language=\"javascript\">";
html += "document.write(unescape('" + encrypted + "'))";
html += " // https://www.npmjs.com/org/html-obfuscator ";
html += "</script\>";
return html
}
o.obfuscate=function(tx) {
var text = '';
for (i = 0; i < tx.length; i++) {
text += '%' + o.hexfromdec(tx.charCodeAt(i))
}
return text;
}
o.hexfromdec=function(num) {
if(num > 65535) return ("Error at hexfromdec");
first = Math.round(num / 4096 - .5);
temp1 = num - first * 4096;
second = Math.round(temp1 / 256 - .5);
temp2 = temp1 - second * 256;
third = Math.round(temp2 / 16 - .5);
fourth = temp2 - third * 16;
return (''+o.convert(third)+o.convert(fourth));
}
o.convert=function(num) {
if (num < 10) {
return num;
} else {
if (num == 10) {
return "A"
}
if (num == 11) {
return "B"
}
if (num == 12) {
return "C"
}
if (num == 13) {
return "D"
}
if (num == 14) {
return "E"
}
if (num == 15) {
return "F"
}
}
}
module.exports=obfuscator
})()
module.exports=require('./lib/index')
{
"name": "html-obfuscator",
"version": "1.0.1",
"description": "Simple HTML obfuscator, that makes html files harder to understand",
"version": "1.0.2",
"description": "Simple HTML obfuscator, that makes html files harder to understand.",
"main": "main.js",

@@ -19,2 +19,3 @@ "scripts": {

"web",
"code",
"site"

@@ -27,7 +28,3 @@ ],

},
"homepage": "https://github.com/mrozio13pl/html-obfuscator#readme",
"dependencies": {
"fs": "0.0.1-security",
"path": "^0.12.7"
}
"homepage": "https://github.com/mrozio13pl/html-obfuscator#readme"
}

@@ -1,3 +0,8 @@

# HTML Obfuscator [![Version](https://img.shields.io/static/v1?label=Version&message=1.0.0&color=blue)](https://www.npmjs.com/package/html-obfuscator) [![License](https://img.shields.io/badge/licence-MIT-green)](https://github.com/mrozio13pl/html-obfuscator/blob/main/LICENSE) [![Build Passing](https://img.shields.io/badge/build-passing-success)](https://www.npmjs.com/package/html-obfuscator)
# Project Title
A brief description of what this project does and who it's for
# HTML Obfuscator [![Version](https://img.shields.io/static/v1?label=Version&message=1.0.2&color=blue)](https://www.npmjs.com/package/html-obfuscator) [![License](https://img.shields.io/badge/licence-MIT-green)](https://github.com/mrozio13pl/html-obfuscator/blob/main/LICENSE) [![Build Passing](https://img.shields.io/badge/build-passing-success)](https://www.npmjs.com/package/html-obfuscator)
##### A simple html obfuscator that makes code harder to read and understand

@@ -47,4 +52,11 @@

```
NOTE: You have to type a file in the function which you want to obfuscate, you can't put a code inside a function yet.
### Options
##### **type** - `file`/`text` - Gets text to obfuscate from file (default) / Obfuscates typed text
####
```js
var obfuscate = require('html-obfuscator')
obfuscate('<h1>Hello World</h1>', { type: "text" } )
```
### Express

@@ -78,3 +90,3 @@

fs.writeFileSync('obfuscated.html', obfuscate('index.html'))
fs.writeFileSync('obfuscated.html', obfuscate('index.html', { type: "file" }))
```

@@ -87,2 +99,2 @@ ## License

##### [Inspiration](http://snapbuilder.com/code_snippet_generator/obfuscate_html_source_code/)
#### Made by some random beginner
#### Made by some random beginner
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc