Re: [sleuthkit-users] Autopsy Python module - read file header
Brought to you by:
carrier
|
From: James H Jr J. <jj...@gm...> - 2015-05-18 22:06:17
|
Something like this should work (when modified for your specific needs):
# Read the contents of the file.
inputStream = ReadContentInputStream(file)
buffer = jarray.zeros(1024, "b")
totLen = 0
len = inputStream.read(buffer)
while (len != -1):
totLen = totLen + len
len = inputStream.read(buffer)
Also, imports include:
import jarray
from java.lang import System
--Jim
From: Justin Grover [mailto:jus...@gm...]
Sent: Monday, May 18, 2015 5:42 PM
To: sle...@li...
Subject: [sleuthkit-users] Autopsy Python module - read file header
Autopsy devs--
I've got a python File Ingest Module. Let's say I need to read the first byte from each file to determine its header value. What's the best way to do this in Python/Autopsy?
I've got the following function within my module, but it doesn't work. Jython doesn't seem to handle the callback to fill the buffer.
def process(self, abstractFile):
buf = []
tmp = abstractFile.read(buf, 0, 1)
-Justin
|