dexcalibur icon indicating copy to clipboard operation
dexcalibur copied to clipboard

Cannot open project UnhandledPromiseRejectionWarning

Open cryptax opened this issue 4 years ago • 13 comments

I am trying to open a project, it fails and shows errors in console.

[INFO] [APK HELPER] APK extracted into : /root/dexcaliburWS/alien_0/apk
TypeError: Cannot read property 'getUID' of undefined
    at DexcaliburProject.fullscan (/usr/lib/node_modules/dexcalibur/src/DexcaliburProject.js:712:56)
    at /usr/lib/node_modules/dexcalibur/src/WebServer.js:438:49
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:695) UnhandledPromiseRejectionWarning: Error: [PROJECT] synchronizePlatform : unkow platform. Aborted
    at DexcaliburProject.synchronizePlatform (/usr/lib/node_modules/dexcalibur/src/DexcaliburProject.js:429:19)
    at /usr/lib/node_modules/dexcalibur/src/WebServer.js:434:43
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:695) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
[INFO] [ADB] Enumerating connected devices ...
Execute command request : /root/dexcaliburWS/.dxc/bin/platform-tools/adb devices -l

This is running inside a Docker container which contains Android SDK + Android Emulators + NodeJS + Frida + Dexcalibur, (why? because I am trying to build such a container for people with Windows, for which Dexcalibur doesn't seem to install ok).

  • Docker container
  • Ubuntu 20.04.1 LTS
  • Dexcalibur 0.7.5
  • Frida 14.2.13
  • NodeJS 12.20.2
  • Android emulator 11 x86_64 with google apis

cryptax avatar Feb 22 '21 14:02 cryptax

hi,

It is same issue than #42

I cannot reproduce the issue but i fixed a potential platform issue with 5942fa0a9b130a404485cd898c9e1b4e125fe25c.

Please retry with v0.7.6 (now available on NPM).

FrenchYeti avatar Feb 22 '21 15:02 FrenchYeti

currently facing the same problem. I'm running Android 11/API 30 but don't notice it here

chrome_XbLn6F8GMk

is it related?

Tried with both 0.7.5 and 0.7.6

duckness avatar Feb 22 '21 17:02 duckness

@duckness Can you check the content of folders inside "<DEXCALIBUR_WORKSPACE>/.dxc/api/sdk_androidapi_29_google" ? Since you run Dexcalibur on Windows, this error can have a different root cause.

Is the stack trace is similar ? => Error in synchronizePlatform()

FrenchYeti avatar Feb 22 '21 18:02 FrenchYeti

.dxc/api/sdk_androidapi_29_google
❯ dir

    Directory: C:\Users\duckness\dexcaliburWS\.dxc\api\sdk_androidapi_29_google

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----           22/2/2021 10:35 pm                android
d----           22/2/2021 10:35 pm                androidx
d----           22/2/2021 10:35 pm                dalvik
d----           22/2/2021 10:35 pm                java
d----           22/2/2021 10:35 pm                javax
d----           22/2/2021 10:35 pm                org

after looking at the stacktrace a bit closer, I realised that the very first run (on 0.7.5) gave me that exact error:

TypeError: Cannot read property 'getUID' of undefined
    at DexcaliburProject.fullscan (C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\DexcaliburProject.js:712:56)
    at C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\WebServer.js:438:49
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:25988) UnhandledPromiseRejectionWarning: Error: [PROJECT] synchronizePlatform : unkow platform. Aborted
    at DexcaliburProject.synchronizePlatform (C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\DexcaliburProject.js:429:19)
    at C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\WebServer.js:434:43
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

subsequent runs on 0.7.5 and 0.7.6 gave me a slightly different error, instead of undefined, it is null. I have been unable to reproduce the undefined:

TypeError: Cannot read property 'getUID' of null
    at DexcaliburProject.fullscan (C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\DexcaliburProject.js:714:56)
    at C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\WebServer.js:438:49
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:19708) UnhandledPromiseRejectionWarning: Error: [PROJECT] synchronizePlatform : unkow platform. Aborted
    at DexcaliburProject.synchronizePlatform (C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\DexcaliburProject.js:431:19)
    at C:\Users\duckness\Downloads\dexcalibur-master\dexcalibur-master\src\WebServer.js:434:43
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

duckness avatar Feb 23 '21 06:02 duckness

Very good information :)

As i cannot reproduce the error, can you patch your code with the commit dbba59a557b1489d7175d39bdeeeb81a1932b2c9 ?

Can you say me if an error occurs and if there are more error messages into terminal ?

Thanks !

EDIT: Only src/PlatformManager.js and src/WebServer.jsshould be patched.

FrenchYeti avatar Feb 23 '21 09:02 FrenchYeti

[ERROR] Platform Manager : undefined is not a valid platform

I get this and nothing else

duckness avatar Feb 23 '21 10:02 duckness

@cryptax can you check if v0.7.8 solves your issue ?

FrenchYeti avatar Feb 24 '21 14:02 FrenchYeti

I close this issue. Feel free to update this issue, if problem persists.

FrenchYeti avatar Mar 08 '21 13:03 FrenchYeti

Just tried. The problem persists with 0.7.8.

[INFO] [APK HELPER] APK extracted into : /root/dexcaliburWS/Alien/apk
TypeError: Cannot read property 'getUID' of null
    at DexcaliburProject.fullscan (/usr/lib/node_modules/dexcalibur/src/DexcaliburProject.js:710:56)
    at /usr/lib/node_modules/dexcalibur/src/WebServer.js:445:49
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:64) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getMinApiVersion' of null
    at DexcaliburProject.synchronizePlatform (/usr/lib/node_modules/dexcalibur/src/DexcaliburProject.js:411:78)
    at /usr/lib/node_modules/dexcalibur/src/WebServer.js:441:43
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:64) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:64) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Would you like me to join my Dockerfile to help you reproduce?

cryptax avatar Mar 08 '21 16:03 cryptax

By the way, I am getting the same error, even without using a Dockerfile, i.e straight on the host. Version 0.7.8. Can you re-open the bug?

TypeError: Cannot read property 'getUID' of null
    at DexcaliburProject.fullscan (/home/axelle/.nvm/versions/node/v12.20.0/lib/node_modules/dexcalibur/src/DexcaliburProject.js:710:56)
    at /home/axelle/.nvm/versions/node/v12.20.0/lib/node_modules/dexcalibur/src/WebServer.js:445:49
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:276651) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getMinApiVersion' of null
    at DexcaliburProject.synchronizePlatform (/home/axelle/.nvm/versions/node/v12.20.0/lib/node_modules/dexcalibur/src/DexcaliburProject.js:411:78)
    at /home/axelle/.nvm/versions/node/v12.20.0/lib/node_modules/dexcalibur/src/WebServer.js:441:43
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:276651) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:276651) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

cryptax avatar Mar 12 '21 08:03 cryptax

Did you select a device for the project ? Is this devices is successfully enrolled ?
Is it an emulator or a physical device ?

FrenchYeti avatar Mar 12 '21 08:03 FrenchYeti

  • yes the device is enrolled
  • it is an emulator. Actually an ARM7 emulator. But I don't think it is related to ARM or x86.

dexcalibur

cryptax avatar Mar 12 '21 09:03 cryptax

With more tests, note this error only happens at the creation of the project. Actually, the project gets created, so, if after that you choose to open an existing project, it works, and you manage to open and analyze the APK.

cryptax avatar Mar 12 '21 13:03 cryptax