js-confuser
js-confuser copied to clipboard
TypeError
Describe the bug:
TypeError: Cannot read properties of null (reading 'type')
Config and Small code sample
Too Big
Code:
Too big can't upload
Expected behavior
The Program should be obfuscated successfully
Actual behavior
Not Obfusacting
Hi, can you provide the entire error stack so I can understand better
Hi, can you provide the entire error stack so I can understand better
i'm only getting the same error
I mean please show the stack trace. It should appear like this: (example)
/Users/michael/Desktop/test/node_modules/js-confuser/dist/index.js:89
throw new TypeError("code must be type string");
^
TypeError: code must be type string
at JsConfuser (/Users/michael/Desktop/test/node_modules/js-confuser/dist/index.js:89:11)
at Object.obfuscate (/Users/michael/Desktop/test/node_modules/js-confuser/dist/index.js:56:16)
at Object.<anonymous> (/Users/michael/Desktop/test/index.js:3:12)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
Oh here
C:\Users\onmaz\Downloads\Krex Priv Gr@bber\Priv\node_modules\js-confuser\dist\transforms\controlFlowFlattening\switchCaseObfuscation.js:31
return object.type == "SwitchStatement" && !object.cases.find(x => !(x.test.type == "Literal" && typeof x.test.value === "number" && Math.abs(x.test.value) < 100000));
^
TypeError: Cannot read properties of null (reading 'type')
at C:\Users\onmaz\Downloads\Krex Priv Gr@bber\Priv\node_modules\←[4mjs-confuser←[24m\dist\transforms\controlFlowFlattening\switchCaseObfuscation.js:31:81
at Array.find (<anonymous>)
at SwitchCaseObfuscation.match (C:\Users\onmaz\Downloads\Krex Priv Gr@bber\Priv\node_modules\←[4mjs-confuser←[24m\dist\transforms\controlFlowFlattening\switchCaseObfuscation.js:31:62)
at SwitchCaseObfuscation.input (C:\Users\onmaz\Downloads\Krex Priv Gr@bber\Priv\node_modules\←[4mjs-confuser←[24m\dist\transforms\transform.js:189:14)
at C:\Users\onmaz\Downloads\Krex Priv Gr@bber\Priv\node_modules\←[4mjs-confuser←[24m\dist\transforms\transform.js:141:21
at walk (C:\Users\onmaz\Downloads\Krex Priv Gr@bber\Priv\node_modules\←[4mjs-confuser←[24m\dist\traverse.js:59:18)
at walk (C:\Users\onmaz\Downloads\Krex Priv Gr@bber\Priv\node_modules\←[4mjs-confuser←[24m\dist\traverse.js:76:15)
at walk (C:\Users\onmaz\Downloads\Krex Priv Gr@bber\Priv\node_modules\←[4mjs-confuser←[24m\dist\traverse.js:65:13)
at walk (C:\Users\onmaz\Downloads\Krex Priv Gr@bber\Priv\node_modules\←[4mjs-confuser←[24m\dist\traverse.js:76:15)
at walk (C:\Users\onmaz\Downloads\Krex Priv Gr@bber\Priv\node_modules\←[4mjs-confuser←[24m\dist\traverse.js:76:15)
Thanks I will get to working on this soon. It seems to do with Switch statements with default cases.
Thanks I will get to working on this soon. It seems to do with Switch statements with default cases.
oh ok
Sounds like #45 which is closed. @Krex38 can you still reproduce the issue? If so, can you try to get a minimal reproduction case?
I'm running into this same issue. I don't know if it helps, but I got a different error that the maximum call stack was exceeded when I tried to add verbose: true to the options. There are some decently big files that I'm working with. They're all chunked by webpack, but it always fails in the same spot. I've tried adjusting options to no avail. I'm on the latest version.
Using the low preset, but setting minify and compact to false seemed to fix the issue for me.
Closing for now, feel free to reopen