-
-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathutils.py
40 lines (35 loc) · 978 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
import subprocess
import settings
def adb_connection_int(apps):
'''
Starts ADB server
Connect to Device
Kills All Apps
'''
adb = settings.ADB_BINARY
dev_id = settings.DEVICE_ID
subprocess.call([adb, "kill-server"])
subprocess.call([adb, "start-server"])
subprocess.call([adb, "-s", dev_id, "wait-for-device"])
try:
for app in apps:
subprocess.call([adb, "shell", "am", "force-stop", app])
except:
pass
def adb_kill():
"""
Kill ADB Server
"""
adb = settings.ADB_BINARY
subprocess.call([adb, "kill-server"])
def make_dirs():
"""
Make needed directories
"""
valid_crash_dir = os.path.join(os.path.dirname(__file__), "crash")
fuzz_out_dir = os.path.join(os.path.dirname(__file__), "fuzz_files")
if not os.path.exists(fuzz_out_dir):
os.makedirs(fuzz_out_dir)
if not os.path.exists(valid_crash_dir):
os.makedirs(valid_crash_dir)