Skip to content
Snippets Groups Projects
Unverified Commit 7e801480 authored by Brian Carrier's avatar Brian Carrier Committed by GitHub
Browse files

Merge pull request #2714 from APriestman/5591_disableTimelineEvents

CT5591 Add option to disable timeline events
parents df8559a3 15337acc
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package org.sleuthkit.datamodel; package org.sleuthkit.datamodel;
   
import com.google.common.annotations.Beta;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
...@@ -51,6 +52,7 @@ ...@@ -51,6 +52,7 @@
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.Date; import java.util.Date;
import java.util.EnumMap; import java.util.EnumMap;
...@@ -191,6 +193,7 @@ public class SleuthkitCase { ...@@ -191,6 +193,7 @@ public class SleuthkitCase {
private SleuthkitJNI.CaseDbHandle caseHandle; private SleuthkitJNI.CaseDbHandle caseHandle;
private final String caseHandleIdentifier; // Used to identify this case in the JNI cache. private final String caseHandleIdentifier; // Used to identify this case in the JNI cache.
private String dbBackupPath; private String dbBackupPath;
private AtomicBoolean timelineEventsDisabled = new AtomicBoolean(false);
   
private CaseDbSchemaVersionNumber caseDBSchemaCreationVersion; private CaseDbSchemaVersionNumber caseDBSchemaCreationVersion;
   
...@@ -3062,6 +3065,16 @@ private static String createCaseDataBaseName(String candidateDbName) { ...@@ -3062,6 +3065,16 @@ private static String createCaseDataBaseName(String candidateDbName) {
   
return dbName; return dbName;
} }
/**
* Disable the creation of timeline events for new files.
*
* This setting is not saved to the case database.
*/
@Beta
public void disableTimelineEventCreation() {
timelineEventsDisabled.set(true);
}
   
/** /**
* Returns the Examiner object for currently logged in user * Returns the Examiner object for currently logged in user
...@@ -7101,7 +7114,9 @@ public FsContent addFileSystemFile(long dataSourceObjId, long fsObjId, ...@@ -7101,7 +7114,9 @@ public FsContent addFileSystemFile(long dataSourceObjId, long fsObjId,
DerivedFile derivedFile = new DerivedFile(this, objectId, dataSourceObjId, fsObjId, fileName, dirType, metaType, dirFlag, metaFlags, DerivedFile derivedFile = new DerivedFile(this, objectId, dataSourceObjId, fsObjId, fileName, dirType, metaType, dirFlag, metaFlags,
size, ctime, crtime, atime, mtime, md5Hash, sha256Hash, sha1Hash, null, parentPath, null, parent.getId(), mimeType, null, extension, ownerUid, osAccountId); size, ctime, crtime, atime, mtime, md5Hash, sha256Hash, sha1Hash, null, parentPath, null, parent.getId(), mimeType, null, extension, ownerUid, osAccountId);
   
timelineManager.addEventsForNewFile(derivedFile, connection); if (!timelineEventsDisabled.get()) {
timelineManager.addEventsForNewFile(derivedFile, connection);
}
   
for (Attribute fileAttribute : fileAttributes) { for (Attribute fileAttribute : fileAttributes) {
fileAttribute.setAttributeParentId(objectId); fileAttribute.setAttributeParentId(objectId);
...@@ -7840,7 +7855,9 @@ public DerivedFile addDerivedFile(String fileName, String localPath, ...@@ -7840,7 +7855,9 @@ public DerivedFile addDerivedFile(String fileName, String localPath,
DerivedFile derivedFile = new DerivedFile(this, newObjId, dataSourceObjId, fsObjId, fileName, dirType, metaType, dirFlag, metaFlags, DerivedFile derivedFile = new DerivedFile(this, newObjId, dataSourceObjId, fsObjId, fileName, dirType, metaType, dirFlag, metaFlags,
savedSize, ctime, crtime, atime, mtime, null, null, null, null, parentPath, localPath, parentId, null, encodingType, extension, OsAccount.NO_OWNER_ID, OsAccount.NO_ACCOUNT); savedSize, ctime, crtime, atime, mtime, null, null, null, null, parentPath, localPath, parentId, null, encodingType, extension, OsAccount.NO_OWNER_ID, OsAccount.NO_ACCOUNT);
   
timelineManager.addEventsForNewFile(derivedFile, connection); if (!timelineEventsDisabled.get()) {
timelineManager.addEventsForNewFile(derivedFile, connection);
}
   
//TODO add derived method to tsk_files_derived and tsk_files_derived_method //TODO add derived method to tsk_files_derived and tsk_files_derived_method
return derivedFile; return derivedFile;
...@@ -8269,7 +8286,9 @@ public LocalFile addLocalFile(String fileName, String localPath, ...@@ -8269,7 +8286,9 @@ public LocalFile addLocalFile(String fileName, String localPath,
localPath, localPath,
encodingType, extension, encodingType, extension,
ownerAccount, osAccountId); ownerAccount, osAccountId);
getTimelineManager().addEventsForNewFile(localFile, connection); if (!timelineEventsDisabled.get()) {
getTimelineManager().addEventsForNewFile(localFile, connection);
}
return localFile; return localFile;
   
} catch (SQLException ex) { } catch (SQLException ex) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment