-
Notifications
You must be signed in to change notification settings - Fork 172
/
Copy pathbiomeSync.py
78 lines (66 loc) · 2.33 KB
/
biomeSync.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
__artifacts_v2__ = {
"get_biomeSync": {
"name": "Biome Sync - Devices",
"description": "Parses Biome Device Sync records",
"author": "@JohnHyla",
"version": "0.0.2",
"date": "2024-10-17",
"requirements": "none",
"category": "Biome Sync",
"notes": "",
"paths": ('**/Biome/sync/sync.db*'),
"output_types": "standard"
}
}
from scripts.builds_ids import OS_build
from scripts.ilapfuncs import open_sqlite_db_readonly, convert_ts_human_to_utc
from scripts.ilapfuncs import artifact_processor, convert_utc_human_to_timezone
@artifact_processor
def get_biomeSync(files_found, report_folder, seeker, wrap_text, timezone_offset):
data_list = []
report_file = 'Unknown'
for file_found in files_found:
file_found = str(file_found)
if not file_found.endswith('.db'):
continue # Skip all other files
report_file = file_found
db = open_sqlite_db_readonly(file_found)
cursor = db.cursor()
cursor.execute('''
select
datetime(last_sync_date,'unixepoch'),
device_identifier,
name,
case platform
when 1 then 'iPad'
when 2 then 'iPhone'
when 4 then 'macOS'
when 6 then 'watchOS'
else 'Unknown'
end,
model,
case me
when 0 then ''
when 1 then 'Yes'
end as 'Local Device'
from DevicePeer
''')
all_rows = cursor.fetchall()
for row in all_rows:
if row[0] == ' ':
timestamp = ''
elif row[0] is None:
timestamp = row[0]
else:
timestamp = row[0]
timestamp = convert_ts_human_to_utc(timestamp)
timestamp = convert_utc_human_to_timezone(timestamp, timezone_offset)
os_build = 'Unknown'
for key, value in OS_build.items():
if str(row[4]) == key:
os_build = value
break
data_list.append((timestamp, row[1], row[2], row[3], row[4], os_build, row[5]))
db.close()
data_headers = (('Last Sync Timestamp', 'datetime'), 'Device ID', 'Name', 'Device Type', 'OS Build', 'OS Version', 'Local Device')
return data_headers, data_list, report_file