tweaselORG / cyanoacrylate

Toolkit for large-scale automated traffic analysis of mobile apps on Android and iOS.
MIT License
5 stars 1 forks source link

System requirement aapt not listed #20

Closed jchmrt closed 1 year ago

jchmrt commented 1 year ago

Hi! Thanks for this cool project. I've been working on setting it up on my system and I ran into an issue where running the examples would give an error while installing Wireguard on the emulator.

Error: Failed to automatically install WireGuard app. Try again or install it manually.
    at Object.ensureDevice (file:///ABC/node_modules/appstraction/dist/index.js:382:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///ABC/analysis.js:21:5 {
  [cause]: Error: Failed to install app: "/tmp/cb0bf978e9c8165113e29ba2f08d7ee5.apk" is not a valid APK.
      at file:///ABC/node_modules/appstraction/dist/index.js:473:35
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Promise.all (index 0)
      at async Object.installApp (file:///AB/node_modules/appstraction/dist/index.js:472:29)
      at async Object.ensureDevice (file:///ABC/node_modules/appstraction/dist/index.js:377:21)
      at async file:///ABC/analysis.js:21:5
}

After some testing and digging around in the code, I realized it is due to this line in util.ts: https://github.com/tweaselORG/appstraction/blob/main/src/util.ts#L75, which uses aapt to check the apk file. Turns out I didn't have aapt installed (I'm on a relatively fresh install of ubuntu 22.04). A quick apt install aapt fixed this problem.

From a quick look, I couldn't find aapt mentioned as a requirement for this project. So, maybe it would be possible to add this somewhere in the documentation and/or to improve the error message to make this more clear?

Let me know if you need any more info from me. Thanks!

zner0L commented 1 year ago

aapt is part of the Android Build Tools, which we mention in the host dependencies for Android of appstraction. Maybe you didn't install the build tools or you don't have your PATH set up correctly?

Thanks for the feedback on the README, though. I think we could provide clearer steps on how to install the dependencies and maybe also check they have been correctly installed.

jchmrt commented 1 year ago

Ah yes, I see the problem. My installed build tools where in $ANDROID_HOME/build-tools/33.0.2/, but I simply copied the PATH lines from the README which uses version 33.0.0. Changing that solves it.

Thanks for the explanation!

baltpeter commented 1 year ago

Since appstraction v0.3.0, we're now installing the Android SDK tools automatically, so I think this can be closed.