MCPcopy
hub / github.com/fortra/impacket / build_file_name_attr

Function build_file_name_attr

tests/misc/test_ntfs_read.py:112–125  ·  view source on GitHub ↗

Build raw NTFS_FILE_NAME_ATTR bytes.

(name, file_name_type=FILE_NAME_WIN32)

Source from the content-addressed store, hash-verified

110
111
112def build_file_name_attr(name, file_name_type=FILE_NAME_WIN32):
113 """Build raw NTFS_FILE_NAME_ATTR bytes."""
114 encoded = name.encode('utf-16le')
115 buf = struct.pack('<Q', 5) # ParentDirectory
116 buf += struct.pack('<Q', 0) # CreationTime
117 buf += struct.pack('<Q', 132_000_000_000_000_000) # LastDataChangeTime
118 buf += struct.pack('<Q', 0) # LastMftChangeTime
119 buf += struct.pack('<Q', 0) # LastAccessTime
120 buf += struct.pack('<Q', 0) # AllocatedSize
121 buf += struct.pack('<Q', 0) # DataSize
122 buf += struct.pack('<LL', 0, 0) # FileAttributes, EaSize
123 buf += struct.pack('BB', len(name), file_name_type)
124 buf += encoded
125 return buf
126
127
128def build_attr_list_entry(attr_type, starting_vcn, mft_record_num, attr_id,

Callers 1

test_inline_entriesMethod · 0.85

Calls 2

encodeMethod · 0.80
packMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…