Server for running mobile app analyses for the tweasel project using locally connected devices/emulators.
This is an analysis runner for the tweasel.org platform that works with locally connected devices/emulators. It accepts analysis requests for the configured platform (Android emulator or iOS device) and reports the results back to the server running platform
.
For each analysis request, the runner:
- Downloads the requested Android app using apkeep or iOS app using ipatool.
- Runs a dynamic analysis of the requested app, capturing its network traffic using cyanoacrylate.
- Detects tracking data transmissions in the recorded traffic using TrackHAR, relying solely on the adapter-based workflow.
The server uses Hono as the framework. Analysis requests are kept in a better-queue queue that is persisted in an SQLite database.
Thank you for your interest in contributing to the project! To run the it locally for development, follow these steps:
-
Install Node.js and Yarn 1 (Classic) if you haven't done so already.
-
Install appstraction's host dependencies.
-
Set up a device or an emulator according to appstraction's device preparation instructions.
-
Install and configure the dependencies for downloading Android and/or iOS apps.
-
Clone the repo and run
yarn
in the root directory of the repo to fetch all required dependencies. -
Copy the file
config.sample.json
toconfig.json
and edit it accordingly. Most values should be self-explanatory and you can refer to the config schema, but here are some notes:target
sets the options for how cyanoacrylate talks to your device/emulator. These differ depending on the platform.analysisResultUrl
is the URL to the endpoint that accepts the analysis results on your locally runningplatform
instance. In development, this should behttp://localhost:4321/private-api/analysis-result
.token
is a shared secret between the server and the runner. The runner only accepts requests with this token and the server only accepts results with this token. Thus, you need to set the same value in the*_RUNNER_TOKEN
environment variable in yourplatform
instance.
-
Finally, run
yarn dev
to start the server in development mode. It will be available athttp://localhost:3000
and automatically reload for any changes you make.
For the analysis runner to be able to download Android apps, you need to have apkeep installed and set up:
-
Install using
cargo install apkeep
. -
Fetch an
oauth_token
by going to https://accounts.google.com/embedded/setup/v2/android and logging in. Once you click "I agree" on the last page, a cookie calledoauth_token
will be placed (value starts withoauth2_4/0
). The website will continue loading forever, but the cookie is already valid. -
Run
apkeep -e '<email>' --oauth-token '<oauth_token>'
. This should print an AAS token. -
Create
~/.config/apkeep/apkeep.ini
with the following contents:[google] email = <email> aas_token = <AAS token>
You can test that everything works correctly by running:
apkeep -a <app ID> -d google-play -o device=px_3a,locale=en_DE,include_additional_files=1,split_apk=1 <out dir>
For the analysis runner to be able to download iOS apps, you need to have IPATool installed and set up:
- Install the latest release of IPATool to your
$PATH
. - Log in using
ipatool auth login --email <email> --password <password>
.
You can test that everything works correctly by running:
ipatool download -b <bundle ID> --purchase
This code is licensed under the MIT license, see the LICENSE
file for details.
Issues and pull requests are welcome! Please be aware that by contributing, you agree for your work to be licensed under an MIT license.