Skip to content

Commit

Permalink
Merge pull request #1013 from Johann-PLW/main
Browse files Browse the repository at this point in the history
Rename does_table_exist to does_table_exist_in_db
  • Loading branch information
Johann-PLW authored Jan 9, 2025
2 parents 7e71deb + 141812f commit 2cd3b16
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions scripts/artifacts/FacebookMessenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from os.path import basename

from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, get_next_unused_name, open_sqlite_db_readonly, does_table_exist, does_view_exist
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, get_next_unused_name, open_sqlite_db_readonly, does_table_exist_in_db, does_view_exist

def get_FacebookMessenger(files_found, report_folder, seeker, wrap_text, timezone_offset):

Expand Down Expand Up @@ -104,7 +104,7 @@ def get_FacebookMessenger(files_found, report_folder, seeker, wrap_text, timezon
logfunc(f'No Facebook Messenger - Calls data available for {basename(file_found)}')

db = open_sqlite_db_readonly(file_found)
check = does_table_exist(file_found, 'contacts')
check = does_table_exist_in_db(file_found, 'contacts')
if check:
cursor = db.cursor()
cursor.execute('''
Expand Down Expand Up @@ -143,7 +143,7 @@ def get_FacebookMessenger(files_found, report_folder, seeker, wrap_text, timezon
logfunc(f'No Facebook Messenger - Contacts data available for {basename(file_found)}')

db = open_sqlite_db_readonly(file_found)
check = does_table_exist(file_found, 'contacts')
check = does_table_exist_in_db(file_found, 'contacts')
if check:
cursor = db.cursor()
cursor.execute('''
Expand Down Expand Up @@ -181,7 +181,7 @@ def get_FacebookMessenger(files_found, report_folder, seeker, wrap_text, timezon
logfunc(f'No Facebook Messenger - Secret Conversation data available for {basename(file_found)}')

db = open_sqlite_db_readonly(file_found)
check = does_table_exist(file_found, 'thread_participant_detail')
check = does_table_exist_in_db(file_found, 'thread_participant_detail')
if check:
cursor = db.cursor()
cursor.execute('''
Expand Down
4 changes: 2 additions & 2 deletions scripts/artifacts/FitnessWorkoutsLocationData.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from packaging import version
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, logdevinfo, tsv, timeline, is_platform_windows, open_sqlite_db_readonly, does_table_exist
from scripts.ilapfuncs import logfunc, logdevinfo, tsv, timeline, is_platform_windows, open_sqlite_db_readonly, does_table_exist_in_db

def get_Health(files_found, report_folder, seeker, wrap_text, timezone_offset):

Expand All @@ -29,7 +29,7 @@ def get_Health(files_found, report_folder, seeker, wrap_text, timezone_offset):

cursor = db.cursor()

if does_table_exist(healthdb_secure, 'location_series_data') == True:
if does_table_exist_in_db(healthdb_secure, 'location_series_data') == True:

# Fitness Workouts Location Data Analysis

Expand Down
4 changes: 2 additions & 2 deletions scripts/artifacts/calendarAll.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

from scripts.artifact_report import ArtifactHtmlReport
from urllib.parse import unquote
from scripts.ilapfuncs import open_sqlite_db_readonly, does_table_exist, does_column_exist_in_db,convert_ts_human_to_utc, convert_utc_human_to_timezone, artifact_processor, get_birthdate
from scripts.ilapfuncs import open_sqlite_db_readonly, does_table_exist_in_db, does_column_exist_in_db,convert_ts_human_to_utc, convert_utc_human_to_timezone, artifact_processor, get_birthdate


def get_sharees(cursor):
Expand Down Expand Up @@ -155,7 +155,7 @@ def calendarEvents(files_found, report_folder, seeker, wrap_text, timezone_offse

# Calendar Events

attachment_file_exists = does_table_exist(file_found, 'AttachmentFile')
attachment_file_exists = does_table_exist_in_db(file_found, 'AttachmentFile')

if attachment_file_exists:
attachments = '''
Expand Down
6 changes: 3 additions & 3 deletions scripts/artifacts/geodApplications.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import scripts.artifacts.artGlobals
from packaging import version
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, open_sqlite_db_readonly, does_table_exist
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, open_sqlite_db_readonly, does_table_exist_in_db


def get_geodApplications(files_found, report_folder, seeker, wrap_text, timezone_offset):
Expand All @@ -18,9 +18,9 @@ def get_geodApplications(files_found, report_folder, seeker, wrap_text, timezone
db = open_sqlite_db_readonly(file_found)
cursor = db.cursor()

if does_table_exist(file_found, 'mkcount'):
if does_table_exist_in_db(file_found, 'mkcount'):
query = "SELECT count_type, app_id, createtime FROM mkcount"
elif does_table_exist(file_found, 'dailycounts'):
elif does_table_exist_in_db(file_found, 'dailycounts'):
query = "SELECT count_type, app_id, createtime FROM dailycounts"

cursor.execute(query)
Expand Down
6 changes: 3 additions & 3 deletions scripts/artifacts/geodMapTiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import zlib

from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, open_sqlite_db_readonly, does_table_exist, artifact_processor
from scripts.ilapfuncs import logfunc, open_sqlite_db_readonly, does_table_exist_in_db, artifact_processor


def ReadVLOC(data):
Expand Down Expand Up @@ -106,15 +106,15 @@ def geodMapTiles(files_found, report_folder, seeker, wrap_text, timezone_offset)
cursor = db.cursor()
usesDataTable = True

if does_table_exist(file_found, 'tiles') and does_table_exist(file_found, 'data'):
if does_table_exist_in_db(file_found, 'tiles') and does_table_exist_in_db(file_found, 'data'):
logfunc('Parsing Geolocation from data table with tiles table.')
query = '''
SELECT datetime(access_times.timestamp, 'unixepoch') as timestamp, key_a, key_b, key_c, key_d, tileset, data, size, etag
FROM data
INNER JOIN tiles on data.ROWID = tiles.data_pk
INNER JOIN access_times on data.rowid = access_times.data_pk
'''
elif does_table_exist(file_found, 'data'):
elif does_table_exist_in_db(file_found, 'data'):
logfunc('Parsing Geolocation from data table.')
query = '''
SELECT datetime(access_times.timestamp, 'unixepoch') as timestamp, key_a, key_b, key_c, key_d, tileset, data, size, etag
Expand Down
4 changes: 2 additions & 2 deletions scripts/artifacts/geodPDPlaceCache.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import scripts.artifacts.artGlobals
from packaging import version
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, strings, open_sqlite_db_readonly, does_table_exist
from scripts.ilapfuncs import logfunc, tsv, timeline, is_platform_windows, strings, open_sqlite_db_readonly, does_table_exist_in_db


def get_geodPDPlaceCache(files_found, report_folder, seeker, wrap_text, timezone_offset):
Expand All @@ -16,7 +16,7 @@ def get_geodPDPlaceCache(files_found, report_folder, seeker, wrap_text, timezone
break

db = open_sqlite_db_readonly(file_found)
if does_table_exist(file_found, 'pdplacelookup'):
if does_table_exist_in_db(file_found, 'pdplacelookup'):
query = ("""
SELECT requestkey, pdplacelookup.pdplacehash, datetime('2001-01-01', "lastaccesstime" || ' seconds') as lastaccesstime, datetime('2001-01-01', "expiretime" || ' seconds') as expiretime, pdplace
FROM pdplacelookup
Expand Down
4 changes: 2 additions & 2 deletions scripts/artifacts/googleTranslate.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import os
from pathlib import Path
from scripts.filetype import audio_match
from scripts.ilapfuncs import artifact_processor, get_file_path, get_sqlite_db_records, does_table_exist, convert_unix_ts_to_utc
from scripts.ilapfuncs import artifact_processor, get_file_path, get_sqlite_db_records, does_table_exist_in_db, convert_unix_ts_to_utc

@artifact_processor
def googleTranslateHistory(files_found, report_folder, seeker, wrap_text, timezone_offset):
Expand Down Expand Up @@ -117,7 +117,7 @@ def googleTranslateTts(files_found, report_folder, seeker, wrap_text, timezone_o
data_list = []
data_list_html = []

if not does_table_exist(source_path, 'tts'):
if not does_table_exist_in_db(source_path, 'tts'):
return (), data_list, source_path

query = '''
Expand Down
4 changes: 2 additions & 2 deletions scripts/artifacts/voicemail.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from os.path import basename, dirname
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, timeline, open_sqlite_db_readonly, media_to_html, does_table_exist, convert_ts_human_to_utc, convert_utc_human_to_timezone
from scripts.ilapfuncs import logfunc, tsv, timeline, open_sqlite_db_readonly, media_to_html, does_table_exist_in_db, convert_ts_human_to_utc, convert_utc_human_to_timezone


def get_voicemail(files_found, report_folder, seeker, wrap_text, timezone_offset):
Expand All @@ -30,7 +30,7 @@ def get_voicemail(files_found, report_folder, seeker, wrap_text, timezone_offset
db = open_sqlite_db_readonly(voicemail_db)
cursor = db.cursor()

table_map_exists = does_table_exist(voicemail_db, 'map')
table_map_exists = does_table_exist_in_db(voicemail_db, 'map')

if table_map_exists:
db_query = '''
Expand Down
2 changes: 1 addition & 1 deletion scripts/ilapfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def does_column_exist_in_db(path, table_name, col_name):
pass
return False

def does_table_exist(path, table_name):
def does_table_exist_in_db(path, table_name):
'''Checks if a table with specified name exists in an sqlite db'''
db = open_sqlite_db_readonly(path)
if db:
Expand Down

0 comments on commit 2cd3b16

Please sign in to comment.