Skip to content

Commit 66d3f0a

Browse files
authored
Merge pull request abrignoni#954 from Johann-PLW/main
Update accountData.py using new get_sqlite_db_records function
2 parents 997d0a4 + 62461fb commit 66d3f0a

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

scripts/artifacts/accountData.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,41 @@
99
"category": "Accounts",
1010
"notes": "",
1111
"paths": ('*/mobile/Library/Accounts/Accounts3.sqlite*',),
12-
"output_types": "standard"
12+
"output_types": "standard",
13+
"artifact_icon": "user"
1314
}
1415
}
1516

1617

17-
from scripts.ilapfuncs import artifact_processor, open_sqlite_db_readonly, convert_ts_human_to_timezone_offset
18+
from scripts.ilapfuncs import artifact_processor, get_sqlite_db_records, convert_cocoa_core_data_ts_to_utc
1819

1920
@artifact_processor
2021
def accountData(files_found, report_folder, seeker, wrap_text, timezone_offset):
2122
data_list = []
2223
db_file = ''
24+
db_records = []
25+
26+
query = '''
27+
SELECT
28+
zdate,
29+
zaccounttypedescription,
30+
zusername,
31+
zaccountdescription,
32+
zaccount.zidentifier,
33+
zaccount.zowningbundleid
34+
FROM zaccount, zaccounttype
35+
WHERE zaccounttype.z_pk=zaccount.zaccounttype
36+
'''
2337

2438
for file_found in files_found:
2539
if file_found.endswith('Accounts3.sqlite'):
2640
db_file = file_found
41+
db_records = get_sqlite_db_records(db_file, query)
2742
break
2843

29-
with open_sqlite_db_readonly(db_file) as db:
30-
cursor = db.cursor()
31-
cursor.execute('''
32-
SELECT
33-
datetime(zdate+978307200,'unixepoch'),
34-
zaccounttypedescription,
35-
zusername,
36-
zaccountdescription,
37-
zaccount.zidentifier,
38-
zaccount.zowningbundleid
39-
FROM zaccount, zaccounttype
40-
WHERE zaccounttype.z_pk=zaccount.zaccounttype
41-
''')
42-
43-
all_rows = cursor.fetchall()
44-
45-
for row in all_rows:
46-
timestamp = convert_ts_human_to_timezone_offset(row[0], timezone_offset)
47-
data_list.append((timestamp,row[1],row[2],row[3],row[4],row[5]))
44+
for record in db_records:
45+
timestamp = convert_cocoa_core_data_ts_to_utc(record[0])
46+
data_list.append((timestamp, record[1], record[2], record[3], record[4], record[5]))
4847

4948
data_headers = (
5049
('Timestamp', 'datetime'),

0 commit comments

Comments
 (0)