-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 22248c6
Showing
19 changed files
with
1,146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# JavaScript Obfuscate | ||
|
||
Demo of JavaScript Obfuscate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const code = ` | ||
let x = '1' + 1 | ||
console.log('x', x) | ||
` | ||
|
||
const options = { | ||
compact: false, | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) | ||
// var _0x151c=['log'];(function(_0x1ce384,_0x20a7c7){var _0x25fc92=function(_0x188aec){while(--_0x188aec){_0x1ce384['push'](_0x1ce384['shift']());}};_0x25fc92(++_0x20a7c7);}(_0x151c,0x1b7));var _0x553e=function(_0x259219,_0x241445){_0x259219=_0x259219-0x0;var _0x56d72d=_0x151c[_0x259219];return _0x56d72d;};let x='1'+0x1;console[_0x553e('0x0')]('x',x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const code = ` | ||
(function(){ | ||
function foo () { | ||
return function () { | ||
var sum = 1 + 2; | ||
console.log(1); | ||
console.log(2); | ||
console.log(3); | ||
console.log(4); | ||
console.log(5); | ||
console.log(6); | ||
} | ||
} | ||
foo()(); | ||
})(); | ||
` | ||
|
||
const options = { | ||
compact: false, | ||
controlFlowFlattening: false | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const code = ` | ||
console.log('abc'); | ||
console.log('cde'); | ||
console.log('efg'); | ||
console.log('hij'); | ||
` | ||
|
||
const options = { | ||
compact: false, | ||
deadCodeInjection: true, | ||
deadCodeInjectionThreshold: 1 | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const code = ` | ||
for (let i = 0; i < 5; i ++) { | ||
console.log('i', i) | ||
} | ||
` | ||
|
||
const options = { | ||
debugProtection: true | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const code = ` | ||
console.log('hello world') | ||
` | ||
const options = { | ||
disableConsoleOutput: true | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const code = ` | ||
console.log('hello world') | ||
` | ||
|
||
const options = { | ||
domainLock: ['cuiqingcai.com'] | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const code = ` | ||
let hello = '1' + 1 | ||
console.log('hello', hello) | ||
` | ||
|
||
const options = { | ||
compact: true, | ||
identifierNamesGenerator: 'mangled' | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const code = ` | ||
let hello = '1' + 1 | ||
console.log('hello', hello) | ||
` | ||
|
||
const options = { | ||
identifiersPrefix: 'germey' | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const code = ` | ||
var $ = function(id) { | ||
return document.getElementById(id); | ||
}; | ||
` | ||
|
||
const options = { | ||
renameGlobals: true | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const code = ` | ||
console.log('hello world') | ||
` | ||
|
||
const options = { | ||
selfDefending: true | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const code = ` | ||
var a = 'hello world' | ||
` | ||
const options = { | ||
stringArray: false, | ||
rotateStringArray: true, | ||
stringArrayEncoding: true, // 'base64' or 'rc4' or false | ||
stringArrayThreshold: 1, | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const code = ` | ||
console.log('hello world') | ||
` | ||
|
||
const options = { | ||
target: 'browser-no-eval' | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const code = ` | ||
(function(){ | ||
var object = { | ||
foo: 'test1', | ||
bar: { | ||
baz: 'test2' | ||
} | ||
}; | ||
})(); | ||
` | ||
const options = { | ||
compact: false, | ||
transformObjectKeys: true | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const code = ` | ||
var a = 'hello world' | ||
` | ||
const options = { | ||
compact: false, | ||
unicodeEscapeSequence: true | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
|
||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
|
||
console.log(obfuscate(code, options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const code = ` | ||
let x = '1' + 1 | ||
console.log('x', x) | ||
` | ||
|
||
const options = { | ||
compact: false, | ||
controlFlowFlattening: true | ||
} | ||
|
||
const obfuscator = require('javascript-obfuscator') | ||
function obfuscate(code, options) { | ||
return obfuscator.obfuscate(code, options).getObfuscatedCode() | ||
} | ||
console.log(obfuscate(code, options)) |
Oops, something went wrong.