Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export context constructed from Raw MFT file. #92

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions parser/easy.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ type FileInfo struct {
SlackOffset int64 `json:"SlackOffset,omitempty"`
}

// Build an NTFS Context from the raw MFT file. NOTE: This approach
// has some shortcomings which callers should be aware of:

// 1. There is no image other than the provided MFT so any MFT
// attributes with external clusters will return empty data.

// 2. The cluster size and MFT record size are not known (These are
// specified in the boot sector) so callers will have to guess those.
func GetNTFSContextFromRawMFT(reader io.ReaderAt,
cluster_size int64,
record_size int64) *NTFSContext {

ntfs := newNTFSContext(&NullReader{}, "NullReader")

ntfs.MFTReader = reader
ntfs.ClusterSize = cluster_size
ntfs.RecordSize = record_size

return ntfs
}

func GetNTFSContext(image io.ReaderAt, offset int64) (*NTFSContext, error) {
ntfs := newNTFSContext(image, "GetNTFSContext")

Expand Down
6 changes: 2 additions & 4 deletions parser/mft.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,10 @@ func ParseMFTFileWithOptions(
go func() {
defer close(output)

ntfs := newNTFSContext(&NullReader{}, "NullReader")
ntfs := GetNTFSContextFromRawMFT(
reader, cluster_size, record_size)
defer ntfs.Close()

ntfs.MFTReader = reader
ntfs.ClusterSize = cluster_size
ntfs.RecordSize = record_size
ntfs.SetOptions(options)

for id := start_entry; id < size/record_size+1; id++ {
Expand Down
Loading