def application(device, app_type, show, package): adb = ADB(device_id=device) dumpsys_out = adb.dumpsys(["package", package]) perms_list = adb.get_req_perms_dumpsys_package(dumpsys_out) app = App(adb, package, perms_list=perms_list) all_perms, dangerous_perms, device_owner = app.check_app() if show == "danger_perms": return render_template('application.html', app_type=app_type, show=show, device=device, package=package, perms=dangerous_perms) else: return render_template('application.html', app_type=app_type, show=show, device=device, package=package, perms=all_perms)
def refresh_scan(device, app_type): adb = ADB(ADB_PATH, device_id=device) packages = adb.list_installed_packages(app_type) dict_packages = dict() for package in packages: dumpsys_out = adb.dumpsys(["package", package]) perms_list = adb.get_req_perms_dumpsys_package(dumpsys_out) app = App(adb, package, perms_list=perms_list) perm_desc, dangerous_perms, device_owner = app.check_app() dict_packages[package] = dict() dict_packages[package]["dangerous"] = dangerous_perms dict_packages[package]["isAdmin"] = app.is_app_device_owner() dict_packages[package]["all_perms"] = perm_desc dict_packages[package]["mal_confidence"] = app.malware_confidence dict_packages[package]["mal_score"] = app.score return dict_packages