From 13371337071754b34f9a758995fd0af0c2a48940 Mon Sep 17 00:00:00 2001 From: Billy Lau Date: Tue, 23 Jun 2026 15:21:13 +0800 Subject: [PATCH] uraniborg: Remove obsolete risk scoring framework. The device risk scoring code is no longer relevant to the project. We now remove it to simplify the codebase. This change includes the removal of: - Core scoring logic: `risk_analyzer.py` and `device_scoring.py` - Baseline generation scripts: `generate_baseline_packages.py` - Preloaded GSI baseline data and whitelists: `package_whitelists.py` and the `data/` directory - Related documentation: `device_scoring.md` and `adding_new_baseline.md` Additionally, `README.md` has been updated to remove references to the risk analysis features and collaboration details. Change-Id: Ia3c7e790e26ff352635215fd257447f98159be8d --- uraniborg/README.md | 12 - uraniborg/docs/adding_new_baseline.md | 57 - uraniborg/docs/device_scoring.md | 106 -- uraniborg/scripts/python/data/N-AOSP.json | 166 --- uraniborg/scripts/python/data/O-AOSP.json | 187 --- uraniborg/scripts/python/data/P-AOSP.json | 189 --- uraniborg/scripts/python/data/Q-GSI.json | 286 ----- uraniborg/scripts/python/data/R-GSI.json | 360 ------ uraniborg/scripts/python/data/S-GSI.json | 299 ----- uraniborg/scripts/python/data/T-GSI.json | 264 ---- uraniborg/scripts/python/data/U-GSI.json | 352 ------ uraniborg/scripts/python/data/V-GSI.json | 358 ------ uraniborg/scripts/python/device_scoring.py | 280 ----- .../python/generate_baseline_packages.py | 91 -- .../scripts/python/package_whitelists.py | 326 ----- uraniborg/scripts/python/risk_analyzer.py | 1066 ----------------- 16 files changed, 4399 deletions(-) delete mode 100644 uraniborg/docs/adding_new_baseline.md delete mode 100644 uraniborg/docs/device_scoring.md delete mode 100644 uraniborg/scripts/python/data/N-AOSP.json delete mode 100644 uraniborg/scripts/python/data/O-AOSP.json delete mode 100644 uraniborg/scripts/python/data/P-AOSP.json delete mode 100644 uraniborg/scripts/python/data/Q-GSI.json delete mode 100644 uraniborg/scripts/python/data/R-GSI.json delete mode 100644 uraniborg/scripts/python/data/S-GSI.json delete mode 100644 uraniborg/scripts/python/data/T-GSI.json delete mode 100644 uraniborg/scripts/python/data/U-GSI.json delete mode 100644 uraniborg/scripts/python/data/V-GSI.json delete mode 100644 uraniborg/scripts/python/device_scoring.py delete mode 100644 uraniborg/scripts/python/generate_baseline_packages.py delete mode 100644 uraniborg/scripts/python/package_whitelists.py delete mode 100644 uraniborg/scripts/python/risk_analyzer.py diff --git a/uraniborg/README.md b/uraniborg/README.md index 97b4473..ffc0bd9 100644 --- a/uraniborg/README.md +++ b/uraniborg/README.md @@ -9,14 +9,6 @@ can be obtained. This repository currently contains code that can be used to build an explorer app (APK) called Hubble. -It also contains code that can be used to score device preload risks. In this -effort, we collaborated with a team of university experts from the University of -Cambridge, University of Strathclyde, and Johannes Kepler University in Linz, -who created a formula that considers the risk of platform signed apps, -pregranted permissions on preloaded apps, and apps communicating using cleartext -traffic. A whitepaper of the scoring framework is also available at: -https://www.android-device-security.org/publications/ - The name of this project and its components are mainly inspired by the field of astronomy. @@ -36,10 +28,6 @@ Below are links to more specific documentations. ### Data Interpretation - [Interpreting Hubble results](docs/hubble_results.md) -### Risk Analysis -- [Scoring device preload risks](docs/device_scoring.md) -- [Adding new baseline for new OS release](docs/adding_new_baseline.md) - ## Version The current version info can be found within the VERSION file, and in the build.gradle file of the Hubble app. diff --git a/uraniborg/docs/adding_new_baseline.md b/uraniborg/docs/adding_new_baseline.md deleted file mode 100644 index 8e6304b..0000000 --- a/uraniborg/docs/adding_new_baseline.md +++ /dev/null @@ -1,57 +0,0 @@ -# Adding new baseline for new OS release - -We anticipate that every year, a new OS release will be available. In each -release, we assume that a new reference implementation (i.e. -[GSI](https://source.android.com/setup/build/gsi)) will be available. - -Here, we provide a guide and a working example of how the current risk scoring -implementation can be updated to include new baselines in order to do a proper -comparison of a build on a new OS release. - -## Steps -### Collect new data -First, download a new prebuilt official GSI image -\[[website](https://developer.android.com/topic/generic-system-image/releases#android-gsi-12)\] of the new OS version and flash -it onto a compatible device. - -Then, make sure that the device boots into the GSI image by verifying the -build string matches that of the downloaded image during runtime by navigating -to `Settings > About phone` on the device after boot. - -Next, deploy `Hubble` on the device running GSI build using -`automate_observation.py` script in this repo \[[docs](automate_observation.md)\]. You should obtain results in a `results/` directory if no additional parameters -were given when executing `automate_observation.py`. - -Now, you are ready to generate a new set of baseline data with the results obtained -in the earlier step by making use of the `generate_baseline_packages.py` script -that is also provided in this repo. For example: -``` -$ python3 generate_baseline_packages.py results/Android/gsi_arm64\:12/SPB5.210812.003/7673742\:user/release-keys/000 - -``` - -Upon successful execution of that, you should see results printed to stdout on -your terminal. You can either copy or pipe that to a file, which can be named -with the convention `-GSI.json`. Then, move the json file into the - `data/` directory located within the `scripts/python` directory. - -### Modify code to update mapping -The current risk scoring implementation makes use of the baseline readings in -the `data/` directory as baselines. Therefore, there are some code changes that -are required to make sure that the code recognizes the new baseline and have -appropriate mappings updated. Here are the necessary changes: - -In `package_whitelists.py`, add a mapping for the latest API level to filename, i.e. to the json file you have just generated in the earlier section. -HINT: Look at how previous levels are mapped. - -Finally, you should append relevant objects/mappings to `risk_analyzers.py` that reflects the latest change in the latest version of the OS. To do so: - -For each non `AbstractBasedClass` analyzer, e.g. `PlatformSignature`, you'll need -to add a new OS Level specific class at the section labeled "NOTE TO IMPLEMENTORS" -within the code. Then, add a new `if` statement that returns the OS-version specific -object. Again, refer to the existing implementation for the design pattern. - -For example, if we are introducing Android S, we would first create an -`SPlatformSignature` class by referring to how previous release's class -(`RPlatformSignature`) was implemented, and return an instance of -`SPlatformSignature` when the API level check corresponds to `31`. diff --git a/uraniborg/docs/device_scoring.md b/uraniborg/docs/device_scoring.md deleted file mode 100644 index 9a48330..0000000 --- a/uraniborg/docs/device_scoring.md +++ /dev/null @@ -1,106 +0,0 @@ -# Scoring device preload risks - -An angle of analysis for the data that is collected via Hubble is to attempt to -score security and privacy risks that users are exposed to via the type and the -manner that apps are preloaded on each device/build. - -In order to do this, we have developed a -[risk scoring framework](Uraniborg's%20Preloaded%20App%20Risks%20Scoring%20Metrics%20%282020-08%29%20v1.0.pdf) -(also available [here](https://www.android-device-security.org/publications/)) that allows -individual risk categories to be defined and then summed as a device risk score. - -In order for users to more easily grasp and make use of the final risk score, we -have adopted a fixed score framework in this iteration where a low score would -indicate a low level of risk and a high score would indicate a -high level of risk. And the score is bounded to a maximum value, of which is -currently defined to be `10`. - -## General Note -We are working in tandem with a [university consortium](https://www.android-device-security.org/) -to develop a fine-grained formula for each risk category, in addition to the -identification of new categories as we proceed. - -Note that this aspect of the work (scoring) is an active work-in-progress that -may progress/evolve very quickly. We also do appreciate any feedback that you -may have for us so that we can further improve the risk scoring modules. - - -## Risk Categories -As of today, we have identified 3 major risk categories based on the information -that is collected via Hubble: -- Platform Signature Risk - - Here we try to evaluate how much risk is posed by the introduction of additional - APKs that are signed using the platform key. -- Risky Privileged Permissions Risk - - Here we try to evaluate how much risk is posed by the pregranting of permissions - that is done by the OEM. -- Cleartext Traffic Risk - - Here we try to evaluate how much risk is the user exposed to due to the APKs - using cleartext traffic in their network communications. - - -## Formula -For simplicity, we state the general formula that is used across every risk -category that we have defined as follows: - -` Risk = Likelihood x Damage Potential` - -### Likelihood of Risk -We currently estimate the likelihood of risk using a coarse package counting. - -The likelihood value is thus calculated based on a simple formula currently and -is implemented in the `_cambridge` method in `risk_analysis.py`. Expressed, the -formula for it is as follows: - -` Likelihood = |A_t \ A_b| / |A_t|` - -where: - -`A_t` is the set of apps on a target device fulfilling a certain criteria, defined -by the risk category. - -`A_b` is the set of apps on a baseline device fulfilling the same criteria, defined -by the risk category. The corresponding baseline device/build has been determined -by our algorithm to be an AOSP or GSI build of a matching API level. - -`\` is the set [complement](https://en.wikipedia.org/wiki/Complement_(set_theory)) operator. - -`|A|` is the [cardinality](https://en.wikipedia.org/wiki/Cardinality) of the set `A`. - - -### Damage Potential -Damage potential are essentially weight values that are assigned to each category. -For instance, in this iteration, we assign the damage potential of each risk -category as follows: - -| Risk Categories | Damage Potential | -|:--------------------|:-------------:| -| Platform Signature | 6.0 | -| Risky Permissions | 3.0 | -| Cleartext Traffic | 1.0 | -| **Total** | **10.0** | - -## Implementation -The bulk of the analysis described above is implemented in `risk_analysis.py`. -To give an example of how to call those libraries, we provided `device_scoring.py` -that is located in the same directory, i.e. `scripts/python`. In order to make -use of it, you will first need to have Hubble results collected. - -Then, issue the following command on your terminal: - -`python3 device_scoring.py --dir --normalize` - -Essentially, you can copy and paste the resulting path that is outputted in the -last line of a successful execution of `automate_observation.py` (see [docs]( -automate_observation.md)) and supply it as the argument to the `--dir` option. - -You should always supply the `--normalize` argument so that the computation -engine would normalize the score against the base build. - -Upon successful analysis, you should see outputs like below on your terminal: -``` -INFO:compute_scores(159): Platform Signature Risk: X.XXXX / 6.0000 -INFO:compute_scores(179): Risky Permissions Risk Score without GMS: Y.YYYY / 3.0000 -INFO:compute_scores(197): Cleartext Traffic Risk Score without GMS: Z.ZZZZ / 1.0000 -WARNING:main(262): Adjusted Device Risk Score (without GMS): *.** / 10.00 -``` \ No newline at end of file diff --git a/uraniborg/scripts/python/data/N-AOSP.json b/uraniborg/scripts/python/data/N-AOSP.json deleted file mode 100644 index 2486864..0000000 --- a/uraniborg/scripts/python/data/N-AOSP.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "packagesAll": [ - "com.android.cellbroadcastreceiver", - "com.android.calendar", - "com.android.dialer", - "com.android.gallery3d", - "com.android.htmlviewer", - "com.android.bookmarkprovider", - "com.android.location.fused", - "com.android.backupconfirm", - "jp.co.omronsoft.openwnn", - "android.ext.shared", - "com.android.packageinstaller", - "com.android.providers.userdictionary", - "com.android.providers.downloads.ui", - "com.android.externalstorage", - "com.android.calllogbackup", - "com.android.providers.contacts", - "com.android.apps.tag", - "com.android.bluetoothmidiservice", - "com.android.dreams.phototable", - "com.android.mtp", - "com.android.music", - "com.android.documentsui", - "com.android.cts.ctsshim", - "com.android.shell", - "com.android.calculator2", - "com.android.settings", - "com.android.sharedstoragebackup", - "com.android.managedprovisioning", - "com.android.proxyhandler", - "com.android.wallpapercropper", - "com.android.qxdmloggerv2", - "com.android.wallpaperbackup", - "com.svox.pico", - "com.android.wallpaper.livepicker", - "com.android.camera2", - "com.android.inputdevices", - "com.android.keychain", - "com.android.bluetooth", - "com.android.providers.settings", - "com.android.captiveportallogin", - "com.android.printspooler", - "com.android.smspush", - "org.chromium.webview_shell", - "com.android.statementservice", - "com.android.onetimeinitializer", - "com.android.inputmethod.latin", - "com.android.dreams.basic", - "com.android.printservice.recommendation", - "com.android.contacts", - "com.android.ramdump", - "com.android.launcher3", - "android.ext.services", - "com.android.vpndialogs", - "com.android.pacprocessor", - "com.android.server.telecom", - "com.android.provision", - "com.android.carrierconfig", - "com.android.deskclock", - "com.android.messaging", - "com.android.email", - "com.android.defcontainer", - "com.android.cts.priv.ctsshim", - "com.android.mms.service", - "com.android.systemui", - "com.android.quicksearchbox", - "com.android.phone", - "com.android.nfc", - "com.android.providers.media", - "com.android.providers.calendar", - "com.android.musicfx", - "android", - "com.android.certinstaller", - "com.android.webview", - "com.android.emergency", - "com.android.providers.blockednumber", - "com.android.providers.telephony", - "com.android.providers.downloads", - "com.android.stk", - "com.android.egg", - "com.android.storagemanager" - ], - "packagesNoCode": [ - "com.android.cts.priv.ctsshim", - "com.android.cts.ctsshim", - "android" - ], - "platformAppsAll": [ - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.backupconfirm", - "android.ext.shared", - "com.android.packageinstaller", - "com.android.externalstorage", - "com.android.bluetoothmidiservice", - "com.android.documentsui", - "com.android.shell", - "com.android.settings", - "com.android.sharedstoragebackup", - "com.android.managedprovisioning", - "com.android.proxyhandler", - "com.android.wallpapercropper", - "com.android.wallpaperbackup", - "com.android.wallpaper.livepicker", - "com.android.inputdevices", - "com.android.keychain", - "com.android.bluetooth", - "com.android.providers.settings", - "com.android.captiveportallogin", - "android.ext.services", - "com.android.vpndialogs", - "com.android.pacprocessor", - "com.android.server.telecom", - "com.android.provision", - "com.android.carrierconfig", - "com.android.messaging", - "com.android.defcontainer", - "com.android.mms.service", - "com.android.systemui", - "com.android.phone", - "com.android.nfc", - "android", - "com.android.certinstaller", - "com.android.emergency", - "com.android.providers.telephony", - "com.android.stk", - "com.android.egg" - ], - "platformAppsNoCode": [ - "android" - ], - "packagesSharedUid": { - "android.uid.system": [ - "com.android.location.fused", - "com.android.settings", - "com.android.wallpaperbackup", - "com.android.inputdevices", - "com.android.keychain", - "com.android.providers.settings", - "com.android.server.telecom", - "android" - ], - "android.uid.shell": [ - "com.android.shell" - ], - "android.uid.bluetooth": [ - "com.android.bluetooth" - ], - "android.uid.phone": [ - "com.android.mms.service", - "com.android.phone", - "com.android.providers.telephony", - "com.android.stk" - ], - "android.uid.systemui": [ - "com.android.systemui" - ], - "android.uid.nfc": [ - "com.android.nfc" - ], - "com.android.emergency.uid": [ - "com.android.emergency" - ] - } -} diff --git a/uraniborg/scripts/python/data/O-AOSP.json b/uraniborg/scripts/python/data/O-AOSP.json deleted file mode 100644 index eb4aae4..0000000 --- a/uraniborg/scripts/python/data/O-AOSP.json +++ /dev/null @@ -1,187 +0,0 @@ -{ - "packagesAll": [ - "com.android.storagemanager", - "com.android.printspooler", - "com.android.bluetoothmidiservice", - "com.android.defcontainer", - "jp.co.omronsoft.openwnn", - "com.android.carrierconfig", - "com.android.dialer", - "android.ext.services", - "com.android.apps.tag", - "com.android.phone", - "com.android.pacprocessor", - "com.android.mms.service", - "com.android.egg", - "com.android.captiveportallogin", - "com.android.inputdevices", - "com.android.calllogbackup", - "com.android.wallpaper.livepicker", - "com.android.providers.calendar", - "org.chromium.webview_shell", - "com.android.providers.telephony", - "com.android.contacts", - "com.android.deskclock", - "com.android.externalstorage", - "com.android.dreams.phototable", - "com.google.pixel.wahoo.gfxdrv", - "com.android.server.telecom", - "com.android.keychain", - "com.android.gallery3d", - "com.android.wallpaperbackup", - "com.android.cts.ctsshim", - "com.android.providers.contacts", - "com.android.managedprovisioning", - "com.android.providers.media", - "com.android.mtp", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.nfc", - "com.android.launcher3", - "com.svox.pico", - "com.android.inputmethod.latin", - "com.android.bookmarkprovider", - "com.android.vpndialogs", - "com.android.wallpapercropper", - "android.ext.shared", - "com.android.email", - "com.android.emergency", - "android", - "com.android.carrierdefaultapp", - "com.android.onetimeinitializer", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.statementservice", - "com.android.webview", - "com.android.certinstaller", - "com.android.systemui.theme.dark", - "com.android.providers.settings", - "com.qti.qualcomm.datastatusnotification", - "com.android.systemui", - "android.auto_generated_rro__", - "com.android.provision", - "com.android.bips", - "com.android.companiondevicemanager", - "com.android.proxyhandler", - "com.android.musicfx", - "com.android.music", - "com.android.smspush", - "com.android.messaging", - "com.android.camera2", - "com.android.providers.downloads", - "com.android.dreams.basic", - "com.android.quicksearchbox", - "com.android.packageinstaller", - "com.android.printservice.recommendation", - "com.qualcomm.atfwd", - "com.android.bluetooth", - "com.android.cts.priv.ctsshim", - "com.android.calculator2", - "com.android.wallpaperpicker", - "com.android.providers.downloads.ui", - "com.android.shell", - "com.android.providers.blockednumber", - "com.android.backupconfirm", - "com.qualcomm.timeservice", - "com.android.calendar", - "com.android.settings", - "com.android.providers.userdictionary", - "com.android.htmlviewer", - "com.qualcomm.qti.telephonyservice" - ], - "packagesNoCode": [ - "com.android.cts.priv.ctsshim", - "android", - "com.android.systemui.theme.dark", - "android.auto_generated_rro__", - "com.google.pixel.wahoo.gfxdrv", - "com.android.cts.ctsshim" - ], - "platformAppsAll": [ - "com.android.bluetoothmidiservice", - "com.android.defcontainer", - "com.android.carrierconfig", - "android.ext.services", - "com.android.phone", - "com.android.pacprocessor", - "com.android.mms.service", - "com.android.egg", - "com.android.captiveportallogin", - "com.android.inputdevices", - "com.android.wallpaper.livepicker", - "com.android.providers.telephony", - "com.android.externalstorage", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "com.android.managedprovisioning", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.nfc", - "com.android.vpndialogs", - "com.android.wallpapercropper", - "android.ext.shared", - "com.android.emergency", - "android", - "com.android.carrierdefaultapp", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.certinstaller", - "com.android.systemui.theme.dark", - "com.android.providers.settings", - "com.qti.qualcomm.datastatusnotification", - "com.android.systemui", - "android.auto_generated_rro__", - "com.android.provision", - "com.android.proxyhandler", - "com.android.messaging", - "com.android.packageinstaller", - "com.qualcomm.atfwd", - "com.android.bluetooth", - "com.android.shell", - "com.android.backupconfirm", - "com.qualcomm.timeservice", - "com.android.settings", - "com.qualcomm.qti.telephonyservice" - ], - "platformAppsNoCode": [ - "android.auto_generated_rro__", - "android", - "com.android.systemui.theme.dark" - ], - "packagesSharedUid": { - "android.uid.phone": [ - "com.android.phone", - "com.android.mms.service", - "com.android.providers.telephony", - "com.qti.qualcomm.datastatusnotification", - "com.qualcomm.qti.telephonyservice" - ], - "android.uid.system": [ - "com.android.inputdevices", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "android", - "com.android.location.fused", - "com.android.providers.settings", - "com.qualcomm.atfwd", - "com.android.settings" - ], - "android.uid.nfc": [ - "com.android.nfc" - ], - "com.android.emergency.uid": [ - "com.android.emergency" - ], - "android.uid.systemui": [ - "com.android.systemui" - ], - "android.uid.bluetooth": [ - "com.android.bluetooth" - ], - "android.uid.shell": [ - "com.android.shell" - ] - } -} diff --git a/uraniborg/scripts/python/data/P-AOSP.json b/uraniborg/scripts/python/data/P-AOSP.json deleted file mode 100644 index e8c76c6..0000000 --- a/uraniborg/scripts/python/data/P-AOSP.json +++ /dev/null @@ -1,189 +0,0 @@ -{ - "packagesAll": [ - "com.android.settings.intelligence", - "com.android.storagemanager", - "com.android.printspooler", - "com.android.bluetoothmidiservice", - "com.android.defcontainer", - "com.android.internal.display.cutout.emulation.double", - "com.android.carrierconfig", - "com.android.dialer", - "android.ext.services", - "com.android.apps.tag", - "com.android.phone", - "com.android.pacprocessor", - "com.android.mms.service", - "com.android.egg", - "com.android.captiveportallogin", - "com.android.inputdevices", - "com.android.calllogbackup", - "com.android.wallpaper.livepicker", - "com.android.providers.calendar", - "org.chromium.webview_shell", - "com.android.providers.telephony", - "com.android.contacts", - "com.android.deskclock", - "com.android.externalstorage", - "com.android.dreams.phototable", - "com.google.pixel.wahoo.gfxdrv", - "com.android.server.telecom", - "com.android.keychain", - "com.android.gallery3d", - "com.android.wallpaperbackup", - "com.android.cts.ctsshim", - "com.android.providers.contacts", - "com.android.managedprovisioning", - "com.android.providers.media", - "com.android.mtp", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.nfc", - "com.android.launcher3", - "com.android.inputmethod.latin", - "com.android.bookmarkprovider", - "com.android.vpndialogs", - "com.android.wallpapercropper", - "android.ext.shared", - "com.android.email", - "com.android.emergency", - "com.android.internal.display.cutout.emulation.corner", - "android", - "com.android.carrierdefaultapp", - "com.android.onetimeinitializer", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.statementservice", - "com.android.webview", - "com.android.certinstaller", - "com.android.systemui.theme.dark", - "com.android.providers.settings", - "com.android.systemui", - "android.auto_generated_rro__", - "com.android.provision", - "com.android.se", - "com.android.bips", - "com.android.companiondevicemanager", - "com.google.android.theme.pixel", - "com.android.proxyhandler", - "com.android.simappdialog", - "com.android.musicfx", - "com.android.music", - "com.android.smspush", - "com.android.messaging", - "com.android.camera2", - "com.android.providers.downloads", - "com.android.dreams.basic", - "com.android.quicksearchbox", - "com.android.packageinstaller", - "com.android.printservice.recommendation", - "com.android.internal.display.cutout.emulation.tall", - "com.android.bluetooth", - "com.android.cts.priv.ctsshim", - "com.android.calculator2", - "com.android.wallpaperpicker", - "com.android.providers.downloads.ui", - "com.android.shell", - "com.android.providers.blockednumber", - "com.android.backupconfirm", - "com.android.traceur", - "com.qualcomm.timeservice", - "com.android.calendar", - "com.android.settings", - "com.android.providers.userdictionary", - "com.android.htmlviewer" - ], - "packagesNoCode": [ - "com.google.pixel.wahoo.gfxdrv", - "android", - "com.android.cts.priv.ctsshim", - "com.android.systemui.theme.dark", - "com.android.internal.display.cutout.emulation.corner", - "com.android.cts.ctsshim", - "com.android.internal.display.cutout.emulation.double", - "com.google.android.theme.pixel", - "android.auto_generated_rro__", - "com.android.internal.display.cutout.emulation.tall" - ], - "platformAppsAll": [ - "com.android.bluetoothmidiservice", - "com.android.defcontainer", - "com.android.carrierconfig", - "android.ext.services", - "com.android.phone", - "com.android.pacprocessor", - "com.android.mms.service", - "com.android.egg", - "com.android.captiveportallogin", - "com.android.inputdevices", - "com.android.wallpaper.livepicker", - "com.android.providers.telephony", - "com.android.externalstorage", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "com.android.managedprovisioning", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.nfc", - "com.android.vpndialogs", - "com.android.wallpapercropper", - "android.ext.shared", - "com.android.emergency", - "android", - "com.android.carrierdefaultapp", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.certinstaller", - "com.android.providers.settings", - "com.android.systemui", - "com.android.provision", - "com.android.se", - "com.android.proxyhandler", - "com.android.simappdialog", - "com.android.messaging", - "com.android.packageinstaller", - "com.android.bluetooth", - "com.android.shell", - "com.android.backupconfirm", - "com.android.traceur", - "com.android.settings" - ], - "platformAppsNoCode": [ - "android" - ], - "packagesSharedUid": { - "android.uid.phone": [ - "com.android.phone", - "com.android.mms.service", - "com.android.providers.telephony" - ], - "android.uid.system": [ - "com.android.inputdevices", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "android", - "com.android.location.fused", - "com.android.providers.settings", - "com.android.settings" - ], - "android.uid.nfc": [ - "com.android.nfc" - ], - "com.android.emergency.uid": [ - "com.android.emergency" - ], - "android.uid.systemui": [ - "com.android.systemui" - ], - "android.uid.se": [ - "com.android.se" - ], - "android.uid.bluetooth": [ - "com.android.bluetooth" - ], - "android.uid.shell": [ - "com.android.shell" - ] - } -} diff --git a/uraniborg/scripts/python/data/Q-GSI.json b/uraniborg/scripts/python/data/Q-GSI.json deleted file mode 100644 index 8aad194..0000000 --- a/uraniborg/scripts/python/data/Q-GSI.json +++ /dev/null @@ -1,286 +0,0 @@ -{ - "packagesAll": [ - "com.android.ons", - "com.android.storagemanager", - "com.android.printspooler", - "android.ext.services", - "android.auto_generated_rro_vendor__", - "com.android.pacprocessor", - "com.android.permissioncontroller", - "com.android.phone.auto_generated_rro_vendor__", - "com.android.wallpaper.livepicker", - "com.android.theme.icon_pack.circular.themepicker", - "com.android.internal.systemui.navbar.gestural_narrow_back", - "com.android.providers.telephony", - "com.android.contacts", - "com.android.deskclock", - "com.android.dreams.phototable", - "com.android.bluetooth.auto_generated_rro_vendor__", - "com.android.cts.ctsshim", - "com.android.providers.contacts", - "com.android.mtp", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.service.ims", - "com.android.nfc", - "com.android.launcher3", - "com.android.inputmethod.latin", - "com.android.bookmarkprovider", - "com.android.vpndialogs", - "com.android.theme.color.cinnamon", - "com.android.nfc.auto_generated_rro_vendor__", - "android.ext.shared", - "com.android.emergency", - "com.android.theme.icon_pack.circular.android", - "com.android.internal.display.cutout.emulation.corner", - "com.android.carrierdefaultapp", - "com.android.theme.color.ocean", - "com.android.networkstack.permissionconfig", - "com.android.sdksetup", - "com.android.theme.icon.roundedrect", - "com.android.internal.systemui.navbar.gestural_extra_wide_back", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.statementservice", - "com.android.localtransport", - "com.android.theme.icon.squircle", - "com.android.providers.settings", - "com.android.systemui", - "com.android.theme.icon_pack.rounded.android", - "com.android.timezone.updater", - "com.android.bips", - "com.android.companiondevicemanager", - "com.android.systemui.auto_generated_rro_vendor__", - "com.android.theme.icon_pack.filled.systemui", - "com.android.camera2", - "com.android.theme.icon_pack.filled.settings", - "com.android.dreams.basic", - "com.android.quicksearchbox", - "com.android.theme.icon_pack.filled.themepicker", - "com.android.printservice.recommendation", - "com.android.internal.systemui.navbar.gestural_wide_back", - "com.android.wallpaperpicker", - "com.android.theme.icon_pack.rounded.launcher", - "com.google.pixel.crosshatch.gamedriver", - "com.android.shell", - "com.android.safetyregulatoryinfo", - "com.android.backupconfirm", - "com.android.theme.icon.teardrop", - "com.qualcomm.timeservice", - "com.android.calendar", - "com.android.settings", - "com.android.providers.userdictionary", - "com.android.theme.color.purple", - "com.android.theme.icon_pack.rounded.systemui", - "com.android.settings.intelligence", - "com.android.theme.color.orchid", - "com.android.theme.icon_pack.filled.android", - "com.android.theme.font.notoserifsource", - "com.android.theme.icon_pack.filled.launcher", - "com.android.bluetoothmidiservice", - "com.android.internal.display.cutout.emulation.double", - "com.android.carrierconfig", - "com.android.networkstack", - "com.android.theme.color.space", - "com.android.dialer", - "com.android.apps.tag", - "com.android.theme.icon_pack.circular.systemui", - "com.android.phone", - "com.android.mms.service", - "com.android.egg", - "com.android.captiveportallogin", - "com.android.theme.icon_pack.rounded.settings", - "com.android.hotspot2", - "com.android.theme.color.black", - "com.android.inputdevices", - "com.android.calllogbackup", - "com.android.providers.partnerbookmarks", - "com.android.providers.calendar", - "org.chromium.webview_shell", - "com.android.externalstorage", - "com.android.providers.settings.auto_generated_rro_vendor__", - "com.android.server.telecom", - "com.android.keychain", - "com.android.gallery3d", - "com.android.wallpaperbackup", - "com.android.managedprovisioning", - "com.android.providers.media", - "com.android.modulemetadata", - "com.android.stk", - "com.android.internal.systemui.navbar.threebutton", - "com.android.wallpapercropper", - "com.android.service.ims.presence", - "com.android.email", - "android", - "com.android.onetimeinitializer", - "com.android.webview", - "com.android.certinstaller", - "com.android.internal.display.cutout.emulation.emu01", - "com.android.provision", - "com.android.theme.color.green", - "com.android.se", - "com.android.proxyhandler", - "com.android.simappdialog", - "com.android.theme.icon_pack.circular.launcher", - "com.android.musicfx", - "com.android.music", - "com.android.smspush", - "com.android.messaging", - "com.android.providers.downloads", - "com.android.theme.icon_pack.circular.settings", - "com.android.packageinstaller", - "com.android.internal.display.cutout.emulation.tall", - "com.android.bluetooth", - "com.android.cts.priv.ctsshim", - "com.android.internal.systemui.navbar.twobutton", - "com.android.providers.downloads.ui", - "com.android.providers.blockednumber", - "com.android.internal.systemui.navbar.gestural", - "com.android.traceur", - "com.android.dynsystem", - "com.android.htmlviewer" - ], - "packagesNoCode": [ - "com.android.theme.icon.squircle", - "com.android.theme.icon_pack.rounded.launcher", - "com.android.internal.systemui.navbar.gestural_extra_wide_back", - "com.android.theme.icon.roundedrect", - "com.android.cts.ctsshim", - "com.android.theme.color.space", - "com.android.theme.icon_pack.circular.themepicker", - "com.android.theme.color.cinnamon", - "com.android.internal.systemui.navbar.gestural", - "com.android.theme.icon_pack.filled.systemui", - "com.android.theme.font.notoserifsource", - "com.android.internal.systemui.navbar.gestural_wide_back", - "com.android.theme.color.orchid", - "com.android.theme.icon_pack.filled.launcher", - "android", - "com.android.theme.icon.teardrop", - "com.android.theme.color.black", - "com.google.pixel.crosshatch.gamedriver", - "com.android.theme.icon_pack.filled.android", - "com.android.theme.icon_pack.circular.systemui", - "com.android.cts.priv.ctsshim", - "com.android.internal.display.cutout.emulation.emu01", - "com.android.theme.icon_pack.rounded.systemui", - "com.android.internal.systemui.navbar.twobutton", - "com.android.theme.icon_pack.rounded.settings", - "com.android.theme.color.purple", - "com.android.internal.systemui.navbar.gestural_narrow_back", - "com.android.internal.display.cutout.emulation.double", - "com.android.internal.systemui.navbar.threebutton", - "com.android.theme.icon_pack.circular.android", - "com.android.internal.display.cutout.emulation.corner", - "com.android.theme.color.green", - "com.android.theme.color.ocean", - "com.android.theme.icon_pack.rounded.android", - "com.android.theme.icon_pack.filled.settings", - "com.android.theme.icon_pack.circular.settings", - "com.android.internal.display.cutout.emulation.tall", - "com.android.theme.icon_pack.filled.themepicker", - "com.android.theme.icon_pack.circular.launcher" - ], - "platformAppsAll": [ - "com.android.ons", - "android.ext.services", - "com.android.pacprocessor", - "com.android.permissioncontroller", - "com.android.wallpaper.livepicker", - "com.android.theme.icon_pack.circular.themepicker", - "com.android.providers.telephony", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.service.ims", - "com.android.nfc", - "com.android.vpndialogs", - "android.ext.shared", - "com.android.emergency", - "com.android.carrierdefaultapp", - "com.android.sdksetup", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.systemui", - "com.android.timezone.updater", - "com.android.theme.icon_pack.filled.themepicker", - "com.android.shell", - "com.android.backupconfirm", - "com.android.settings", - "com.android.bluetoothmidiservice", - "com.android.carrierconfig", - "com.android.phone", - "com.android.mms.service", - "com.android.egg", - "com.android.hotspot2", - "com.android.inputdevices", - "com.android.externalstorage", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "com.android.managedprovisioning", - "com.android.stk", - "com.android.wallpapercropper", - "com.android.service.ims.presence", - "android", - "com.android.certinstaller", - "com.android.internal.display.cutout.emulation.emu01", - "com.android.provision", - "com.android.se", - "com.android.proxyhandler", - "com.android.simappdialog", - "com.android.messaging", - "com.android.packageinstaller", - "com.android.bluetooth", - "com.android.traceur", - "com.android.dynsystem" - ], - "platformAppsNoCode": [ - "com.android.internal.display.cutout.emulation.emu01", - "com.android.theme.icon_pack.circular.themepicker", - "com.android.theme.icon_pack.filled.themepicker", - "android" - ], - "packagesSharedUid": { - "android.uid.phone": [ - "com.android.ons", - "com.android.providers.telephony", - "com.android.service.ims", - "com.android.phone", - "com.android.mms.service", - "com.android.stk", - "com.android.service.ims.presence" - ], - "android.uid.nfc": [ - "com.android.nfc" - ], - "com.android.emergency.uid": [ - "com.android.emergency" - ], - "android.uid.system": [ - "com.android.location.fused", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.settings", - "com.android.inputdevices", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "android", - "com.android.dynsystem" - ], - "android.uid.systemui": [ - "com.android.systemui" - ], - "android.uid.shell": [ - "com.android.shell" - ], - "android.uid.se": [ - "com.android.se" - ], - "android.uid.bluetooth": [ - "com.android.bluetooth" - ] - } -} diff --git a/uraniborg/scripts/python/data/R-GSI.json b/uraniborg/scripts/python/data/R-GSI.json deleted file mode 100644 index e87854f..0000000 --- a/uraniborg/scripts/python/data/R-GSI.json +++ /dev/null @@ -1,360 +0,0 @@ -{ - "packagesAll": [ - "com.android.ons", - "com.android.storagemanager", - "com.android.printspooler", - "com.android.emulator.multidisplay", - "android.ext.services", - "android.auto_generated_rro_vendor__", - "vendor.qti.hardware.cacert.server", - "com.android.pacprocessor", - "com.android.hbmsvmanager.auto_generated_rro_vendor__", - "com.android.permissioncontroller", - "com.android.phone.auto_generated_rro_vendor__", - "com.android.hotspot2.osulogin", - "com.android.media", - "com.android.cellbroadcastservice", - "com.android.wallpaper.livepicker", - "com.android.theme.icon_pack.circular.themepicker", - "com.android.internal.systemui.navbar.gestural_narrow_back", - "com.android.mediaprovider", - "com.android.providers.telephony", - "com.android.contacts", - "com.android.internal.display.cutout.emulation.waterfall", - "com.android.deskclock", - "com.android.dreams.phototable", - "com.android.cts.ctsshim", - "com.android.providers.contacts", - "com.android.settings.auto_generated_rro_vendor__", - "com.android.wifi.resources", - "com.android.mtp", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.service.ims", - "com.android.permission", - "com.android.nfc", - "com.android.launcher3", - "com.android.i18n", - "com.android.wifi", - "com.android.inputmethod.latin", - "com.android.bookmarkprovider", - "com.android.vpndialogs", - "com.android.networkstack.tethering", - "com.android.theme.color.cinnamon", - "com.android.providers.media.module", - "com.android.nfc.auto_generated_rro_vendor__", - "android.ext.shared", - "com.android.emergency", - "com.android.theme.icon_pack.circular.android", - "com.android.internal.display.cutout.emulation.corner", - "com.android.carrierdefaultapp", - "com.android.sdkext", - "com.android.theme.color.ocean", - "com.android.networkstack.permissionconfig", - "com.android.conscrypt", - "com.android.sdksetup", - "com.android.theme.icon.roundedrect", - "com.android.internal.systemui.navbar.gestural_extra_wide_back", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.statementservice", - "com.android.localtransport", - "com.android.media.swcodec", - "com.android.theme.icon.squircle", - "com.android.providers.settings", - "com.android.neuralnetworks", - "com.android.systemui", - "com.android.se.auto_generated_rro_vendor__", - "com.android.theme.icon_pack.rounded.android", - "com.android.timezone.updater", - "com.android.bips", - "com.android.vndk.v30", - "com.android.companiondevicemanager", - "com.android.systemui.auto_generated_rro_vendor__", - "com.android.theme.icon_pack.filled.systemui", - "com.android.camera2", - "com.android.theme.icon_pack.filled.settings", - "com.android.dreams.basic", - "com.android.quicksearchbox", - "com.android.theme.icon_pack.rounded.themepicker", - "com.android.theme.icon_pack.filled.themepicker", - "com.android.printservice.recommendation", - "com.android.internal.systemui.navbar.gestural_wide_back", - "com.android.carrierconfig.auto_generated_rro_product__", - "com.google.pixel.redbull.gpuprofiling.vulkanlayer", - "com.android.wallpaperpicker", - "com.android.theme.icon_pack.rounded.launcher", - "com.android.shell", - "com.android.safetyregulatoryinfo", - "com.android.ipsec", - "com.android.backupconfirm", - "com.android.theme.icon.teardrop", - "com.qualcomm.timeservice", - "com.android.calendar", - "com.android.settings", - "com.android.providers.userdictionary", - "com.android.theme.color.purple", - "com.android.theme.icon_pack.rounded.systemui", - "com.android.settings.intelligence", - "com.android.theme.color.orchid", - "com.android.theme.icon_pack.filled.android", - "com.android.theme.font.notoserifsource", - "com.android.theme.icon_pack.filled.launcher", - "com.android.bluetoothmidiservice", - "com.android.internal.display.cutout.emulation.double", - "com.android.carrierconfig", - "com.android.networkstack", - "com.android.theme.color.space", - "com.android.dialer", - "com.android.apps.tag", - "com.android.theme.icon_pack.circular.systemui", - "com.android.phone", - "com.android.mms.service", - "com.android.egg", - "com.android.captiveportallogin", - "com.android.theme.icon_pack.rounded.settings", - "com.android.tethering", - "com.android.extservices", - "com.android.systemui.auto_generated_rro_product__", - "com.android.theme.color.black", - "com.android.inputdevices", - "com.android.theme.icon.pebble", - "com.android.calllogbackup", - "com.android.providers.partnerbookmarks", - "com.android.providers.calendar", - "com.android.internal.display.cutout.emulation.hole", - "org.chromium.webview_shell", - "com.android.externalstorage", - "com.android.apex.cts.shim", - "com.android.server.telecom", - "com.android.keychain", - "com.android.gallery3d", - "com.android.wallpaperbackup", - "com.android.vndk.v28", - "com.android.managedprovisioning", - "com.android.soundpicker", - "com.android.vndk.v29", - "com.android.providers.media", - "com.android.modulemetadata", - "com.android.stk", - "com.android.providers.settings.auto_generated_rro_product__", - "com.android.runtime", - "com.android.internal.systemui.navbar.threebutton", - "com.android.resolv", - "com.android.adbd", - "vendor.qti.iwlan", - "com.android.wallpapercropper", - "com.android.service.ims.presence", - "android", - "com.android.onetimeinitializer", - "com.android.cellbroadcastreceiver.module", - "com.android.os.statsd", - "com.android.webview", - "com.android.theme.icon.taperedrect", - "com.android.certinstaller", - "com.android.theme.icon.vessel", - "com.android.provision", - "com.android.theme.color.green", - "com.android.se", - "com.android.proxyhandler", - "com.android.simappdialog", - "com.android.theme.icon_pack.circular.launcher", - "com.android.musicfx", - "com.android.music", - "com.android.tzdata", - "com.android.messaging", - "com.android.providers.downloads", - "com.android.theme.icon_pack.circular.settings", - "com.android.packageinstaller", - "com.android.internal.display.cutout.emulation.tall", - "com.android.bluetooth", - "com.android.cts.priv.ctsshim", - "com.android.internal.systemui.navbar.twobutton", - "com.android.providers.downloads.ui", - "com.qualcomm.qti.gpudrivers.lito.api30", - "com.android.providers.blockednumber", - "com.android.internal.systemui.navbar.gestural", - "com.qualcomm.qti.cne", - "android.auto_generated_rro_product__", - "com.android.traceur", - "com.android.cellbroadcast", - "com.android.dynsystem", - "com.android.htmlviewer", - "com.android.art" - ], - "packagesNoCode": [ - "com.android.internal.systemui.navbar.threebutton", - "com.android.i18n", - "com.android.adbd", - "com.android.theme.icon_pack.filled.android", - "com.android.ipsec", - "com.android.theme.icon_pack.filled.launcher", - "com.android.theme.color.green", - "com.android.internal.systemui.navbar.gestural_extra_wide_back", - "com.android.cts.ctsshim", - "com.android.media", - "com.android.theme.icon_pack.rounded.android", - "com.android.theme.font.notoserifsource", - "com.android.os.statsd", - "com.qualcomm.qti.gpudrivers.lito.api30", - "com.android.modulemetadata", - "com.android.theme.icon_pack.circular.launcher", - "com.android.vndk.v29", - "com.android.wifi", - "com.android.extservices", - "com.android.theme.icon_pack.circular.settings", - "com.android.theme.icon.roundedrect", - "com.android.apex.cts.shim", - "com.android.theme.icon_pack.filled.settings", - "com.android.theme.icon_pack.circular.android", - "com.android.internal.systemui.navbar.gestural", - "com.android.resolv", - "com.android.theme.color.orchid", - "android", - "com.android.theme.color.cinnamon", - "com.android.tzdata", - "com.android.theme.color.purple", - "com.android.theme.icon_pack.filled.themepicker", - "com.android.theme.icon_pack.rounded.settings", - "com.android.theme.icon.squircle", - "com.android.theme.icon.vessel", - "com.android.internal.systemui.navbar.twobutton", - "com.android.theme.icon_pack.rounded.launcher", - "com.android.mediaprovider", - "com.android.theme.color.space", - "com.android.theme.icon.teardrop", - "com.android.cts.priv.ctsshim", - "com.android.theme.color.black", - "com.android.theme.icon_pack.circular.themepicker", - "com.android.internal.display.cutout.emulation.hole", - "com.android.tethering", - "com.android.sdkext", - "com.android.theme.icon.taperedrect", - "com.android.conscrypt", - "com.android.theme.icon.pebble", - "com.android.theme.icon_pack.circular.systemui", - "com.android.permission", - "com.android.theme.icon_pack.rounded.themepicker", - "com.android.internal.display.cutout.emulation.double", - "com.android.runtime", - "com.android.wifi.resources", - "com.android.art", - "com.android.theme.icon_pack.rounded.systemui", - "com.android.media.swcodec", - "com.android.cellbroadcast", - "com.android.theme.icon_pack.filled.systemui", - "com.android.internal.display.cutout.emulation.corner", - "com.google.pixel.redbull.gpuprofiling.vulkanlayer", - "com.android.internal.display.cutout.emulation.tall", - "com.android.internal.systemui.navbar.gestural_narrow_back", - "com.android.neuralnetworks", - "com.android.internal.display.cutout.emulation.waterfall", - "com.android.vndk.v28", - "com.android.internal.systemui.navbar.gestural_wide_back", - "com.android.theme.color.ocean", - "com.android.vndk.v30" - ], - "platformAppsAll": [ - "com.android.ons", - "com.android.emulator.multidisplay", - "android.ext.services", - "com.android.pacprocessor", - "com.android.permissioncontroller", - "com.android.wallpaper.livepicker", - "com.android.theme.icon_pack.circular.themepicker", - "com.android.providers.telephony", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.service.ims", - "com.android.nfc", - "com.android.vpndialogs", - "android.ext.shared", - "com.android.emergency", - "com.android.carrierdefaultapp", - "com.android.sdksetup", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.systemui", - "com.android.timezone.updater", - "com.android.theme.icon_pack.rounded.themepicker", - "com.android.theme.icon_pack.filled.themepicker", - "com.android.shell", - "com.android.backupconfirm", - "com.android.settings", - "com.android.bluetoothmidiservice", - "com.android.carrierconfig", - "com.android.phone", - "com.android.mms.service", - "com.android.egg", - "com.android.inputdevices", - "com.android.externalstorage", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "com.android.managedprovisioning", - "com.android.stk", - "com.android.wallpapercropper", - "com.android.service.ims.presence", - "android", - "com.android.certinstaller", - "com.android.provision", - "com.android.se", - "com.android.proxyhandler", - "com.android.simappdialog", - "com.android.messaging", - "com.android.packageinstaller", - "com.android.bluetooth", - "com.android.traceur", - "com.android.dynsystem" - ], - "platformAppsNoCode": [ - "com.android.theme.icon_pack.circular.themepicker", - "android", - "com.android.theme.icon_pack.filled.themepicker", - "com.android.theme.icon_pack.rounded.themepicker" - ], - "packagesSharedUid": { - "android.uid.phone": [ - "com.android.ons", - "com.android.providers.telephony", - "com.android.service.ims", - "com.android.phone", - "com.android.mms.service", - "com.android.stk", - "com.android.service.ims.presence" - ], - "android.uid.system": [ - "com.android.emulator.multidisplay", - "com.android.location.fused", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.settings", - "com.android.inputdevices", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "android", - "com.android.dynsystem" - ], - "android.uid.nfc": [ - "com.android.nfc" - ], - "com.android.emergency.uid": [ - "com.android.emergency" - ], - "android.uid.systemui": [ - "com.android.systemui" - ], - "android.uid.shell": [ - "com.android.shell" - ], - "android.uid.se": [ - "com.android.se" - ], - "android.uid.bluetooth": [ - "com.android.bluetooth" - ] - } -} diff --git a/uraniborg/scripts/python/data/S-GSI.json b/uraniborg/scripts/python/data/S-GSI.json deleted file mode 100644 index 1cb70b3..0000000 --- a/uraniborg/scripts/python/data/S-GSI.json +++ /dev/null @@ -1,299 +0,0 @@ -{ - "packagesAll": [ - "com.android.ons", - "com.android.storagemanager", - "com.android.printspooler", - "com.android.emulator.multidisplay", - "android.ext.services", - "android.auto_generated_rro_vendor__", - "vendor.qti.hardware.cacert.server", - "com.android.pacprocessor", - "com.android.hbmsvmanager.auto_generated_rro_vendor__", - "com.android.permissioncontroller", - "com.android.phone.auto_generated_rro_vendor__", - "com.android.hotspot2.osulogin", - "com.android.media", - "com.android.cellbroadcastservice", - "com.android.wallpaper.livepicker", - "com.android.internal.systemui.navbar.gestural_narrow_back", - "com.android.mediaprovider", - "com.android.providers.telephony", - "com.android.contacts", - "com.android.internal.display.cutout.emulation.waterfall", - "com.android.deskclock", - "com.android.dreams.phototable", - "com.android.cts.ctsshim", - "com.android.providers.contacts", - "com.android.settings.auto_generated_rro_vendor__", - "com.android.wifi.resources", - "com.android.mtp", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.permission", - "com.android.nfc", - "com.android.launcher3", - "com.android.i18n", - "com.android.wifi", - "com.android.inputmethod.latin", - "com.android.bookmarkprovider", - "com.android.vpndialogs", - "com.android.networkstack.tethering", - "com.android.providers.media.module", - "com.android.nfc.auto_generated_rro_vendor__", - "android.ext.shared", - "com.android.emergency", - "com.android.internal.display.cutout.emulation.corner", - "com.android.carrierdefaultapp", - "com.android.sdkext", - "com.android.networkstack.permissionconfig", - "com.android.conscrypt", - "com.android.sdksetup", - "com.android.internal.systemui.navbar.gestural_extra_wide_back", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.statementservice", - "com.android.localtransport", - "com.android.media.swcodec", - "com.android.providers.settings", - "com.android.neuralnetworks", - "com.android.systemui", - "com.android.se.auto_generated_rro_vendor__", - "com.uraniborg.hubble", - "com.android.vndk.v31", - "com.android.bips", - "com.android.vndk.v30", - "com.android.companiondevicemanager", - "com.android.systemui.auto_generated_rro_vendor__", - "com.android.camera2", - "com.android.dreams.basic", - "com.android.quicksearchbox", - "com.android.printservice.recommendation", - "com.android.internal.systemui.navbar.gestural_wide_back", - "com.android.imsserviceentitlement", - "com.google.pixel.redbull.gpuprofiling.vulkanlayer", - "com.android.wallpaperpicker", - "com.android.shell", - "com.android.ipsec", - "com.android.backupconfirm", - "com.qualcomm.timeservice", - "com.android.calendar", - "com.android.settings", - "com.android.providers.userdictionary", - "com.android.settings.intelligence", - "com.android.theme.font.notoserifsource", - "com.android.bluetoothmidiservice", - "com.android.internal.display.cutout.emulation.double", - "com.android.carrierconfig", - "com.android.networkstack", - "com.android.dialer", - "com.android.apps.tag", - "com.android.phone", - "com.android.mms.service", - "com.android.egg", - "com.android.internal.systemui.onehanded.gestural", - "com.android.captiveportallogin", - "com.android.tethering", - "com.android.extservices", - "com.android.inputdevices", - "com.android.calllogbackup", - "com.android.providers.partnerbookmarks", - "com.android.providers.calendar", - "com.android.internal.display.cutout.emulation.hole", - "org.chromium.webview_shell", - "com.android.externalstorage", - "com.android.apex.cts.shim", - "com.android.server.telecom", - "com.android.keychain", - "com.android.gallery3d", - "com.android.wallpaperbackup", - "com.android.vndk.v28", - "com.android.managedprovisioning", - "com.android.soundpicker", - "com.android.vndk.v29", - "com.android.providers.media", - "com.android.modulemetadata", - "com.android.stk", - "com.android.runtime", - "com.android.internal.systemui.navbar.threebutton", - "com.android.resolv", - "com.android.adbd", - "vendor.qti.iwlan", - "com.android.wallpapercropper", - "android", - "com.android.onetimeinitializer", - "com.android.cellbroadcastreceiver.module", - "com.android.os.statsd", - "com.android.webview", - "com.android.certinstaller", - "com.android.provision", - "com.android.se", - "com.android.proxyhandler", - "com.android.simappdialog", - "com.android.musicfx", - "com.android.music", - "com.android.tzdata", - "com.android.messaging", - "com.android.providers.downloads", - "com.android.networkstack.tethering.emulator", - "com.android.packageinstaller", - "com.android.connectivity.resources", - "com.android.internal.display.cutout.emulation.tall", - "com.android.bluetooth", - "com.android.appsearch", - "com.android.cts.priv.ctsshim", - "com.android.internal.systemui.navbar.twobutton", - "com.android.providers.downloads.ui", - "com.qualcomm.qti.gpudrivers.lito.api30", - "com.android.providers.blockednumber", - "com.android.internal.systemui.navbar.gestural", - "com.qualcomm.qti.cne", - "com.android.scheduling", - "com.android.traceur", - "com.android.cellbroadcast", - "com.android.dynsystem", - "com.android.htmlviewer", - "com.android.art", - "com.android.cameraextensions" - ], - "packagesNoCode": [ - "com.android.resolv", - "com.android.vndk.v30", - "com.android.ipsec", - "com.android.sdkext", - "com.android.art", - "com.android.connectivity.resources", - "com.android.internal.systemui.navbar.twobutton", - "com.android.vndk.v28", - "com.android.internal.display.cutout.emulation.double", - "com.android.os.statsd", - "com.android.neuralnetworks", - "android", - "com.android.internal.systemui.onehanded.gestural", - "com.android.internal.display.cutout.emulation.tall", - "com.android.internal.systemui.navbar.threebutton", - "com.android.i18n", - "com.android.tethering", - "com.android.internal.systemui.navbar.gestural_extra_wide_back", - "com.android.scheduling", - "com.android.runtime", - "com.android.conscrypt", - "com.android.internal.display.cutout.emulation.waterfall", - "com.android.internal.systemui.navbar.gestural", - "com.android.wifi", - "com.android.internal.display.cutout.emulation.hole", - "com.android.internal.systemui.navbar.gestural_wide_back", - "com.android.internal.display.cutout.emulation.corner", - "com.android.adbd", - "com.android.media.swcodec", - "com.android.vndk.v31", - "com.android.media", - "com.android.theme.font.notoserifsource", - "com.android.cts.ctsshim", - "com.android.permission", - "com.android.cellbroadcast", - "com.android.wifi.resources", - "com.android.mediaprovider", - "com.android.apex.cts.shim", - "com.android.cts.priv.ctsshim", - "com.qualcomm.qti.gpudrivers.lito.api30", - "com.android.networkstack.tethering.emulator", - "com.android.extservices", - "com.google.pixel.redbull.gpuprofiling.vulkanlayer", - "com.android.appsearch", - "com.android.tzdata", - "com.android.internal.systemui.navbar.gestural_narrow_back", - "com.android.vndk.v29", - "com.android.modulemetadata" - ], - "platformAppsAll": [ - "com.android.ons", - "com.android.emulator.multidisplay", - "android.ext.services", - "com.android.pacprocessor", - "com.android.permissioncontroller", - "com.android.wallpaper.livepicker", - "com.android.providers.telephony", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.nfc", - "com.android.vpndialogs", - "android.ext.shared", - "com.android.emergency", - "com.android.carrierdefaultapp", - "com.android.sdksetup", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.statementservice", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.systemui", - "com.android.shell", - "com.android.backupconfirm", - "com.android.settings", - "com.android.carrierconfig", - "com.android.phone", - "com.android.mms.service", - "com.android.egg", - "com.android.inputdevices", - "com.android.externalstorage", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "com.android.managedprovisioning", - "com.android.stk", - "com.android.wallpapercropper", - "android", - "com.android.certinstaller", - "com.android.provision", - "com.android.se", - "com.android.proxyhandler", - "com.android.messaging", - "com.android.packageinstaller", - "com.android.bluetooth", - "com.android.dynsystem", - "com.android.cameraextensions" - ], - "platformAppsNoCode": [ - "android" - ], - "packagesSharedUid": { - "android.uid.phone": [ - "com.android.ons", - "com.android.providers.telephony", - "com.android.phone", - "com.android.mms.service", - "com.android.stk" - ], - "android.uid.system": [ - "com.android.emulator.multidisplay", - "com.android.location.fused", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.settings", - "com.android.inputdevices", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "android", - "com.android.dynsystem" - ], - "android.uid.nfc": [ - "com.android.nfc" - ], - "com.android.emergency.uid": [ - "com.android.emergency" - ], - "android.uid.systemui": [ - "com.android.systemui" - ], - "android.uid.shell": [ - "com.android.shell" - ], - "android.uid.se": [ - "com.android.se" - ], - "android.uid.bluetooth": [ - "com.android.bluetooth" - ] - } -} diff --git a/uraniborg/scripts/python/data/T-GSI.json b/uraniborg/scripts/python/data/T-GSI.json deleted file mode 100644 index 46c062b..0000000 --- a/uraniborg/scripts/python/data/T-GSI.json +++ /dev/null @@ -1,264 +0,0 @@ -{ - "packagesAll": [ - "com.android.ons", - "com.android.storagemanager", - "com.android.printspooler", - "com.android.ondevicepersonalization.services", - "android.ext.services", - "com.android.nearby.halfsheet", - "android.auto_generated_rro_vendor__", - "com.android.pacprocessor", - "com.android.permissioncontroller", - "com.android.phone.auto_generated_rro_vendor__", - "com.android.hotspot2.osulogin", - "com.android.media", - "com.android.cellbroadcastservice", - "com.android.wallpaper.livepicker", - "com.google.pixel.camera.hal", - "com.android.mediaprovider", - "com.android.providers.telephony", - "com.android.btservices", - "com.google.android.storagemanager.auto_generated_rro_vendor__", - "com.android.cts.ctsshim", - "com.android.providers.contacts", - "com.android.settings.auto_generated_rro_vendor__", - "com.android.wifi.resources", - "com.android.mtp", - "com.android.sharedstoragebackup", - "com.android.traceur.auto_generated_rro_vendor__", - "com.android.documentsui", - "com.android.permission", - "com.android.nfc", - "com.android.launcher3", - "com.android.i18n", - "com.android.wifi", - "com.android.inputmethod.latin", - "com.android.bookmarkprovider", - "com.android.vpndialogs", - "com.android.networkstack.tethering", - "com.android.providers.media.module", - "com.android.nfc.auto_generated_rro_vendor__", - "com.android.adservices", - "android.ext.shared", - "com.android.ondevicepersonalization", - "com.android.carrierdefaultapp", - "com.android.sdkext", - "com.android.conscrypt", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.statementservice", - "com.android.ons.auto_generated_rro_vendor__", - "com.android.localtransport", - "com.android.media.swcodec", - "com.android.providers.settings", - "com.android.neuralnetworks", - "com.android.systemui", - "com.android.sdksandbox", - "com.uraniborg.hubble", - "com.android.vndk.v31", - "com.android.bips", - "com.android.vndk.v30", - "com.android.companiondevicemanager", - "com.android.systemui.auto_generated_rro_vendor__", - "com.android.vndk.v33", - "com.android.uwb.resources", - "com.android.vndk.v32", - "com.android.camera2", - "com.android.dreams.basic", - "com.android.printservice.recommendation", - "com.android.shell", - "com.android.ipsec", - "com.android.backupconfirm", - "com.android.settings", - "com.android.providers.userdictionary", - "com.android.wifi.dialog", - "com.android.bluetoothmidiservice", - "com.android.carrierconfig", - "com.android.networkstack", - "com.android.dialer", - "com.android.apps.tag", - "com.android.phone", - "com.android.omadm.service.auto_generated_rro_vendor__", - "com.android.adservices.api", - "com.android.mms.service", - "com.android.egg", - "com.android.captiveportallogin", - "com.android.tethering", - "com.android.extservices", - "com.android.inputdevices", - "com.android.calllogbackup", - "com.android.providers.partnerbookmarks", - "com.android.providers.calendar", - "org.chromium.webview_shell", - "com.android.uwb", - "com.android.externalstorage", - "com.android.apex.cts.shim", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "com.android.vndk.v28", - "com.android.managedprovisioning", - "com.android.soundpicker", - "com.android.vndk.v29", - "com.android.providers.media", - "com.android.modulemetadata", - "com.android.stk", - "com.android.runtime", - "com.android.resolv", - "com.android.adbd", - "android", - "com.android.cellbroadcastreceiver.module", - "com.android.os.statsd", - "com.android.webview", - "com.android.certinstaller", - "com.android.provision", - "com.android.se", - "com.android.proxyhandler", - "com.android.simappdialog", - "com.android.musicfx", - "com.android.tzdata", - "com.android.messaging", - "com.android.providers.downloads", - "com.android.packageinstaller", - "com.android.connectivity.resources", - "com.android.bluetooth", - "com.android.appsearch", - "com.android.cts.priv.ctsshim", - "com.android.providers.downloads.ui", - "com.google.android.flipendo.auto_generated_rro_vendor__", - "com.android.providers.blockednumber", - "com.android.scheduling", - "com.android.traceur", - "com.android.cellbroadcast", - "com.android.safetycenter.resources", - "com.android.dynsystem", - "com.android.htmlviewer", - "com.android.art", - "com.android.cameraextensions" - ], - "packagesNoCode": [ - "com.google.pixel.camera.hal", - "com.android.vndk.v32", - "com.android.media", - "com.android.permission", - "com.android.mediaprovider", - "com.android.uwb", - "com.android.vndk.v33", - "com.android.ondevicepersonalization", - "android", - "com.android.safetycenter.resources", - "com.android.vndk.v29", - "com.android.runtime", - "com.android.os.statsd", - "com.android.btservices", - "com.android.adbd", - "com.android.media.swcodec", - "com.android.wifi", - "com.android.modulemetadata", - "com.android.tzdata", - "com.android.cts.ctsshim", - "com.android.art", - "com.android.neuralnetworks", - "com.android.cellbroadcast", - "com.android.i18n", - "com.android.vndk.v30", - "com.android.resolv", - "com.android.extservices", - "com.android.connectivity.resources", - "com.android.vndk.v28", - "com.android.sdkext", - "com.android.wifi.resources", - "com.android.tethering", - "com.android.apex.cts.shim", - "com.android.adservices", - "com.android.uwb.resources", - "com.android.cts.priv.ctsshim", - "com.android.appsearch", - "com.android.scheduling", - "com.android.conscrypt", - "com.android.ipsec", - "com.android.vndk.v31" - ], - "platformAppsAll": [ - "com.android.ons", - "com.android.storagemanager", - "com.android.ondevicepersonalization.services", - "com.android.pacprocessor", - "com.android.permissioncontroller", - "com.android.providers.telephony", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.nfc", - "com.android.vpndialogs", - "android.ext.shared", - "com.android.carrierdefaultapp", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.statementservice", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.systemui", - "com.android.bips", - "com.android.companiondevicemanager", - "com.android.shell", - "com.android.backupconfirm", - "com.android.settings", - "com.android.carrierconfig", - "com.android.phone", - "com.android.mms.service", - "com.android.egg", - "com.android.inputdevices", - "com.android.externalstorage", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "com.android.managedprovisioning", - "com.android.stk", - "android", - "com.android.certinstaller", - "com.android.provision", - "com.android.se", - "com.android.proxyhandler", - "com.android.messaging", - "com.android.packageinstaller", - "com.android.traceur", - "com.android.dynsystem", - "com.android.cameraextensions" - ], - "platformAppsNoCode": [ - "android" - ], - "packagesSharedUid": { - "android.uid.phone": [ - "com.android.ons", - "com.android.providers.telephony", - "com.android.phone", - "com.android.mms.service", - "com.android.stk" - ], - "android.uid.nfc": [ - "com.android.nfc" - ], - "android.uid.system": [ - "com.android.location.fused", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.settings", - "com.android.inputdevices", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "android", - "com.android.dynsystem" - ], - "android.uid.systemui": [ - "com.android.systemui" - ], - "android.uid.shell": [ - "com.android.shell" - ], - "android.uid.se": [ - "com.android.se" - ] - } -} diff --git a/uraniborg/scripts/python/data/U-GSI.json b/uraniborg/scripts/python/data/U-GSI.json deleted file mode 100644 index 1d747a3..0000000 --- a/uraniborg/scripts/python/data/U-GSI.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "packagesAll": [ - "com.android.ons", - "com.android.storagemanager", - "com.android.printspooler", - "com.android.ondevicepersonalization.services", - "com.android.emulator.multidisplay", - "android.ext.services", - "com.android.nearby.halfsheet", - "android.auto_generated_rro_vendor__", - "com.android.pacprocessor", - "com.android.microdroid.empty_payload", - "com.android.role.notes.enabled", - "com.android.permissioncontroller", - "com.android.systemui.accessibility.accessibilitymenu", - "com.android.phone.auto_generated_rro_vendor__", - "com.android.hotspot2.osulogin", - "com.android.media", - "com.android.virt", - "com.android.internal.systemui.navbar.transparent", - "com.android.cellbroadcastservice", - "com.android.wallpaper.livepicker", - "com.android.internal.systemui.navbar.gestural_narrow_back", - "com.google.pixel.camera.hal", - "com.android.mediaprovider", - "com.android.providers.telephony", - "com.android.contacts", - "com.android.btservices", - "com.android.internal.display.cutout.emulation.waterfall", - "com.android.deskclock", - "com.android.dreams.phototable", - "com.google.android.storagemanager.auto_generated_rro_vendor__", - "com.android.cts.ctsshim", - "com.android.providers.contacts", - "com.android.settings.auto_generated_rro_vendor__", - "com.android.wifi.resources", - "com.android.mtp", - "com.android.sharedstoragebackup", - "com.android.traceur.auto_generated_rro_vendor__", - "com.android.documentsui", - "com.android.permission", - "com.android.nfc", - "com.android.compos", - "com.android.launcher3", - "com.android.configinfrastructure", - "com.android.i18n", - "com.android.wifi", - "com.android.inputmethod.latin", - "com.android.bookmarkprovider", - "com.android.vpndialogs", - "com.android.networkstack.tethering", - "com.android.providers.media.module", - "com.android.nfc.auto_generated_rro_vendor__", - "com.android.adservices", - "android.ext.shared", - "com.android.emergency", - "com.android.ondevicepersonalization", - "com.android.internal.display.cutout.emulation.corner", - "com.android.credentialmanager", - "com.android.carrierdefaultapp", - "com.android.sdkext", - "com.android.conscrypt", - "com.android.sdksetup", - "com.android.internal.systemui.navbar.gestural_extra_wide_back", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.statementservice", - "com.android.media.swcodec", - "com.android.ons.auto_generated_rro_vendor__", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.neuralnetworks", - "com.android.systemui", - "com.android.sdksandbox", - "com.uraniborg.hubble", - "com.android.vndk.v31", - "com.android.bips", - "com.android.vndk.v30", - "com.android.companiondevicemanager", - "com.android.systemui.auto_generated_rro_vendor__", - "com.android.vndk.v33", - "com.android.uwb.resources", - "com.android.vndk.v32", - "com.android.vndk.v34", - "com.android.healthfitness", - "com.android.camera2", - "com.android.dreams.basic", - "com.android.quicksearchbox", - "com.android.printservice.recommendation", - "com.android.internal.systemui.navbar.gestural_wide_back", - "com.android.imsserviceentitlement", - "com.android.devicelock", - "com.android.wallpaperpicker", - "com.android.rkpdapp", - "com.android.shell", - "com.android.ipsec", - "com.android.backupconfirm", - "com.android.virtualmachine.res", - "com.android.calendar", - "com.android.settings", - "com.android.providers.userdictionary", - "com.android.wifi.dialog", - "com.android.settings.intelligence", - "com.android.theme.font.notoserifsource", - "com.android.bluetoothmidiservice", - "com.android.internal.display.cutout.emulation.double", - "com.android.carrierconfig", - "com.android.networkstack", - "com.android.dialer", - "com.android.apps.tag", - "com.android.phone", - "com.android.omadm.service.auto_generated_rro_vendor__", - "com.android.adservices.api", - "com.android.mms.service", - "com.android.egg", - "com.android.captiveportallogin", - "com.android.tethering", - "com.android.extservices", - "com.android.federatedcompute.services", - "com.android.inputdevices", - "com.android.calllogbackup", - "com.android.intentresolver", - "com.android.providers.partnerbookmarks", - "com.android.providers.calendar", - "com.android.internal.display.cutout.emulation.hole", - "com.android.uwb", - "org.chromium.webview_shell", - "com.android.externalstorage", - "com.android.apex.cts.shim", - "com.android.server.telecom", - "com.android.keychain", - "com.android.gallery3d", - "com.android.wallpaperbackup", - "com.android.managedprovisioning", - "com.android.soundpicker", - "com.android.vndk.v29", - "com.android.providers.media", - "com.android.modulemetadata", - "com.android.stk", - "com.android.health.connect.backuprestore", - "com.android.ext.adservices.api", - "com.android.runtime", - "com.android.internal.systemui.navbar.threebutton", - "com.android.resolv", - "com.android.adbd", - "com.android.systemui.gsi.overlay", - "com.android.wallpapercropper", - "android", - "com.android.cellbroadcastreceiver.module", - "com.android.os.statsd", - "com.android.webview", - "com.android.certinstaller", - "com.android.healthconnect.controller", - "com.android.se", - "com.google.pixel.wifi.ext", - "com.android.proxyhandler", - "com.android.simappdialog", - "com.android.musicfx", - "com.android.tzdata", - "com.android.music", - "com.android.messaging", - "com.android.providers.downloads", - "com.android.networkstack.tethering.emulator", - "com.google.android.widevine", - "com.android.packageinstaller", - "com.android.connectivity.resources", - "com.android.internal.display.cutout.emulation.tall", - "com.android.bluetooth", - "com.android.devicelockcontroller", - "com.android.appsearch", - "com.android.rkpd", - "com.android.cts.priv.ctsshim", - "com.android.internal.systemui.navbar.twobutton", - "com.android.providers.downloads.ui", - "com.android.compos.payload", - "com.google.android.flipendo.auto_generated_rro_vendor__", - "com.android.providers.blockednumber", - "com.android.internal.systemui.navbar.gestural", - "com.android.scheduling", - "com.android.traceur", - "com.android.cellbroadcast", - "com.android.safetycenter.resources", - "com.android.dynsystem", - "com.android.htmlviewer", - "com.android.art", - "com.android.cameraextensions" - ], - "packagesNoCode": [ - "com.android.healthfitness", - "com.android.vndk.v31", - "com.android.vndk.v33", - "com.android.ondevicepersonalization", - "com.android.internal.systemui.navbar.threebutton", - "com.android.uwb.resources", - "com.google.pixel.camera.hal", - "com.android.internal.systemui.navbar.gestural_wide_back", - "com.android.connectivity.resources", - "com.android.compos.payload", - "com.android.i18n", - "com.android.btservices", - "com.android.mediaprovider", - "com.android.networkstack.tethering.emulator", - "com.android.wifi", - "com.android.virt", - "com.android.vndk.v32", - "com.android.internal.display.cutout.emulation.waterfall", - "com.android.internal.display.cutout.emulation.hole", - "com.android.os.statsd", - "com.android.tethering", - "com.google.android.widevine", - "com.google.pixel.wifi.ext", - "com.android.uwb", - "com.android.extservices", - "com.android.theme.font.notoserifsource", - "com.android.cts.priv.ctsshim", - "com.android.compos", - "com.android.ipsec", - "com.android.permission", - "com.android.internal.systemui.navbar.gestural", - "com.android.devicelock", - "com.android.art", - "com.android.microdroid.empty_payload", - "com.android.internal.display.cutout.emulation.corner", - "com.android.virtualmachine.res", - "com.android.cts.ctsshim", - "com.android.conscrypt", - "com.android.cellbroadcast", - "com.android.vndk.v34", - "com.android.internal.systemui.navbar.gestural_extra_wide_back", - "com.android.media", - "com.android.wifi.resources", - "com.android.internal.systemui.navbar.gestural_narrow_back", - "com.android.neuralnetworks", - "com.android.internal.systemui.navbar.twobutton", - "com.android.systemui.gsi.overlay", - "com.android.tzdata", - "com.android.configinfrastructure", - "com.android.scheduling", - "com.android.rkpd", - "com.android.modulemetadata", - "android", - "com.android.internal.display.cutout.emulation.double", - "com.android.internal.display.cutout.emulation.tall", - "com.android.resolv", - "com.android.internal.systemui.navbar.transparent", - "com.android.media.swcodec", - "com.android.sdkext", - "com.android.runtime", - "com.android.appsearch", - "com.android.vndk.v30", - "com.android.apex.cts.shim", - "com.android.adbd", - "com.android.vndk.v29", - "com.android.adservices", - "com.android.role.notes.enabled" - ], - "platformAppsAll": [ - "com.android.ons", - "com.android.storagemanager", - "com.android.ondevicepersonalization.services", - "com.android.emulator.multidisplay", - "com.android.pacprocessor", - "com.android.role.notes.enabled", - "com.android.permissioncontroller", - "com.android.systemui.accessibility.accessibilitymenu", - "com.android.providers.telephony", - "com.android.sharedstoragebackup", - "com.android.documentsui", - "com.android.nfc", - "com.android.vpndialogs", - "android.ext.shared", - "com.android.emergency", - "com.android.credentialmanager", - "com.android.carrierdefaultapp", - "com.android.sdksetup", - "com.android.cellbroadcastreceiver", - "com.android.location.fused", - "com.android.statementservice", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.systemui", - "com.android.bips", - "com.android.companiondevicemanager", - "com.android.shell", - "com.android.backupconfirm", - "com.android.settings", - "com.android.carrierconfig", - "com.android.phone", - "com.android.mms.service", - "com.android.egg", - "com.android.inputdevices", - "com.android.intentresolver", - "com.android.externalstorage", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "com.android.managedprovisioning", - "com.android.stk", - "com.android.wallpapercropper", - "android", - "com.android.certinstaller", - "com.android.se", - "com.android.proxyhandler", - "com.android.messaging", - "com.android.packageinstaller", - "com.android.devicelockcontroller", - "com.android.traceur", - "com.android.dynsystem", - "com.android.cameraextensions" - ], - "platformAppsNoCode": [ - "android", - "com.android.role.notes.enabled" - ], - "packagesSharedUid": { - "android.uid.phone": [ - "com.android.ons", - "com.android.providers.telephony", - "com.android.phone", - "com.android.mms.service", - "com.android.stk" - ], - "android.uid.system": [ - "com.android.emulator.multidisplay", - "com.android.location.fused", - "com.android.localtransport", - "com.android.providers.settings", - "com.android.settings", - "com.android.inputdevices", - "com.android.server.telecom", - "com.android.keychain", - "com.android.wallpaperbackup", - "android", - "com.android.dynsystem" - ], - "android.uid.nfc": [ - "com.android.nfc" - ], - "com.android.emergency.uid": [ - "com.android.emergency" - ], - "android.uid.systemui": [ - "com.android.systemui" - ], - "android.uid.shell": [ - "com.android.shell" - ], - "android.uid.se": [ - "com.android.se" - ] - } -} diff --git a/uraniborg/scripts/python/data/V-GSI.json b/uraniborg/scripts/python/data/V-GSI.json deleted file mode 100644 index f6e91c5..0000000 --- a/uraniborg/scripts/python/data/V-GSI.json +++ /dev/null @@ -1,358 +0,0 @@ -{ - "packagesAll": [ - "android", - "android.auto_generated_rro_vendor__", - "android.ext.services", - "android.ext.shared", - "com.android.DeviceAsWebcam", - "com.android.adbd", - "com.android.adservices", - "com.android.adservices.api", - "com.android.apex.cts.shim", - "com.android.apps.tag", - "com.android.appsearch", - "com.android.appsearch.apk", - "com.android.art", - "com.android.avatarpicker", - "com.android.backupconfirm", - "com.android.bips", - "com.android.bluetooth", - "com.android.bluetoothmidiservice", - "com.android.bookmarkprovider", - "com.android.btservices", - "com.android.calendar", - "com.android.calllogbackup", - "com.android.camera2", - "com.android.cameraextensions", - "com.android.captiveportallogin", - "com.android.carrierconfig", - "com.android.carrierdefaultapp", - "com.android.cellbroadcast", - "com.android.cellbroadcastreceiver", - "com.android.cellbroadcastreceiver.module", - "com.android.cellbroadcastservice", - "com.android.certinstaller", - "com.android.companiondevicemanager", - "com.android.compos", - "com.android.compos.payload", - "com.android.configinfrastructure", - "com.android.connectivity.resources", - "com.android.conscrypt", - "com.android.contacts", - "com.android.credentialmanager", - "com.android.cts.ctsshim", - "com.android.cts.priv.ctsshim", - "com.android.deskclock", - "com.android.devicediagnostics", - "com.android.devicediagnostics.auto_generated_rro_vendor__", - "com.android.devicelock", - "com.android.devicelockcontroller", - "com.android.dialer", - "com.android.documentsui", - "com.android.dreams.basic", - "com.android.dreams.phototable", - "com.android.dynsystem", - "com.android.egg", - "com.android.emergency", - "com.android.externalstorage", - "com.android.extservices", - "com.android.federatedcompute.services", - "com.android.gallery3d", - "com.android.hardware.biometrics.face.virtual", - "com.android.hardware.biometrics.fingerprint.virtual", - "com.android.hardware.cas", - "com.android.health.connect.backuprestore", - "com.android.healthconnect.controller", - "com.android.healthfitness", - "com.android.hotspot2.osulogin", - "com.android.htmlviewer", - "com.android.i18n", - "com.android.imsserviceentitlement", - "com.android.inputdevices", - "com.android.inputmethod.latin", - "com.android.intentresolver", - "com.android.internal.display.cutout.emulation.corner", - "com.android.internal.display.cutout.emulation.double", - "com.android.internal.display.cutout.emulation.hole", - "com.android.internal.display.cutout.emulation.tall", - "com.android.internal.display.cutout.emulation.waterfall", - "com.android.internal.systemui.navbar.gestural", - "com.android.internal.systemui.navbar.threebutton", - "com.android.internal.systemui.navbar.transparent", - "com.android.ipsec", - "com.android.keychain", - "com.android.launcher3", - "com.android.localtransport", - "com.android.location.fused", - "com.android.managedprovisioning", - "com.android.media", - "com.android.media.swcodec", - "com.android.mediaprovider", - "com.android.messaging", - "com.android.microdroid.empty_payload", - "com.android.mms.service", - "com.android.modulemetadata", - "com.android.mtp", - "com.android.music", - "com.android.musicfx", - "com.android.networkstack", - "com.android.networkstack.tethering", - "com.android.neuralnetworks", - "com.android.nfc", - "com.android.nfcservices", - "com.android.omadm.service.auto_generated_rro_vendor__", - "com.android.ondevicepersonalization", - "com.android.ondevicepersonalization.services", - "com.android.ons", - "com.android.os.statsd", - "com.android.packageinstaller", - "com.android.pacprocessor", - "com.android.permission", - "com.android.permissioncontroller", - "com.android.phone", - "com.android.phone.auto_generated_rro_vendor__", - "com.android.printservice.recommendation", - "com.android.printspooler", - "com.android.profiling", - "com.android.providers.blockednumber", - "com.android.providers.calendar", - "com.android.providers.contactkeys", - "com.android.providers.contacts", - "com.android.providers.downloads", - "com.android.providers.downloads.ui", - "com.android.providers.media", - "com.android.providers.media.module", - "com.android.providers.partnerbookmarks", - "com.android.providers.settings", - "com.android.providers.settings.auto_generated_rro_vendor__", - "com.android.providers.telephony", - "com.android.providers.userdictionary", - "com.android.provision", - "com.android.proxyhandler", - "com.android.quicksearchbox", - "com.android.resolv", - "com.android.rkpd", - "com.android.rkpdapp", - "com.android.role.notes.enabled", - "com.android.runtime", - "com.android.safetycenter.resources", - "com.android.scheduling", - "com.android.sdkext", - "com.android.sdksandbox", - "com.android.se", - "com.android.server.deviceconfig.resources", - "com.android.server.telecom", - "com.android.settings", - "com.android.settings.auto_generated_rro_vendor__", - "com.android.settings.intelligence", - "com.android.sharedstoragebackup", - "com.android.shell", - "com.android.simappdialog", - "com.android.soundpicker", - "com.android.statementservice", - "com.android.stk", - "com.android.storagemanager", - "com.android.systemui", - "com.android.systemui.accessibility.accessibilitymenu", - "com.android.systemui.auto_generated_rro_vendor__", - "com.android.systemui.gsi.overlay", - "com.android.tethering", - "com.android.theme.font.notoserifsource", - "com.android.traceur", - "com.android.traceur.auto_generated_rro_vendor__", - "com.android.tzdata", - "com.android.uwb", - "com.android.uwb.resources", - "com.android.virt", - "com.android.virtualmachine.res", - "com.android.vndk.v30", - "com.android.vndk.v31", - "com.android.vndk.v32", - "com.android.vndk.v33", - "com.android.vndk.v34", - "com.android.vpndialogs", - "com.android.wallpaper", - "com.android.wallpaper.livepicker", - "com.android.wallpaperbackup", - "com.android.wallpapercropper", - "com.android.webview", - "com.android.wifi", - "com.android.wifi.dialog", - "com.android.wifi.resources", - "com.google.android.flipendo.auto_generated_rro_vendor__", - "com.google.android.hardware.biometrics.face", - "com.google.android.storagemanager.auto_generated_rro_vendor__", - "com.google.android.widevine.nonupdatable", - "com.google.pixel.camera.hal", - "com.google.pixel.euicc.update", - "com.google.pixel.wifi.ext", - "com.uraniborg.hubble", - "org.chromium.webview_shell" - ], - "packagesNoCode": [ - "com.google.android.widevine.nonupdatable", - "com.android.vndk.v32", - "com.android.configinfrastructure", - "android", - "com.android.cts.ctsshim", - "com.android.devicelock", - "com.android.internal.display.cutout.emulation.waterfall", - "com.android.vndk.v33", - "com.android.appsearch", - "com.android.sdkext", - "com.android.healthfitness", - "com.android.virt", - "com.android.runtime", - "com.android.uwb", - "com.android.appsearch.apk", - "com.android.rkpd", - "com.android.vndk.v30", - "com.android.internal.systemui.navbar.threebutton", - "com.android.art", - "com.android.hardware.biometrics.fingerprint.virtual", - "com.android.vndk.v34", - "com.google.pixel.wifi.ext", - "com.android.hardware.biometrics.face.virtual", - "com.android.btservices", - "com.android.virtualmachine.res", - "com.google.pixel.euicc.update", - "com.android.nfcservices", - "com.android.modulemetadata", - "com.android.compos.payload", - "com.android.os.statsd", - "com.android.theme.font.notoserifsource", - "com.google.android.hardware.biometrics.face", - "com.android.extservices", - "com.google.pixel.camera.hal", - "com.android.internal.display.cutout.emulation.hole", - "com.android.mediaprovider", - "com.android.compos", - "com.android.systemui.gsi.overlay", - "com.android.vndk.v31", - "com.android.adservices", - "com.android.role.notes.enabled", - "com.android.internal.display.cutout.emulation.corner", - "com.android.microdroid.empty_payload", - "com.android.connectivity.resources", - "com.android.media", - "com.android.i18n", - "com.android.cts.priv.ctsshim", - "com.android.adbd", - "com.android.internal.display.cutout.emulation.double", - "com.android.cellbroadcast", - "com.android.ondevicepersonalization", - "com.android.scheduling", - "com.android.resolv", - "com.android.internal.systemui.navbar.gestural", - "com.android.uwb.resources", - "com.android.permission", - "com.android.tzdata", - "com.android.wifi.resources", - "com.android.apex.cts.shim", - "com.android.server.deviceconfig.resources", - "com.android.conscrypt", - "com.android.hardware.cas", - "com.android.internal.systemui.navbar.transparent", - "com.android.internal.display.cutout.emulation.tall", - "com.android.wifi", - "com.android.neuralnetworks", - "com.android.tethering", - "com.android.media.swcodec", - "com.android.ipsec", - "com.android.profiling" - ], - "platformAppsAll": [ - "android", - "android.ext.shared", - "com.android.DeviceAsWebcam", - "com.android.avatarpicker", - "com.android.backupconfirm", - "com.android.bips", - "com.android.cameraextensions", - "com.android.carrierconfig", - "com.android.carrierdefaultapp", - "com.android.cellbroadcastreceiver", - "com.android.certinstaller", - "com.android.companiondevicemanager", - "com.android.credentialmanager", - "com.android.devicediagnostics", - "com.android.devicelockcontroller", - "com.android.documentsui", - "com.android.dynsystem", - "com.android.egg", - "com.android.emergency", - "com.android.externalstorage", - "com.android.inputdevices", - "com.android.intentresolver", - "com.android.keychain", - "com.android.localtransport", - "com.android.location.fused", - "com.android.managedprovisioning", - "com.android.messaging", - "com.android.mms.service", - "com.android.ondevicepersonalization.services", - "com.android.ons", - "com.android.packageinstaller", - "com.android.pacprocessor", - "com.android.permissioncontroller", - "com.android.phone", - "com.android.providers.settings", - "com.android.providers.telephony", - "com.android.provision", - "com.android.proxyhandler", - "com.android.role.notes.enabled", - "com.android.se", - "com.android.server.deviceconfig.resources", - "com.android.server.telecom", - "com.android.settings", - "com.android.sharedstoragebackup", - "com.android.shell", - "com.android.statementservice", - "com.android.stk", - "com.android.storagemanager", - "com.android.systemui", - "com.android.systemui.accessibility.accessibilitymenu", - "com.android.traceur", - "com.android.vpndialogs", - "com.android.wallpaperbackup", - "com.android.wallpapercropper" - ], - "platformAppsNoCode": [ - "com.android.role.notes.enabled", - "android", - "com.android.server.deviceconfig.resources" - ], - "packagesSharedUid": { - "android.uid.system": [ - "android", - "com.android.DeviceAsWebcam", - "com.android.dynsystem", - "com.android.inputdevices", - "com.android.keychain", - "com.android.localtransport", - "com.android.location.fused", - "com.android.providers.settings", - "com.android.server.telecom", - "com.android.settings" - ], - "com.android.emergency.uid": [ - "com.android.emergency" - ], - "android.uid.phone": [ - "com.android.mms.service", - "com.android.ons", - "com.android.phone", - "com.android.providers.telephony", - "com.android.stk" - ], - "android.uid.se": [ - "com.android.se" - ], - "android.uid.shell": [ - "com.android.shell" - ], - "android.uid.systemui": [ - "com.android.systemui" - ] - } -} diff --git a/uraniborg/scripts/python/device_scoring.py b/uraniborg/scripts/python/device_scoring.py deleted file mode 100644 index 7c14b7e..0000000 --- a/uraniborg/scripts/python/device_scoring.py +++ /dev/null @@ -1,280 +0,0 @@ -#!/usr/bin/python3 -# Copyright 2020 Uraniborg authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -"""Device Scorer. - -This script is an example program of how to make use of the risk_analyzer -module in order to compute a device's preloaded risk score. -""" - -import argparse -import logging -import os -import sys - -import hubble_parser -import package_whitelists -import risk_analyzer as RA - -HubbleParser = hubble_parser.HubbleParser -BaselinePackages = package_whitelists.BaselinePackages -PackageWhitelists = package_whitelists.PackageWhitelists - -# consts -KEY_PLATFORM = "platform" -KEY_RISKY_PERMS = "risky-permissions" -KEY_CLEARTEXT = "cleartext" - - -def parse_arguments(): - """Parses cmdline arguments. - - Returns: - An object containing information about arguments that are passed within - this namespace. - """ - parser = argparse.ArgumentParser( - description="A script that computes risk scores, starting with base " - "risk score computed based on risky permissions granted and " - "number of apps signed with platform signature." - "Secondary score is computed using a baseline, i.e. GSI.") - required_args = parser.add_argument_group("required arguments") - required_args.add_argument("--dir", required=True, - help="The directory that contains output files of " - "Hubble's observations.") - - parser.add_argument("-o", "--output", required=False, default=None, - help="Specifies the output directory where the " - "\"results\" directory can be found.") - parser.add_argument("-D", "--debug", required=False, action="count", - help="If specified, debugging mode is turned on.") - parser.add_argument("--normalize", required=False, action="count", - help="If specified, normalize score to use " - "GSI packages as filter.") - parser.add_argument("--csv", required=False, action="count", - help="If specified, prints result in CSV form and no " - "logging messages will be printed.") - parser.add_argument("--csv_header", required=False, action="count", - help="If specified together with --csv, headers will be" - "printed.") - parser.add_argument("--include-gms", - action="store_true", - help="If specified, the calculation would include GMS " - "packages from risk calculation.") - args = parser.parse_args() - return args - - -def set_up_logging(args): - """Sets up various logging parameters. - - Args: - args: Parsed arguments from calling argparse.ArgumentParser() - - Returns: - A logger object suitable for usage. - """ - logger = logging.getLogger(__name__) - - if args.debug: - logger.setLevel(logging.DEBUG) - else: - logger.setLevel(logging.INFO) - - if args.csv: - logger.setLevel(logging.CRITICAL) - - s_handler = logging.StreamHandler() - log_format_w_filename = "%(levelname)s:%(filename)s:%(funcName)s(%(lineno)d): %(message)s" - log_format_no_filename = "%(levelname)s:%(funcName)s(%(lineno)d): %(message)s" - s_format = logging.Formatter( - log_format_no_filename) - s_handler.setFormatter(s_format) - - logger.addHandler(s_handler) - return logger - - -def supported_platform(logger): - """Check if this script is running on a supported platform. - - Args: - logger: A valid logger instance to log error messages. - - Returns: - True if this platform is supported. - """ - # TODO(billy): Look into what is required to support Windows in the future. - logger.debug("Current platform: {}".format(sys.platform)) - if not (sys.platform == "linux" or sys.platform == "darwin"): - logger.error("Sorry, your OS is currenly unsupported for this script.") - return False - - # Do this check to prevent users running this on Python2 - if not (sys.version_info.major == 3 and sys.version_info.minor >= 5): - logger.error("This script requires Python 3.5 or higher!") - logger.error("You are using Python {}.{}.".format(sys.version_info.major, - sys.version_info.minor)) - return False - - return True - - -def compute_scores(logger, hubble, normalize=False, include_gms=False): - """Computes the scores for all the risk categories. - - Args: - logger: A valid logger instance. - hubble: A valid HubbleParser instance. - normalize: A boolean indicating to normalize against baseline build or not. - Usually this would be set to False if you want to do reading on - a baseline build. - include_gms: A boolean indicating whether or not to include GMS packages in - the computation. To ignore/discard GMS packages, set this to - False. - Returns: - A dict containing all the individual scores for every metric, depending on - the inclusion or exclusion of GMS apps based on param include_gms. - """ - results = dict() - ### PLATFORM SIGNATURE RISK ######## - platform_signature_risk_analyzer = RA.PlatformSignature.get_scorer( - hubble.get_api_level(), logger) - platform_signature_risk = platform_signature_risk_analyzer.compute_score( - hubble, normalize) - logger.info("Platform Signature Risk: %2.4f / %2.4f", platform_signature_risk, - platform_signature_risk_analyzer.PHI) - results[KEY_PLATFORM] = platform_signature_risk - - logger.debug("include_gms: %s", include_gms) - #### RISKY PRIVILEGED PERMISSIONS ########## - if include_gms: - risky_permissions_risk_analyzer = RA.RiskyPermissions.get_scorer( - hubble.get_api_level(), logger) - results[KEY_RISKY_PERMS] = risky_permissions_risk_analyzer.compute_score( - hubble, normalize) - logger.info("Pregranted Permissions Risk Score: %2.4f / %2.4f", - results[KEY_RISKY_PERMS], risky_permissions_risk_analyzer.PHI) - else: - # without GMS - risky_permissions_ra_no_gms = RA.RiskyPermissions.get_scorer( - hubble.get_api_level(), logger, True) - results[KEY_RISKY_PERMS] = risky_permissions_ra_no_gms.compute_score( - hubble, normalize) - logger.info("Pregranted Permissions Risk Score without GMS: %2.4f / %2.4f", - results[KEY_RISKY_PERMS], - risky_permissions_ra_no_gms.PHI) - - ### CLEARTEXT TRAFFIC ##### - if include_gms: - cleartext_traffic_risk_analyzer = RA.CleartextTraffic.get_scorer( - hubble.get_api_level(), logger) - results[KEY_CLEARTEXT] = cleartext_traffic_risk_analyzer.compute_score( - hubble, normalize) - logger.info("Cleartext Traffic Risk Score: %2.4f / %2.4f", - results[KEY_CLEARTEXT], - cleartext_traffic_risk_analyzer.PHI) - else: - # without GMS - cleartext_traffic_ra_no_gms = RA.CleartextTraffic.get_scorer( - hubble.get_api_level(), logger, True) - results[KEY_CLEARTEXT] = cleartext_traffic_ra_no_gms.compute_score( - hubble, normalize) - logger.info("Cleartext Traffic Risk Score without GMS: %2.4f / %2.4f", - results[KEY_CLEARTEXT], cleartext_traffic_ra_no_gms.PHI) - - return results - - -def interpret_device_score(score): - """Converts a device risk score into rating. - - Note that this is just an example of how scores can be divided into different - rating categories, and does not represent the actual final rating that may be - adopted by a more official standard. - - Args: - score: A float representing the total device risk score. - - Returns: - A string representing the interpretation or risk rating of the score. - """ - if score >= 0 and score <= 2.5: - return "VERY LOW" - elif score > 2.5 and score <= 4.5: - return "LOW" - elif score > 4.5 and score <= 5.5: - return "MEDIUM" - elif score > 5.5 and score <= 6.5: - return "HIGH" - elif score > 6.5 and score <= 7.5: - return "VERY HIGH" - elif score > 7.5 and score <= 10.0: - return "ELEVATED" - return "ERROR" - - -def main(): - args = parse_arguments() - logger = set_up_logging(args) - - if not supported_platform(logger): - logger.error("Sorry, your OS is currently unsupported for this script.") - return - - logger.debug("normalize: %s", args.normalize) - logger.debug("include gmscore: %s", args.include_gms) - - # read in Hubble's output - directory = args.dir - if not os.path.exists(directory): - logger.error("%s does not exist!", directory) - return - - normalize = args.normalize is not None - - hp = HubbleParser(logger, normalize) - if not hp.parse_hubble_output(args.dir): - logger.error("Error parsing necessary files. Aborting...") - return - - scores = compute_scores(logger, hp, normalize, args.include_gms) - total_risk_score = sum(scores.values()) - if args.include_gms: - logger.warning("Uraniborg's Device Preloaded Apps Risk Score " - "(including GMS): {:2.2f} / 10.00".format(total_risk_score)) - else: - logger.warning("Adjusted Uraniborg's Device Preloaded Apps Risk Score " - "(without GMS): {:2.2f} / 10.00".format(total_risk_score)) - logger.warning("Use the --include-gms option to see the scores with GMS") - - if args.csv: - device_info_str = "{},{}:{}:{},{},{},".format(hp.hardware["oem"], - hp.hardware["brand"], - hp.hardware["modelName"], - hp.hardware["productName"], - hp.build["apiLevel"], - hp.build["fingerprint"]) - scores_str = "{:2.2f},{:2.2f},{:2.2f},".format(scores[KEY_PLATFORM], - scores[KEY_RISKY_PERMS], - scores[KEY_CLEARTEXT]) - scores_str += "{:2.2f},".format(total_risk_score) - rating_str = "{},".format(interpret_device_score(total_risk_score)) - print(device_info_str + scores_str) - - -if __name__ == "__main__": - main() diff --git a/uraniborg/scripts/python/generate_baseline_packages.py b/uraniborg/scripts/python/generate_baseline_packages.py deleted file mode 100644 index 7288eaa..0000000 --- a/uraniborg/scripts/python/generate_baseline_packages.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/python3 -# Copyright 2020 Uraniborg authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -"""Generate Baseline Packages. - -This is a script that can be used to generate packages as baseline or reference -to be used as point of comparisons with target builds/devices. - -The output can be piped to separate files. This script is currently used to -generate BasePackages in package_whitelists module. - -Currently, it reads in Hubble results directly and uses HubbleParser to parse -them and then classify them in the combination of whether they: -1. are platform signed -2. have code or not (purely resource APKs) -""" - -import json -import logging -import os -import sys - -import hubble_parser - -HubbleParser = hubble_parser.HubbleParser - - -def set_up_logging(logging_level): - logger = logging.getLogger(__name__) - logger.setLevel(logging_level) - log_format = ("%(levelname)s:%(filename)s:%(funcName)s(%(lineno)d): " - "%(message)s") - s_handler = logging.StreamHandler() - s_format = logging.Formatter(log_format) - s_handler.setFormatter(s_format) - logger.addHandler(s_handler) - return logger - - -def main(): - logger = set_up_logging(logging.ERROR) - if len(sys.argv) < 2: - logger.error("Insufficient argument!") - print("USAGE: {} [directory]".format(sys.argv[0])) - sys.exit(1) - - directory = os.path.join(sys.argv[1]) - - hubble = HubbleParser(logger, False) - if not hubble.parse_hubble_output(directory): - logger.error("Failed to parse Hubble result files in %s", sys.argv[1]) - sys.exit(1) - - # List all packages - packages_all = hubble.get_all_packages(False) - packages_no_code = list(set(packages_all) - - set(hubble.get_all_packages(True))) - - # List all platform signed apps - platform_signed_apps_all = hubble.get_platform_packages(False) - platform_signed_no_code = list(set(platform_signed_apps_all) - - set(hubble.get_platform_packages(True))) - - # Extract/Identify all shared uid apps - shared_uid_apps = hubble.get_shared_uid_packages() - - # Create JSON Object - data = {} - data["packagesAll"] = packages_all - data["packagesNoCode"] = packages_no_code - data["platformAppsAll"] = platform_signed_apps_all - data["platformAppsNoCode"] = platform_signed_no_code - data["packagesSharedUid"] = shared_uid_apps - json_data = json.dumps(data, indent=2) - print(json_data) - -if __name__ == "__main__": - main() diff --git a/uraniborg/scripts/python/package_whitelists.py b/uraniborg/scripts/python/package_whitelists.py deleted file mode 100644 index a9c4ec6..0000000 --- a/uraniborg/scripts/python/package_whitelists.py +++ /dev/null @@ -1,326 +0,0 @@ -#!/usr/bin/python3 -# Copyright 2020 Uraniborg authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -"""Package Whitelists Module. - -This module defines a generic class that encapsulates the necessary attributes -of what package whitelists would be like. Package whitelists and baseline may -differ according to OEM and API level - thus the need for specificity. - -Currently, we are exempting safety information packages. - -Google Mobile Service (GMS) packages are also exempted. -""" - -import json -import os - - -class BaselinePackages: - """A set of packages used as point of reference based on API level. - - The package names are observed from either AOSP or GSI builds. - """ - - data_filename = "" - instance = None - instances = {} - api_level_to_filename = { - 24: "data/N-AOSP.json", - 25: "data/N-AOSP.json", - 26: "data/O-AOSP.json", - 27: "data/O-AOSP.json", - 28: "data/P-AOSP.json", - 29: "data/Q-GSI.json", - 30: "data/R-GSI.json", - 31: "data/S-GSI.json", - 33: "data/T-GSI.json", # per https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU - 34: "data/U-GSI.json", # per https://developer.android.com/reference/android/os/Build.VERSION_CODES#UPSIDE_DOWN_CAKE - 35: "data/V-GSI.json", # per https://developer.android.com/reference/android/os/Build.VERSION_CODES#VANILLA_ICE_CREAM - } - - @staticmethod - def get_instance(api_level): - """Obtains a usable instance of BaselinePackages according to API Level. - - Args: - api_level: An int representing the api level. - - Returns: - An instance of BaselinePackages that is tailored for the API level. - """ - instance = BaselinePackages.instances.get(api_level) - if not instance: - instance = BaselinePackages() - curr_dir = os.path.dirname(os.path.abspath(__file__)) - data_filepath = os.path.join(curr_dir, - BaselinePackages.api_level_to_filename.get( - api_level)) - instance.load_data_files(data_filepath) - BaselinePackages.instances[api_level] = instance - return instance - - def load_data_files(self, data_filepath): - """Reads in data files & converts JSON objects into instance attributes. - - Args: - data_filepath: the filepath of the data file that is to be read in. - """ - in_json = "" - with open(data_filepath, "r") as f_in: - in_json = f_in.read() - in_json = json.loads(in_json) - self.packages_all = in_json["packagesAll"] - self.packages_no_code = in_json["packagesNoCode"] - self.packages_platform_signed = in_json["platformAppsAll"] - self.packages_platform_no_code = in_json["platformAppsNoCode"] - self.packages_shared_uid = in_json["packagesSharedUid"] - - def get_all_packages(self, no_code=False): - if no_code: - return self.packages_no_code - return self.packages_all - - def get_platform_signed_packages(self, no_code=False): - if no_code: - return self.packages_platform_no_code - return self.packages_platform_signed - - def get_shared_uid_packages(self): - return self.packages_shared_uid - - -class GMS: - """A class defining Google Mobile Services (GMS) apps. - - Maintenance: This class may need to be updatede in the future should the - signing certificates be rotated/changed. - """ - PACKAGES = { - # The actual gmscore APK - "com.google.android.gms": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - # Google Drive - "com.google.android.apps.docs": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - # Youtube - "com.google.android.youtube": - "3d7a1223019aa39d9ea0e3436ab7c0896bfb4fb679f4de5fe7c23f326c8f994a", - # Google Play Client - "com.android.vending": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - # Chrome browser - "com.android.chrome": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - # Google Photos - "com.google.android.apps.photos": - "3d7a1223019aa39d9ea0e3436ab7c0896bfb4fb679f4de5fe7c23f326c8f994a", - # Google Maps - "com.google.android.apps.maps": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - # Gmail - "com.google.android.gm": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - # Google Services Framework - "com.google.android.gsf": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - # Google - "com.google.android.googlequicksearchbox": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - # Google Setup Wizard - "com.google.android.setupwizard": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - # Google Calendar - "com.google.android.calendar": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - # Google Movies - "com.google.android.videos": - "3d7a1223019aa39d9ea0e3436ab7c0896bfb4fb679f4de5fe7c23f326c8f994a", - } - - @staticmethod - def is_gms_package(package): - """Checks if a package is a legitimate GMS APK based on signer cert. - - Args: - package: A JSON object representing info about an APK. - - Returns: - True if the package's signature matches the correct one. - """ - package_name = package["name"] - if package_name not in GMS.PACKAGES: - return False - - package_signature = package["certIds"][0] - if package_signature == GMS.PACKAGES.get(package_name): - return True - return False - - -class PackageWhitelists: - """The main class. - - This class defines globally excluded packages. It can be inherited to create - OEM-specific excluded packages. - - As of now, we found 3 categories of what we think can legitimately be - excluded: - 1. The "android" APK, which every Android device must have. - 2. Regulatory APK that displays safety or other legal information. - 3. Installer APKs in the form of 1P OEM app store. Note that 3P installers - should never be included in the exception list, and are considered as - adding risk to the build! - - Categories 1 & 2 are listed using EXCLUDED_PACKAGES set, and the 3rd is listed - using INSTALLER_PACKAGES dict. - - More categories may be added as necessary in the future. - """ - - PREFIXES = { - "com.android.", - "android." - } - - EXCLUDED_PACKAGES = { - # These are globally excluded packages. In OEM-specific instances, - # regulatory safety/legal APKs can be included here. - "android", # the framework package - "com.uraniborg.hubble", # our observer app - } - - INSTALLER_PACKAGES = { - # The other exception we are making is for 1P app stores. We are listing - # Google Play Store client as the global whitelist as it is a required app - # in MADA. - "com.android.vending": - "f0fd6c5b410f25cb25c3b53346c8972fae30f8ee7411df910480ad6b2d60db83", - } - - @staticmethod - def get_whitelist(oem): - """Gets an oem-specific whitelist. - - Args: - oem: A string describing the manufacturer. - - Returns: - A specific PackageWhitelists instance that contains OEM-specific excluded - packages. - """ - if oem == "Google": - return Google() - elif oem == "samsung": - return Samsung() - elif oem == "HUAWEI": - return Huawei() - elif oem == "HMD Global": - return Nokia() - elif oem == "Sony": - return Sony() - elif oem == "motorola": - return Motorola() - elif oem == "asus": - return Asus() - elif oem == "OnePlus": - return OnePlus() - else: - return PackageWhitelists() - - @staticmethod - def package_name_fuzzy_match(logger, package_name, whitelist): - """Performs package name fuzzy matching. - - We are doing some sort of prefix matching currently. - - Args: - logger: a logger object - package_name: the name of the package to be matched - whitelist: a list containing package names to be matched with. - - Returns: - The corresponding package name within the whitelist that the package_name - was matched to. In case of no match, None is returned. - """ - if package_name in whitelist: - logger.debug("%s is direct match!", package_name) - return package_name - - for whitelisted_package in whitelist: - for prefix in PackageWhitelists.PREFIXES: - truncated_package_name = "" - if whitelisted_package.startswith(prefix): - truncated_package_name = "." + whitelisted_package[len(prefix):] - - if package_name.endswith(truncated_package_name): - return whitelisted_package - - return None - - -class Samsung(PackageWhitelists): - EXCLUDED_PACKAGES = PackageWhitelists.EXCLUDED_PACKAGES | { - # Safety information - "com.samsung.safetyinformation", - } - - INSTALLER_PACKAGES = { - **PackageWhitelists.INSTALLER_PACKAGES, - # Galaxy Store with signer - "com.sec.android.app.samsungapps": - "fba3af4e7757d9016e953fb3ee4671ca2bd9af725f9a53d52ed4a38eaaa08901", - } - - -class Google(PackageWhitelists): - EXCLUDED_PACKAGES = PackageWhitelists.EXCLUDED_PACKAGES | { - "com.android.safetyregulatoryinfo", - } - - -class Nokia(PackageWhitelists): - EXCLUDED_PACKAGES = PackageWhitelists.EXCLUDED_PACKAGES | { - "com.hmdglobal.app.legalinformation", - } - - -class Huawei(PackageWhitelists): - INSTALLER_PACKAGES = { - **PackageWhitelists.INSTALLER_PACKAGES, - # AppGallery (Huawei's App Store) - "com.huawei.appmarket": - "ffe391e0ea186d0734ed601e4e70e3224b7309d48e2075bac46d8c667eae7212", - } - - -class Sony(PackageWhitelists): - pass - - -class Motorola(PackageWhitelists): - pass - - -class Asus(PackageWhitelists): - pass - - -class OnePlus(PackageWhitelists): - pass - - -# NOTE: Create new oem-specific classes here: diff --git a/uraniborg/scripts/python/risk_analyzer.py b/uraniborg/scripts/python/risk_analyzer.py deleted file mode 100644 index f345a14..0000000 --- a/uraniborg/scripts/python/risk_analyzer.py +++ /dev/null @@ -1,1066 +0,0 @@ -#!/usr/bin/python3 -# Copyright 2020 Uraniborg authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -"""Risk Analyzers. - -This module defines a generic class that encapsulates the necessary -functionalities and attributes of a risk scorer. -Out of that, specific risk analyzers inherit from the generic class & implement -how scoring is done for each risk metric. -""" -import abc -import logging -import hubble_parser -import package_whitelists - - -ABC = abc.ABC -abstractmethod = abc.abstractmethod -HubbleParser = hubble_parser.HubbleParser -BaselinePackages = package_whitelists.BaselinePackages -PackageWhitelists = package_whitelists.PackageWhitelists -GMS = package_whitelists.GMS - - -class RiskAnalyzer(ABC): - """A generic risk analyzer class. - - As this is an abstract class, it should not be instantiable; It defines a set - of interfaces that its inheritors MUST implement. - - NOTE TO IMPLEMENTORS: - If you wish to implement a new metric, you should create a new class that - inherits from this class, and implement the abstract methods. For example, - look at how the current metrics are implemented. - """ - BASE_SCORE = 0 - PHI = 0 - LAMBDA_I = 0.25 - - - def __init__(self): - self.related_apps = [] - - def get_related_apps(self): - """Returns a list of apps which are considered by the analyzer.""" - return self.related_apps - - @staticmethod - def convert_to_odds(probability): - return probability / (1 - probability) - - @staticmethod - def convert_to_probability(odds): - return odds / (1 + odds) - - @abstractmethod - def compute_base_score(self, hubble, normalize): - """This method must be implemented to calculate a raw score for a metric. - - If you are defining and implementing a new metric, you would want this - method to do the base calculations. - - Args: - hubble: A valid HubbleParser instance containing the output of a target - build/device to be evaluated. - normalize: A boolean indicating whether or not to do normalization against - a baseline build. Typically, this is set to True when you are - evaluating the additional signals by a target device, and set - to False when you are collecting data for baseline build. - - Returns: - Either a float or an int (depending on what your scores look like) of an - unweighted raw/base risk score for the metric you are defining. - """ - pass - - @abstractmethod - def compute_score(self, hubble, normalize): - pass - - @staticmethod - @abstractmethod - def get_scorer(api_level, logger): - """For callers to get an instance of a scorer according to API level. - - This method must be implemented by an inheriting class. Essentially this is - similar to a factory method where an instance of a scorer is returned to the - caller according to the API level that is passed in. - - Args: - api_level: the API level of the build to be scored/compared against. - logger: a valid logger instance. - - Returns: - An instance of a scorer that can be used immediately. Else, exception may - be raised if the API level is not handled/implemented yet. - """ - pass - - def compute_lambda_o(self, iota): - return iota * self.LAMBDA_I / (1 + self.LAMBDA_I * (iota - 1)) - - def _billy_formula_v1(self, hubble, normalize): - """Implements my initial formula. - - The formula for this is slightly more involved. Here, the risk score is - defined as probability (lambda) x damage_potential (PHI). However, in order - to calculate the observed probability (lambda_o), we use likelihood ratio - (iota) and multiply that with the odds of occurence. Relationship between - probability and odds are also defined in other methods in this class. - Finally, we return the computed observed probability (lambda_o) and multiply - that with the weight or damage potential (PHI) of the metric. - - Args: - hubble: A HubbleParser instance containing the output of a target build to - be evaluated. - normalize: A boolean indicating whether or not to normalize the reading - with respect to baseline. - - Returns: - A float representing the final (weighted) score of a metric. - """ - logger = self.logger - raw_score = self.compute_base_score(hubble, normalize) - - iota = raw_score / self.BASE_SCORE - logger.debug("iota = %2.2f / %2.2f = %2.4f", raw_score, self.BASE_SCORE) - lambda_o = self.compute_lambda_o(iota) - logger.debug("lambda_o = %2.4f", lambda_o) - return lambda_o * self.PHI - - def _cambridge(self, hubble, normalize): - r"""Implements the Cambridge formula. - - The formula is simple: r = |A_t \ A_baseline| / |A_t| where: - r is the likelihood of risk we are calculating for a particular metric, - A_t is the set of apps on target device meeting the criteria for the metric, - A_baseline is the set of apps on baseline build that meets the same criteria - \ is the set complement operator. - - Args: - hubble: A HubbleParser instance containing the output of target build to - be evaluated. - normalize: A boolean indicating whether or not to normalize the reading - with respect to baseline. - - Returns: - A float representing the final (weighted) score of a metric. - """ - logger = self.logger - numerator = self.compute_base_score(hubble, True) - denominator = self.compute_base_score(hubble, False) - r = 0.0 - if denominator: - r = numerator / denominator - logger.debug("r = %2.2f / %2.2f = %2.4f", numerator, denominator, r) - return r * self.PHI - - -class PlatformSignature(RiskAnalyzer): - """The platform signature risk analyzer. - - This class analyzes packages on a particular build to score the risks posed - by the introduction of additional platform signed packages. The comparison - is made with a relevant baseline: either GSI or AOSP builds when available. - """ - PHI = 6.0 - LAMBDA_I = 0.25 - - def __init__(self, logger): - super().__init__() - self.logger = logger - self.platform_apps = [] - - @staticmethod - def get_scorer(api_level, logger): - if api_level == 35: - return VPlatformSignature(logger) - if api_level == 34: - logger.debug("Returning UPlatformSignature") - return UPlatformSignature(logger) - if api_level == 33: - logger.debug("Returning TPlatformSignature") - return TPlatformSignature(logger) - if api_level == 31: - logger.debug("Returning SPlatformSignature") - return SPlatformSignature(logger) - if api_level == 30: - logger.debug("Returning RPlatformSignature") - return RPlatformSignature(logger) - if api_level == 29: - logger.debug("Returning QPlatformSignature") - return QPlatformSignature(logger) - elif api_level == 28: - logger.debug("Returning PPlatformSignature") - return PPlatformSignature(logger) - elif api_level == 27 or api_level == 26: - logger.debug("Returning OPlatformSignature") - return OPlatformSignature(logger) - elif api_level == 25 or api_level == 24: - return NPlatformSignature(logger) - else: - raise Exception("API Level not handled!") - - def compute_base_score(self, hubble, normalize): - """Computes the base score for platforn signature metrics. - - Args: - hubble: A valid instance of HubbleParser object. - normalize: A boolean indicating to normalize the score against baseline or - not. Typically, this value is set to True when computing score - for a target device and False when collecting base score for - baseline measurements. - - Returns: - An int representing the raw score of this metrics - """ - logger = self.logger - - # first determine platform signature - platform_signature = hubble.get_platform_signature() - - num_platform_signed_app = 0 - packages = hubble.packages - whitelist = PackageWhitelists.get_whitelist(hubble.get_oem()) - baseline = BaselinePackages.get_instance(hubble.get_api_level()) - hubble.platform_apps = [] - hubble.system_uid_apps = [] - update_apps = False - if not self.related_apps and normalize: - update_apps = True - for package in packages: - package_name = package["name"] - - ### do filtering - if package_name in whitelist.EXCLUDED_PACKAGES: - logger.debug("^%s is in OEM global whitelist. Excluding...", - package_name) - continue - - if normalize: - fuzzy_matched_package = PackageWhitelists.package_name_fuzzy_match( - logger, package_name, baseline.get_platform_signed_packages()) - if fuzzy_matched_package: - # only discount if the same package was signed using platform - # signature in GSI's build - continue - - if platform_signature in package["certIds"]: - hubble.platform_apps.append(package_name) - num_platform_signed_app += 1 - logger.debug("+%s is platform signed. Running score: %d", package_name, - num_platform_signed_app) - - if package["sharedUserId"] == "android.uid.system": - hubble.system_uid_apps.append(package_name) - - if not package["hasCode"]: - # we discount those that has no code, but not remove from our list, - # because these packages are still signed with platform signature - # nonetheless. - num_platform_signed_app -= 1 - logger.debug("-%s but has no code. Running total: %d", package_name, - num_platform_signed_app) - elif update_apps: - self.related_apps.append(package) - return num_platform_signed_app - - def compute_score(self, hubble, normalize): - # This is where you can choose which scheme to use (including the one you - # implemented yourself) to compute the weighted score for the metric you are - # measuring. - return self._cambridge(hubble, normalize) - - -# NOTE TO IMPLEMENTORS: -# BASE_SCORE is calculated by doing a run with normalize=False on baseline data. -# But it is not used in the final risk formula today. -class NPlatformSignature(PlatformSignature): - API_LEVEL = 25 - BASE_SCORE = 38 - - -class OPlatformSignature(PlatformSignature): - API_LEVEL = 27 - BASE_SCORE = 42 - - -class PPlatformSignature(PlatformSignature): - API_LEVEL = 28 - BASE_SCORE = 41 - - -class QPlatformSignature(PlatformSignature): - API_LEVEL = 29 - BASE_SCORE = 49 - - -class RPlatformSignature(PlatformSignature): - API_LEVEL = 30 - BASE_SCORE = 49 - - -class SPlatformSignature(PlatformSignature): - API_LEVEL = 31 - BASE_SCORE = 45 - - -class TPlatformSignature(PlatformSignature): - API_LEVEL = 33 - BASE_SCORE = 50 - - -class UPlatformSignature(PlatformSignature): - API_LEVEL = 34 - BASE_SCORE = 50 - - -class VPlatformSignature(PlatformSignature): - API_LEVEL = 35 - BASE_SCORE = 51 - - -class SystemUid(RiskAnalyzer): - """Analyzer for system uid risks. - """ - PHI = 6.0 - LAMBDA_I = 0.25 - - def __init__(self, logger): - super().__init__() - self.logger = logger - self.system_uid_apps = [] - - @staticmethod - def get_scorer(api_level, logger): - if api_level == 35: - logger.debug("returning VSystemUid") - return VSystemUid(logger) - if api_level == 34: - logger.debug("Returning USystemUid") - return USystemUid(logger) - if api_level == 33: - logger.debug("Returning TSystemUid") - return TSystemUid(logger) - if api_level == 31: - logger.debug("Returning SSystemUid") - return SSystemUid(logger) - if api_level == 30: - logger.debug("Returning RSystemUid") - return RSystemUid(logger) - if api_level == 29: - logger.debug("Returning QSystemUid") - return QSystemUid(logger) - if api_level == 28: - logger.debug("Return PSystemUid") - return PSystemUid(logger) - elif api_level == 27 or api_level == 26: - logger.debug("Returning OSystemUid") - return OSystemUid(logger) - elif api_level == 25 or api_level == 24: - return NSystemUid(logger) - else: - raise Exception("API Level not supported!") - - def compute_base_score(self, hubble, normalize): - logger = self.logger - - shared_uid_packages = hubble.get_shared_uid_packages() - baseline = BaselinePackages.get_instance(hubble.get_api_level()) - baseline_shared_uid_packages = baseline.get_shared_uid_packages() - whitelist = PackageWhitelists.get_whitelist(hubble.get_oem()) - - shared_uid_score = 0 - for shared_uid in shared_uid_packages: - for package_name in shared_uid_packages[shared_uid]: - - if normalize: - if package_name in whitelist.EXCLUDED_PACKAGES: - logger.debug("^%s is in OEM global whitelist. Excluding...", - package_name) - continue - - b_suid_packages = baseline_shared_uid_packages.get(shared_uid) - if b_suid_packages is not None and package_name in b_suid_packages: - logger.debug("^%s is a baseline shared uid: %s. Skipping...", - package_name, shared_uid) - continue - logger.debug("+%s is newly introduced shared uid: %s.", package_name, - shared_uid) - shared_uid_score += 1 - logger.debug("Shared UID Score: %d", shared_uid_score) - return shared_uid_score - - def compute_score(self, hubble, normalize): - return self._cambridge(hubble, normalize) - - -class NSystemUid(SystemUid): - API_LEVEL = 25 - BASE_SCORE = 17 - - -class OSystemUid(SystemUid): - API_LEVEL = 27 - BASE_SCORE = 19 - - -class PSystemUid(SystemUid): - API_LEVEL = 28 - BASE_SCORE = 17 - - -class QSystemUid(SystemUid): - API_LEVEL = 29 - BASE_SCORE = 23 - - -class RSystemUid(SystemUid): - API_LEVEL = 30 - BASE_SCORE = 24 - - -class SSystemUid(SystemUid): - API_LEVEL = 31 - BASE_SCORE = 25 - - -class TSystemUid(SystemUid): - API_LEVEL = 33 - BASE_SCORE = 30 - - -class USystemUid(SystemUid): - API_LEVEL = 34 - BASE_SCORE = 33 - - -class VSystemUid(SystemUid): - API_LEVEL = 35 - BASE_SCORE = 35 - - -class RiskyPermissions(RiskAnalyzer): - """The risky permission risk analyzer. - - This class provides a stack ranked permissions according to the severity of - the permissions. Then, it computes the score based on how many of the - corresponding permissions are pre-granted to each app. - """ - PHI = 3 - LAMBDA_I = 0.25 - - class Weights: - RISK_ASTRONOMICAL = 100 - RISK_CRITICAL = 10 - RISK_HIGH = 7.5 - RISK_MEDIUM = 5 - RISK_LOW = 2.5 - - class Permissions: - """Nested class of stack ranked permissions. - - The permissions are evaluated from the Android framework, and stack ranked - according to the severity of the impact/risk of the permissions. This was - done based on inputs from security experts. - - This list is currently in sync with permissions weighted in - https://github.com/DEKRA-Cybersecurity/MAS-Preloaded-Apps-Scripts/blob/main/config/methods_config.yml - up till Android 14. - """ - RISK_ASTRONOMICAL = { - "android.permission.INSTALL_PACKAGES" - } - - RISK_CRITICAL = { - "android.permission.PROVIDE_REMOTE_CREDENTIALS", - "android.permission.COPY_PROTECTED_DATA", - "android.permission.WRITE_SECURE_SETTINGS", - "android.permission.READ_FRAME_BUFFER", - "android.permission.MANAGE_CA_CERTIFICATES", - "android.permission.MANAGE_APP_OPS_MODES", - "android.permission.GRANT_RUNTIME_PERMISSIONS", - "android.permission.DUMP", - "android.permission.CAMERA", - "android.permission.SYSTEM_CAMERA", - "android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS", - "android.permission.MOUNT_UNMOUNT_FILESYSTEMS", - "android.permission.PROVIDE_DEFAULT_ENABLED_CREDENTIAL_SERVICE", - } - - RISK_HIGH = { - "android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS", - "android.permission.READ_SMS", - "android.permission.WRITE_SMS", - "android.permission.RECEIVE_MMS", - "android.permission.SEND_SMS_NO_CONFIRMATION", - "android.permission.RECEIVE_SMS", - "android.permission.READ_LOGS", - "android.permission.READ_PRIVILEGED_PHONE_STATE", - "android.permission.LOCATION_HARDWARE", - "android.permission.ACCESS_FINE_LOCATION", - "android.permission.ACCESS_BACKGROUND_LOCATION", - "android.permission.BIND_ACCESSIBILITY_SERVICE", - "android.permission.ACCESS_WIFI_STATE", - "com.android.voicemail.permission.READ_VOICEMAIL", - "android.permission.RECORD_AUDIO", - "android.permission.CAPTURE_AUDIO_OUTPUT", - "android.permission.ACCESS_NOTIFICATIONS", - "android.permission.INTERACT_ACROSS_USERS_FULL", - "android.permission.BLUETOOTH_PRIVILEGED", - "android.permission.GET_PASSWORD", - "android.permission.INTERNAL_SYSTEM_WINDOW", - "android.permission.MANAGE_ONGOING_CALLS", - "android.permission.READ_RESTRICTED_STATS", - "android.permission.BIND_AUTOFILL_SERVICE", - } - - RISK_MEDIUM = { - "android.permission.ACCESS_COARSE_LOCATION", - "android.permission.CHANGE_COMPONENT_ENABLED_STATE", - "android.permission.READ_CONTACTS", - "android.permission.WRITE_CONTACTS", - "android.permission.CONNECTIVITY_INTERNAL", - "android.permission.ACCESS_MEDIA_LOCATION", - "android.permission.READ_EXTERNAL_STORAGE", - "android.permission.WRITE_EXTERNAL_STORAGE", - "android.permission.SYSTEM_ALERT_WINDOW", - "android.permission.READ_CALL_LOG", - "android.permission.WRITE_CALL_LOG", - "android.permission.INTERACT_ACROSS_USERS", - "android.permission.MANAGE_USERS", - "android.permission.READ_CALENDAR", - "android.permission.BLUETOOTH_ADMIN", - "android.permission.BODY_SENSORS", - "android.permission.MANAGE_EXTERNAL_STORAGE", - "android.permission.ACCESS_BLOBS_ACROSS_USERS", - "android.permission.BLUETOOTH_ADVERTISE", - "android.permission.READ_MEDIA_AUDIO", - "android.permission.READ_MEDIA_IMAGES", - "android.permission.READ_MEDIA_VIDEO", - } - - RISK_LOW = { - "android.permission.DOWNLOAD_WITHOUT_NOTIFICATION", - "android.permission.PACKAGE_USAGE_STATS", - "android.permission.MASTER_CLEAR", - "android.permission.DELETE_PACKAGES", - "android.permission.GET_PACKAGE_SIZE", - "android.permission.BLUETOOTH", - "android.permission.DEVICE_POWER", - "android.permission.READ_PRECISE_PHONE_STATE", - "android.permission.LOG_FOREGROUND_RESOURCE_USE", - "android.permission.MANAGE_DEFAULT_APPLICATIONS", - "android.permission.MANAGE_FACE", - } - - @staticmethod - def get_scorer(api_level, logger, google_discount=False): - if api_level == 35: - return VRiskyPermissions(logger, google_discount) - if api_level == 34: - return URiskyPermissions(logger, google_discount) - if api_level == 33: - return TRiskyPermissions(logger, google_discount) - if api_level == 31: - return SRiskyPermissions(logger, google_discount) - if api_level == 30: - return RRiskyPermissions(logger, google_discount) - if api_level == 29: - return QRiskyPermissions(logger, google_discount) - elif api_level == 28: - return PRiskyPermissions(logger, google_discount) - elif api_level == 27 or api_level == 26: - return ORiskyPermissions(logger, google_discount) - elif api_level == 25 or api_level == 24: - return NRiskyPermissions(logger, google_discount) - else: - raise Exception("API Level not handled!") - - @staticmethod - def map_permission_to_score(permission_name): - """Maps permission to a score. - - Scores are determined based on their risk category. The value of each - category is also pre-defined in RiskyPermissions.Weights - - Args: - permission_name: a string containing permission name - - Returns: - An int representing the score of the permission. If the permission - is not found under any of the risk categories, 0 is returned. - """ - Permissions = RiskyPermissions.Permissions - Weights = RiskyPermissions.Weights - permission_levels = [a for a in dir(Permissions) if a.startswith("RISK")] - - for permission_level in permission_levels: - if permission_name in getattr(Permissions, permission_level): - return getattr(Weights, permission_level) - - return 0 - - def __init__(self, logger, google_discount): - super().__init__() - self.logger = logger - self.google_discount = google_discount - - def _compute_fair_permission_score(self, permissions): - """Account for permissions within the same group. - - The intuition behind this can be expressed via the following example. If an - app is granted both ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION, it - should be accounted for its more severe permission, i.e. the fine grained - permission. It does not gain additional ability from the - ACCESS_COARSE_LOCATION permission, and thus does not pose additional risk - as a result too. Thus, our risk score computation should reflect cases like - this. - - So far, we are handling location and sms as permission groups. This can be - expanded in the future to include more categories. - - Args: - permissions: A collection of strings representing Android permission names - to be scored. - - Returns: - A dict containing scores in various categories. Most of the rest of the - scores are accrued within the 'generic' key. - """ - scores = dict() - scores["generic"] = 0 - scores["location"] = 0 - scores["sms"] = 0 - - for permission in permissions: - if "LOCATION" in permission: - scores["location"] = max(scores["location"], - RiskyPermissions.map_permission_to_score( - permission)) - continue - if "SMS" in permission: - scores["sms"] = max(scores["sms"], - RiskyPermissions.map_permission_to_score( - permission)) - continue - - scores["generic"] += RiskyPermissions.map_permission_to_score(permission) - return scores - - def compute_base_score(self, hubble, normalize): - logger = self.logger - total_granted_score = 0 - total_ungranted_score = 0 - - packages = hubble.packages - whitelist = PackageWhitelists.get_whitelist(hubble.get_oem()) - baseline = BaselinePackages.get_instance(hubble.get_api_level()) - - gms_packages = GMS.PACKAGES if self.google_discount else [] - update_apps = False - if not self.related_apps and normalize: - update_apps = True - for package in packages: - package_name = package["name"] - - # We start by handling whitelists or identifying packages that should - # be skipped. - if package_name in hubble.platform_apps: - logger.debug("^%s was platform signed. Skipping...", package_name) - continue - - if package_name in whitelist.EXCLUDED_PACKAGES: - logger.debug("^%s is listed in OEM whitelist. Skipping...", - package_name) - continue - - if package_name in whitelist.INSTALLER_PACKAGES: - if package["certIds"][0] == whitelist.INSTALLER_PACKAGES.get( - package_name): - logger.debug("^%s is the OEM's app store. Skipping...", package_name) - continue - else: - logger.warning("!%s's signature does not match whitelist", - package_name) - - if normalize: - fuzzy_matched_package = PackageWhitelists.package_name_fuzzy_match( - logger, package_name, baseline.get_all_packages()) - if fuzzy_matched_package: - # the ideal case would be to compute the diff of permission between - # packages. But we'll use a simpler version by skipping for now in - # this iteration. - logger.debug("^%s skipped - fuzzy matched to GSI package %s", - package_name, fuzzy_matched_package) - continue - - if not package["hasCode"]: - logger.debug("^%s has no code. Skipping...", package_name) - continue - - if package_name in gms_packages: - if GMS.is_gms_package(package): - logger.debug("^%s is GMS package. Skipped...", package_name) - continue - else: - logger.debug("!%s seems to be GMS but signature doesn't match!", - package_name) - - risk_score = self._compute_fair_permission_score( - package["permissionsGranted"]) - # handle special permissions - risk_score["special"] = 0 - for special_permission in package["permissionsSpecial"]: - risk_score["special"] += RiskyPermissions.map_permission_to_score( - special_permission) - - ungranted_score = self._compute_fair_permission_score( - package["permissionsNotGranted"]) - - is_related = False - for score_type in risk_score: - if risk_score[score_type]: - logger.debug("+%s added %d points as %s pregranted score.", - package_name, risk_score[score_type], score_type) - is_related = True - total_granted_score += risk_score[score_type] - for score_type in ungranted_score: - if ungranted_score[score_type]: - logger.debug("/%s added %d points as %s ungranted score.", - package_name, ungranted_score[score_type], score_type) - total_ungranted_score += ungranted_score[score_type] - - if update_apps and is_related: - self.related_apps.append(package) - - logger.debug("Total pregranted perms score: %2.2f", total_granted_score) - logger.debug("Total ungranted perms score: %2.2f", total_ungranted_score) - return total_granted_score - - def compute_score(self, hubble, normalize): - return self._cambridge(hubble, normalize) - - -# NOTE TO IMPLEMENTORS: -# UNGRANTED_SCORE is calculated by running through compute_score on baseline -# builds with normalize=False. It represents the total score of permissions -# requested by all the preloaded apps but not pre-granted. -# This value is recorded but currently unused in any computation. -# Also note that BASE_SCORE and UNGRANTED_SCORE may change if the mappings -# and/or weightings for the permissions change. -class NRiskyPermissions(RiskyPermissions): - API_LEVEL = 25 - BASE_SCORE = 307.5 - UNGRANTED_SCORE = 175 - - -class ORiskyPermissions(RiskyPermissions): - API_LEVEL = 27 - BASE_SCORE = 340 - UNGRANTED_SCORE = 167 - - -class PRiskyPermissions(RiskyPermissions): - API_LEVEL = 28 - BASE_SCORE = 342.5 - UNGRANTED_SCORE = 160 - - -class QRiskyPermissions(RiskyPermissions): - API_LEVEL = 29 - BASE_SCORE = 385 - UNGRANTED_SCORE = 190 - - -class RRiskyPermissions(RiskyPermissions): - API_LEVEL = 30 - BASE_SCORE = 462.5 - UNGRANTED_SCORE = 187.5 - - -class SRiskyPermissions(RiskyPermissions): - API_LEVEL = 31 - BASE_SCORE = 485 - UNGRANTED_SCORE = 175 - - -class TRiskyPermissions(RiskyPermissions): - API_LEVEL = 33 - BASE_SCORE = 500 - UNGRANTED_SCORE = 200 - - -class URiskyPermissions(RiskyPermissions): - API_LEVEL = 34 - BASE_SCORE = 542.50 - UNGRANTED_SCORE = 162.50 - - -class VRiskyPermissions(RiskyPermissions): - API_LEVEL = 35 - BASE_SCORE = 735 - UNGRANTED_SCORE = 290 - - -class CleartextTraffic(RiskAnalyzer): - """Cleartext traffic risk analyzer. - - This class analyzes packages to see if they pose any security risk of using - cleartext traffic in their communication. - """ - PHI = 1 - LAMBDA_I = 0.25 - - @staticmethod - def get_scorer(api_level, logger, google_discount=False): - if api_level == 35: - return VCleartextTraffic(logger, google_discount) - if api_level == 34: - return UCleartextTraffic(logger, google_discount) - if api_level == 33: - return TCleartextTraffic(logger, google_discount) - if api_level == 31: - return SCleartextTraffic(logger, google_discount) - if api_level == 30: - return RCleartextTraffic(logger, google_discount) - if api_level == 29: - return QCleartextTraffic(logger, google_discount) - elif api_level == 28: - return PCleartextTraffic(logger, google_discount) - elif api_level == 27 or api_level == 26: - return OCleartextTraffic(logger, google_discount) - elif api_level == 25 or api_level == 24: - return NCleartextTraffic(logger, google_discount) - else: - raise Exception("API Level not handled!") - - def __init__(self, logger, google_discount): - super().__init__() - self.logger = logger - self.google_discount = google_discount - - def compute_base_score(self, hubble, normalize): - """Computes the base score of cleartext traffic risk. - - Args: - hubble: A HubbleParser instance containing build to be evaluated. - normalize: A boolean indicating whether or not to normalize the computed - base score against a baseline. - - Returns: - An int representing the base or raw score of this metric. - """ - logger = self.logger - packages = hubble.packages - baseline = BaselinePackages.get_instance(hubble.get_api_level()) - gms_packages = GMS.PACKAGES if self.google_discount else [] - total_score = 0 - update_apps = False - if not self.related_apps and normalize: - update_apps = True - for package in packages: - package_name = package["name"] - - if normalize: - fuzzy_matched_package = PackageWhitelists.package_name_fuzzy_match( - logger, package_name, baseline.get_all_packages()) - if fuzzy_matched_package: - logger.debug("^%s skipped - fuzzy matched to GSI package %s", - package_name, fuzzy_matched_package) - continue - - if package_name in gms_packages: - if GMS.is_gms_package(package): - logger.debug("^%s is GMS package. Skipping...", package_name) - continue - else: - logger.warning("%s's signature does not match database. Careful!", - package_name) - - if not package["hasCode"]: - logger.debug("^%s has no code. Skipping for now...", package_name) - continue - - if package["usesCleartextTraffic"]: - logger.debug("+%s uses cleartext traffic!", package_name) - total_score += 1 - - if "android.permission.INTERNET" not in package["permissionsGranted"]: - logger.debug("-%s has no INTERNET permission? Discounting...", - package_name) - total_score -= 1 - elif update_apps: - self.related_apps.append(package) - return total_score - - def compute_score(self, hubble, normalize): - """Computes the CleartextTraffic risk score. - - Note that this method currently does NOT disregard platform signed apps. - In fact, we should consider if we should double count those signed using - platform apps to discourage this behavior among more privileged apps. - We're using the Cambridge formula here to calculate the weighted risk score. - - Args: - hubble: a valid HubbleParser object. - normalize: a boolean indicating whether or not to normalize the score - with a baseline. This should be set to false when obtaining - baseline scores. - - Returns: - A float representing the calculated risk score using the formula of - probability x damage_potential. - """ - return self._cambridge(hubble, normalize) - - -class NCleartextTraffic(CleartextTraffic): - BASE_SCORE = 15 - - -class OCleartextTraffic(CleartextTraffic): - BASE_SCORE = 18 - - -class PCleartextTraffic(CleartextTraffic): - BASE_SCORE = 12 - - -class QCleartextTraffic(CleartextTraffic): - BASE_SCORE = 8 - - -class RCleartextTraffic(CleartextTraffic): - BASE_SCORE = 8 - - -class SCleartextTraffic(CleartextTraffic): - BASE_SCORE = 8 - - -class TCleartextTraffic(CleartextTraffic): - BASE_SCORE = 9 - - -class UCleartextTraffic(CleartextTraffic): - BASE_SCORE = 8 - - -class VCleartextTraffic(CleartextTraffic): - BASE_SCORE = 2 - - -class HostileDownloader(RiskAnalyzer): - """Analyzer assessing hostile downloader security risk. - """ - PHI = 2.5 - LAMBDA_I = 0.25 - - def __init__(self, logger, google_discount=True): - super().__init__() - self.logger = logger - self.google_discount = google_discount - self.installer_apps = [] - self.installer_apps_certs = set() - - @staticmethod - def get_scorer(api_level, logger): - pass - - def compute_base_score(self, hubble, normalize): - logger = self.logger - num_sources = 0 - num_platform_signed = 0 - - packages = hubble.packages - whitelist = PackageWhitelists.get_whitelist(hubble.get_oem()) - baseline = BaselinePackages.get_instance(hubble.get_api_level()) - gms_packages = GMS.PACKAGES if self.google_discount else [] - platform_signature = hubble.get_platform_signature() - for package in packages: - package_name = package["name"] - - if "android.permission.INSTALL_PACKAGES" not in package[ - "permissionsGranted"]: - continue - - if package_name in whitelist.INSTALLER_PACKAGES: - logger.debug("^%s is an official installer app. Skipping...", - package_name) - continue - - if normalize: - fuzzy_matched_package = PackageWhitelists.package_name_fuzzy_match( - logger, package_name, baseline.get_all_packages()) - if fuzzy_matched_package: - logger.debug("^%s skipping - fuzzy matched to GSI package %s", - package_name, fuzzy_matched_package) - continue - - if package_name in gms_packages: - if GMS.is_gms_package(package): - logger.debug("^%s is GMS package. Skipping...", package_name) - continue - else: - logger.warning("%s's signature does not match actual GMS package!", - package_name) - - self.installer_apps.append(package_name) - signer_cert = package["certIds"][0] - self.installer_apps_certs.add(signer_cert) - logger.debug("+%s signed by %s can install other packages.", package_name, - signer_cert) - if signer_cert == platform_signature: - logger.warning("!%s's signer is platform key!", package_name) - num_platform_signed += 1 - - num_sources = len(self.installer_apps_certs) - logger.debug("There are %d different sources of %d installer app", - num_sources, len(self.installer_apps)) - return num_sources + num_platform_signed - - def compute_score(self, hubble, normalize): - logger = self.logger - # we're using direct multiples of num_sources as iota here, to discourage - # this phenomenon - multiplier = 1 - base_score = self.compute_base_score(hubble, normalize) - if not base_score: - base_score = 1 - iota = multiplier * base_score - if not normalize: - iota = 1 - logger.debug("iota: %2.4f", iota) - - lambda_i = 0.25 - lambda_o = iota * lambda_i / (1 + lambda_i * (iota - 1)) - logger.debug("lambda_o: %2.4f", lambda_o) - - return lambda_o * self.PHI - - -def set_up_logging(): - logger = logging.getLogger(__name__) - logger.setLevel(logging.ERROR) - log_format = ("%(levelname)s:%(filename)s:%(funcName)s(%(lineno)d): " - "%(message)s") - s_handler = logging.StreamHandler() - s_format = logging.Formatter(log_format) - s_handler.setFormatter(s_format) - logger.addHandler(s_handler) - return logger