-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathSQLiteWalker.py
More file actions
1126 lines (934 loc) · 52.6 KB
/
Copy pathSQLiteWalker.py
File metadata and controls
1126 lines (934 loc) · 52.6 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import argparse
import base64
import csv
import os
import platform as _platform_mod
import re
import shutil
import sqlite3
import subprocess
import sys
import tarfile
import tempfile
import threading
import time
import tkinter as tk
from tkinter import ttk, filedialog, messagebox
import traceback
import webbrowser
import zipfile
VERSION = "1.0.0"
ASCII_BANNER = (
" SQLiteWalker v" + VERSION + "\n"
" https://github.com/stark4n6/SQLiteWalker\n"
" @KevinPagano3 | @stark4n6\n"
)
# ---------------------------------------------------------------------------
# Platform
# ---------------------------------------------------------------------------
_SYS = _platform_mod.system() # "Windows", "Darwin", or "Linux"
def _is_windows(): return _SYS == "Windows"
def _is_mac(): return _SYS == "Darwin"
def _is_linux(): return _SYS == "Linux"
# Font families per OS
if _is_windows():
_SANS, _MONO = "DejaVu Sans", "DejaVu Sans Mono"
elif _is_mac():
_SANS, _MONO = "SF Pro Text", "Menlo" # SF Pro falls back to Helvetica Neue
else:
_SANS, _MONO = "DejaVu Sans", "DejaVu Sans Mono"
MONO = (_MONO, 9)
SANS_SM = (_SANS, 9)
SANS_MD = (_SANS, 10)
HEADER = (_MONO, 14, "bold")
# ---------------------------------------------------------------------------
# Palette
# ---------------------------------------------------------------------------
BG = "#1a1d23"
BG_PANEL = "#21252e"
BG_INPUT = "#030303"
ACCENT = "#00d4aa"
ACCENT_DIM = "#007a63"
FG = "#d0d6e0"
FG_DIM = "#6b7280"
RED = "#f87171"
YELLOW = "#fbbf24"
# ---------------------------------------------------------------------------
# Embedded icon - 32x32 "SW" PNG + ICO, no external files needed
# ---------------------------------------------------------------------------
_ICON_PNG_B64 = (
"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAdlSURBVFhHnZf7U1TnGcd3Yc/9PWdv7IIoKgaqSSvqtE51RKdJ2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35wr/iasL/y87C/8AAAL/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAv81QQv/jbAO/7bmCv+Fqg3/LTkK/wAAA/8AAAH/GiEJ/3CNDv+z4gv/nscL/0lbDP8DBAT/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8FBgX/TmEM/6HLCv+u3gj/dJMM/2mGDP+k0Av/r9sL/2N7Df8RFQf/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/FhoI/2iCDP+hygr/ptAL/3mYDP8lLgr/AAAB/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAB/wkLBv8NDwb/AAAC/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
)
def resource_path(relative_path):
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
def _set_window_icon(root):
try:
if _is_windows():
tmp = tempfile.NamedTemporaryFile(suffix=".ico", delete=False)
tmp.write(base64.b64decode(_ICON_ICO_B64))
tmp.close()
root.iconbitmap(tmp.name)
os.unlink(tmp.name)
else:
img = tk.PhotoImage(data=_ICON_PNG_B64)
root.iconphoto(True, img)
root._icon_ref = img
except Exception:
pass
def _open_folder(path):
try:
if _is_windows():
os.startfile(path)
elif _is_mac():
subprocess.Popen(["open", path])
else:
subprocess.Popen(["xdg-open", path])
except Exception:
pass
# ---------------------------------------------------------------------------
# SQLite helpers
# ---------------------------------------------------------------------------
def open_sqlite_db_readonly(path):
if _is_windows():
if path.startswith("\\\\?\\UNC\\"):
path = "%5C%5C%3F%5C" + path[4:]
elif path.startswith("\\\\?\\"):
path = "%5C%5C%3F%5C" + path[4:]
elif path.startswith("\\\\"):
path = "%5C%5C%3F%5C\\UNC" + path[1:]
else:
path = "%5C%5C%3F%5C" + path
return sqlite3.connect(f"file:{path}?mode=ro", uri=True)
WINDOWS_RESERVED_NAMES = {
"CON", "PRN", "AUX", "NUL",
"COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",
"LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9",
}
def sanitize_archive_member_name(member_name):
member_name = member_name.replace("\\", "/")
if member_name.startswith("/") or re.match(r"^[A-Za-z]:", member_name):
raise RuntimeError(
f"Unsafe absolute archive path blocked: {member_name}"
)
safe_parts = []
for part in member_name.split("/"):
if part in ("", ".", ".."):
raise RuntimeError(
f"Unsafe archive path component blocked: {member_name}"
)
safe_part = re.sub(r'[<>:"/\\|?*\x00-\x1f]', "_", part)
safe_part = safe_part.rstrip(" .")
if not safe_part:
safe_part = "_"
stem = safe_part.split(".", 1)[0].upper()
if stem in WINDOWS_RESERVED_NAMES:
safe_part = f"_{safe_part}"
safe_parts.append(safe_part)
return os.path.join(*safe_parts)
def unique_dest_path(dest_path):
if not os.path.exists(dest_path):
return dest_path
folder, filename = os.path.split(dest_path)
stem, ext = os.path.splitext(filename)
for suffix_num in range(1, 1000):
candidate = os.path.join(folder, f"{stem}-{suffix_num:03d}{ext}")
if not os.path.exists(candidate):
return candidate
raise RuntimeError(
f"Could not create a unique output path for {filename}"
)
def safe_archive_dest_path(member_name, destination):
dest_root = os.path.abspath(destination)
safe_member_name = sanitize_archive_member_name(member_name)
dest_path = os.path.abspath(os.path.join(dest_root, safe_member_name))
try:
common_path = os.path.commonpath([dest_root, dest_path])
except ValueError:
common_path = ""
if common_path != dest_root:
raise RuntimeError(
f"Unsafe archive path blocked: {member_name}"
)
return unique_dest_path(dest_path)
def safe_tar_write_file(member, source, destination, initial_data=b""):
if member.islnk() or member.issym():
raise RuntimeError(
f"Unsafe TAR link blocked: {member.name}"
)
dest_path = safe_archive_dest_path(member.name, destination)
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
with open(dest_path, "wb") as out:
if initial_data:
out.write(initial_data)
shutil.copyfileobj(source, out)
# Preserve metadata modification timestamp from TAR header
try:
if hasattr(member, "mtime") and member.mtime:
os.utime(dest_path, (member.mtime, member.mtime))
except Exception:
pass
return dest_path
def safe_zip_extract(zip_archive, member, destination):
dest_path = safe_archive_dest_path(member.filename, destination)
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
with zip_archive.open(member) as source, open(dest_path, "wb") as out:
shutil.copyfileobj(source, out)
# Preserve metadata modification timestamp from ZIP header
try:
zip_time = time.mktime(member.date_time + (0, 0, -1))
os.utime(dest_path, (zip_time, zip_time))
except Exception:
pass
return dest_path
def create_output_folder(output_path, base, splitter):
output_ts = time.strftime("%Y%m%d-%H%M%S")
for suffix_num in range(1000):
suffix = "" if suffix_num == 0 else f"-{suffix_num:03d}"
out_folder = output_path + base + output_ts + suffix
try:
os.makedirs(out_folder + splitter + "db_out")
return out_folder
except FileExistsError:
continue
raise RuntimeError(
f"Could not create a unique output folder for {base}{output_ts}"
)
# ---------------------------------------------------------------------------
# Core scan - runs entirely in a worker thread, never touches tkinter directly
# ---------------------------------------------------------------------------
def run_scan(input_path, output_path, src_type_choice, quiet_mode, log_cb, progress_cb, live_count_cb, done_cb):
base = "SQLiteWalker_Out_"
data_list = []
error_list = []
data_headers = ("File Name", "File Type", "Export Path", "Tables")
error_headers = ("File Name", "Export Path", "Error")
count = error_count = wal_count = shm_count = 0
splitter = "\\" if _is_windows() else "/"
start_time = time.time()
# Prefix Windows paths to handle >260-char paths
if _is_windows():
if len(input_path) > 1 and input_path[1] == ":":
input_path = "\\\\?\\" + input_path.replace("/", "\\")
if len(output_path) > 1 and output_path[1] == ":":
output_path = "\\\\?\\" + output_path.replace("/", "\\")
if not output_path.endswith("\\"):
output_path += "\\"
out_folder = create_output_folder(output_path, base, splitter)
# Get the normalized absolute output folder name to trim matches relative to it
clean_out_root = os.path.abspath(out_folder)
if _is_windows() and clean_out_root.startswith("\\\\?\\"):
clean_out_root = clean_out_root[4:]
if src_type_choice == "archive":
_, basename = os.path.split(input_path)
basename_lower = basename.lower()
if basename_lower.endswith(".zip"):
archive_type = "zip"
elif basename_lower.endswith((".tar", ".tar.gz", ".tgz")):
archive_type = "tar"
else:
log_cb("Input file is not a supported archive (.zip / .tar / .tar.gz / .tgz). Aborting.\n", "error")
done_cb(0, 0, 0, 0, 0, out_folder)
return
log_cb(f"Opening {archive_type.upper()}: {input_path}\n", "info")
if archive_type == "zip":
archive = zipfile.ZipFile(input_path, "r")
files = archive.infolist()
total = len(files)
else:
log_cb("Pre-counting items inside TAR file to synchronize progress bar...\n", "info")
total = 0
with tarfile.open(input_path, "r|*") as count_archive:
for _ in count_archive:
total += 1
archive = tarfile.open(input_path, "r|*")
files = archive
for idx, entry in enumerate(files, 1):
progress_cb(idx, total)
file = entry.filename if archive_type == "zip" else entry.name
file_name = file.rsplit("/", 1)
if file.endswith(("-shm", "-wal")):
try:
if archive_type == "zip":
if entry.is_dir():
continue
new_path = safe_zip_extract(archive, entry, out_folder + splitter + "db_out")
else:
if not entry.isfile():
continue
f = archive.extractfile(entry)
if f is None:
continue
with f:
new_path = safe_tar_write_file(entry, f, out_folder + splitter + "db_out")
except RuntimeError as e:
log_cb(f" BLOCKED ARCHIVE ENTRY: {e}\n", "error")
continue
if file.startswith("/"):
file = file[1:]
if _is_windows():
new_path = new_path.replace("/", "\\")
dest = new_path[4:] if _is_windows() else new_path
trimmed_dest = os.path.relpath(dest, os.path.dirname(clean_out_root))
if file.endswith("-shm"):
shm_count += 1
live_count_cb("shm", shm_count)
log_cb(f" SHM {shm_count}: {file}\n", "shm")
f_type = "-SHM"
else:
wal_count += 1
live_count_cb("wal", wal_count)
log_cb(f" WAL {wal_count}: {file}\n", "wal")
f_type = "-WAL"
data_list.append((file_name[-1], f_type, trimmed_dest, ""))
else:
db = None
new_path = None
if archive_type == "zip":
if entry.is_dir():
continue
with archive.open(entry) as f:
header = f.read(100)
if not header.startswith(b"\x53\x51\x4c\x69\x74\x65\x20\x66\x6f\x72\x6d\x61\x74\x20\x33\x00"):
continue
try:
new_path = safe_zip_extract(archive, entry, out_folder + splitter + "db_out")
except RuntimeError as e:
log_cb(f" BLOCKED ZIP ENTRY: {e}\n", "error")
continue
else:
if not entry.isfile():
continue
f = archive.extractfile(entry)
if f is None:
continue
with f:
header = f.read(100)
if not header.startswith(b"\x53\x51\x4c\x69\x74\x65\x20\x66\x6f\x72\x6d\x61\x74\x20\x33\x00"):
continue
try:
new_path = safe_tar_write_file(entry, f, out_folder + splitter + "db_out", header)
except RuntimeError as e:
log_cb(f" BLOCKED TAR ENTRY: {e}\n", "error")
continue
try:
if file.startswith("/"):
file = file[1:]
if _is_windows():
new_path = new_path.replace("/", "\\")
db = open_sqlite_db_readonly(new_path)
cursor = db.cursor()
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables_list = [r[0] for r in cursor.fetchall()]
dest = new_path[4:] if _is_windows() else new_path
trimmed_dest = os.path.relpath(dest, os.path.dirname(clean_out_root))
count += 1
live_count_cb("db", count)
data_list.append((file_name[-1], "DB", trimmed_dest, tables_list))
log_cb(f" DB {count}: {file} [{len(tables_list)} tables]\n", "db")
except sqlite3.Error as e:
dest = new_path[4:] if _is_windows() else new_path
trimmed_dest = os.path.relpath(dest, os.path.dirname(clean_out_root))
error_count += 1
live_count_cb("err", error_count)
log_cb(f" ERROR: {file} - {e}\n", "error")
error_list.append((file_name[-1], trimmed_dest, e))
finally:
try: db.close()
except Exception: pass
archive.close()
elif src_type_choice == "folder":
log_cb(f"Walking folder: {input_path}\n", "info")
all_files = [(r, fn) for r, _, fns in os.walk(input_path) for fn in fns]
total = max(len(all_files), 1)
for idx, (root, file) in enumerate(all_files, 1):
progress_cb(idx, total)
src = os.path.join(root, file)
if file.endswith(("-shm", "-wal")):
rel_path = os.path.relpath(root, input_path)
if rel_path == ".":
dest_dir = out_folder
else:
dest_dir = os.path.join(out_folder, rel_path)
dest_file = os.path.join(dest_dir, file)
os.makedirs(dest_dir, exist_ok=True)
shutil.copy2(src, dest_file)
clean_dest = dest_file[4:] if _is_windows() and dest_file.startswith("\\\\?\\") else dest_file
trimmed_dest = os.path.relpath(clean_dest, os.path.dirname(clean_out_root))
if file.endswith("-shm"):
shm_count += 1
live_count_cb("shm", shm_count)
log_cb(f" SHM {shm_count}: {file}\n", "shm")
f_type = "-SHM"
else:
wal_count += 1
live_count_cb("wal", wal_count)
log_cb(f" WAL {wal_count}: {file}\n", "wal")
f_type = "-WAL"
data_list.append((file, f_type, trimmed_dest, ""))
continue
if not os.path.isfile(src) or os.path.getsize(src) <= 100:
continue
try:
with open(src, "r", encoding="ISO-8859-1") as f:
hdr = f.read(100)
except Exception:
continue
if not hdr.startswith("SQLite format 3"):
continue
db = None
try:
db = open_sqlite_db_readonly(src)
cursor = db.cursor()
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables_list = [r[0] for r in cursor.fetchall()]
rel_path = os.path.relpath(root, input_path)
if rel_path == ".":
dest_dir = out_folder
else:
dest_dir = os.path.join(out_folder, rel_path)
dest_file = os.path.join(dest_dir, file)
os.makedirs(dest_dir, exist_ok=True)
shutil.copy2(src, dest_file)
clean_dest = dest_file[4:] if _is_windows() and dest_file.startswith("\\\\?\\") else dest_file
trimmed_dest = os.path.relpath(clean_dest, os.path.dirname(clean_out_root))
count += 1
live_count_cb("db", count)
data_list.append((file, "DB", trimmed_dest, tables_list))
log_cb(f" DB {count}: {file} [{len(tables_list)} tables]\n", "db")
except sqlite3.Error as e:
clean_src = src[4:] if _is_windows() and src.startswith("\\\\?\\") else src
trimmed_src = os.path.relpath(clean_src, os.path.dirname(clean_out_root))
error_count += 1
live_count_cb("err", error_count)
log_cb(f" ERROR: {file} - {e}\n", "error")
error_list.append((file, trimmed_src, e))
finally:
try:
if db: db.close()
except Exception: pass
# Write results TSV
tsv_path = out_folder + splitter + "db_list.tsv"
with open(tsv_path, "w", newline="") as f_out:
w = csv.writer(f_out, delimiter="\t")
w.writerow(data_headers)
for row in data_list:
w.writerow(row)
if error_count > 0:
err_path = out_folder + splitter + "error_list.tsv"
with open(err_path, "w", newline="") as f_out:
w = csv.writer(f_out, delimiter="\t")
w.writerow(error_headers)
for row in error_list:
w.writerow(row)
# Write Results to SQLite Database with Indexes on all columns
sqlite_out_path = out_folder + splitter + "db_list.db"
try:
out_db = sqlite3.connect(sqlite_out_path)
out_curr = out_db.cursor()
out_curr.execute("""
CREATE TABLE IF NOT EXISTS db_list (
file_name TEXT,
file_type TEXT,
export_path TEXT,
tables TEXT
);
""")
for row in data_list:
tbls_str = ", ".join(row[3]) if isinstance(row[3], list) else str(row[3])
out_curr.execute("INSERT INTO db_list VALUES (?, ?, ?, ?);", (row[0], row[1], row[2], tbls_str))
out_curr.execute("CREATE INDEX IF NOT EXISTS idx_filename ON db_list(file_name);")
out_curr.execute("CREATE INDEX IF NOT EXISTS idx_filetype ON db_list(file_type);")
out_curr.execute("CREATE INDEX IF NOT EXISTS idx_exportpath ON db_list(export_path);")
out_curr.execute("CREATE INDEX IF NOT EXISTS idx_tables ON db_list(tables);")
if error_count > 0:
out_curr.execute("""
CREATE TABLE IF NOT EXISTS error_list (
file_name TEXT,
export_path TEXT,
error TEXT
);
""")
for row in error_list:
out_curr.execute("INSERT INTO error_list VALUES (?, ?, ?);", (row[0], row[1], str(row[2])))
out_curr.execute("CREATE INDEX IF NOT EXISTS idx_err_filename ON error_list(file_name);")
out_curr.execute("CREATE INDEX IF NOT EXISTS idx_err_exportpath ON error_list(export_path);")
out_curr.execute("CREATE INDEX IF NOT EXISTS idx_err_error ON error_list(error);")
out_db.commit()
out_db.close()
except Exception as dbe:
log_cb(f" DATABASE WRITE ERROR: Failed compiling db_list.db - {dbe}\n", "error")
elapsed = round(time.time() - start_time, 2)
done_cb(count, shm_count, wal_count, error_count, elapsed, out_folder)
# ---------------------------------------------------------------------------
# GUI App Class
# ---------------------------------------------------------------------------
class SQLiteWalkerApp(tk.Tk):
def __init__(self):
super().__init__()
self.title(f"SQLiteWalker v{VERSION}")
self.configure(bg=BG)
self.minsize(780, 580)
self.resizable(True, True)
_set_window_icon(self)
self._scanning = False
self._last_output = None
self._build_ui()
self._log(ASCII_BANNER, "banner")
self._log(f" Platform : {_SYS}\n", "info")
self._log(f" Python : {sys.version.split()[0]}\n\n", "info")
# ------------------------------------------------------------------
# Layout
# ------------------------------------------------------------------
def _build_ui(self):
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=0) # Topbar frame row
self.rowconfigure(1, weight=1) # Main Body frame row
self.rowconfigure(2, weight=0) # Statusbar frame row
self._build_topbar()
self._build_body()
self._build_statusbar()
def _build_topbar(self):
# Frame container configured to grid title text components and the right-aligned halved logo
bar = tk.Frame(self, bg=BG_PANEL, pady=10, padx=18)
bar.grid(row=0, column=0, sticky="ew")
bar.columnconfigure(1, weight=1)
# Left Column Stack for Application Labels & Repositioned About Button
title_frame = tk.Frame(bar, bg=BG_PANEL)
title_frame.grid(row=0, column=0, sticky="nw")
tk.Label(title_frame, text="SQLiteWalker", font=HEADER,
bg=BG_PANEL, fg=ACCENT).grid(row=0, column=0, sticky="w")
tk.Label(title_frame, text=f"v{VERSION} ",
font=SANS_SM, bg=BG_PANEL, fg=FG_DIM).grid(row=0, column=1, sticky="w", padx=(6, 0))
# Repositioned About Button beneath Title string metadata stack
tk.Button(title_frame, text="About", font=SANS_SM,
bg=BG_PANEL, fg=ACCENT, activebackground=BG_PANEL, activeforeground=ACCENT_DIM,
relief="flat", bd=0, cursor="hand2", anchor="w",
command=self._show_about).grid(row=1, column=0, columnspan=2, sticky="w", pady=(4, 0))
# Right Column Layout checking for external asset availability
#script_dir = os.path.dirname(os.path.abspath(__file__)) if "__file__" in locals() else os.getcwd()
#logo_path = os.path.join(script_dir, "logo.png")
#if os.path.exists(logo_path):
try:
# Load external photo reference and divide layout dimensions strictly by 3
full_img = tk.PhotoImage(file=resource_path("logo.png"))
self._main_logo_img = full_img.subsample(3, 3)
logo_label = tk.Label(bar, image=self._main_logo_img, bg=BG_PANEL, cursor="hand2")
logo_label.grid(row=0, column=2, sticky="e")
# Double feature: clicking logo opens script repository hub
logo_label.bind("<Button-1>", lambda e: webbrowser.open_new_tab("https://github.com/stark4n6/SQLiteWalker"))
except Exception:
pass
def _build_body(self):
body = tk.Frame(self, bg=BG)
body.grid(row=1, column=0, sticky="nsew", padx=18, pady=(12, 0))
body.columnconfigure(0, weight=1)
body.rowconfigure(4, weight=1)
src_row = tk.Frame(body, bg=BG)
src_row.grid(row=0, column=0, sticky="w", pady=(0, 4))
tk.Label(src_row, text="Source type", font=SANS_MD,
bg=BG, fg=FG, width=12, anchor="w").pack(side="left")
self.src_type = tk.StringVar(value="folder")
for val, lbl in [
("folder", "Folder"),
("archive", "Archive (.zip / .tar / .tar.gz / .tgz)"),
]:
tk.Radiobutton(src_row, text=lbl,
variable=self.src_type,
value=val,
font=SANS_SM,
bg=BG,
fg=FG,
selectcolor=BG_INPUT,
activebackground=BG,
activeforeground=ACCENT,
relief="flat",
bd=0,
command=self._on_src_type_change).pack(
side="left", padx=(0, 14))
self._build_path_row(body, 1, "Source", "input_path", self._browse_source, "Path to scan")
self._build_path_row(body, 2, "Output Folder", "output_path", self._browse_output, "Folder where results will be saved")
opts = tk.Frame(body, bg=BG)
opts.grid(row=3, column=0, sticky="ew", pady=(4, 10))
self.quiet_var = tk.BooleanVar(value=True)
self.open_btn = tk.Button(opts, text="Open Output",
font=SANS_SM, bg=BG_PANEL, fg=FG_DIM,
activebackground=ACCENT_DIM, activeforeground=BG,
relief="flat", bd=0, padx=12, pady=5,
cursor="hand2", state="disabled",
command=self._open_last_output)
self.open_btn.pack(side="right", padx=(6, 0))
self.scan_btn = tk.Button(opts, text="Run Scan",
font=(_SANS, 10, "bold"),
bg=ACCENT, fg=BG,
activebackground=ACCENT_DIM, activeforeground=BG,
disabledforeground=BG,
relief="flat", bd=0, padx=18, pady=5,
cursor="hand2", command=self._start_scan)
self.scan_btn.pack(side="right")
self._build_log_panel(body)
def _build_log_panel(self, parent):
frame = tk.Frame(parent, bg=BG_PANEL)
frame.grid(row=4, column=0, sticky="nsew")
frame.rowconfigure(1, weight=1)
frame.columnconfigure(0, weight=1)
hdr = tk.Frame(frame, bg=BG_PANEL, padx=10, pady=6)
hdr.grid(row=0, column=0, sticky="ew")
tk.Label(hdr, text="Log", font=SANS_SM, bg=BG_PANEL, fg=FG_DIM).pack(side="left")
tk.Button(hdr, text="Clear", font=SANS_SM,
bg=BG_PANEL, fg=FG_DIM, relief="flat", bd=0,
activebackground=BG_PANEL, activeforeground=ACCENT,
cursor="hand2", command=self._clear_log).pack(side="right")
txt_frame = tk.Frame(frame, bg=BG_PANEL)
txt_frame.grid(row=1, column=0, sticky="nsew", padx=(10, 0), pady=(0, 4))
txt_frame.rowconfigure(0, weight=1)
txt_frame.columnconfigure(0, weight=1)
self.log_text = tk.Text(txt_frame, bg=BG_INPUT, fg=FG, font=MONO,
wrap="none", relief="flat", bd=0,
insertbackground=ACCENT, state="disabled", spacing1=1)
self.log_text.grid(row=0, column=0, sticky="nsew")
sb_y = ttk.Scrollbar(txt_frame, orient="vertical", command=self.log_text.yview)
sb_x = ttk.Scrollbar(txt_frame, orient="horizontal", command=self.log_text.xview)
sb_y.grid(row=0, column=1, sticky="ns")
sb_x.grid(row=1, column=0, sticky="ew")
self.log_text.configure(yscrollcommand=sb_y.set, xscrollcommand=sb_x.set)
self.log_text.tag_config("banner", foreground=ACCENT)
self.log_text.tag_config("info", foreground=FG_DIM)
self.log_text.tag_config("db", foreground=ACCENT)
self.log_text.tag_config("shm", foreground=YELLOW)
self.log_text.tag_config("wal", foreground=YELLOW)
self.log_text.tag_config("error", foreground=RED)
self.log_text.tag_config("done", foreground=ACCENT)
self.log_text.tag_config("normal", foreground=FG)
prog_frame = tk.Frame(frame, bg=BG_PANEL)
prog_frame.grid(row=2, column=0, sticky="ew", padx=10, pady=(0, 6))
prog_frame.columnconfigure(0, weight=1)
style = ttk.Style(self)
style.theme_use("default")
style.configure("Scan.Horizontal.TProgressbar",
troughcolor=BG_INPUT, background=ACCENT,
darkcolor=ACCENT, lightcolor=ACCENT,
bordercolor=BG_INPUT, troughrelief="flat", relief="flat")
style.configure("Vertical.TScrollbar",
troughcolor=BG_INPUT, background=BG_PANEL,
arrowcolor=FG_DIM, bordercolor=BG_INPUT)
style.configure("Horizontal.TScrollbar",
troughcolor=BG_INPUT, background=BG_PANEL,
arrowcolor=FG_DIM, bordercolor=BG_INPUT)
self.progress = ttk.Progressbar(prog_frame, style="Scan.Horizontal.TProgressbar",
orient="horizontal", length=400, mode="determinate")
self.progress.grid(row=0, column=0, sticky="ew")
self.prog_label = tk.Label(prog_frame, text="", font=SANS_SM,
bg=BG_PANEL, fg=FG_DIM, width=14, anchor="e")
self.prog_label.grid(row=0, column=1, padx=(8, 0))
def _build_statusbar(self):
bar = tk.Frame(self, bg=BG_PANEL, padx=18, pady=6)
bar.grid(row=2, column=0, sticky="ew")
bar.columnconfigure(1, weight=1)
self.status_var = tk.StringVar(value="Ready")
tk.Label(bar, textvariable=self.status_var,
font=SANS_SM, bg=BG_PANEL, fg=FG_DIM, anchor="w").grid(row=0, column=0, sticky="w")
pills = tk.Frame(bar, bg=BG_PANEL)
pills.grid(row=0, column=1, sticky="e")
self._stat_vars = {}
for key, label, color in [
("db", "DBs", ACCENT),
("wal", "WALs", YELLOW),
("shm", "SHMs", YELLOW),
("err", "Errors", RED),
]:
v = tk.StringVar(value="-")
self._stat_vars[key] = v
pill = tk.Frame(pills, bg=BG, padx=8, pady=2)
pill.pack(side="left", padx=3)
tk.Label(pill, textvariable=v, font=(_MONO, 10, "bold"),
bg=BG, fg=color).pack(side="left")
tk.Label(pill, text=f" {label}", font=SANS_SM,
bg=BG, fg=FG_DIM).pack(side="left")
def _build_path_row(self, parent, row, label_text, attr, browse_cmd, placeholder):
row_frame = tk.Frame(parent, bg=BG)
row_frame.grid(row=row, column=0, sticky="ew", pady=(0, 6))
row_frame.columnconfigure(1, weight=1)
tk.Label(row_frame, text=label_text, font=SANS_MD,
bg=BG, fg=FG, width=12, anchor="w").grid(row=0, column=0, sticky="w")
entry = tk.Entry(row_frame, font=MONO, bg=BG_INPUT, fg=FG,
insertbackground=ACCENT, relief="flat", bd=0,
highlightthickness=1,
highlightcolor=ACCENT, highlightbackground=BG_PANEL)
entry.grid(row=0, column=1, sticky="ew", ipady=5, padx=(6, 6))
entry.insert(0, placeholder)
entry.config(fg=FG_DIM)
def _focus_in(e, ph=placeholder, en=entry):
if en.get() == ph:
en.delete(0, "end")
en.config(fg=FG)
def _focus_out(e, ph=placeholder, en=entry):
if not en.get():
en.insert(0, ph)
en.config(fg=FG_DIM)
entry.bind("<FocusIn>", _focus_in)
entry.bind("<FocusOut>", _focus_out)
setattr(self, attr, entry)
tk.Button(row_frame, text="Browse...", font=SANS_SM,
bg=BG_PANEL, fg=ACCENT,
activebackground=ACCENT_DIM, activeforeground=BG,
relief="flat", bd=0, padx=10, pady=5,
cursor="hand2", command=browse_cmd).grid(row=0, column=2, sticky="e")
def _on_src_type_change(self):
ph = "Path to scan"
if self.input_path.get() not in (ph, ""):
self.input_path.delete(0, "end")
self.input_path.insert(0, ph)
self.input_path.config(fg=FG_DIM)
def _browse_source(self):
if self.src_type.get() == "archive":
path = filedialog.askopenfilename(
title="Select archive",
filetypes=[
("Supported archives", "*.zip *.tar *.tar.gz *.tgz"),
("All files", "*.*"),
]
)
else:
path = filedialog.askdirectory(title="Select source folder")
if path:
self.input_path.delete(0, "end")
self.input_path.insert(0, path)
self.input_path.config(fg=FG)
def _browse_output(self):
path = filedialog.askdirectory(title="Select output folder")
if path:
self.output_path.delete(0, "end")
self.output_path.insert(0, path)
self.output_path.config(fg=FG)
def _show_about(self, *args):
# 1. Check if an active instance already exists in memory
if hasattr(self, "_about_window") and self._about_window and tk.Toplevel.winfo_exists(self._about_window):
self._about_window.lift()
self._about_window.focus_set()
return
# 2. Hard execution gate check to stop instantaneous double-firing
if hasattr(self, "_building_about") and self._building_about:
return
self._building_about = True
try:
self._about_window = tk.Toplevel(self)
win = self._about_window
win.title("About SQLiteWalker")
win.configure(bg=BG)
win.resizable(False, False)
win.transient(self)
_set_window_icon(win)
content = tk.Frame(win, bg=BG, padx=26, pady=22)
content.grid(row=0, column=0, sticky="nsew")
content.columnconfigure(1, weight=1)
tk.Label(content, text="SQLiteWalker", font=HEADER,
bg=BG, fg=ACCENT).grid(row=0, column=0, columnspan=2, sticky="w")
tk.Label(content, text="Python script to walk a folder, zip or tar file looking for SQLite databases",
font=SANS_MD, bg=BG, fg=FG).grid(row=1, column=0, columnspan=2, sticky="w", pady=(4, 12))
tk.Frame(content, bg=BG_PANEL, height=1).grid(row=2, column=0, columnspan=2, sticky="ew", pady=(0, 12))
rows = [
("Version", VERSION, False),
("Author", "@KevinPagano3 | @stark4n6", False),
("GitHub", "https://github.com/stark4n6/SQLiteWalker", True),
("Website", "https://startme.stark4n6.com", True),
("GUI contributor", "@Mipa97", False),
("Runtime", f"{_SYS} | Python {sys.version.split()[0]}", False),
]
def _open_url(url):
try:
webbrowser.open_new_tab(url)
except Exception:
pass
for row_idx, (label, value, is_url) in enumerate(rows, 3):
tk.Label(content, text=label, font=SANS_SM, bg=BG, fg=FG_DIM,
width=15, anchor="w").grid(row=row_idx, column=0, sticky="nw", pady=2)
if is_url:
lbl_val = tk.Label(content, text=value, font=SANS_SM, bg=BG, fg=ACCENT,
anchor="w", wraplength=340, justify="left", cursor="hand2")
lbl_val.grid(row=row_idx, column=1, sticky="w", pady=2)
lbl_val.bind("<Button-1>", lambda e, url=value: _open_url(url))
lbl_val.bind("<Enter>", lambda e, lbl=lbl_val: lbl.config(font=(_SANS, 9, "underline")))
lbl_val.bind("<Leave>", lambda e, lbl=lbl_val: lbl.config(font=SANS_SM))
else:
tk.Label(content, text=value, font=SANS_SM, bg=BG, fg=FG,
anchor="w", wraplength=340, justify="left").grid(row=row_idx, column=1, sticky="w", pady=2)
btn_row = tk.Frame(content, bg=BG)
btn_row.grid(row=3 + len(rows), column=0, columnspan=2, sticky="e", pady=(16, 0))
tk.Button(btn_row, text="Close", font=SANS_SM,
bg=BG_PANEL, fg=ACCENT,
activebackground=ACCENT_DIM, activeforeground=BG,
relief="flat", bd=0, padx=18, pady=5,
cursor="hand2", command=win.destroy).pack()
win.bind("<Escape>", lambda _e: win.destroy())
win.update_idletasks()
x = self.winfo_rootx() + (self.winfo_width() - win.winfo_width()) // 2
y = self.winfo_rooty() + (self.winfo_height() - win.winfo_height()) // 2
win.geometry(f"+{max(x, 0)}+{max(y, 0)}")
win.grab_set()
win.focus_set()
finally:
self._building_about = False
def _log(self, text, tag="normal"):
self.log_text.config(state="normal")
self.log_text.insert("end", text, tag)
self.log_text.see("end")
self.log_text.config(state="disabled")
def _clear_log(self):
self.log_text.config(state="normal")
self.log_text.delete("1.0", "end")
self.log_text.config(state="disabled")
self._log(ASCII_BANNER, "banner")
def _thread_log(self, text, tag="normal"):
self.after(0, self._log, text, tag)
def _thread_progress(self, current, total):
def _up():
if total:
pct = int(current / total * 100)
self.progress["value"] = pct
self.prog_label.config(text=f"{current} / {total}")
else:
self.progress["value"] = 0
self.prog_label.config(text=f"{current} scanned")
self.after(0, _up)
def _thread_live_count(self, key, current_val):
def _up():
if key in self._stat_vars:
self._stat_vars[key].set(str(current_val))
self.after(0, _up)
def _open_last_output(self):
if self._last_output and os.path.isdir(self._last_output):
_open_folder(self._last_output)
def _start_scan(self):
if self._scanning:
return
placeholders = {"Path to scan", "Folder where results will be saved"}
inp = self.input_path.get().strip()
out = self.output_path.get().strip()
if inp in placeholders or not inp:
messagebox.showerror("Missing input", "Please select a source file or folder.")
return
if out in placeholders or not out:
messagebox.showerror("Missing output", "Please select an output folder.")
return
if not os.path.exists(inp):
messagebox.showerror("Not found", f"Source path does not exist:\n{inp}")
return
if not os.path.exists(out):
messagebox.showerror("Not found", f"Output folder does not exist:\n{out}")
return
self._scanning = True