html-obfuscator
Advanced tools
Comparing version 1.0.1 to 1.0.2
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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6077
0
4
60
98
- Removedfs@0.0.1-security
- Removedpath@^0.12.7
- Removedfs@0.0.1-security(transitive)
- Removedinherits@2.0.3(transitive)
- Removedpath@0.12.7(transitive)
- Removedprocess@0.11.10(transitive)
- Removedutil@0.10.4(transitive)