Skip to content

Commit 2b94b94

Browse files
authored
Merge pull request #126 from rowingdude/development
AsyncIO rewrite
2 parents 91e0a7b + 314cd7b commit 2b94b94

26 files changed

+793
-912
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,5 @@ tags
331331
.history/
332332

333333
# Built Visual Studio Code Extensions
334-
*.vsix
334+
*.vsix
335+
test1.csv

CHANGES.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,33 @@
33

44
This document lists the changes and version history for the AnalyzeMFT script and component scripts.
55

6+
## Version 3.0.1 (2024-09-03)
7+
8+
### Changes
9+
- Implementing asyncio for improved performance and responsiveness.
10+
- Handles potential issues with asyncio on different platforms, especially Windows.
11+
- Added the ability to compute and include various hash types (MD5, SHA256, SHA512, CRC32) optionally.
12+
13+
### Fixes
14+
- Now uses a more robust method to build file paths, handling edge cases like root directory and orphaned files.
15+
- Set all relevant data, including optional hash information, to be correctly written to the CSV file.
16+
17+
### Upcoming additions:
18+
19+
- Granular processing of each attribute type, file type, etc found in Constants.py (3.0.2)
20+
- Readmission of file export types other than CSV - XML, JSON, Excel, etc. (3.0.3)
21+
- Readmission of forensic file types such as the Body file (3.0.4)
22+
- Optional integration of SQLite (3.0.5)
23+
- Optional user stipulated fields and reordering of the CSV with optional header (3.0.6)
24+
25+
26+
627
## Version 3.0 (2024-08-15)
728

829
Work has completed on the class-based layout. The program has been split into individual files each composed of the class within.
930
I believe this is the way to go (personal preference) as I like to work on one module at a time!
1031

1132

12-
### To do list:
13-
14-
1. Implement a testing framework involving the sister project [GenerateMFT](https://github.com/rowingdude/GenerateMFT/).
15-
2. Implement multithreading as an option
16-
3. Complete a more succinct and visually appealing menu system (✅ 16-Aug-24 )
17-
18-
<! ----------------- We are going to version up to 3.0 given the complete rewrite ------------------->
1933

2034
## Version 2.1.1 (2024-08-02)
2135

USAGE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ To analyze an MFT file and output the results to a CSV file:
6363
2. Bodyfile: A format suitable for timeline analysis tools.
6464
3. CSV Timeline: A chronological representation of file system events.
6565

66+
## Status Bar
67+
68+
I added a tqdm status bar to the program and then error wrapping around it, so when a corrupted file or entry is discovered, the output becomes:
69+
70+
No attributes found. Last checked offset: 56
71+
No attributes found in record 196610. Raw data:
72+
46494c45300003002431be4a00000000090000003800000040000000000400008d76020000000300010000001b7502000300000000000000ffffffff8279471100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
73+
Parsing MFT: 51%|█████████████████████████████████████████████████████████████▌ | 165M/322M [00:36<00:36, 4.32MB/s]
74+
75+
76+
If you interrupt it (Ctrl+C), it will now save progress and exit:
77+
78+
Parsing MFT: 1%|█▎ | 3.30M/322M [00:00<01:32, 3.43MB/s]
79+
Parsing was cancelled. Saving progress...
80+
6681
## Notes
6782

6883
- Ensure you have the necessary permissions to read the MFT file.

analyzeMFT.py

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,10 @@
1-
try:
2-
3-
from analyze_mft.common_imports import *
4-
from analyze_mft.mft_parser import MFTParser
5-
from analyze_mft.file_handler import FileHandler
6-
from analyze_mft.csv_writer import CSVWriter
7-
from analyze_mft.options_parser import OptionsParser
8-
from analyze_mft.attribute_parser import AttributeParser
9-
from analyze_mft.thread_manager import ThreadManager
10-
from analyze_mft.logger import Logger
11-
12-
except ImportError as e:
13-
print(f"Error: Failed to import required modules. {e}")
14-
sys.exit(1)
15-
16-
def main():
17-
18-
options_parser = OptionsParser()
19-
options = options_parser.parse_options()
20-
21-
logger = Logger(options)
22-
logger.verbose(f"Starting analyzeMFT-v{VERSION}")
23-
24-
file_handler = FileHandler(options)
25-
file_handler.open_files()
26-
27-
logger.verbose("Opened input and output files successfully.")
28-
29-
csv_writer = CSVWriter(options, file_handler)
30-
31-
with ThreadManager(options.thread_count) as thread_manager:
32-
33-
logger.verbose("Initializaing the MFT parsing object...")
34-
mft_parser = MFTParser(options, file_handler, csv_writer)
35-
36-
logger.verbose("Running the MFT parser...")
37-
mft_parser.parse_mft_file()
38-
39-
logger.verbose("Generating file paths...")
40-
mft_parser.generate_filepaths()
41-
42-
logger.verbose("Writing records...")
43-
mft_parser.print_records()
44-
45-
logger.verbose("analyzeMFT completed successfully.")
1+
import asyncio
2+
import sys
3+
from src.analyzeMFT.cli import main
464

475
if __name__ == "__main__":
48-
main()
6+
if sys.platform == "win32":
7+
# This sets the event loop policy to use the ProactorEventLoop on Windows
8+
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
9+
10+
asyncio.run(main())

analyze_mft/__init__.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

analyze_mft/attribute_parser.py

Lines changed: 0 additions & 125 deletions
This file was deleted.

analyze_mft/common_imports.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

analyze_mft/constants.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)