feat: add resident data inclusion in JSON/CSV output with filtering options #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the ability to include resident data directly in JSON/CSV output files, eliminating the need to correlate separate binary files manually. Three new command-line parameters provide granular control over which resident data to include.
Motivation
Currently, the
--drflag extracts resident data as separate binary files in theResident/subdirectory. This approach creates challenges for automated analysis:Resident data is highly relevant in DFIR contexts, particularly for:
Changes
New Parameters
--ir: Enable resident data inclusion in JSON/CSV output (boolean, default: false)--re <extensions>: Comma-separated list of file extensions to include (e.g., ".txt,.ps1,.bat")--rm <bytes>: Maximum size in bytes for resident data inclusion (integer, default: 4096, max: 1024000)Implementation Details
Modified Files:
MFTECmd/MFTRecordOut.cs: Added three new propertiesResidentDataBase64: Base64-encoded binary dataResidentDataHex: Hex-formatted byte representationResidentDataASCII: UTF-8/ASCII text if valid, null otherwiseMFTECmd/Program.cs: Core processing logicPopulateResidentData()method with filtering logicGetCsvData()to conditionally populate resident dataProcessing Flow:
--rmparameterText Validation:
ASCII field is populated only if data contains:
Evidence
The screenshots below demonstrate the feature in action using the same MFT file:
Without
--irflag (baseline behavior):File "The Chains Not Seen.txt" appears in output with standard metadata fields only. No resident data fields are present.
With
--irflag enabled:The same file now includes three additional fields with the resident data:
ResidentDataBase64: Full Base64-encoded contentResidentDataHex: Hex representation of the dataResidentDataASCII: Human-readable text content extracted from resident dataThis allows immediate access to file contents without requiring separate binary file extraction and correlation.
Usage Examples
Testing
I have included a sample $MFT.zip file for testing. The file contains resident data entries that can be used to validate the implementation:
MFTECmd.exe -f $MFT_sample --json output --jsonf baseline.jsonMFTECmd.exe -f $MFT_sample --json output --jsonf with_resident.json --ir--iris specifiedMFTECmd.exe -f $MFT_sample --json output --ir --rm 2048Backward Compatibility
This change is fully backward compatible:
Performance Considerations
Use Cases
This feature streamlines several DFIR workflows:
Future Enhancements
Potential improvements for subsequent PRs:
Checklist
--ir,--re,--rm)