{"id":16467175,"url":"https://github.com/avilum/jsafer","last_synced_at":"2025-10-27T13:30:40.675Z","repository":{"id":40442493,"uuid":"354623132","full_name":"avilum/jsafer","owner":"avilum","description":"A simple JS source code obfuscator/minifier that doesn't hurt consistency or speed.","archived":false,"fork":false,"pushed_at":"2022-05-08T17:41:26.000Z","size":83,"stargazers_count":13,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T05:41:19.405Z","etag":null,"topics":["codeproject","javascript","minifier","obfuscator","security-tools"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avilum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-04T18:55:57.000Z","updated_at":"2024-09-15T09:16:58.000Z","dependencies_parsed_at":"2022-08-09T20:30:50.730Z","dependency_job_id":null,"html_url":"https://github.com/avilum/jsafer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avilum%2Fjsafer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avilum%2Fjsafer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avilum%2Fjsafer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avilum%2Fjsafer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avilum","download_url":"https://codeload.github.com/avilum/jsafer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238497689,"owners_count":19482298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeproject","javascript","minifier","obfuscator","security-tools"],"created_at":"2024-10-11T11:46:22.479Z","updated_at":"2025-10-27T13:30:40.203Z","avatar_url":"https://github.com/avilum.png","language":"JavaScript","readme":"# jsafer\n```shell\n$ npm install -g jsafer\n```\n```shell\n$ # Let's test the installation.\n$ jsafer\n\nNo files were specified, getting code from prompt.\n\nprompt: code:\n\nfunction fibo(limit, a=1, b=1){\n    // Some docstring about this function\n    if(a \u003e limit){\n        return\n    }\n    console.log(a)\n    return fibo(limit, b, a+b)\n}\n\nfibo(1000);\n\n- jsafer -  Stage 1 - Obfuscation #1 is done\n- jsafer - Stage 2 - Obfuscation #2 is done\n- jsafer - Stage 3 - Minifying...\n- jsafer - Stage 4 - Obfuscated And Minified:\n\nvar _0x49e6=[\"1zlSZGb\",\"518807ylKatK\",\"Qlakm\",\"1155382sXYSWG\",\"log\",\"3085474vbXBWc\",\"11seDYzl\",\"46887RdaVcU\",\"514116BeWIKX\",\"987748FPAGmd\",\"1177490DqkqIl\",\"kFteY\",\"VBurQ\",\"2BAVaWb\"],_0x7c2b=function(r,n){return _0x49e6[r-=190]},_0x2f68a6=_0x7c2b;!function(r,n){for(var t=_0x7c2b;;)try{if(715168===-parseInt(t(192))*-parseInt(t(193))+parseInt(t(201))+-parseInt(t(198))*parseInt(t(199))+-parseInt(t(202))+-parseInt(t(195))+parseInt(t(200))*-parseInt(t(191))+parseInt(t(197)))break;r.push(r.shift())}catch(n){r.push(r.shift())}}(_0x49e6);var _0x84f0=[_0x2f68a6(196)];function fibo(r,n=1,t=1){var e=_0x2f68a6,a={kFteY:function(r,n){return r\u003en},Qlakm:function(r,n,t,e){return r(n,t,e)},VBurQ:function(r,n){return r+n}};if(!a[e(203)](n,r))return console[_0x84f0[0]](n),a[e(194)](fibo,r,t,a[e(190)](n,t))}fibo(1e3);\n\n- jsafer - Stage 5 - Done.\n1\n1\n2\n3\n5\n8\n13\n21\n34\n55\n89\n144\n233\n377\n610\n```\n## Security Obfuscation Examples\nThe CLI tool enables various usages.\u003cbr\u003e\nCode of any size can be encapsulated with this technique, in a stable way. \u003cbr\u003e\nThe output is production-ready artifacts, that are created as \"*\u003coriginal_name\u003e*.obfuscated.js\"\n\n#### Single File Obfuscation / Protection\n```shell\n➜  jsafer git:(main) ✗ jsafer ./simple_test.js\n- jsafer - Files to minify:  [ './simple_test.js' ]\n- jsafer -  Stage 0 - First obfuscation is done\n- jsafer - Stage 0 - Second obfuscation is done\n- jsafer -  Stage 1 - First obfuscation is done\n- jsafer - Stage 1 - Second obfuscation is done\n- jsafer -  Stage 2 - First obfuscation is done\n- jsafer - Stage 2 - Second obfuscation is done\n- jsafer -  Stage 3 - First obfuscation is done\n- jsafer - Stage 3 - Second obfuscation is done\n- jsafer -  Stage 4 - First obfuscation is done\n- jsafer - Stage 4 - Second obfuscation is done\n- jsafer -  Stage 5 - First obfuscation is done\n- jsafer - Stage 5 - Second obfuscation is done\n- jsafer -  Stage 6 - First obfuscation is done\n- jsafer - Stage 6 - Second obfuscation is done\n- jsafer -  Stage 7 - First obfuscation is done\n- jsafer - Stage 7 - Second obfuscation is done\n- jsafer -  Stage 8 - First obfuscation is done\n- jsafer - Stage 8 - Second obfuscation is done\n- jsafer -  Stage 9 - First obfuscation is done\n- jsafer - Stage 9 - Second obfuscation is done\n- jsafer - Stage 3 - Minifying...\n- jsafer - Stage 4 - Obfuscated And Minified:\n\nvar _0x342e93=_0x1143;function _0x1143(e,r){var n=_0x35d0();return(_0x1143=function(e,r){return n[e-=302]})(e,r)}!function(e,r){for(var n=_0x1143,t=_0x35d0();;)try{if(520382===-parseInt(n(315))/1*(-parseInt(n(307))/2)+-parseInt(n(319))/3+parseInt(n(303))/4*(parseInt(n(305))/5)+parseInt(n(308))/6+parseInt(n(311))/7+-parseInt(n(309))/8+-parseInt(n(318))/9)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();var _0x9875=[_0x342e93(316),_0x342e93(302),_0x342e93(312),_0x342e93(310)+_0x342e93(314),_0x342e93(313)+_0x342e93(304)];const{performance:performance}=require(_0x9875[0]);var startTime=performance[_0x9875[1]]();function fibo(e,r=1,n=1){var t=_0x342e93,o={vxBTI:function(e,r){return e\u003er},aEBwR:function(e,r,n,t){return e(r,n,t)},LHoLC:function(e,r){return e+r}};if(!o[t(306)](r,e))return console[_0x9875[2]](r),o[t(320)](fibo,e,n,o[t(317)](r,n))}function _0x35d0(){var e=[\"ok \",\"341sPqGdk\",\"perf_hooks\",\"LHoLC\",\"11695428cDfJvU\",\"516504tfDkFZ\",\"aEBwR\",\"now\",\"284FEQHXZ\",\"nds\",\"890aKXUeK\",\"vxBTI\",\"4978Piqczx\",\"5899530SGIBSd\",\"732472GoaJsq\",\"The run to\",\"1672713PsAbHz\",\"log\",\" milliseco\"];return(_0x35d0=function(){return e})()}fibo(1/1e-9);var endTime=performance[_0x9875[1]]();console[_0x9875[2]](\"\"+_0x9875[3]+(endTime-startTime)+_0x9875[4]);\n\n- jsafer - Stage 5 - Done.\n```\nCheck the obfuscated code:\n```shell\n➜  jsafer git:(main) ✗ node simple_test.obfuscated.js \n1\n1\n2\n3\n5\n8\n13\n21\n34\n55\n89\n144\n233\n377\n610\n987\n1597\n2584\n4181\n6765\n10946\n17711\n28657\n46368\n75025\n121393\n196418\n317811\n514229\n832040\n1346269\n2178309\n3524578\n5702887\n9227465\n14930352\n24157817\n39088169\n63245986\n102334155\n165580141\n267914296\n433494437\n701408733\nThe run took 7.0212240014225245 milliseconds\n```\n#### Code Snippet Obfuscation\n```shell\n % jsafer\n\nNo files were specified, getting code from prompt.\n\nprompt: code: \"let a=1, b=2; console.alert(1);'\"\n- jsafer - Command-line input received:\n- jsafer -  Stage 1 - Obfuscation #1 is done\n- jsafer - Stage 2 - Obfuscation #2 is done\n- jsafer - Stage 3 - Minifying...\n- jsafer - Stage 4 - Obfuscated And Minified:\n\nvar _0x9b94=[\"31691VFPYXl\",\"15KxXWKQ\",\"e.alert(1)\",\"=2; \n... +_0x556a0e(121)+_0x556a0e(120)+\";'\"];jsafer,_0x57a5[0];\n\n- jsafer - Stage 5 - Done.\n```\n#### Directory Obfuscation\n```shell\n% jsafer *.js\n\n- jsafer - Files to minify:  [\n  'obfuscate.js',\n  'simple_test.js',\n]\n\n...\n381)](t[x(381)](3994,9310),-13268)],((_,r)=\u003e{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)}))})));\n\n- jsafer - Stage 5 - Done.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favilum%2Fjsafer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favilum%2Fjsafer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favilum%2Fjsafer/lists"}