jsafer

A simple Javascript Obfuscator that chains files/snippets using multiple obfuscation techniques.

Usage no npm install needed!

<script type="module">
  import jsafer from 'https://cdn.skypack.dev/jsafer';
</script>

README

jsafer

npm install -g jsafer

Security Obfuscation Examples

the cli tool enables various usages.
The output is production-ready artifacts, that are created as "<original_name>.obfuscated.js"

Single File Obfuscation / Protection

% jsafer "simple_test.js"
- jsafer - Files to minify:  [ 'simple_test.js' ]
- jsafer -  Stage 1 - Obfuscation #1 is done
- jsafer - Stage 2 - Obfuscation #2 is done
- jsafer - Stage 3 - Minifying...
- jsafer - Stage 4 - Obfuscated And Minified:

var _0x50d8=["631792iiXlAT","73vmOeJA","1491FsqhOo","1akSToO","227pSAJBp","772838JDMXmH","ZgHGw","RGuPM","542108bhZLlN","log","575550LCKIKG","17DslkVc","505380IVuxHJ","wSbKG"],_0x43c0=function(n,r){return _0x50d8[n-=276]},_0x3f5543=_0x43c0;!function(n,r){for(var t=_0x43c0;;)try{if(413626===parseInt(t(284))*parseInt(t(282))-parseInt(t(277))+-parseInt(t(281))*parseInt(t(283))+parseInt(t(289))+-parseInt(t(279))+parseInt(t(280))*-parseInt(t(276))+parseInt(t(287)))break;n.push(n.shift())}catch(r){n.push(n.shift())}}(_0x50d8);var _0x2a32=[_0x3f5543(288)];function fibo(n,r=1,t=1){var a=_0x3f5543,e={ZgHGw:function(n,r){return n>r},RGuPM:function(n,r,t,a){return n(r,t,a)},wSbKG:function(n,r){return n+r}};if(!e[a(285)](r,n))return console[_0x2a32[0]](r),e[a(286)](fibo,n,t,e[a(278)](r,t))}fibo(1e3);

- jsafer - Stage 5 - Done.

Code Snippet Obfuscation

 % jsafer                                   
No files were specified, getting code from prompt.
prompt: code:  jsafer "let a=1, b=2; console.alert(1);'"
- jsafer - Command-line input received:
- jsafer -  Stage 1 - Obfuscation #1 is done
- jsafer - Stage 2 - Obfuscation #2 is done
- jsafer - Stage 3 - Minifying...
- jsafer - Stage 4 - Obfuscated And Minified:

var _0x9b94=["31691VFPYXl","15KxXWKQ","e.alert(1)","=2; consol","151499PBZhCp","656899sssszm","1oUgXUp","6683Lzkzic","167654ksFLrv","let a=1, b","263622DnXYnw","1SIlJGI","3vrEjPn","131731rBGYdc"],_0x28db=function(a,r){return _0x9b94[a-=111]},_0x556a0e=_0x28db;!function(a,r){for(var s=_0x28db;;)try{if(137711===-parseInt(s(116))*-parseInt(s(118))+parseInt(s(119))*parseInt(s(111))+-parseInt(s(115))*parseInt(s(117))+parseInt(s(124))*-parseInt(s(122))-parseInt(s(114))-parseInt(s(112))+parseInt(s(123)))break;a.push(a.shift())}catch(r){a.push(a.shift())}}(_0x9b94);var _0x57a5=[_0x556a0e(113)+_0x556a0e(121)+_0x556a0e(120)+";'"];jsafer,_0x57a5[0];

- jsafer - Stage 5 - Done.

Directory Obfuscation

% jsafer *.js

- jsafer - Files to minify:  [
  'obfuscate.js',
  'simple_test.js',
]
...
381)](t[x(381)](3994,9310),-13268)],((_,r)=>{const c=x,d=_0x2724;if(_)return void console[_0xb827[t[c(387)](t[c(387)](-7876,-8188),t[c(388)](1,16085))]](_);e[t[c(527)](d,411)](obfuscate,r,n)}))})));

- jsafer - Stage 5 - Done.