mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge pull request #926 from rcordovano/release-3.1.1
Remove use of deprecated method in Python sample and make easier to test
This commit is contained in:
commit
e5ec1e8233
@ -27,7 +27,6 @@
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
import jarray
|
||||
from java.lang import System
|
||||
from org.sleuthkit.datamodel import SleuthkitCase
|
||||
@ -97,10 +96,10 @@ class SampleJythonDataSourceIngestModule(DataSourceIngestModule):
|
||||
services = Services(sleuthkitCase)
|
||||
fileManager = services.getFileManager()
|
||||
|
||||
# Get count of files with .doc extension.
|
||||
# Get count of files with "test" in name.
|
||||
fileCount = 0;
|
||||
docFiles = fileManager.findFiles(dataSource, "%.doc")
|
||||
for docFile in docFiles:
|
||||
files = fileManager.findFiles(dataSource, "%test%")
|
||||
for file in files:
|
||||
fileCount += 1
|
||||
progressBar.progress(1)
|
||||
|
||||
@ -110,7 +109,7 @@ class SampleJythonDataSourceIngestModule(DataSourceIngestModule):
|
||||
# Get files by creation time.
|
||||
currentTime = System.currentTimeMillis() / 1000
|
||||
minTime = currentTime - (14 * 24 * 60 * 60) # Go back two weeks.
|
||||
otherFiles = sleuthkitCase.findFilesWhere("crtime > %d" % minTime)
|
||||
otherFiles = sleuthkitCase.findAllFilesWhere("crtime > %d" % minTime)
|
||||
for otherFile in otherFiles:
|
||||
fileCount += 1
|
||||
progressBar.progress(1);
|
||||
@ -119,7 +118,8 @@ class SampleJythonDataSourceIngestModule(DataSourceIngestModule):
|
||||
return IngestModule.ProcessResult.OK;
|
||||
|
||||
#Post a message to the ingest messages in box.
|
||||
message = IngestMessage.createMessage(IngestMessage.MessageType.DATA, "Sample Jython Data Source Ingest Module", "Found %d files" % fileCount)
|
||||
message = IngestMessage.createMessage(IngestMessage.MessageType.DATA,
|
||||
"Sample Jython Data Source Ingest Module", "Found %d files" % fileCount)
|
||||
IngestServices.getInstance().postMessage(message)
|
||||
|
||||
return IngestModule.ProcessResult.OK;
|
||||
@ -135,9 +135,9 @@ class SampleJythonFileIngestModule(FileIngestModule):
|
||||
|
||||
def process(self, file):
|
||||
# If the file has a txt extension, post an artifact to the blackboard.
|
||||
if file.getName().endswith("txt"):
|
||||
if file.getName().find("test") != -1:
|
||||
art = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT)
|
||||
att = BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), "Sample Jython File Ingest Module", "Text file")
|
||||
att = BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), "Sample Jython File Ingest Module", "Text Files")
|
||||
art.addAttribute(att)
|
||||
|
||||
# Read the contents of the file.
|
||||
|
Loading…
x
Reference in New Issue
Block a user