Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError #42

Open
Krex38 opened this issue Aug 24, 2022 · 9 comments
Open

TypeError #42

Krex38 opened this issue Aug 24, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@Krex38
Copy link

Krex38 commented Aug 24, 2022

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

@Krex38 Krex38 added the bug Something isn't working label Aug 24, 2022
@MichaelXF
Copy link
Owner

Hi, can you provide the entire error stack so I can understand better

@Krex38
Copy link
Author

Krex38 commented Aug 24, 2022

Hi, can you provide the entire error stack so I can understand better

i'm only getting the same error

@MichaelXF
Copy link
Owner

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

@Krex38
Copy link
Author

Krex38 commented Aug 25, 2022

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)

@MichaelXF
Copy link
Owner

Thanks I will get to working on this soon. It seems to do with Switch statements with default cases.

@Krex38
Copy link
Author

Krex38 commented Aug 25, 2022

Thanks I will get to working on this soon. It seems to do with Switch statements with default cases.

oh ok

@Le0Developer
Copy link

Sounds like #45 which is closed. @Krex38 can you still reproduce the issue?
If so, can you try to get a minimal reproduction case?

@kitsune7
Copy link

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.

@kitsune7
Copy link

Using the low preset, but setting minify and compact to false seemed to fix the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants