-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathaccounts_ce.py
executable file
·67 lines (58 loc) · 1.99 KB
/
accounts_ce.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
import glob
import json
import os
import shutil
import sqlite3
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, is_platform_windows, open_sqlite_db_readonly
def get_accounts_ce(files_found, report_folder, seeker, wrap_text, time_offset):
slash = '\\' if is_platform_windows() else '/'
# Filter for path xxx/yyy/system_ce/0
for file_found in files_found:
file_found = str(file_found)
parts = file_found.split(slash)
uid = parts[-2]
try:
uid_int = int(uid)
# Skip sbin/.magisk/mirror/data/system_de/0 , it should be duplicate data??
if file_found.find('{0}mirror{0}'.format(slash)) >= 0:
continue
process_accounts_ce(file_found, uid, report_folder)
except ValueError:
pass # uid was not a number
def process_accounts_ce(folder, uid, report_folder):
#Query to create report
db = open_sqlite_db_readonly(folder)
cursor = db.cursor()
#Query to create report
cursor.execute('''
SELECT
name,
type,
password
FROM
accounts
''')
all_rows = cursor.fetchall()
usageentries = len(all_rows)
if usageentries > 0:
report = ArtifactHtmlReport('Accounts_ce')
report.start_artifact_report(report_folder, f'accounts_ce_{uid}')
report.add_script()
data_headers = ('Name', 'Type', 'Password')
data_list = []
for row in all_rows:
data_list.append((row[0], row[1], row[2]))
report.write_artifact_data_table(data_headers, data_list, folder)
report.end_artifact_report()
tsvname = f'accounts ce {uid}'
tsv(report_folder, data_headers, data_list, tsvname)
else:
logfunc(f'No accounts_ce_{uid} data available')
db.close()
__artifacts__ = {
"Accounts_ce": (
"Accounts_ce",
('*/system_ce/*/accounts_ce.db'),
get_accounts_ce)
}