Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from pprint import pprint
|
|
| 3 |
|
| 4 |
import gradio as gr
|
| 5 |
import easy_db
|
|
|
|
| 6 |
|
| 7 |
def get_db_path():
|
| 8 |
return "device_data.db"
|
|
@@ -62,11 +63,31 @@ def process_request(id_textbox, installer_textbox,boot_state_textbox,verify_text
|
|
| 62 |
|
| 63 |
apps_and_permissions = app_permissions_textbox.split("&&")
|
| 64 |
permissions_dict = {}
|
|
|
|
| 65 |
for app_and_permissions in apps_and_permissions:
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
dict_of_device_data_to_save = {"id": id_textbox,
|
| 72 |
"installer": installer_textbox,
|
|
@@ -86,8 +107,7 @@ def process_request(id_textbox, installer_textbox,boot_state_textbox,verify_text
|
|
| 86 |
"adb_enabled": adb_enabled_textbox,
|
| 87 |
"lock_screen_timeout": lock_screen_timeout_textbox,
|
| 88 |
"lock_screen_type": lock_screen_type_textbox,
|
| 89 |
-
"notification_visibility": notification_visibility_textbox
|
| 90 |
-
"app_permissions_textbox":permissions_dict}
|
| 91 |
db = easy_db.DataBase('device_data.db')
|
| 92 |
|
| 93 |
|
|
|
|
| 3 |
|
| 4 |
import gradio as gr
|
| 5 |
import easy_db
|
| 6 |
+
from DroidDetective import DroidDetective
|
| 7 |
|
| 8 |
def get_db_path():
|
| 9 |
return "device_data.db"
|
|
|
|
| 63 |
|
| 64 |
apps_and_permissions = app_permissions_textbox.split("&&")
|
| 65 |
permissions_dict = {}
|
| 66 |
+
#
|
| 67 |
for app_and_permissions in apps_and_permissions:
|
| 68 |
+
try:
|
| 69 |
+
app, permissions = app_and_permissions.split("*******")
|
| 70 |
+
permissions = permissions.split(" ")
|
| 71 |
+
permissions_dict[app] = permissions
|
| 72 |
+
except ValueError as e:
|
| 73 |
+
print(e)
|
| 74 |
+
|
| 75 |
+
is_malware_list = []
|
| 76 |
+
for permission in permissions_dict:
|
| 77 |
+
detector = DroidDetective.APK_Analyser()
|
| 78 |
+
is_malware = detector.identify(permissions_dict[permission], "DroidDetective/apk_malware.model")[0]
|
| 79 |
+
|
| 80 |
+
if is_malware == 0:
|
| 81 |
+
is_malware = False
|
| 82 |
+
else:
|
| 83 |
+
is_malware = True
|
| 84 |
+
|
| 85 |
+
is_malware_list.append(is_malware)
|
| 86 |
+
|
| 87 |
+
if True in is_malware_list:
|
| 88 |
+
results.append(True)
|
| 89 |
+
else:
|
| 90 |
+
results.append(False)
|
| 91 |
|
| 92 |
dict_of_device_data_to_save = {"id": id_textbox,
|
| 93 |
"installer": installer_textbox,
|
|
|
|
| 107 |
"adb_enabled": adb_enabled_textbox,
|
| 108 |
"lock_screen_timeout": lock_screen_timeout_textbox,
|
| 109 |
"lock_screen_type": lock_screen_type_textbox,
|
| 110 |
+
"notification_visibility": notification_visibility_textbox}
|
|
|
|
| 111 |
db = easy_db.DataBase('device_data.db')
|
| 112 |
|
| 113 |
|