From 008bbc9df2656ea0f87c087d45c6b32109b2cff2 Mon Sep 17 00:00:00 2001
From: Roofiif Alria Dzakwan <113032478+roofiifalria@users.noreply.github.com>
Date: Tue, 9 Dec 2025 22:13:38 +0700
Subject: [PATCH 1/2] Enhance error handling in Google Maps GMM script
Added error handling for database query and improved code structure.
---
scripts/artifacts/googleMapsGmm.py | 72 ++++++++++++++++--------------
1 file changed, 39 insertions(+), 33 deletions(-)
diff --git a/scripts/artifacts/googleMapsGmm.py b/scripts/artifacts/googleMapsGmm.py
index 991cb3db..1f101376 100644
--- a/scripts/artifacts/googleMapsGmm.py
+++ b/scripts/artifacts/googleMapsGmm.py
@@ -85,44 +85,50 @@ def get_googleMapsGmm(files_found, report_folder, seeker, wrap_text):
db = open_sqlite_db_readonly(file_found)
file_found_myplaces = file_found
cursor = db.cursor()
- cursor.execute('''
- select
- rowid,
- key_string,
- round(latitude*.000001,6),
- round(longitude*.000001,6),
- sync_item,
- timestamp
- from sync_item
- ''')
- all_rows = cursor.fetchall()
+ # --- MULAI PERBAIKAN ---
+ try:
+ cursor.execute('''
+ select
+ rowid,
+ key_string,
+ round(latitude*.000001,6),
+ round(longitude*.000001,6),
+ sync_item,
+ timestamp
+ from sync_item
+ ''')
+ all_rows = cursor.fetchall()
- for row in all_rows:
- id = row[0]
- keystring = row[1]
- latitude = row[2]
- longitude = row[3]
- syncitem = row[4]
- timestamp = row[5]
- pb = blackboxprotobuf.decode_message(syncitem, 'None')
+ for row in all_rows:
+ id = row[0]
+ keystring = row[1]
+ latitude = row[2]
+ longitude = row[3]
+ syncitem = row[4]
+ timestamp = row[5]
+ pb = blackboxprotobuf.decode_message(syncitem, 'None')
- if keystring == "0:0":
- label = "Home"
- elif keystring == "1:0":
- label = "Work"
- else:
- label = pb[0].get('6', {}).get('7', b'').decode('utf-8')
+ if keystring == "0:0":
+ label = "Home"
+ elif keystring == "1:0":
+ label = "Work"
+ else:
+ label = pb[0].get('6', {}).get('7', b'').decode('utf-8')
- address = pb[0].get('6', {}).get('2', b'').decode('utf-8')
- url = pb[0].get('6', {}).get('6', b'').decode('utf-8')
- url = f'{url}'
- timestamp = datetime.fromtimestamp(timestamp/1000, tz=timezone.utc)
- timestamp = convert_utc_human_to_timezone(timestamp, 'UTC')
- data_list_myplaces.append((timestamp,label,latitude,longitude,address,url))
+ address = pb[0].get('6', {}).get('2', b'').decode('utf-8')
+ url = pb[0].get('6', {}).get('6', b'').decode('utf-8')
+ url = f'{url}'
+ timestamp = datetime.fromtimestamp(timestamp/1000, tz=timezone.utc)
+ timestamp = convert_utc_human_to_timezone(timestamp, 'UTC')
+ data_list_myplaces.append((timestamp,label,latitude,longitude,address,url))
+
+ except sqlite3.OperationalError:
+ logfunc(f"Table sync_item not found in {file_found}")
+ # --- AKHIR PERBAIKAN ---
+
db.close()
else:
continue
-
if data_list_storage:
report = ArtifactHtmlReport('Google Search History Maps')
report.start_artifact_report(report_folder, 'Google Search History Maps')
@@ -150,4 +156,4 @@ def get_googleMapsGmm(files_found, report_folder, seeker, wrap_text):
tlactivity = f'Google Maps Label Places'
timeline(report_folder, tlactivity, data_list_myplaces, data_headers)
else:
- logfunc('No Google Maps Label Places data available')
\ No newline at end of file
+ logfunc('No Google Maps Label Places data available')
From aa4ba37b89fc334334a4c1ff4b4c712bc30963ed Mon Sep 17 00:00:00 2001
From: Roofiif Alria Dzakwan <113032478+roofiifalria@users.noreply.github.com>
Date: Tue, 9 Dec 2025 22:14:01 +0700
Subject: [PATCH 2/2] Convert file modification time to UTC
Added UTC conversion for file modification time.
---
scripts/artifacts/offlinePages.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/artifacts/offlinePages.py b/scripts/artifacts/offlinePages.py
index 8e20c906..6667b085 100644
--- a/scripts/artifacts/offlinePages.py
+++ b/scripts/artifacts/offlinePages.py
@@ -24,7 +24,9 @@ def get_offlinePages(files_found, report_folder, seeker, wrap_text):
file_found = str(file_found)
modified_time = os.path.getmtime(file_found)
+
utc_modified_date = datetime.fromtimestamp(modified_time, tz=timezone.utc)
+ # -------------------------
timestamp = convert_utc_int_to_timezone(utc_modified_date, 'UTC')
@@ -59,4 +61,4 @@ def get_offlinePages(files_found, report_folder, seeker, wrap_text):
('*/*.mhtml', '*/*.mht'),
get_offlinePages)
}
-
\ No newline at end of file
+