temp restore

This commit is contained in:
Burgess Leo
2025-05-19 13:25:07 +08:00
parent b2e14fdbe0
commit 07a4ae7a74
5 changed files with 83 additions and 8 deletions

View File

@@ -76,6 +76,7 @@ def GetFileMftEntry(file_path):
print(f"Looking up MFT entry for: {rel_path}")
mft_entry = find_file_mft_entry(fs, rel_path)
print(f"MFT Entry: {mft_entry}")
if mft_entry is None:
raise RuntimeError("Could not find MFT entry for the specified file.")
@@ -102,7 +103,9 @@ def CalculateFileMftStartSector(mft_entry, volume_letter="Z"):
config_data = GetNTFSBootInfo(volume_letter)
# 计算文件 MFT Entry 的起始扇区号
start_sector = config_data["MftPosition"] * 8 + mft_entry * 2
if start_sector < 0:
raise ValueError("起始扇区号不能为负数")
print(f"文件 MFT Entry 的起始扇区号: {start_sector}")
return start_sector
@@ -214,10 +217,11 @@ def GetFile80hPattern(file_path):
try:
mft_entry_value = GetFileMftEntry(file_path)
StartSector = CalculateFileMftStartSector(mft_entry_value, volume_letter)
print(f"\n文件的相关信息以及80属性内容")
print(Get80hPattern(StartSector, volume_letter))
except Exception as e:
print(f"❌ Error: {e}")
if __name__ == '__main__':
GetFile80hPattern(r"Z:\demo.jpg")
GetFile80hPattern(r"Z:\hello.txt")