-
Notifications
You must be signed in to change notification settings - Fork 9
/
example.py
740 lines (637 loc) · 26.7 KB
/
example.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
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
from getopt import getopt
from logging import WARNING, basicConfig
from os import makedirs
from os.path import basename, exists, normpath, sep
from re import sub
from sys import argv
from sqlite_dissect.carving.carver import SignatureCarver
from sqlite_dissect.carving.signature import Signature
from sqlite_dissect.constants import (
BASE_VERSION_NUMBER,
CELL_LOCATION,
CELL_SOURCE,
EXPORT_TYPES,
MASTER_SCHEMA_ROW_TYPE,
ROLLBACK_JOURNAL_POSTFIX,
WAL_FILE_POSTFIX,
WAL_INDEX_POSTFIX,
)
from sqlite_dissect.export.csv_export import CommitCsvExporter
from sqlite_dissect.file.database.database import Database
from sqlite_dissect.file.database.page import BTreePage
from sqlite_dissect.file.database.utilities import get_pages_from_b_tree_page
from sqlite_dissect.file.journal.jounal import RollbackJournal
from sqlite_dissect.file.schema.master import OrdinaryTableRow, VirtualTableRow
from sqlite_dissect.file.utilities import validate_page_version_history
from sqlite_dissect.file.wal.wal import WriteAheadLog
from sqlite_dissect.file.wal_index.wal_index import WriteAheadLogIndex
from sqlite_dissect.interface import (
carve_table,
create_database,
create_table_signature,
create_version_history,
create_write_ahead_log,
export_table_or_index_version_history_to_csv,
export_table_or_index_version_history_to_sqlite,
export_version_history_to_csv,
export_version_history_to_sqlite,
get_index_names,
get_table_names,
get_version_history_iterator,
select_all_from_index,
select_all_from_table,
)
from sqlite_dissect.output import (
stringify_cell_records,
stringify_master_schema_versions,
stringify_page_information,
stringify_unallocated_space,
)
from sqlite_dissect.version_history import VersionHistory, VersionHistoryParser
"""
example.py
This script shows examples of how this library can be used.
"""
# Setup logging
logging_level = WARNING
logging_format = "%(levelname)s %(asctime)s [%(pathname)s] %(funcName)s at line %(lineno)d: %(message)s"
logging_data_format = "%d %b %Y %H:%M:%S"
basicConfig(level=logging_level, format=logging_format, datefmt=logging_data_format)
file_name = None
export_directory = None
export_type = None
opts, args = getopt(argv[1:], "f:e:t:")
for opt, arg in opts:
if opt == "-f":
file_name = arg
elif opt == "-e":
export_directory = arg
elif opt == "-t":
export_type = arg
"""
Note: Currently only the csv export_type is supported in this example. The csv and sqlite export_types are used in
the API example below. Other specified types are currently ignored.
"""
if (export_directory and not export_type) or (not export_directory and export_type):
print(
"The export directory (-e) and export type (-t) both need to be defined if either one is specified."
)
print(f"Export types are: {[export_type for export_type in EXPORT_TYPES]}.")
exit(1)
if export_type and export_type.upper() not in EXPORT_TYPES:
print(f"Invalid export type: {export_type}.")
print(
"Export types are: {}.".format(
",".join([export_type.lower() for export_type in EXPORT_TYPES])
)
)
exit(1)
if not file_name:
print("Please execute the application specifying the file name.")
exit(1)
elif not exists(file_name):
print(f"File: {file_name} does not exist.")
exit(1)
else:
print(f"Starting to parse and carve: {file_name}.\n")
file_prefix = basename(normpath(file_name))
padding = "\t"
"""
Load the Database File.
"""
database_file = Database(file_name)
print(f"Database File:\n{database_file.stringify(padding, False, False)}\n")
print(f"Page Information:\n{stringify_page_information(database_file, padding)}\n")
"""
Check if the Write-Ahead Log File exists and load it if it does.
"""
wal_file = None
wal_file_name = file_name + WAL_FILE_POSTFIX
if exists(wal_file_name):
wal_file = WriteAheadLog(wal_file_name)
print(f"WAL File:\n{wal_file.stringify(padding, False)}\n")
else:
print("No WAL File Found.\n")
"""
Check if the Write-Ahead Log Index File exists and load it if it does.
"""
wal_index_file = None
wal_index_file_name = file_name + WAL_INDEX_POSTFIX
if exists(wal_index_file_name):
wal_index_file = WriteAheadLogIndex(wal_index_file_name)
print(f"WAL Index File:\n{wal_index_file.stringify(padding)}\n")
else:
print("No WAL Index File Found.\n")
"""
Check if the Rollback Journal File exists and load it if it does.
"""
rollback_journal_file = None
rollback_journal_file_name = file_name + ROLLBACK_JOURNAL_POSTFIX
if exists(rollback_journal_file_name):
rollback_journal_file = RollbackJournal(rollback_journal_file_name)
print(f"Rollback Journal File:\n{rollback_journal_file.stringify(padding)}\n")
else:
print("No Rollback Journal File Found.\n")
"""
Print Unallocated Non-Zero Space from the Database File.
"""
unallocated_non_zero_space = stringify_unallocated_space(database_file, padding, False)
print(
f"Unallocated Non-Zero Space from the Database File:\n{unallocated_non_zero_space}\n"
)
"""
Create the version history from the database and WAL file (even if the WAL file was not found).
"""
version_history = VersionHistory(database_file, wal_file)
print(f"Number of versions: {version_history.number_of_versions}\n")
print("Validating Page Version History...")
page_version_history_validated = validate_page_version_history(version_history)
print(f"Validating Page Version History (Check): {page_version_history_validated}\n")
if not page_version_history_validated:
print("Error in validating page version history.")
exit(1)
print("Version History of Master Schemas:\n")
for version_number, version in version_history.versions.iteritems():
if version.master_schema_modified:
master_schema_entries = version.master_schema.master_schema_entries
if master_schema_entries:
print(f"Version {version_number} Master Schema Entries:")
for master_schema_entry in master_schema_entries:
string = (
padding
+ "Master Schema Entry: Root Page Number: {} Type: {} Name: {} "
"Table Name: {} SQL: {}."
)
print(
string.format(
master_schema_entry.root_page_number,
master_schema_entry.row_type,
master_schema_entry.name,
master_schema_entry.table_name,
master_schema_entry.sql,
)
)
print("Version History:\n")
for version_number, version in version_history.versions.iteritems():
print(
f"Version: {version_number} has updated page numbers: {version.updated_page_numbers}."
)
print(f"Page Information:\n{stringify_page_information(version, padding)}\n")
last_version = version_history.number_of_versions - 1
print(
"Version: {} has updated page numbers: {}.".format(
version_history.number_of_versions - 1, last_version.updated_page_numbers
)
)
print(f"Page Information:\n{stringify_page_information(last_version, padding)}\n")
print(
f"Version History of Master Schemas:\n{stringify_master_schema_versions(version_history)}\n"
)
print("Master Schema B-Trees (Index and Table) Version Histories:")
for master_schema_entry in database_file.master_schema.master_schema_entries:
if (
master_schema_entry.row_type
in [MASTER_SCHEMA_ROW_TYPE.INDEX, MASTER_SCHEMA_ROW_TYPE.TABLE]
and not isinstance(master_schema_entry, VirtualTableRow)
and not (
isinstance(master_schema_entry, OrdinaryTableRow)
and master_schema_entry.without_row_id
)
):
version_history_parser = VersionHistoryParser(
version_history, master_schema_entry
)
page_type = version_history_parser.page_type
string = "Master schema entry: {} type: {} on page type: {}:"
string = string.format(
version_history_parser.row_type,
master_schema_entry.name,
page_type,
version_history_parser.root_page_number_version_index,
)
print(string)
for commit in version_history_parser:
if commit.updated:
string = (
"Updated in version: {} with root page number: {} on b-tree page numbers: {} "
"and updated root b-tree page numbers: {}:"
)
string = string.format(
commit.version_number,
commit.root_page_number,
commit.b_tree_page_numbers,
commit.updated_b_tree_page_numbers,
)
print(string)
for added_cell_string in stringify_cell_records(
commit.added_cells.values(),
database_file.database_text_encoding,
page_type,
):
print(f"Added: {added_cell_string}")
for updated_cell_string in stringify_cell_records(
commit.updated_cells.values(),
database_file.database_text_encoding,
page_type,
):
print(f"Updated: {updated_cell_string}")
for deleted_cell_string in stringify_cell_records(
commit.deleted_cells.values(),
database_file.database_text_encoding,
page_type,
):
print(f"Deleted: {deleted_cell_string}")
for carved_cell_string in stringify_cell_records(
commit.carved_cells.values(),
database_file.database_text_encoding,
page_type,
):
print(f"Carved: {carved_cell_string}")
print("\n")
signatures = {}
for master_schema_entry in database_file.master_schema.master_schema_entries:
"""
Due to current implementation limitations we are restricting signature generation to table row types.
"""
if master_schema_entry.row_type == MASTER_SCHEMA_ROW_TYPE.TABLE:
signature = Signature(version_history, master_schema_entry)
signatures[master_schema_entry.name] = signature
print(
"Signature:\n{}\n".format(
signature.stringify(padding + "\t", False, False, False)
)
)
else:
string = (
"No signature will be generated for master schema entry type: {} with name: {} on "
"table name: {} and sql: {}"
)
string = string.format(
master_schema_entry.row_type,
master_schema_entry.name,
master_schema_entry.table_name,
master_schema_entry.sql,
)
print(string + "\n")
print("Carving base version (main SQLite database file):")
version = version_history.versions[BASE_VERSION_NUMBER]
carved_records = {}
for master_schema_entry in database_file.master_schema.master_schema_entries:
"""
Due to current implementation limitations we are restricting carving to table row types.
Note: This is not allowing "without rowid" or virtual tables until further testing is done. (Virtual tables
tend to have a root page number of 0 with no data stored in the main table. Further investigation
is needed.)
"""
if (
master_schema_entry.row_type == MASTER_SCHEMA_ROW_TYPE.TABLE
and not isinstance(master_schema_entry, VirtualTableRow)
and not master_schema_entry.without_row_id
):
b_tree_pages = get_pages_from_b_tree_page(
version.get_b_tree_root_page(master_schema_entry.root_page_number)
)
b_tree_page_numbers = [b_tree_page.number for b_tree_page in b_tree_pages]
string = "Carving Table Entry: Name: {} root page: {} on page numbers: {}"
print(
string.format(
master_schema_entry.name,
master_schema_entry.root_page_number,
b_tree_page_numbers,
)
)
carved_records[master_schema_entry.name] = []
for b_tree_page_number in b_tree_page_numbers:
page = database_file.pages[b_tree_page_number]
source = CELL_SOURCE.B_TREE
# For carving freeblocks make sure the page is a b-tree page and not overflow
if isinstance(page, BTreePage):
carved_cells = SignatureCarver.carve_freeblocks(
version,
source,
page.freeblocks,
signatures[master_schema_entry.name],
)
carved_records[master_schema_entry.name].extend(carved_cells)
carved_cells = SignatureCarver.carve_unallocated_space(
version,
source,
b_tree_page_number,
page.unallocated_space_start_offset,
page.unallocated_space,
signatures[master_schema_entry.name],
)
carved_records[master_schema_entry.name].extend(carved_cells)
else:
string = (
"Not carving master schema entry row type: {} name: {} table name: {} and sql: {} since it is not "
"a normal table."
)
string = string.format(
master_schema_entry.row_type,
master_schema_entry.name,
master_schema_entry.table_name,
master_schema_entry.sql,
)
print(string)
print("\n")
print("Carved Entries:\n")
for master_schema_entry_name, carved_cells in carved_records.iteritems():
print(f"Table Master Schema Entry Name {master_schema_entry_name}:")
carved_freeblock_records_total = len(
[
carved_cell
for carved_cell in carved_cells
if carved_cell.location == CELL_LOCATION.FREEBLOCK
]
)
print(f"Recovered {carved_freeblock_records_total} entries from freeblocks:")
for carved_cell in carved_cells:
if carved_cell.location == CELL_LOCATION.FREEBLOCK:
payload = carved_cell.payload
cell_record_column_values = [
str(record_column.value) if record_column.value else "NULL"
for record_column in payload.record_columns
]
string = "{}: {} Index: ({}, {}, {}, {}): ({})"
string = string.format(
carved_cell.page_number,
carved_cell.index,
carved_cell.file_offset,
payload.serial_type_definition_start_offset,
payload.serial_type_definition_end_offset,
payload.cutoff_offset,
" , ".join(cell_record_column_values),
)
print(string)
carved_unallocated_space_records_total = len(
[
carved_cell
for carved_cell in carved_cells
if carved_cell.location == CELL_LOCATION.UNALLOCATED_SPACE
]
)
print(
f"Recovered {carved_unallocated_space_records_total} entries from unallocated space:"
)
for carved_cell in carved_cells:
if carved_cell.location == CELL_LOCATION.UNALLOCATED_SPACE:
payload = carved_cell.payload
cell_record_column_values = [
str(record_column.value) if record_column.value else "NULL"
for record_column in payload.record_columns
]
string = "{}: {} Index: ({}, {}, {}, {}): ({})"
string = string.format(
carved_cell.page_number,
carved_cell.index,
carved_cell.file_offset,
payload.serial_type_definition_start_offset,
payload.serial_type_definition_end_offset,
payload.cutoff_offset,
" , ".join(cell_record_column_values),
)
print(string)
print("\n")
print("\n")
print("Master Schema B-Trees (Index and Table) Version Histories Including Carvings:")
for master_schema_entry in database_file.master_schema.master_schema_entries:
if master_schema_entry.row_type in [
MASTER_SCHEMA_ROW_TYPE.INDEX,
MASTER_SCHEMA_ROW_TYPE.TABLE,
]:
# We only have signatures of the tables (not indexes)
signature = (
signatures[master_schema_entry.name]
if master_schema_entry.row_type == MASTER_SCHEMA_ROW_TYPE.TABLE
else None
)
version_history_parser = VersionHistoryParser(
version_history, master_schema_entry, None, None, signature
)
page_type = version_history_parser.page_type
string = "Master schema entry: {} type: {} on page type: {}:"
string = string.format(
master_schema_entry.name,
version_history_parser.row_type,
page_type,
version_history_parser.root_page_number_version_index,
)
print(string)
for commit in version_history_parser:
if commit.updated:
string = (
"Updated in version: {} with root page number: {} on b-tree page numbers: {} "
"and updated root b-tree page numbers: {}:"
)
string = string.format(
commit.version_number,
commit.root_page_number,
commit.b_tree_page_numbers,
commit.updated_b_tree_page_numbers,
)
print(string)
for added_cell_string in stringify_cell_records(
commit.added_cells.values(),
database_file.database_text_encoding,
page_type,
):
print(f"Added: {added_cell_string}")
for updated_cell_string in stringify_cell_records(
commit.updated_cells.values(),
database_file.database_text_encoding,
page_type,
):
print(f"Updated: {updated_cell_string}")
for deleted_cell_string in stringify_cell_records(
commit.deleted_cells.values(),
database_file.database_text_encoding,
page_type,
):
print(f"Deleted: {deleted_cell_string}")
for carved_cell_string in stringify_cell_records(
commit.carved_cells.values(),
database_file.database_text_encoding,
page_type,
):
print(f"Carved: {carved_cell_string}")
print("\n")
if export_type and export_type.upper() == EXPORT_TYPES.CSV:
csv_prefix_file_name = basename(normpath(file_prefix))
commit_csv_exporter = CommitCsvExporter(export_directory, csv_prefix_file_name)
print(
"Exporting SQLite Master Schema B-Trees (Index and Table) Version Histories "
"(Including Carvings) to CSV Directory: {}.".format(export_directory)
)
for master_schema_entry in database_file.master_schema.master_schema_entries:
if master_schema_entry.row_type in [
MASTER_SCHEMA_ROW_TYPE.INDEX,
MASTER_SCHEMA_ROW_TYPE.TABLE,
]:
# We only have signatures of the tables (not indexes)
signature = (
signatures[master_schema_entry.name]
if master_schema_entry.row_type == MASTER_SCHEMA_ROW_TYPE.TABLE
else None
)
carve_freelist_pages = True if signature else False
version_history_parser = VersionHistoryParser(
version_history,
master_schema_entry,
None,
None,
signature,
carve_freelist_pages,
)
page_type = version_history_parser.page_type
for commit in version_history_parser:
commit_csv_exporter.write_commit(master_schema_entry, commit)
print("\n")
"""
Below are examples on using the interface.
The functions used from the interface script are documented below (taken from documentation in the interface script):
create_database(file_name, file_object=None, store_in_memory=False, strict_format_checking=True)
create_write_ahead_log(file_name, file_object=None)
create_version_history(database, write_ahead_log=None)
get_table_names(database)
get_index_names(database)
select_all_from_table(table_name, version)
select_all_from_index(index_name, version)
create_table_signature(table_name, version, version_history=None)
carve_table(table_name, signature, version)
get_version_history_iterator(table_or_index_name, version_history, signature=None)
export_table_or_index_version_history_to_csv(export_directory, version_history,
table_or_index_name, signature=None, carve_freelist_pages=False)
export_version_history_to_csv(export_directory, version_history, signatures=None, carve_freelist_pages=False)
"""
print("Example interface usage:\n")
# Create the database
database = create_database(file_name)
# Create the write ahead log
write_ahead_log = (
create_write_ahead_log(file_name + WAL_FILE_POSTFIX)
if exists(file_name + WAL_FILE_POSTFIX)
else None
)
# Create the version history
version_history = create_version_history(database, write_ahead_log)
# Get all of the table names
table_names = get_table_names(database)
print(f"Table Names: {table_names}\n")
# Get all of the cells in each table and print the number of cells (rows) for each table
for table_name in table_names:
select_all_data = select_all_from_table(table_name, database)
print(f"Table: {table_name} has {len(select_all_data)} rows in the database file.")
print("\n")
# Get all of the index names
index_names = get_index_names(database)
print(f"Index Names: {index_names}")
print("\n")
# Get all of the cells in each index and print the number of cells (rows) for each index
for index_name in index_names:
select_all_data = select_all_from_index(index_name, database)
print(f"Index: {index_name} has {len(select_all_data)} rows in the database file.")
print("\n")
# Get all of the signatures (for tables only - not including "without rowid" and virtual tables)
signatures = {}
for table_name in table_names:
# Specify the version history here to parse through all versions for signature generation
table_signature = create_table_signature(table_name, database, version_history)
# Account for "without rowid" table signatures until supported
if table_signature:
signatures[table_name] = table_signature
# Carve each table with the generated signature and print the number of carved cells (rows) per table
for table_name in table_names:
if table_name in signatures:
carved_cells = carve_table(table_name, signatures[table_name], database)
print(
f"Found {len(carved_cells)} carved cells for table: {table_name} in the database file."
)
print("\n")
# Combine names for index and tables (they are unique) and get the version history iterator for each
names = []
names.extend(table_names)
names.extend(index_names)
for name in names:
signature = signatures[name] if name in signatures else None
version_history_iterator = get_version_history_iterator(
name, version_history, signature
)
for commit in version_history_iterator:
string = f"For: {name} commit: {commit.updated} for version: {commit.version_number}."
if commit.updated:
string += f" Carved Cells: {True if commit.carved_cells else False}."
print(string)
print("\n")
# Check to make sure exporting variables were setup correctly for csv
if export_type and export_type.upper() == EXPORT_TYPES.CSV:
# Create two directories for the two types csv files can be exported through the interface
export_version_directory = export_directory + sep + "csv_version"
if not exists(export_version_directory):
makedirs(export_version_directory)
export_version_history_directory = export_directory + sep + "csv_version_history"
if not exists(export_version_history_directory):
makedirs(export_version_history_directory)
# Iterate through all index and table names and export their version history to a csv file (one at a time)
for name in names:
print(f"Exporting {name} to {export_version_directory} as {export_type}.")
export_table_or_index_version_history_to_csv(
export_version_directory, version_history, name, None, False
)
print("\n")
# Export all index and table histories to csv files while supplying signatures to carve tables and carving freelists
print(
f"Exporting history to {export_version_history_directory} with carvings as {export_type}."
)
export_version_history_to_csv(
export_version_history_directory, version_history, signatures.values(), True
)
print("\n")
# Check to make sure exporting variable were setup correctly for SQLite
if export_type and export_type.upper() == EXPORT_TYPES.SQLITE:
# Create two directories for the two types SQLite files can be exported through the interface
export_version_directory = export_directory + sep + "sqlite_version"
if not exists(export_version_directory):
makedirs(export_version_directory)
export_version_history_directory = export_directory + sep + "sqlite_version_history"
if not exists(export_version_history_directory):
makedirs(export_version_history_directory)
# Currently the file name is taken from the base version name
sqlite_base_file_name = basename(normpath(file_prefix))
sqlite_file_postfix = "-sqlite-dissect.db3"
# Iterate through all index and table names and export their version history to a csv file (one at a time)
for name in names:
fixed_master_schema_name = sub(" ", "_", name)
master_schema_entry_file_name = (
sqlite_base_file_name + "-" + fixed_master_schema_name + sqlite_file_postfix
)
print(
"Exporting {} to {} in {} as {}.".format(
name,
master_schema_entry_file_name,
export_version_directory,
export_type,
)
)
export_table_or_index_version_history_to_sqlite(
export_version_directory,
master_schema_entry_file_name,
version_history,
name,
)
print("\n")
# Export all index and table histories to csv files while supplying signatures to carve tables and carving freelists
sqlite_file_name = sqlite_base_file_name + sqlite_file_postfix
print(
"Exporting history to {} in {} with carvings as {}.".format(
sqlite_file_name, export_version_history_directory, export_type
)
)
export_version_history_to_sqlite(
export_version_history_directory,
sqlite_file_name,
version_history,
signatures.values(),
True,
)
print("\n")