2015-11-01 41 views
1

檢查TSK API後,我發現了一個函數returns the size per block/sector of a file system。我使用pytsk3在Python中試用它。pytsk3 - 如何獲得文件系統的塊大小

import pytsk3 

#defining the path of the disk image 
url="10-ntfs-disk.dd" 

#getting an Img_Info object 
img=pytsk3.Img_Info(url) 

#opening the file system, 32256 is the offset of the file system in bytes 
fs=pytsk3.TSK_FS_INFO(img, 32256, pytsk3.TSK_FS_TYPE_NTFS) 
print fs.block_size 

然而,輸出爲 「分段故障」。我不確定接下來應該做什麼。在pytsk3的GitHub wiki上,該示例使用pytsk3.FS_Info()來打開文件系統,儘管該類似乎沒有返回塊大小的函數。

+0

來自http://dftt.sourceforge.net/test10/的示例圖像。無法發佈兩個以上的鏈接。 – user3044500

+0

你能否成功安裝pytsk3? – jOSe

回答

0

有一個POSIX系統調用「stat」這會重新生成一些文件系統信息,您希望變量的內容爲st_blksize。這適用於所有POSIX兼容系統,這些系統是Linux,Android,Mac而不是Windows。請注意,您可以安裝多個文件系統,因此stat需要一個路徑或文件作爲參數,指向您想要的文件系統中的任何位置。

相關問題