mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
Revert "4072 remove cache"
This commit is contained in:
parent
4ca5ffe523
commit
cde3d8dd1f
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.commonfilesearch;
|
package org.sleuthkit.autopsy.commonfilesearch;
|
||||||
|
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
|
import java.util.Map;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
||||||
import org.sleuthkit.autopsy.datamodel.DisplayableItemNode;
|
import org.sleuthkit.autopsy.datamodel.DisplayableItemNode;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
@ -27,9 +27,9 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an instance in either the CaseDB or CR that had a common match.
|
* Represents an instance in either the CaseDB or CR that had a common match.
|
||||||
* Different implementations know how to get the instance details from either
|
* Different implementations know how to get the instance details from either
|
||||||
* CaseDB or CR.
|
* CaseDB or CR.
|
||||||
*
|
*
|
||||||
* Defines leaf-type nodes used in the Common Files Search results tree. Leaf
|
* Defines leaf-type nodes used in the Common Files Search results tree. Leaf
|
||||||
* nodes, may describe common attributes which exist in the current case DB or
|
* nodes, may describe common attributes which exist in the current case DB or
|
||||||
* in the Central Repo. When a reference to the AbstractFile is lacking (such as
|
* in the Central Repo. When a reference to the AbstractFile is lacking (such as
|
||||||
@ -41,6 +41,8 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
public abstract class AbstractCommonAttributeInstance {
|
public abstract class AbstractCommonAttributeInstance {
|
||||||
|
|
||||||
private final Long abstractFileObjectId;
|
private final Long abstractFileObjectId;
|
||||||
|
// maps object ID to file
|
||||||
|
private final Map<Long, AbstractFile> cachedFiles;
|
||||||
private final String caseName;
|
private final String caseName;
|
||||||
private final String dataSource;
|
private final String dataSource;
|
||||||
|
|
||||||
@ -54,8 +56,9 @@ public abstract class AbstractCommonAttributeInstance {
|
|||||||
* @param dataSource datasource where this attribute appears
|
* @param dataSource datasource where this attribute appears
|
||||||
* @param caseName case where this attribute appears
|
* @param caseName case where this attribute appears
|
||||||
*/
|
*/
|
||||||
AbstractCommonAttributeInstance(Long abstractFileReference, String dataSource, String caseName) {
|
AbstractCommonAttributeInstance(Long abstractFileReference, Map<Long, AbstractFile> cachedFiles, String dataSource, String caseName) {
|
||||||
this.abstractFileObjectId = abstractFileReference;
|
this.abstractFileObjectId = abstractFileReference;
|
||||||
|
this.cachedFiles = cachedFiles;
|
||||||
this.caseName = caseName;
|
this.caseName = caseName;
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
}
|
}
|
||||||
@ -67,18 +70,38 @@ public abstract class AbstractCommonAttributeInstance {
|
|||||||
* @param cachedFiles storage for abstract files which have been used
|
* @param cachedFiles storage for abstract files which have been used
|
||||||
* already so we can avoid extra roundtrips to the case db
|
* already so we can avoid extra roundtrips to the case db
|
||||||
*/
|
*/
|
||||||
AbstractCommonAttributeInstance() {
|
AbstractCommonAttributeInstance(Map<Long, AbstractFile> cachedFiles) {
|
||||||
this.abstractFileObjectId = -1L;
|
this.abstractFileObjectId = -1L;
|
||||||
|
this.cachedFiles = cachedFiles;
|
||||||
this.caseName = "";
|
this.caseName = "";
|
||||||
this.dataSource = "";
|
this.dataSource = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an AbstractFile for this instance if it can be retrieved from the
|
* Grab a cached instance of the AbstractFile or grab one from the
|
||||||
* CaseDB.
|
* SleuthkitCase. Use this in implementations of <code>generateNodes</code>.
|
||||||
*
|
*
|
||||||
* @return AbstractFile corresponding to this common attribute or null if it
|
* @return AbstractFile which is identical to the file instance generated by
|
||||||
* cannot be found (for example, in the event that this is a central repo file)
|
* implementations of this object
|
||||||
|
*/
|
||||||
|
protected AbstractFile lookupOrLoadAbstractFile() {
|
||||||
|
if (this.cachedFiles.containsKey(this.getAbstractFileObjectId())) {
|
||||||
|
return this.cachedFiles.get(this.getAbstractFileObjectId());
|
||||||
|
} else {
|
||||||
|
AbstractFile file = this.getAbstractFile();
|
||||||
|
final long abstractFileId = file.getId();
|
||||||
|
this.cachedFiles.put(abstractFileId, file);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an AbstractFile for this instance if it can be retrieved from
|
||||||
|
* the CaseDB.
|
||||||
|
*
|
||||||
|
* @return AbstractFile corresponding to this common attribute or null if
|
||||||
|
* it cannot be found
|
||||||
|
* @@@ Consider throwing exception instead of NULL
|
||||||
*/
|
*/
|
||||||
abstract AbstractFile getAbstractFile();
|
abstract AbstractFile getAbstractFile();
|
||||||
|
|
||||||
@ -139,24 +162,36 @@ public abstract class AbstractCommonAttributeInstance {
|
|||||||
*
|
*
|
||||||
* @param attributeInstance common file attribute instance form the central
|
* @param attributeInstance common file attribute instance form the central
|
||||||
* repo
|
* repo
|
||||||
* @param abstractFile an AbstractFile from which the attribute instance was
|
* @param equivalentAbstractFile an AbstractFile which is equivalent to the
|
||||||
* found - applies to CaseDbCommonAttributeInstance only
|
* file in which the attribute instance was found
|
||||||
* @param currentCaseName
|
* @param currentCaseName
|
||||||
* @return the appropriate leaf node for the results tree
|
* @return the appropriate leaf node for the results tree
|
||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
*/
|
*/
|
||||||
static DisplayableItemNode createNode(CorrelationAttribute attribute, AbstractFile abstractFile, String currentCaseName) throws TskCoreException {
|
static DisplayableItemNode createInstance(CorrelationAttributeInstance attributeInstance, AbstractFile equivalentAbstractFile, String currentCaseName) throws TskCoreException {
|
||||||
|
|
||||||
DisplayableItemNode leafNode;
|
DisplayableItemNode leafNode;
|
||||||
CorrelationAttributeInstance attributeInstance = attribute.getInstances().get(0);
|
|
||||||
|
|
||||||
if (abstractFile == null) {
|
final String attributeDataSourceName = attributeInstance.getCorrelationDataSource().getName();
|
||||||
leafNode = new CentralRepoCommonAttributeInstanceNode(attributeInstance);
|
final String abstractFileDataSourceName = equivalentAbstractFile.getDataSource().getName();
|
||||||
|
|
||||||
|
final String attributeInstanceCaseName = attributeInstance.getCorrelationCase().getDisplayName();
|
||||||
|
|
||||||
|
final String attributeInstanceFullPath = attributeInstance.getFilePath().replace("\\", "/");
|
||||||
|
|
||||||
|
final String currentAbstractFileParentPath = equivalentAbstractFile.getParentPath();
|
||||||
|
final String currentAbstractFileName = equivalentAbstractFile.getName();
|
||||||
|
final String abstractFileFullPath = (currentAbstractFileParentPath + currentAbstractFileName).replace("\\", "/");
|
||||||
|
|
||||||
|
final boolean sameCase = attributeInstanceCaseName.equalsIgnoreCase(currentCaseName);
|
||||||
|
final boolean sameFileName = attributeInstanceFullPath.equalsIgnoreCase(abstractFileFullPath);
|
||||||
|
final boolean sameDataSource = attributeDataSourceName.equalsIgnoreCase(abstractFileDataSourceName);
|
||||||
|
|
||||||
|
if (sameCase && sameFileName && sameDataSource) {
|
||||||
|
leafNode = new CaseDBCommonAttributeInstanceNode(equivalentAbstractFile, currentCaseName, abstractFileDataSourceName);
|
||||||
} else {
|
} else {
|
||||||
final String abstractFileDataSourceName = abstractFile.getDataSource().getName();
|
leafNode = new CentralRepoCommonAttributeInstanceNode(attributeInstance, equivalentAbstractFile);
|
||||||
leafNode = new CaseDBCommonAttributeInstanceNode(abstractFile, currentCaseName, abstractFileDataSourceName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return leafNode;
|
return leafNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.commonfilesearch;
|
|||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -39,18 +38,12 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractCommonAttributeSearcher {
|
public abstract class AbstractCommonAttributeSearcher {
|
||||||
|
|
||||||
private final Map<Long, String> dataSourceIdToNameMap;
|
|
||||||
private boolean filterByMedia;
|
private boolean filterByMedia;
|
||||||
private boolean filterByDoc;
|
private boolean filterByDoc;
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher(Map<Long, String> dataSourceIdMap, boolean filterByMedia, boolean filterByDoc){
|
AbstractCommonAttributeSearcher(boolean filterByMedia, boolean filterByDoc){
|
||||||
this.filterByDoc = filterByDoc;
|
this.filterByDoc = filterByDoc;
|
||||||
this.filterByMedia = filterByMedia;
|
this.filterByMedia = filterByMedia;
|
||||||
this.dataSourceIdToNameMap = dataSourceIdMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<Long, String> getDataSourceIdToNameMap(){
|
|
||||||
return Collections.unmodifiableMap(this.dataSourceIdToNameMap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,16 +33,8 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
*/
|
*/
|
||||||
public class AllInterCaseCommonAttributeSearcher extends InterCaseCommonAttributeSearcher {
|
public class AllInterCaseCommonAttributeSearcher extends InterCaseCommonAttributeSearcher {
|
||||||
|
|
||||||
/**
|
public AllInterCaseCommonAttributeSearcher(boolean filterByMediaMimeType, boolean filterByDocMimeType) throws EamDbException {
|
||||||
*
|
super(filterByMediaMimeType, filterByDocMimeType);
|
||||||
* @param filterByMediaMimeType match only on files whose mime types can be
|
|
||||||
* broadly categorized as media types
|
|
||||||
* @param filterByDocMimeType match only on files whose mime types can be
|
|
||||||
* broadly categorized as document types
|
|
||||||
* @throws EamDbException
|
|
||||||
*/
|
|
||||||
public AllInterCaseCommonAttributeSearcher(Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) throws EamDbException {
|
|
||||||
super(dataSourceIdMap, filterByMediaMimeType, filterByDocMimeType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package org.sleuthkit.autopsy.commonfilesearch;
|
package org.sleuthkit.autopsy.commonfilesearch;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
@ -44,13 +45,13 @@ final public class CaseDBCommonAttributeInstance extends AbstractCommonAttribute
|
|||||||
* @param objectId id of abstract file to find
|
* @param objectId id of abstract file to find
|
||||||
* @param dataSourceName name of datasource where the object is found
|
* @param dataSourceName name of datasource where the object is found
|
||||||
*/
|
*/
|
||||||
CaseDBCommonAttributeInstance(Long abstractFileReference, String dataSource, String caseName) {
|
CaseDBCommonAttributeInstance(Long abstractFileReference, Map<Long, AbstractFile> cachedFiles, String dataSource, String caseName) {
|
||||||
super(abstractFileReference, dataSource, caseName);
|
super(abstractFileReference, cachedFiles, dataSource, caseName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DisplayableItemNode[] generateNodes() {
|
public DisplayableItemNode[] generateNodes() {
|
||||||
final CaseDBCommonAttributeInstanceNode intraCaseCommonAttributeInstanceNode = new CaseDBCommonAttributeInstanceNode(this.getAbstractFile(), this.getCaseName(), this.getDataSource());
|
final CaseDBCommonAttributeInstanceNode intraCaseCommonAttributeInstanceNode = new CaseDBCommonAttributeInstanceNode(this.lookupOrLoadAbstractFile(), this.getCaseName(), this.getDataSource());
|
||||||
return Arrays.asList(intraCaseCommonAttributeInstanceNode).toArray(new DisplayableItemNode[1]);
|
return Arrays.asList(intraCaseCommonAttributeInstanceNode).toArray(new DisplayableItemNode[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,11 +58,11 @@ public class CaseDBCommonAttributeInstanceNode extends FileNode {
|
|||||||
return visitor.visit(this);
|
return visitor.visit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCase(){
|
String getCase(){
|
||||||
return this.caseName;
|
return this.caseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDataSource() {
|
String getDataSource() {
|
||||||
return this.dataSource;
|
return this.dataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.commonfilesearch;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@ -36,102 +35,75 @@ import org.sleuthkit.datamodel.SleuthkitCase;
|
|||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents that a row in the CR was found in multiple cases.
|
* Represents that a row in the CR was found in multiple cases.
|
||||||
*
|
*
|
||||||
* Generates a DisplayableItmeNode using a CentralRepositoryFile.
|
* Generates a DisplayableItmeNode using a CentralRepositoryFile.
|
||||||
*/
|
*/
|
||||||
final public class CentralRepoCommonAttributeInstance extends AbstractCommonAttributeInstance {
|
final public class CentralRepoCommonAttributeInstance extends AbstractCommonAttributeInstance {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(CentralRepoCommonAttributeInstance.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(CentralRepoCommonAttributeInstance.class.getName());
|
||||||
private final Integer crFileId;
|
private final Integer crFileId;
|
||||||
private CorrelationAttribute currentAttribute;
|
private CorrelationAttributeInstance currentAttributeInstance;
|
||||||
private final Map<String, Long> dataSourceNameToIdMap;
|
|
||||||
|
|
||||||
CentralRepoCommonAttributeInstance(Integer attrInstId, Map<Long, String> dataSourceIdToNameMap) {
|
CentralRepoCommonAttributeInstance(Integer attrInstId, Map<Long, AbstractFile> cachedFiles) {
|
||||||
super();
|
super(cachedFiles);
|
||||||
this.crFileId = attrInstId;
|
this.crFileId = attrInstId;
|
||||||
this.dataSourceNameToIdMap = invertMap(dataSourceIdToNameMap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCurrentAttributeInst(CorrelationAttribute attribute) {
|
void setCurrentAttributeInst(CorrelationAttributeInstance attributeInstance) {
|
||||||
this.currentAttribute = attribute;
|
this.currentAttributeInstance = attributeInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
AbstractFile getAbstractFile() {
|
AbstractFile getAbstractFile() {
|
||||||
|
|
||||||
Case currentCase;
|
Case currentCase;
|
||||||
if (this.currentAttribute != null) {
|
// @@@ Need to CHeck for NULL. This seems to depend on generateNodes to be called first
|
||||||
|
String currentFullPath = this.currentAttributeInstance.getFilePath();
|
||||||
final CorrelationAttributeInstance currentAttributeInstance = this.currentAttribute.getInstances().get(0);
|
|
||||||
|
|
||||||
String currentFullPath = currentAttributeInstance.getFilePath();
|
|
||||||
String currentDataSource = currentAttributeInstance.getCorrelationDataSource().getName();
|
|
||||||
|
|
||||||
|
|
||||||
if(this.dataSourceNameToIdMap.containsKey(currentDataSource)){
|
|
||||||
Long dataSourceObjectId = this.dataSourceNameToIdMap.get(currentDataSource);
|
|
||||||
|
|
||||||
try {
|
|
||||||
currentCase = Case.getCurrentCaseThrows();
|
|
||||||
|
|
||||||
SleuthkitCase tskDb = currentCase.getSleuthkitCase();
|
try {
|
||||||
|
currentCase = Case.getCurrentCaseThrows();
|
||||||
|
|
||||||
File fileFromPath = new File(currentFullPath);
|
SleuthkitCase tskDb = currentCase.getSleuthkitCase();
|
||||||
String fileName = fileFromPath.getName();
|
File fileFromPath = new File(currentFullPath);
|
||||||
String parentPath = (fileFromPath.getParent() + File.separator).replace("\\", "/");
|
String fileName = fileFromPath.getName();
|
||||||
|
//TODO this seems like a flaw - we maybe need to look at all of these not just the first
|
||||||
|
//i think we should search by md5 and return all of them
|
||||||
|
AbstractFile abstractFile = tskDb.findAllFilesWhere(String.format("lower(name) = '%s'", fileName)).get(0);
|
||||||
|
|
||||||
final String whereClause = String.format("lower(name) = '%s' AND md5 = '%s' AND lower(parent_path) = '%s' AND data_source_obj_id = %s", fileName, currentAttribute.getCorrelationValue(), parentPath, dataSourceObjectId);
|
return abstractFile;
|
||||||
List<AbstractFile> potentialAbstractFiles = tskDb.findAllFilesWhere(whereClause);
|
|
||||||
|
|
||||||
if(potentialAbstractFiles.isEmpty()){
|
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||||
return null;
|
LOGGER.log(Level.SEVERE, String.format("Unable to find AbstractFile for record with filePath: %s. Node not created.", new Object[]{currentFullPath}), ex);
|
||||||
} else if(potentialAbstractFiles.size() > 1){
|
return null;
|
||||||
LOGGER.log(Level.WARNING, String.format("Unable to find an exact match for AbstractFile for record with filePath: %s. May have returned the wrong file.", new Object[]{currentFullPath}));
|
|
||||||
return potentialAbstractFiles.get(0);
|
|
||||||
} else {
|
|
||||||
return potentialAbstractFiles.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
|
||||||
LOGGER.log(Level.SEVERE, String.format("Unable to find AbstractFile for record with filePath: %s. Node not created.", new Object[]{currentFullPath}), ex);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DisplayableItemNode[] generateNodes() {
|
public DisplayableItemNode[] generateNodes() {
|
||||||
|
|
||||||
// @@@ We should be doing more of this work in teh generateKeys method. We want to do as little as possible in generateNodes
|
// @@@ We should be doing more of this work in teh generateKeys method. We want to do as little as possible in generateNodes
|
||||||
|
|
||||||
InterCaseSearchResultsProcessor eamDbAttrInst = new InterCaseSearchResultsProcessor();
|
InterCaseSearchResultsProcessor eamDbAttrInst = new InterCaseSearchResultsProcessor();
|
||||||
CorrelationAttribute corrAttr = eamDbAttrInst.findSingleCorrelationAttribute(crFileId);
|
CorrelationAttribute corrAttr = eamDbAttrInst.findSingleCorrelationAttribute(crFileId);
|
||||||
List<DisplayableItemNode> attrInstNodeList = new ArrayList<>(0);
|
List<DisplayableItemNode> attrInstNodeList = new ArrayList<>(0);
|
||||||
String currCaseDbName = Case.getCurrentCase().getDisplayName();
|
String currCaseDbName = Case.getCurrentCase().getDisplayName();
|
||||||
|
|
||||||
|
// @@@ This seems wrong that we are looping here, but only setting one attrInst in the class, which is then used by getAbstractFile().
|
||||||
|
for (CorrelationAttributeInstance attrInst : corrAttr.getInstances()) {
|
||||||
|
try {
|
||||||
|
this.setCurrentAttributeInst(attrInst);
|
||||||
|
|
||||||
|
AbstractFile equivalentAbstractFile = this.lookupOrLoadAbstractFile();
|
||||||
|
|
||||||
|
DisplayableItemNode generatedInstNode = AbstractCommonAttributeInstance.createInstance(attrInst, equivalentAbstractFile, currCaseDbName);
|
||||||
|
|
||||||
try {
|
attrInstNodeList.add(generatedInstNode);
|
||||||
this.setCurrentAttributeInst(corrAttr);
|
|
||||||
|
|
||||||
AbstractFile abstractFileForAttributeInstance = this.getAbstractFile();
|
} catch (TskCoreException ex) {
|
||||||
DisplayableItemNode generatedInstNode = AbstractCommonAttributeInstance.createNode(corrAttr, abstractFileForAttributeInstance, currCaseDbName);
|
LOGGER.log(Level.SEVERE, String.format("Unable to get DataSource for record with filePath: %s. Node not created.", new Object[]{attrInst.getFilePath()}), ex);
|
||||||
attrInstNodeList.add(generatedInstNode);
|
}
|
||||||
|
|
||||||
} catch (TskCoreException ex) {
|
|
||||||
LOGGER.log(Level.SEVERE, String.format("Unable to get DataSource for record with md5: %s. Node not created.", new Object[]{corrAttr.getCorrelationValue()}), ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return attrInstNodeList.toArray(new DisplayableItemNode[attrInstNodeList.size()]);
|
return attrInstNodeList.toArray(new DisplayableItemNode[attrInstNodeList.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Long> invertMap(Map<Long, String> dataSourceIdToNameMap) {
|
|
||||||
HashMap<String, Long> invertedMap = new HashMap<>();
|
|
||||||
for (Map.Entry<Long, String> entry : dataSourceIdToNameMap.entrySet()){
|
|
||||||
invertedMap.put(entry.getValue(), entry.getKey());
|
|
||||||
}
|
|
||||||
return invertedMap;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeIns
|
|||||||
import org.sleuthkit.autopsy.datamodel.DisplayableItemNode;
|
import org.sleuthkit.autopsy.datamodel.DisplayableItemNode;
|
||||||
import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor;
|
import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor;
|
||||||
import org.sleuthkit.autopsy.datamodel.NodeProperty;
|
import org.sleuthkit.autopsy.datamodel.NodeProperty;
|
||||||
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
|
import org.sleuthkit.datamodel.Content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by the Common Files search feature to encapsulate instances of a given
|
* Used by the Common Files search feature to encapsulate instances of a given
|
||||||
@ -44,16 +46,25 @@ public class CentralRepoCommonAttributeInstanceNode extends DisplayableItemNode
|
|||||||
|
|
||||||
private final CorrelationAttributeInstance crFile;
|
private final CorrelationAttributeInstance crFile;
|
||||||
|
|
||||||
CentralRepoCommonAttributeInstanceNode(CorrelationAttributeInstance content) {
|
//this may not be the same file, but at least it is identical,
|
||||||
super(Children.LEAF, Lookups.fixed(content));
|
// and we can use this to support certain actions in the tree table and crFile viewer
|
||||||
|
private final AbstractFile md5Reference;
|
||||||
|
|
||||||
|
CentralRepoCommonAttributeInstanceNode(CorrelationAttributeInstance content, AbstractFile md5Reference) {
|
||||||
|
super(Children.LEAF, Lookups.fixed(content)); // Using md5Reference enables Other Occurances, but for the current file path
|
||||||
this.crFile = content;
|
this.crFile = content;
|
||||||
this.setDisplayName(new File(this.crFile.getFilePath()).getName());
|
this.setDisplayName(new File(this.crFile.getFilePath()).getName());
|
||||||
|
this.md5Reference = md5Reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CorrelationAttributeInstance getCorrelationAttributeInstance(){
|
public CorrelationAttributeInstance getCentralRepoFile(){
|
||||||
return this.crFile;
|
return this.crFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Content getContent(){
|
||||||
|
return this.md5Reference;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Action[] getActions(boolean context){
|
public Action[] getActions(boolean context){
|
||||||
List<Action> actionsList = new ArrayList<>();
|
List<Action> actionsList = new ArrayList<>();
|
||||||
@ -90,24 +101,24 @@ public class CentralRepoCommonAttributeInstanceNode extends DisplayableItemNode
|
|||||||
sheet.put(sheetSet);
|
sheet.put(sheetSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
final CorrelationAttributeInstance centralRepoFile = this.getCorrelationAttributeInstance();
|
final CorrelationAttributeInstance centralRepoFile = this.getCentralRepoFile();
|
||||||
|
|
||||||
final String fullPath = centralRepoFile.getFilePath();
|
final String fullPath = centralRepoFile.getFilePath();
|
||||||
final File file = new File(fullPath);
|
final File file = new File(fullPath);
|
||||||
|
|
||||||
final String caseName = centralRepoFile.getCorrelationCase().getDisplayName();
|
final String caseName = centralRepoFile.getCorrelationCase().getDisplayName();
|
||||||
|
|
||||||
final String name = file.getName();
|
final String name = file.getName();
|
||||||
final String parent = file.getParent();
|
final String parent = file.getParent();
|
||||||
|
|
||||||
final String dataSourceName = centralRepoFile.getCorrelationDataSource().getName();
|
final String caseQualifiedDataSource = centralRepoFile.getCorrelationDataSource().getName();
|
||||||
|
|
||||||
final String NO_DESCR = Bundle.CommonFilesSearchResultsViewerTable_noDescText();
|
final String NO_DESCR = Bundle.CommonFilesSearchResultsViewerTable_noDescText();
|
||||||
|
|
||||||
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_filesColLbl(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_filesColLbl(), NO_DESCR, name));
|
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_filesColLbl(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_filesColLbl(), NO_DESCR, name));
|
||||||
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), NO_DESCR, parent));
|
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), NO_DESCR, parent));
|
||||||
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_hashsetHitsColLbl(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_hashsetHitsColLbl(), NO_DESCR, ""));
|
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_hashsetHitsColLbl(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_hashsetHitsColLbl(), NO_DESCR, ""));
|
||||||
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), NO_DESCR, dataSourceName));
|
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), NO_DESCR, caseQualifiedDataSource));
|
||||||
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_mimeTypeColLbl(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_mimeTypeColLbl(), NO_DESCR, ""));
|
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_mimeTypeColLbl(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_mimeTypeColLbl(), NO_DESCR, ""));
|
||||||
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_caseColLbl1(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_caseColLbl1(), NO_DESCR, caseName));
|
sheetSet.put(new NodeProperty<>(org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_caseColLbl1(), org.sleuthkit.autopsy.commonfilesearch.Bundle.CommonFilesSearchResultsViewerTable_caseColLbl1(), NO_DESCR, caseName));
|
||||||
|
|
||||||
|
@ -157,9 +157,9 @@ public final class CommonAttributePanel extends javax.swing.JDialog {
|
|||||||
if (CommonAttributePanel.this.interCaseRadio.isSelected()) {
|
if (CommonAttributePanel.this.interCaseRadio.isSelected()) {
|
||||||
|
|
||||||
if (caseId == InterCasePanel.NO_CASE_SELECTED) {
|
if (caseId == InterCasePanel.NO_CASE_SELECTED) {
|
||||||
builder = new AllInterCaseCommonAttributeSearcher(intraCasePanel.getDataSourceMap(), filterByMedia, filterByDocuments);
|
builder = new AllInterCaseCommonAttributeSearcher(filterByMedia, filterByDocuments);
|
||||||
} else {
|
} else {
|
||||||
builder = new SingleInterCaseCommonAttributeSearcher(caseId, intraCasePanel.getDataSourceMap(), filterByMedia, filterByDocuments);
|
builder = new SingleInterCaseCommonAttributeSearcher(caseId, filterByMedia, filterByDocuments);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (dataSourceId == CommonAttributePanel.NO_DATA_SOURCE_SELECTED) {
|
if (dataSourceId == CommonAttributePanel.NO_DATA_SOURCE_SELECTED) {
|
||||||
|
@ -86,6 +86,6 @@ final public class CommonAttributeSearchResultRootNode extends DisplayableItemNo
|
|||||||
protected Node createNodeForKey(Integer instanceCount){
|
protected Node createNodeForKey(Integer instanceCount){
|
||||||
List<CommonAttributeValue> attributeValues = this.searchResults.getAttributeValuesForInstanceCount(instanceCount);
|
List<CommonAttributeValue> attributeValues = this.searchResults.getAttributeValuesForInstanceCount(instanceCount);
|
||||||
return new InstanceCountNode(instanceCount, attributeValues);
|
return new InstanceCountNode(instanceCount, attributeValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,41 +33,35 @@ final public class CommonAttributeSearchResults {
|
|||||||
private final Map<Integer, List<CommonAttributeValue>> instanceCountToAttributeValues;
|
private final Map<Integer, List<CommonAttributeValue>> instanceCountToAttributeValues;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a values object which can be handed off to the node factories.
|
* Create a metadata object which can be handed off to the node
|
||||||
|
* factories.
|
||||||
*
|
*
|
||||||
* @param values list of CommonAttributeValue indexed by size of
|
* @param metadata list of CommonAttributeValue indexed by size of CommonAttributeValue
|
||||||
* CommonAttributeValue
|
|
||||||
*/
|
*/
|
||||||
CommonAttributeSearchResults(Map<Integer, List<CommonAttributeValue>> metadata){
|
CommonAttributeSearchResults(Map<Integer, List<CommonAttributeValue>> metadata){
|
||||||
this.instanceCountToAttributeValues = metadata;
|
this.instanceCountToAttributeValues = metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the child node whose children have the specified number of children.
|
* Find the meta data for the given md5.
|
||||||
*
|
*
|
||||||
* This is a convenience method - you can also iterate over
|
* This is a convenience method - you can also iterate over
|
||||||
* <code>getValues()</code>.
|
* <code>getMetadata()</code>.
|
||||||
*
|
*
|
||||||
* @param isntanceCound key
|
* @param md5 key
|
||||||
* @return list of values which represent matches
|
* @return
|
||||||
*/
|
*/
|
||||||
List<CommonAttributeValue> getAttributeValuesForInstanceCount(Integer instanceCount) {
|
List<CommonAttributeValue> getAttributeValuesForInstanceCount(Integer instanceCount) {
|
||||||
return this.instanceCountToAttributeValues.get(instanceCount);
|
return this.instanceCountToAttributeValues.get(instanceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Map<Integer, List<CommonAttributeValue>> getMetadata() {
|
||||||
* Get an unmodifiable collection of values, indexed by number of
|
|
||||||
* grandchildren, which represents the common attributes found in the
|
|
||||||
* search.
|
|
||||||
* @return map of sizes of children to list of matches
|
|
||||||
*/
|
|
||||||
public Map<Integer, List<CommonAttributeValue>> getMetadata() {
|
|
||||||
return Collections.unmodifiableMap(this.instanceCountToAttributeValues);
|
return Collections.unmodifiableMap(this.instanceCountToAttributeValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How many distinct common files exist for this search results?
|
* How many distinct file instances exist for this metadata?
|
||||||
* @return number of common files
|
* @return number of file instances
|
||||||
*/
|
*/
|
||||||
public int size() {
|
public int size() {
|
||||||
|
|
||||||
|
@ -74,6 +74,11 @@ final public class CommonAttributeValue {
|
|||||||
this.fileInstances.add(metadata);
|
this.fileInstances.add(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addFileInstanceMetadata(AbstractCommonAttributeInstance metadata, String caseName) {
|
||||||
|
this.fileInstances.add(metadata);
|
||||||
|
// @@@ Why are we ignoring caseName?
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<AbstractCommonAttributeInstance> getInstances() {
|
public Collection<AbstractCommonAttributeInstance> getInstances() {
|
||||||
return Collections.unmodifiableCollection(this.fileInstances);
|
return Collections.unmodifiableCollection(this.fileInstances);
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,12 @@ package org.sleuthkit.autopsy.commonfilesearch;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
||||||
|
import static org.sleuthkit.autopsy.timeline.datamodel.eventtype.ArtifactEventType.LOGGER;
|
||||||
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.HashUtility;
|
import org.sleuthkit.datamodel.HashUtility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,8 +49,8 @@ abstract class InterCaseCommonAttributeSearcher extends AbstractCommonAttributeS
|
|||||||
*
|
*
|
||||||
* @throws EamDbException
|
* @throws EamDbException
|
||||||
*/
|
*/
|
||||||
InterCaseCommonAttributeSearcher(Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) throws EamDbException {
|
InterCaseCommonAttributeSearcher(boolean filterByMediaMimeType, boolean filterByDocMimeType) throws EamDbException {
|
||||||
super(dataSourceIdMap, filterByMediaMimeType, filterByDocMimeType);
|
super(filterByMediaMimeType, filterByDocMimeType);
|
||||||
dbManager = EamDb.getInstance();
|
dbManager = EamDb.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,24 +71,33 @@ abstract class InterCaseCommonAttributeSearcher extends AbstractCommonAttributeS
|
|||||||
if (md5 == null || HashUtility.isNoDataMd5(md5)) {
|
if (md5 == null || HashUtility.isNoDataMd5(md5)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Map<Long, AbstractFile> fileCache = new HashMap<>();
|
||||||
|
|
||||||
// we don't *have* all the information for the rows in the CR,
|
try {
|
||||||
// so we need to consult the present case via the SleuthkitCase object
|
int caseId = commonFileCases.get(commonAttrId);
|
||||||
// Later, when the FileInstanceNodde is built. Therefore, build node generators for now.
|
CorrelationCase autopsyCrCase = dbManager.getCaseById(caseId);
|
||||||
|
final String correlationCaseDisplayName = autopsyCrCase.getDisplayName();
|
||||||
|
// we don't *have* all the information for the rows in the CR,
|
||||||
|
// so we need to consult the present case via the SleuthkitCase object
|
||||||
|
// Later, when the FileInstanceNodde is built. Therefore, build node generators for now.
|
||||||
|
|
||||||
if (interCaseCommonFiles.containsKey(md5)) {
|
if (interCaseCommonFiles.containsKey(md5)) {
|
||||||
//Add to intercase metaData
|
//Add to intercase metaData
|
||||||
final CommonAttributeValue commonAttributeValue = interCaseCommonFiles.get(md5);
|
final CommonAttributeValue commonAttributeValue = interCaseCommonFiles.get(md5);
|
||||||
|
|
||||||
|
AbstractCommonAttributeInstance searchResult = new CentralRepoCommonAttributeInstance(commonAttrId, fileCache);
|
||||||
|
commonAttributeValue.addFileInstanceMetadata(searchResult, correlationCaseDisplayName);
|
||||||
|
|
||||||
AbstractCommonAttributeInstance searchResult = new CentralRepoCommonAttributeInstance(commonAttrId, this.getDataSourceIdToNameMap());
|
} else {
|
||||||
commonAttributeValue.addInstance(searchResult);
|
CommonAttributeValue commonAttributeValue = new CommonAttributeValue(md5);
|
||||||
|
interCaseCommonFiles.put(md5, commonAttributeValue);
|
||||||
} else {
|
|
||||||
CommonAttributeValue commonAttributeValue = new CommonAttributeValue(md5);
|
AbstractCommonAttributeInstance searchResult = new CentralRepoCommonAttributeInstance(commonAttrId, fileCache);
|
||||||
interCaseCommonFiles.put(md5, commonAttributeValue);
|
commonAttributeValue.addFileInstanceMetadata(searchResult, correlationCaseDisplayName);
|
||||||
|
|
||||||
AbstractCommonAttributeInstance searchResult = new CentralRepoCommonAttributeInstance(commonAttrId, this.getDataSourceIdToNameMap());
|
}
|
||||||
commonAttributeValue.addInstance(searchResult);
|
} catch (Exception ex) {
|
||||||
|
LOGGER.log(Level.WARNING, "Error getting artifact instances from database.", ex); // NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,9 +37,10 @@ public class InterCasePanel extends javax.swing.JPanel {
|
|||||||
static final int NO_CASE_SELECTED = -1;
|
static final int NO_CASE_SELECTED = -1;
|
||||||
|
|
||||||
private ComboBoxModel<String> casesList = new DataSourceComboBoxModel();
|
private ComboBoxModel<String> casesList = new DataSourceComboBoxModel();
|
||||||
|
|
||||||
private final Map<Integer, String> caseMap;
|
private final Map<Integer, String> caseMap;
|
||||||
|
|
||||||
|
private CommonAttributePanel parent;
|
||||||
|
|
||||||
private String errorMessage;
|
private String errorMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,6 +60,10 @@ public class InterCasePanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setParent(CommonAttributePanel parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
String getErrorMessage(){
|
String getErrorMessage(){
|
||||||
return this.errorMessage;
|
return this.errorMessage;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.HashUtility;
|
import org.sleuthkit.datamodel.HashUtility;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase.CaseDbQuery;
|
import org.sleuthkit.datamodel.SleuthkitCase.CaseDbQuery;
|
||||||
@ -44,6 +45,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
@SuppressWarnings("PMD.AbstractNaming")
|
@SuppressWarnings("PMD.AbstractNaming")
|
||||||
public abstract class IntraCaseCommonAttributeSearcher extends AbstractCommonAttributeSearcher {
|
public abstract class IntraCaseCommonAttributeSearcher extends AbstractCommonAttributeSearcher {
|
||||||
|
|
||||||
|
private final Map<Long, String> dataSourceIdToNameMap;
|
||||||
private static final String FILTER_BY_MIME_TYPES_WHERE_CLAUSE = " and mime_type in (%s)"; //NON-NLS // where %s is csv list of mime_types to filter on
|
private static final String FILTER_BY_MIME_TYPES_WHERE_CLAUSE = " and mime_type in (%s)"; //NON-NLS // where %s is csv list of mime_types to filter on
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,7 +58,8 @@ public abstract class IntraCaseCommonAttributeSearcher extends AbstractCommonAtt
|
|||||||
* broadly categorized as document types
|
* broadly categorized as document types
|
||||||
*/
|
*/
|
||||||
IntraCaseCommonAttributeSearcher(Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) {
|
IntraCaseCommonAttributeSearcher(Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) {
|
||||||
super(dataSourceIdMap, filterByMediaMimeType, filterByDocMimeType);
|
super(filterByMediaMimeType, filterByDocMimeType);
|
||||||
|
dataSourceIdToNameMap = dataSourceIdMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,6 +97,7 @@ public abstract class IntraCaseCommonAttributeSearcher extends AbstractCommonAtt
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CommonAttributeSearchResults findFiles() throws TskCoreException, NoCurrentCaseException, SQLException {
|
public CommonAttributeSearchResults findFiles() throws TskCoreException, NoCurrentCaseException, SQLException {
|
||||||
|
//TODO do we need all those exceptions or can we differentiate when they are caught?
|
||||||
Map<String, CommonAttributeValue> commonFiles = new HashMap<>();
|
Map<String, CommonAttributeValue> commonFiles = new HashMap<>();
|
||||||
|
|
||||||
final Case currentCase = Case.getCurrentCaseThrows();
|
final Case currentCase = Case.getCurrentCaseThrows();
|
||||||
@ -102,6 +106,8 @@ public abstract class IntraCaseCommonAttributeSearcher extends AbstractCommonAtt
|
|||||||
SleuthkitCase sleuthkitCase = currentCase.getSleuthkitCase();
|
SleuthkitCase sleuthkitCase = currentCase.getSleuthkitCase();
|
||||||
|
|
||||||
String selectStatement = this.buildSqlSelectStatement();
|
String selectStatement = this.buildSqlSelectStatement();
|
||||||
|
|
||||||
|
Map<Long, AbstractFile> fileCache = new HashMap<>();
|
||||||
|
|
||||||
try (
|
try (
|
||||||
CaseDbQuery query = sleuthkitCase.executeQuery(selectStatement);
|
CaseDbQuery query = sleuthkitCase.executeQuery(selectStatement);
|
||||||
@ -111,7 +117,7 @@ public abstract class IntraCaseCommonAttributeSearcher extends AbstractCommonAtt
|
|||||||
Long objectId = resultSet.getLong(1);
|
Long objectId = resultSet.getLong(1);
|
||||||
String md5 = resultSet.getString(2);
|
String md5 = resultSet.getString(2);
|
||||||
Long dataSourceId = resultSet.getLong(3);
|
Long dataSourceId = resultSet.getLong(3);
|
||||||
String dataSource = this.getDataSourceIdToNameMap().get(dataSourceId);
|
String dataSource = this.dataSourceIdToNameMap.get(dataSourceId);
|
||||||
|
|
||||||
if (md5 == null || HashUtility.isNoDataMd5(md5)) {
|
if (md5 == null || HashUtility.isNoDataMd5(md5)) {
|
||||||
continue;
|
continue;
|
||||||
@ -119,10 +125,10 @@ public abstract class IntraCaseCommonAttributeSearcher extends AbstractCommonAtt
|
|||||||
|
|
||||||
if (commonFiles.containsKey(md5)) {
|
if (commonFiles.containsKey(md5)) {
|
||||||
final CommonAttributeValue commonAttributeValue = commonFiles.get(md5);
|
final CommonAttributeValue commonAttributeValue = commonFiles.get(md5);
|
||||||
commonAttributeValue.addInstance(new CaseDBCommonAttributeInstance(objectId, dataSource, caseName));
|
commonAttributeValue.addInstance(new CaseDBCommonAttributeInstance(objectId, fileCache, dataSource, caseName));
|
||||||
} else {
|
} else {
|
||||||
final CommonAttributeValue commonAttributeValue = new CommonAttributeValue(md5);
|
final CommonAttributeValue commonAttributeValue = new CommonAttributeValue(md5);
|
||||||
commonAttributeValue.addInstance(new CaseDBCommonAttributeInstance(objectId, dataSource, caseName));
|
commonAttributeValue.addInstance(new CaseDBCommonAttributeInstance(objectId, fileCache, dataSource, caseName));
|
||||||
commonFiles.put(md5, commonAttributeValue);
|
commonFiles.put(md5, commonAttributeValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,4 +169,5 @@ public abstract class IntraCaseCommonAttributeSearcher extends AbstractCommonAtt
|
|||||||
}
|
}
|
||||||
return mimeTypeString;
|
return mimeTypeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package org.sleuthkit.autopsy.commonfilesearch;
|
package org.sleuthkit.autopsy.commonfilesearch;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import javax.swing.ComboBoxModel;
|
import javax.swing.ComboBoxModel;
|
||||||
@ -41,7 +40,8 @@ public class IntraCasePanel extends javax.swing.JPanel {
|
|||||||
private boolean singleDataSource;
|
private boolean singleDataSource;
|
||||||
private String selectedDataSource;
|
private String selectedDataSource;
|
||||||
private ComboBoxModel<String> dataSourcesList = new DataSourceComboBoxModel();
|
private ComboBoxModel<String> dataSourcesList = new DataSourceComboBoxModel();
|
||||||
private final Map<Long, String> dataSourceMap;
|
private Map<Long, String> dataSourceMap;
|
||||||
|
private CommonAttributePanel parent;
|
||||||
|
|
||||||
private String errorMessage;
|
private String errorMessage;
|
||||||
|
|
||||||
@ -51,7 +51,10 @@ public class IntraCasePanel extends javax.swing.JPanel {
|
|||||||
public IntraCasePanel() {
|
public IntraCasePanel() {
|
||||||
initComponents();
|
initComponents();
|
||||||
this.errorMessage = "";
|
this.errorMessage = "";
|
||||||
this.dataSourceMap = new HashMap<>();
|
}
|
||||||
|
|
||||||
|
public void setParent(CommonAttributePanel parent){
|
||||||
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSingleDataSource(){
|
public boolean isSingleDataSource(){
|
||||||
@ -63,7 +66,7 @@ public class IntraCasePanel extends javax.swing.JPanel {
|
|||||||
return selectedDataSource;
|
return selectedDataSource;
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Long, String> getDataSourceMap(){
|
public Map<Long, String> getDataSourceMap(){
|
||||||
@ -207,10 +210,10 @@ public class IntraCasePanel extends javax.swing.JPanel {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getErrorMessage() {
|
String getErrorMessage() {
|
||||||
return this.errorMessage;
|
return this.errorMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ public class SingleInterCaseCommonAttributeSearcher extends InterCaseCommonAttri
|
|||||||
* @param filterByDocMimeType
|
* @param filterByDocMimeType
|
||||||
* @throws EamDbException
|
* @throws EamDbException
|
||||||
*/
|
*/
|
||||||
public SingleInterCaseCommonAttributeSearcher(int correlationCaseId, Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) throws EamDbException {
|
public SingleInterCaseCommonAttributeSearcher(int correlationCaseId, boolean filterByMediaMimeType, boolean filterByDocMimeType) throws EamDbException {
|
||||||
super(dataSourceIdMap,filterByMediaMimeType, filterByDocMimeType);
|
super(filterByMediaMimeType, filterByDocMimeType);
|
||||||
|
|
||||||
this.corrleationCaseId = correlationCaseId;
|
this.corrleationCaseId = correlationCaseId;
|
||||||
this.correlationCaseName = "";
|
this.correlationCaseName = "";
|
||||||
|
@ -852,6 +852,50 @@ public class CentralRepoDatamodelTest extends TestCase {
|
|||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test getting common instances with expected results
|
||||||
|
try {
|
||||||
|
List<CentralRepositoryFile> instances = EamDb.getInstance().getArtifactInstancesByCaseValues(Arrays.asList(inAllDataSourcesHash, inDataSource1twiceHash));
|
||||||
|
assertTrue("getArtifactInstancesByCaseValues returned " + instances.size() + " results - expected 5", instances.size() == 5);
|
||||||
|
|
||||||
|
// This test works because all the instances of this hash were set to the same path
|
||||||
|
for (CentralRepositoryFile inst : instances) {
|
||||||
|
if(inst.getValue().equals(inAllDataSourcesHash)) {
|
||||||
|
assertTrue("getArtifactInstancesByCaseValues returned instance with unexpected path " + inst.getFilePath(),
|
||||||
|
inAllDataSourcesPath.equalsIgnoreCase(inst.getFilePath()));
|
||||||
|
}
|
||||||
|
else if(inst.getValue().equals(inDataSource1twiceHash)) {
|
||||||
|
assertTrue("getArtifactInstancesByCaseValues returned instance with unexpected path " + inst.getFilePath(),
|
||||||
|
inDataSource1twicePath1.equalsIgnoreCase(inst.getFilePath()) || inDataSource1twicePath2.equalsIgnoreCase(inst.getFilePath()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test getting instances expecting no results because they are not in the case
|
||||||
|
try {
|
||||||
|
CorrelationCase badCase = new CorrelationCase("badCaseUuid", "badCaseName");
|
||||||
|
List<CentralRepositoryFile> instances = EamDb.getInstance().getArtifactInstancesByCaseValues(badCase, Arrays.asList(inAllDataSourcesHash, inDataSource1twiceHash), 0);
|
||||||
|
|
||||||
|
assertTrue("getArtifactInstancesByTypeValue returned " + instances.size() + " results - expected 0", instances.isEmpty());
|
||||||
|
} catch (EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Test getting instances expecting no results because of bad hashes
|
||||||
|
try {
|
||||||
|
List<CentralRepositoryFile> instances = EamDb.getInstance().getArtifactInstancesByCaseValues(Arrays.asList("xyz", "123"));
|
||||||
|
|
||||||
|
assertTrue("getArtifactInstancesByTypeValue returned " + instances.size() + " results - expected 0", instances.isEmpty());
|
||||||
|
} catch (EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Test getting instances expecting no results
|
// Test getting instances expecting no results
|
||||||
try {
|
try {
|
||||||
@ -880,6 +924,17 @@ public class CentralRepoDatamodelTest extends TestCase {
|
|||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test getting instances with null value
|
||||||
|
// Should just return nothing
|
||||||
|
try {
|
||||||
|
List<CentralRepositoryFile> instances = EamDb.getInstance().getArtifactInstancesByCaseValues(null);
|
||||||
|
|
||||||
|
assertTrue("getArtifactInstancesByTypeValue returned non-empty list for null value", instances.isEmpty());
|
||||||
|
} catch (EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
|
||||||
// Test getting instances with path that should produce results
|
// Test getting instances with path that should produce results
|
||||||
try {
|
try {
|
||||||
|
@ -0,0 +1,466 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2018 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.commonfilessearch;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import junit.framework.Test;
|
||||||
|
import org.netbeans.junit.NbModuleSuite;
|
||||||
|
import org.netbeans.junit.NbTestCase;
|
||||||
|
import org.openide.util.Exceptions;
|
||||||
|
import org.python.icu.impl.Assert;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
|
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
||||||
|
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher;
|
||||||
|
import org.sleuthkit.autopsy.commonfilesearch.AllIntraCaseCommonAttributeSearcher;
|
||||||
|
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
||||||
|
import org.sleuthkit.autopsy.commonfilesearch.SingleIntraCaseCommonAttributeSearcher;
|
||||||
|
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseUtils.*;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestJobSettings.IngestType;
|
||||||
|
import org.sleuthkit.autopsy.ingest.IngestModuleTemplate;
|
||||||
|
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeIdModuleFactory;
|
||||||
|
import org.sleuthkit.autopsy.modules.hashdatabase.HashLookupModuleFactory;
|
||||||
|
import org.sleuthkit.autopsy.testutils.IngestUtils;
|
||||||
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add set 1, set 2, set 3, and set 4 to case and ingest with hash algorithm.
|
||||||
|
*/
|
||||||
|
public class IngestedWithHashAndFileType extends NbTestCase {
|
||||||
|
|
||||||
|
public static Test suite() {
|
||||||
|
NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithHashAndFileType.class).
|
||||||
|
clusters(".*").
|
||||||
|
enableModules(".*");
|
||||||
|
return conf.suite();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final IntraCaseUtils utils;
|
||||||
|
|
||||||
|
public IngestedWithHashAndFileType(String name) {
|
||||||
|
super(name);
|
||||||
|
|
||||||
|
this.utils = new IntraCaseUtils(this, "IngestedWithHashAndFileTypeTests");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUp() {
|
||||||
|
this.utils.setUp();
|
||||||
|
|
||||||
|
IngestModuleTemplate hashLookupTemplate = IngestUtils.getIngestModuleTemplate(new HashLookupModuleFactory());
|
||||||
|
IngestModuleTemplate mimeTypeLookupTemplate = IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory());
|
||||||
|
|
||||||
|
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
|
||||||
|
templates.add(hashLookupTemplate);
|
||||||
|
templates.add(mimeTypeLookupTemplate);
|
||||||
|
|
||||||
|
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestedWithHashAndFileType.class.getCanonicalName(), IngestType.FILES_ONLY, templates);
|
||||||
|
|
||||||
|
try {
|
||||||
|
IngestUtils.runIngestJob(Case.getCurrentCaseThrows().getDataSources(), ingestJobSettings);
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tearDown() {
|
||||||
|
this.utils.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find all matches & all file types. Confirm file.jpg is found on all three
|
||||||
|
* and file.docx is found on two.
|
||||||
|
*/
|
||||||
|
public void testOneA() {
|
||||||
|
try {
|
||||||
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
|
||||||
|
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false);
|
||||||
|
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
||||||
|
|
||||||
|
Map<Long, String> objectIdToDataSource = IntraCaseUtils.mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
|
List<AbstractFile> files = IntraCaseUtils.getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 2));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET1, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find all matches & only image types. Confirm file.jpg is found on all
|
||||||
|
* three.
|
||||||
|
*/
|
||||||
|
public void testOneB() {
|
||||||
|
try {
|
||||||
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
|
||||||
|
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, true, false);
|
||||||
|
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
||||||
|
|
||||||
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
|
List<AbstractFile> files = getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 2));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find all matches & only image types. Confirm file.jpg is found on all
|
||||||
|
* three.
|
||||||
|
*/
|
||||||
|
public void testOneC() {
|
||||||
|
try {
|
||||||
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
|
||||||
|
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, true);
|
||||||
|
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
||||||
|
|
||||||
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
|
List<AbstractFile> files = getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET1, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find matches on set 1 & all file types. Confirm same results.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void testTwoA() {
|
||||||
|
try {
|
||||||
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
Long first = getDataSourceIdByName(SET1, dataSources);
|
||||||
|
|
||||||
|
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, false);
|
||||||
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
|
List<AbstractFile> files = getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 2));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET1, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find matches on set 1 & only media types. Confirm same results.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void testTwoB() {
|
||||||
|
try {
|
||||||
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
Long first = getDataSourceIdByName(SET1, dataSources);
|
||||||
|
|
||||||
|
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, true, false);
|
||||||
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
|
List<AbstractFile> files = getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 2));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find matches on set 1 & all file types. Confirm same results.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void testTwoC() {
|
||||||
|
try {
|
||||||
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
Long first = getDataSourceIdByName(SET1, dataSources);
|
||||||
|
|
||||||
|
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, true);
|
||||||
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
|
List<AbstractFile> files = getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET1, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find matches on set 2 & all file types: Confirm file.jpg.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void testThree() {
|
||||||
|
try {
|
||||||
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
Long second = getDataSourceIdByName(SET2, dataSources);
|
||||||
|
|
||||||
|
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(second, dataSources, false, false);
|
||||||
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
|
List<AbstractFile> files = getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 2));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find matches on set 4 & all file types: Confirm nothing is found.
|
||||||
|
*/
|
||||||
|
public void testFour() {
|
||||||
|
try {
|
||||||
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
Long last = getDataSourceIdByName(SET4, dataSources);
|
||||||
|
|
||||||
|
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(last, dataSources, false, false);
|
||||||
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
|
List<AbstractFile> files = getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find matches on set 3 & all file types: Confirm file.jpg and file.docx.
|
||||||
|
*/
|
||||||
|
public void testFive() {
|
||||||
|
try {
|
||||||
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
Long third = getDataSourceIdByName(SET3, dataSources);
|
||||||
|
|
||||||
|
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(third, dataSources, false, false);
|
||||||
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
|
List<AbstractFile> files = getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 2));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET1, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET3, 1));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, DOC, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, PDF, SET4, 0));
|
||||||
|
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET1, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET2, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
|
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -19,21 +19,17 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.commonfilessearch;
|
package org.sleuthkit.autopsy.commonfilessearch;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import org.netbeans.junit.NbModuleSuite;
|
import org.netbeans.junit.NbModuleSuite;
|
||||||
import org.netbeans.junit.NbTestCase;
|
import org.netbeans.junit.NbTestCase;
|
||||||
import org.openide.util.Exceptions;
|
import org.openide.util.Exceptions;
|
||||||
import org.python.icu.impl.Assert;
|
import org.python.icu.impl.Assert;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher;
|
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.AllInterCaseCommonAttributeSearcher;
|
import org.sleuthkit.autopsy.commonfilesearch.AllInterCaseCommonAttributeSearcher;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.SingleInterCaseCommonAttributeSearcher;
|
|
||||||
import static org.sleuthkit.autopsy.commonfilessearch.InterCaseTestUtils.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests with case 3 as the current case.
|
|
||||||
*
|
|
||||||
* If I use the search all cases option: One node for Hash A (1_1_A.jpg,
|
* If I use the search all cases option: One node for Hash A (1_1_A.jpg,
|
||||||
* 1_2_A.jpg, 3_1_A.jpg) If I search for matches only in Case 1: One node for
|
* 1_2_A.jpg, 3_1_A.jpg) If I search for matches only in Case 1: One node for
|
||||||
* Hash A (1_1_A.jpg, 1_2_A.jpg, 3_1_A.jpg) If I search for matches only in Case
|
* Hash A (1_1_A.jpg, 1_2_A.jpg, 3_1_A.jpg) If I search for matches only in Case
|
||||||
@ -42,8 +38,10 @@ import static org.sleuthkit.autopsy.commonfilessearch.InterCaseTestUtils.*;
|
|||||||
*/
|
*/
|
||||||
public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
|
public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
|
||||||
|
|
||||||
private final InterCaseTestUtils utils;
|
private final InterCaseUtils utils;
|
||||||
|
|
||||||
|
private Case currentCase;
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithHashAndFileTypeInterCaseTests.class).
|
NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithHashAndFileTypeInterCaseTests.class).
|
||||||
clusters(".*").
|
clusters(".*").
|
||||||
@ -53,7 +51,7 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
|
|||||||
|
|
||||||
public IngestedWithHashAndFileTypeInterCaseTests(String name) {
|
public IngestedWithHashAndFileTypeInterCaseTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
this.utils = new InterCaseTestUtils(this);
|
this.utils = new InterCaseUtils(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,7 +59,7 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
|
|||||||
this.utils.clearTestDir();
|
this.utils.clearTestDir();
|
||||||
try {
|
try {
|
||||||
this.utils.enableCentralRepo();
|
this.utils.enableCentralRepo();
|
||||||
this.utils.createCases(this.utils.getIngestSettingsForHashAndFileType(), InterCaseTestUtils.CASE3);
|
this.currentCase = this.utils.createCases(this.utils.getIngestSettingsForHashAndFileType(), InterCaseUtils.CASE3);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
@ -70,107 +68,24 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tearDown(){
|
public void tearDown(){
|
||||||
this.utils.clearTestDir();
|
|
||||||
this.utils.tearDown();
|
this.utils.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search All cases with no file type filtering.
|
* Search All
|
||||||
|
*
|
||||||
|
* One node for Hash A (1_1_A.jpg, 1_2_A.jpg, 3_1_A.jpg)
|
||||||
*/
|
*/
|
||||||
public void testOne() {
|
public void testOne() {
|
||||||
try {
|
try {
|
||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
|
||||||
|
|
||||||
//note that the params false and false are presently meaningless because that feature is not supported yet
|
AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(false, false);
|
||||||
AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(dataSources, false, false);
|
|
||||||
|
|
||||||
CommonAttributeSearchResults metadata = builder.findFiles();
|
CommonAttributeSearchResults metadata = builder.findFiles();
|
||||||
|
|
||||||
assertTrue("Results should not be empty", metadata.size() != 0);
|
assertTrue("Results should not be empty", metadata.size() != 0);
|
||||||
|
|
||||||
//case 1 data set 1
|
//assertTrue("")
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_0_DAT, CASE1_DATASET_1, CASE1, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE1_DATASET_1, CASE1, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE1_DATASET_1, CASE1, 1));
|
|
||||||
|
|
||||||
//case 1 data set 2
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_0_DAT, CASE1_DATASET_2, CASE1, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE1_DATASET_2, CASE1, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE1_DATASET_2, CASE1, 1));
|
|
||||||
|
|
||||||
//case 2 data set 1
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_B_PDF, CASE2_DATASET_1, CASE2, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_B_JPG, CASE2_DATASET_1, CASE2, 0));
|
|
||||||
|
|
||||||
//case 2 data set 2
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE2_DATASET_2, CASE2, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE2_DATASET_2, CASE2, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_DOC, CASE2_DATASET_2, CASE2, 1));
|
|
||||||
|
|
||||||
//case 3 data set 1
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE3_DATASET_1, CASE3, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE3_DATASET_1, CASE3, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_JPG, CASE3_DATASET_1, CASE3, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_PDF, CASE3_DATASET_1, CASE3, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_JPG, CASE3_DATASET_1, CASE3, 0));
|
|
||||||
|
|
||||||
//case 3 data set 2
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_JPG, CASE3_DATASET_2, CASE3, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_PDF, CASE3_DATASET_2, CASE3, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3, 1));
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
Exceptions.printStackTrace(ex);
|
|
||||||
Assert.fail(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Search All cases with no file type filtering.
|
|
||||||
*/
|
|
||||||
public void testTwo() {
|
|
||||||
try {
|
|
||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
|
||||||
|
|
||||||
int matchesMustAlsoBeFoundInThisCase = this.utils.getCaseMap().get(CASE2);
|
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher builder = new SingleInterCaseCommonAttributeSearcher(matchesMustAlsoBeFoundInThisCase, dataSources, false, false);
|
|
||||||
|
|
||||||
CommonAttributeSearchResults metadata = builder.findFiles();
|
|
||||||
|
|
||||||
assertTrue("Results should not be empty", metadata.size() != 0);
|
|
||||||
|
|
||||||
//case 1 data set 1
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_0_DAT, CASE1_DATASET_1, CASE1, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE1_DATASET_1, CASE1, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE1_DATASET_1, CASE1, 1));
|
|
||||||
|
|
||||||
//case 1 data set 2
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_0_DAT, CASE1_DATASET_2, CASE1, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE1_DATASET_2, CASE1, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE1_DATASET_2, CASE1, 1));
|
|
||||||
|
|
||||||
//case 2 data set 1
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_B_PDF, CASE2_DATASET_1, CASE2, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_B_JPG, CASE2_DATASET_1, CASE2, 0));
|
|
||||||
|
|
||||||
//case 2 data set 2
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE2_DATASET_2, CASE2, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE2_DATASET_2, CASE2, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_DOC, CASE2_DATASET_2, CASE2, 1));
|
|
||||||
|
|
||||||
//case 3 data set 1
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE3_DATASET_1, CASE3, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE3_DATASET_1, CASE3, 1));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_JPG, CASE3_DATASET_1, CASE3, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_PDF, CASE3_DATASET_1, CASE3, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_JPG, CASE3_DATASET_1, CASE3, 0));
|
|
||||||
|
|
||||||
//case 3 data set 2
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_JPG, CASE3_DATASET_2, CASE3, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_PDF, CASE3_DATASET_2, CASE3, 0));
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3, 1));
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.commonfilessearch;
|
package org.sleuthkit.autopsy.commonfilessearch;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -30,12 +29,11 @@ import org.openide.util.Exceptions;
|
|||||||
import org.python.icu.impl.Assert;
|
import org.python.icu.impl.Assert;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher;
|
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.AllIntraCaseCommonAttributeSearcher;
|
import org.sleuthkit.autopsy.commonfilesearch.AllIntraCaseCommonAttributeSearcher;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
||||||
|
import org.sleuthkit.autopsy.commonfilesearch.IntraCaseCommonAttributeSearcher;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.SingleIntraCaseCommonAttributeSearcher;
|
import org.sleuthkit.autopsy.commonfilesearch.SingleIntraCaseCommonAttributeSearcher;
|
||||||
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseTestUtils.*;
|
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseUtils.*;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
|
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestJobSettings.IngestType;
|
import org.sleuthkit.autopsy.ingest.IngestJobSettings.IngestType;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestModuleTemplate;
|
import org.sleuthkit.autopsy.ingest.IngestModuleTemplate;
|
||||||
@ -57,12 +55,12 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
return conf.suite();
|
return conf.suite();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final IntraCaseTestUtils utils;
|
private final IntraCaseUtils utils;
|
||||||
|
|
||||||
public IngestedWithHashAndFileTypeIntraCaseTests(String name) {
|
public IngestedWithHashAndFileTypeIntraCaseTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
this.utils = new IntraCaseTestUtils(this, "IngestedWithHashAndFileTypeTests");
|
this.utils = new IntraCaseUtils(this, "IngestedWithHashAndFileTypeTests");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -99,12 +97,12 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
try {
|
try {
|
||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false);
|
IntraCaseCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false);
|
||||||
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = IntraCaseTestUtils.mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = IntraCaseUtils.mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
List<AbstractFile> files = IntraCaseTestUtils.getFiles(objectIdToDataSource.keySet());
|
List<AbstractFile> files = IntraCaseUtils.getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 2));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET1, 2));
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 1));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, IMG, SET2, 1));
|
||||||
@ -126,7 +124,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
@ -140,7 +138,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
try {
|
try {
|
||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, true, false);
|
IntraCaseCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, true, false);
|
||||||
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
@ -167,7 +165,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
@ -181,7 +179,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
try {
|
try {
|
||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, true);
|
IntraCaseCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, true);
|
||||||
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
@ -208,7 +206,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
@ -223,7 +221,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
Long first = getDataSourceIdByName(SET1, dataSources);
|
Long first = getDataSourceIdByName(SET1, dataSources);
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, false);
|
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, false);
|
||||||
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
@ -250,7 +248,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
@ -265,7 +263,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
Long first = getDataSourceIdByName(SET1, dataSources);
|
Long first = getDataSourceIdByName(SET1, dataSources);
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, true, false);
|
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, true, false);
|
||||||
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
@ -292,7 +290,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
@ -307,7 +305,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
Long first = getDataSourceIdByName(SET1, dataSources);
|
Long first = getDataSourceIdByName(SET1, dataSources);
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, true);
|
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, true);
|
||||||
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
@ -334,7 +332,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
@ -349,7 +347,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
Long second = getDataSourceIdByName(SET2, dataSources);
|
Long second = getDataSourceIdByName(SET2, dataSources);
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(second, dataSources, false, false);
|
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(second, dataSources, false, false);
|
||||||
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
@ -376,7 +374,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
@ -390,7 +388,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
Long last = getDataSourceIdByName(SET4, dataSources);
|
Long last = getDataSourceIdByName(SET4, dataSources);
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(last, dataSources, false, false);
|
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(last, dataSources, false, false);
|
||||||
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
@ -417,7 +415,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
@ -431,7 +429,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
Long third = getDataSourceIdByName(SET3, dataSources);
|
Long third = getDataSourceIdByName(SET3, dataSources);
|
||||||
|
|
||||||
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(third, dataSources, false, false);
|
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(third, dataSources, false, false);
|
||||||
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
|
||||||
@ -458,7 +456,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
|
|||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET3, 0));
|
||||||
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
assertTrue(verifyInstanceExistanceAndCount(files, objectIdToDataSource, EMPTY, SET4, 0));
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
} catch (Exception ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
|
@ -59,12 +59,12 @@ public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase {
|
|||||||
return conf.suite();
|
return conf.suite();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final IntraCaseTestUtils utils;
|
private final IntraCaseUtils utils;
|
||||||
|
|
||||||
public IngestedWithNoFileTypesIntraCaseTests(String name) {
|
public IngestedWithNoFileTypesIntraCaseTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
this.utils = new IntraCaseTestUtils(this, "IngestedWithNoFileTypes");
|
this.utils = new IntraCaseUtils(this, "IngestedWithNoFileTypes");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -102,9 +102,9 @@ public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase {
|
|||||||
IntraCaseCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, true, false);
|
IntraCaseCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, true, false);
|
||||||
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = IntraCaseTestUtils.mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = IntraCaseUtils.mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
List<AbstractFile> files = IntraCaseTestUtils.getFiles(objectIdToDataSource.keySet());
|
List<AbstractFile> files = IntraCaseUtils.getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
assertTrue(files.isEmpty());
|
assertTrue(files.isEmpty());
|
||||||
|
|
||||||
@ -121,14 +121,14 @@ public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase {
|
|||||||
public void testTwo() {
|
public void testTwo() {
|
||||||
try {
|
try {
|
||||||
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
Map<Long, String> dataSources = this.utils.getDataSourceMap();
|
||||||
Long third = IntraCaseTestUtils.getDataSourceIdByName(IntraCaseTestUtils.SET3, dataSources);
|
Long third = IntraCaseUtils.getDataSourceIdByName(IntraCaseUtils.SET3, dataSources);
|
||||||
|
|
||||||
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(third, dataSources, true, false);
|
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(third, dataSources, true, false);
|
||||||
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = IntraCaseTestUtils.mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = IntraCaseUtils.mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
List<AbstractFile> files = IntraCaseTestUtils.getFiles(objectIdToDataSource.keySet());
|
List<AbstractFile> files = IntraCaseUtils.getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
assertTrue(files.isEmpty());
|
assertTrue(files.isEmpty());
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this testFile except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
@ -25,6 +25,7 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -47,62 +48,50 @@ import org.sleuthkit.autopsy.testutils.IngestUtils;
|
|||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
import org.python.icu.impl.Assert;
|
import org.python.icu.impl.Assert;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeInstance;
|
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.CaseDBCommonAttributeInstanceNode;
|
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.CentralRepoCommonAttributeInstance;
|
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.CentralRepoCommonAttributeInstanceNode;
|
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.DataSourceLoader;
|
import org.sleuthkit.autopsy.commonfilesearch.DataSourceLoader;
|
||||||
|
import org.sleuthkit.autopsy.commonfilesearch.CaseDBCommonAttributeInstance;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValue;
|
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValue;
|
||||||
import org.sleuthkit.autopsy.datamodel.DisplayableItemNode;
|
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities for testing intercase correlation feature.
|
* Utilities for testing intercase correlation feature.
|
||||||
*
|
*
|
||||||
* This will be more useful when we add more flush out the intercase
|
|
||||||
* correlation features and need to add more tests. In particular,
|
|
||||||
* testing scenarios where we need different cases to be the current case
|
|
||||||
* will suggest that we create additional test classes, and we will want to
|
|
||||||
* import this utility in each new intercase test file.
|
|
||||||
*
|
|
||||||
* Description of Test Data:
|
* Description of Test Data:
|
||||||
(Note: files of the same name and extension are identical;
|
* (Note: files of the same name and extension are identical;
|
||||||
files of the same name and differing extension are not identical.)
|
* files of the same name and differing extension are not identical.)
|
||||||
|
*
|
||||||
Case 1
|
* Case 1
|
||||||
+Data Set 1
|
* +Data Set 1
|
||||||
- Hash-0.dat [testFile of size 0]
|
* - Hash-0.dat [file of size 0]
|
||||||
- Hash-A.jpg
|
* - Hash-A.jpg
|
||||||
- Hash-A.pdf
|
* - Hash-A.pdf
|
||||||
+Data Set2
|
* +Data Set2
|
||||||
- Hash-0.dat [testFile of size 0]
|
* - Hash-0.dat [file of size -0]
|
||||||
- Hash-A.jpg
|
* - Hash-A.jpg
|
||||||
- Hash-A.pdf
|
* - Hash-A.pdf
|
||||||
Case 2
|
* Case 2
|
||||||
+Data Set 1
|
* +Data Set 1
|
||||||
- Hash-B.jpg
|
* - Hash-A.jpg
|
||||||
- Hash-B.pdf
|
* - Hash-A.pdf
|
||||||
+Data Set 2
|
* +Data Set 2
|
||||||
- Hash-A.jpg
|
* - Hash-A.jpg
|
||||||
- Hash-A.pdf
|
* - Hash-A.pdf
|
||||||
- Hash_D.doc
|
* - Hash_D.doc
|
||||||
Case 3
|
* Case 3
|
||||||
+Data Set 1
|
* +Data Set 1
|
||||||
- Hash-A.jpg
|
* - Hash-A.jpg
|
||||||
- Hash-A.pdf
|
* - Hash-A.pdf
|
||||||
- Hash-C.jpg
|
* - Hash-C.jpg [we should never find these!]
|
||||||
- Hash-C.pdf
|
* - Hash-C.pdf [we should never find these!]
|
||||||
- Hash-D.jpg
|
* - Hash-D.jpg
|
||||||
+Data Set 2
|
* +Data Set 2
|
||||||
- Hash-C.jpg
|
* - Hash-C.jpg [we should never find these!]
|
||||||
- Hash-C.pdf
|
* - Hash-C.pdf
|
||||||
- Hash-D.doc
|
* - Hash.D-doc
|
||||||
*/
|
*/
|
||||||
class InterCaseTestUtils {
|
class InterCaseUtils {
|
||||||
|
|
||||||
private static final Path CASE_DIRECTORY_PATH = Paths.get(System.getProperty("java.io.tmpdir"), "InterCaseCommonFilesSearchTest");
|
private static final Path CASE_DIRECTORY_PATH = Paths.get(System.getProperty("java.io.tmpdir"), "InterCaseCommonFilesSearchTest");
|
||||||
private static final String CR_DB_NAME = "testcentralrepo.db";
|
private static final String CR_DB_NAME = "testcentralrepo.db";
|
||||||
@ -142,7 +131,7 @@ class InterCaseTestUtils {
|
|||||||
private final IngestJobSettings hashAndNoFileType;
|
private final IngestJobSettings hashAndNoFileType;
|
||||||
private final DataSourceLoader dataSourceLoader;
|
private final DataSourceLoader dataSourceLoader;
|
||||||
|
|
||||||
InterCaseTestUtils(NbTestCase testCase) {
|
InterCaseUtils(NbTestCase testCase) {
|
||||||
|
|
||||||
this.case1DataSet1Path = Paths.get(testCase.getDataDir().toString(), CASE1_DATASET_1);
|
this.case1DataSet1Path = Paths.get(testCase.getDataDir().toString(), CASE1_DATASET_1);
|
||||||
this.case1DataSet2Path = Paths.get(testCase.getDataDir().toString(), CASE1_DATASET_2);
|
this.case1DataSet2Path = Paths.get(testCase.getDataDir().toString(), CASE1_DATASET_2);
|
||||||
@ -162,13 +151,13 @@ class InterCaseTestUtils {
|
|||||||
hashAndMimeTemplate.add(mimeTypeLookupTemplate);
|
hashAndMimeTemplate.add(mimeTypeLookupTemplate);
|
||||||
hashAndMimeTemplate.add(eamDbTemplate);
|
hashAndMimeTemplate.add(eamDbTemplate);
|
||||||
|
|
||||||
this.hashAndFileType = new IngestJobSettings(InterCaseTestUtils.class.getCanonicalName(), IngestType.FILES_ONLY, hashAndMimeTemplate);
|
this.hashAndFileType = new IngestJobSettings(InterCaseUtils.class.getCanonicalName(), IngestType.FILES_ONLY, hashAndMimeTemplate);
|
||||||
|
|
||||||
ArrayList<IngestModuleTemplate> hashAndNoMimeTemplate = new ArrayList<>(1);
|
ArrayList<IngestModuleTemplate> hashAndNoMimeTemplate = new ArrayList<>(1);
|
||||||
hashAndNoMimeTemplate.add(hashLookupTemplate);
|
hashAndNoMimeTemplate.add(hashLookupTemplate);
|
||||||
hashAndMimeTemplate.add(eamDbTemplate);
|
hashAndMimeTemplate.add(eamDbTemplate);
|
||||||
|
|
||||||
this.hashAndNoFileType = new IngestJobSettings(InterCaseTestUtils.class.getCanonicalName(), IngestType.FILES_ONLY, hashAndNoMimeTemplate);
|
this.hashAndNoFileType = new IngestJobSettings(InterCaseUtils.class.getCanonicalName(), IngestType.FILES_ONLY, hashAndNoMimeTemplate);
|
||||||
|
|
||||||
this.dataSourceLoader = new DataSourceLoader();
|
this.dataSourceLoader = new DataSourceLoader();
|
||||||
}
|
}
|
||||||
@ -176,12 +165,8 @@ class InterCaseTestUtils {
|
|||||||
void clearTestDir(){
|
void clearTestDir(){
|
||||||
if(CASE_DIRECTORY_PATH.toFile().exists()){
|
if(CASE_DIRECTORY_PATH.toFile().exists()){
|
||||||
try{
|
try{
|
||||||
if(EamDb.isEnabled()) {
|
|
||||||
EamDb.getInstance().shutdownConnections();
|
|
||||||
}
|
|
||||||
FileUtils.deleteDirectory(CASE_DIRECTORY_PATH.toFile());
|
FileUtils.deleteDirectory(CASE_DIRECTORY_PATH.toFile());
|
||||||
} catch(IOException | EamDbException ex){
|
} catch(IOException ex){
|
||||||
Exceptions.printStackTrace(ex);
|
|
||||||
Assert.fail(ex);
|
Assert.fail(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,13 +177,13 @@ class InterCaseTestUtils {
|
|||||||
return this.dataSourceLoader.getDataSourceMap();
|
return this.dataSourceLoader.getDataSourceMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Integer> getCaseMap() throws EamDbException {
|
Map<Integer, String> getCaseMap() throws EamDbException {
|
||||||
|
|
||||||
if (EamDb.isEnabled()) {
|
if (EamDb.isEnabled()) {
|
||||||
Map<String, Integer> mapOfCaseIdsToCase = new HashMap<>();
|
Map<Integer, String> mapOfCaseIdsToCase = new HashMap<>();
|
||||||
|
|
||||||
for (CorrelationCase caze : EamDb.getInstance().getCases()) {
|
for (CorrelationCase caze : EamDb.getInstance().getCases()) {
|
||||||
mapOfCaseIdsToCase.put(caze.getDisplayName(), caze.getID());
|
mapOfCaseIdsToCase.put(caze.getID(), caze.getDisplayName());
|
||||||
}
|
}
|
||||||
return mapOfCaseIdsToCase;
|
return mapOfCaseIdsToCase;
|
||||||
} else {
|
} else {
|
||||||
@ -258,7 +243,7 @@ class InterCaseTestUtils {
|
|||||||
|
|
||||||
String lastCaseName = null;
|
String lastCaseName = null;
|
||||||
Path[] lastPathsForCase = null;
|
Path[] lastPathsForCase = null;
|
||||||
//iterate over the collections above, creating cases, and storing
|
//iterate over the collecitons above, creating cases, and storing
|
||||||
// just one of them for future reference
|
// just one of them for future reference
|
||||||
for (int i = 0; i < cases.length; i++) {
|
for (int i = 0; i < cases.length; i++) {
|
||||||
String caseName = cases[i];
|
String caseName = cases[i];
|
||||||
@ -304,71 +289,30 @@ class InterCaseTestUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO refactor
|
|
||||||
static boolean verifyInstanceExistanceAndCount(CommonAttributeSearchResults searchDomain, String fileName, String dataSource, String crCase, int instanceCount){
|
static boolean verifyInstanceExistanceAndCount(CommonAttributeSearchResults searchDomain, String fileName, String dataSource, String crCase, int instanceCount){
|
||||||
|
|
||||||
int tally = 0;
|
int tally = 0;
|
||||||
|
|
||||||
for(Map.Entry<Integer, List<CommonAttributeValue>> entry : searchDomain.getMetadata().entrySet()){
|
for(Map.Entry<Integer, List<CommonAttributeValue>> file : searchDomain.getMetadata().entrySet()){
|
||||||
|
|
||||||
for(CommonAttributeValue value : entry.getValue()){
|
//Collection<IntraCaseCommonAttributeSearchResults> fileInstances = file.getValue();
|
||||||
|
|
||||||
for(AbstractCommonAttributeInstance commonAttribute : value.getInstances()){
|
// for(IntraCaseCommonAttributeSearchResults fileInstance : fileInstances){
|
||||||
|
//
|
||||||
if(commonAttribute instanceof CentralRepoCommonAttributeInstance){
|
//
|
||||||
CentralRepoCommonAttributeInstance results = (CentralRepoCommonAttributeInstance) commonAttribute;
|
// }
|
||||||
for (DisplayableItemNode din : results.generateNodes()){
|
|
||||||
|
|
||||||
if(din instanceof CentralRepoCommonAttributeInstanceNode){
|
|
||||||
|
|
||||||
CentralRepoCommonAttributeInstanceNode node = (CentralRepoCommonAttributeInstanceNode) din;
|
|
||||||
CorrelationAttributeInstance instance = node.getCorrelationAttributeInstance();
|
|
||||||
|
|
||||||
final String fullPath = instance.getFilePath();
|
|
||||||
final File testFile = new File(fullPath);
|
|
||||||
|
|
||||||
final String testCaseName = instance.getCorrelationCase().getDisplayName();
|
|
||||||
|
|
||||||
final String testFileName = testFile.getName();
|
|
||||||
|
|
||||||
final String testDataSource = instance.getCorrelationDataSource().getName();
|
|
||||||
|
|
||||||
boolean sameFileName = testFileName.equalsIgnoreCase(fileName);
|
|
||||||
boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource);
|
|
||||||
boolean sameCrCase = testCaseName.equalsIgnoreCase(crCase);
|
|
||||||
|
|
||||||
if( sameFileName && sameDataSource && sameCrCase){
|
|
||||||
tally++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(din instanceof CaseDBCommonAttributeInstanceNode){
|
|
||||||
|
|
||||||
CaseDBCommonAttributeInstanceNode node = (CaseDBCommonAttributeInstanceNode) din;
|
|
||||||
AbstractFile file = node.getContent();
|
|
||||||
|
|
||||||
final String testFileName = file.getName();
|
|
||||||
final String testCaseName = node.getCase();
|
|
||||||
final String testDataSource = node.getDataSource();
|
|
||||||
|
|
||||||
boolean sameFileName = testFileName.equalsIgnoreCase(fileName);
|
|
||||||
boolean sameCaseName = testCaseName.equalsIgnoreCase(crCase);
|
|
||||||
boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource);
|
|
||||||
|
|
||||||
if(sameFileName && sameDataSource && sameCaseName){
|
|
||||||
tally++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Assert.fail("Unable to cast AbstractCommonAttributeInstanceNode to InterCaseCommonAttributeSearchResults.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tally == instanceCount;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Map<Long, String> mapFileInstancesToDataSource(CommonAttributeSearchResults metadata){
|
||||||
|
return IntraCaseUtils.mapFileInstancesToDataSources(metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static List<AbstractFile> getFiles(Set<String> md5s){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the currently open case, delete the case directory, delete the
|
* Close the currently open case, delete the case directory, delete the
|
@ -68,7 +68,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
* set 4
|
* set 4
|
||||||
* - file.dat (empty file)
|
* - file.dat (empty file)
|
||||||
*/
|
*/
|
||||||
class IntraCaseTestUtils {
|
class IntraCaseUtils {
|
||||||
|
|
||||||
private static final String CASE_NAME = "IntraCaseCommonFilesSearchTest";
|
private static final String CASE_NAME = "IntraCaseCommonFilesSearchTest";
|
||||||
static final Path CASE_DIRECTORY_PATH = Paths.get(System.getProperty("java.io.tmpdir"), CASE_NAME);
|
static final Path CASE_DIRECTORY_PATH = Paths.get(System.getProperty("java.io.tmpdir"), CASE_NAME);
|
||||||
@ -92,7 +92,7 @@ class IntraCaseTestUtils {
|
|||||||
|
|
||||||
private final String caseName;
|
private final String caseName;
|
||||||
|
|
||||||
IntraCaseTestUtils(NbTestCase nbTestCase, String caseName){
|
IntraCaseUtils(NbTestCase nbTestCase, String caseName){
|
||||||
this.imagePath1 = Paths.get(nbTestCase.getDataDir().toString(), SET1);
|
this.imagePath1 = Paths.get(nbTestCase.getDataDir().toString(), SET1);
|
||||||
this.imagePath2 = Paths.get(nbTestCase.getDataDir().toString(), SET2);
|
this.imagePath2 = Paths.get(nbTestCase.getDataDir().toString(), SET2);
|
||||||
this.imagePath3 = Paths.get(nbTestCase.getDataDir().toString(), SET3);
|
this.imagePath3 = Paths.get(nbTestCase.getDataDir().toString(), SET3);
|
@ -35,7 +35,7 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
|||||||
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher;
|
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.AllIntraCaseCommonAttributeSearcher;
|
import org.sleuthkit.autopsy.commonfilesearch.AllIntraCaseCommonAttributeSearcher;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
||||||
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseTestUtils.*;
|
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseUtils.*;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
|
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
|
||||||
import org.sleuthkit.autopsy.ingest.IngestModuleTemplate;
|
import org.sleuthkit.autopsy.ingest.IngestModuleTemplate;
|
||||||
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeIdModuleFactory;
|
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeIdModuleFactory;
|
||||||
@ -53,21 +53,21 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
*
|
*
|
||||||
* None of the test files should be found in the results of this test.
|
* None of the test files should be found in the results of this test.
|
||||||
*/
|
*/
|
||||||
public class MatchesInAtLeastTwoSourcesIntraCaseTests extends NbTestCase {
|
public class MatchesInAtLeastTwoSources extends NbTestCase {
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(MatchesInAtLeastTwoSourcesIntraCaseTests.class).
|
NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(MatchesInAtLeastTwoSources.class).
|
||||||
clusters(".*").
|
clusters(".*").
|
||||||
enableModules(".*");
|
enableModules(".*");
|
||||||
return conf.suite();
|
return conf.suite();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final IntraCaseTestUtils utils;
|
private final IntraCaseUtils utils;
|
||||||
|
|
||||||
public MatchesInAtLeastTwoSourcesIntraCaseTests(String name) {
|
public MatchesInAtLeastTwoSources(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
this.utils = new IntraCaseTestUtils(this, "MatchesInAtLeastTwoSources");
|
this.utils = new IntraCaseUtils(this, "MatchesInAtLeastTwoSources");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,7 +86,7 @@ public class MatchesInAtLeastTwoSourcesIntraCaseTests extends NbTestCase {
|
|||||||
templates.add(hashLookupTemplate);
|
templates.add(hashLookupTemplate);
|
||||||
templates.add(mimeTypeLookupTemplate);
|
templates.add(mimeTypeLookupTemplate);
|
||||||
|
|
||||||
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestedWithHashAndFileTypeIntraCaseTests.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates);
|
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestedWithHashAndFileType.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IngestUtils.runIngestJob(Case.getCurrentCaseThrows().getDataSources(), ingestJobSettings);
|
IngestUtils.runIngestJob(Case.getCurrentCaseThrows().getDataSources(), ingestJobSettings);
|
||||||
@ -108,18 +108,18 @@ public class MatchesInAtLeastTwoSourcesIntraCaseTests extends NbTestCase {
|
|||||||
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false);
|
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false);
|
||||||
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
|
||||||
|
|
||||||
Map<Long, String> objectIdToDataSource = IntraCaseTestUtils.mapFileInstancesToDataSources(metadata);
|
Map<Long, String> objectIdToDataSource = IntraCaseUtils.mapFileInstancesToDataSources(metadata);
|
||||||
|
|
||||||
List<AbstractFile> files = IntraCaseTestUtils.getFiles(objectIdToDataSource.keySet());
|
List<AbstractFile> files = IntraCaseUtils.getFiles(objectIdToDataSource.keySet());
|
||||||
|
|
||||||
assertTrue(IntraCaseTestUtils.verifyInstanceExistanceAndCount(files, dataSources, IMG, SET1, 0));
|
assertTrue(IntraCaseUtils.verifyInstanceExistanceAndCount(files, dataSources, IMG, SET1, 0));
|
||||||
assertTrue(IntraCaseTestUtils.verifyInstanceExistanceAndCount(files, dataSources, IMG, SET4, 0));
|
assertTrue(IntraCaseUtils.verifyInstanceExistanceAndCount(files, dataSources, IMG, SET4, 0));
|
||||||
|
|
||||||
assertTrue(IntraCaseTestUtils.verifyInstanceExistanceAndCount(files, dataSources, DOC, SET1, 0));
|
assertTrue(IntraCaseUtils.verifyInstanceExistanceAndCount(files, dataSources, DOC, SET1, 0));
|
||||||
assertTrue(IntraCaseTestUtils.verifyInstanceExistanceAndCount(files, dataSources, DOC, SET4, 0));
|
assertTrue(IntraCaseUtils.verifyInstanceExistanceAndCount(files, dataSources, DOC, SET4, 0));
|
||||||
|
|
||||||
assertTrue(IntraCaseTestUtils.verifyInstanceExistanceAndCount(files, dataSources, EMPTY, SET1, 0));
|
assertTrue(IntraCaseUtils.verifyInstanceExistanceAndCount(files, dataSources, EMPTY, SET1, 0));
|
||||||
assertTrue(IntraCaseTestUtils.verifyInstanceExistanceAndCount(files, dataSources, EMPTY, SET4, 0));
|
assertTrue(IntraCaseUtils.verifyInstanceExistanceAndCount(files, dataSources, EMPTY, SET4, 0));
|
||||||
|
|
||||||
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
Exceptions.printStackTrace(ex);
|
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2018 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.commonfilessearch;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import org.netbeans.junit.NbModuleSuite;
|
||||||
|
import org.netbeans.junit.NbTestCase;
|
||||||
|
import org.openide.util.Exceptions;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
import org.python.icu.impl.Assert;
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher;
|
||||||
|
import org.sleuthkit.autopsy.commonfilesearch.AllInterCaseCommonAttributeSearcher;
|
||||||
|
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Just make sure nothing explodes when we run the feature in the absence of
|
||||||
|
* the Central Repo. This should be considered 'defensive' as it should not be
|
||||||
|
* possible to even run the feature if the CR is not available.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class NoCentralRepoEnabledInterCaseTests extends NbTestCase {
|
||||||
|
|
||||||
|
private final InterCaseUtils utils;
|
||||||
|
|
||||||
|
private Case currentCase;
|
||||||
|
|
||||||
|
public static Test suite() {
|
||||||
|
NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(NoCentralRepoEnabledInterCaseTests.class).
|
||||||
|
clusters(".*").
|
||||||
|
enableModules(".*");
|
||||||
|
return conf.suite();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoCentralRepoEnabledInterCaseTests(String name) {
|
||||||
|
super(name);
|
||||||
|
this.utils = new InterCaseUtils(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setUp() {
|
||||||
|
try {
|
||||||
|
this.currentCase = this.utils.createCases(this.utils.getIngestSettingsForHashAndFileType(), InterCaseUtils.CASE1);
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tearDown() {
|
||||||
|
this.utils.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testOne() {
|
||||||
|
try {
|
||||||
|
AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(false, false);
|
||||||
|
|
||||||
|
CommonAttributeSearchResults metadata = builder.findFiles();
|
||||||
|
|
||||||
|
assertTrue("Should be no results.", metadata.size() == 0);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Exceptions.printStackTrace(ex);
|
||||||
|
Assert.fail(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -30,8 +30,8 @@ import org.sleuthkit.autopsy.commonfilesearch.AllIntraCaseCommonAttributeSearche
|
|||||||
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.IntraCaseCommonAttributeSearcher;
|
import org.sleuthkit.autopsy.commonfilesearch.IntraCaseCommonAttributeSearcher;
|
||||||
import org.sleuthkit.autopsy.commonfilesearch.SingleIntraCaseCommonAttributeSearcher;
|
import org.sleuthkit.autopsy.commonfilesearch.SingleIntraCaseCommonAttributeSearcher;
|
||||||
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseTestUtils.SET1;
|
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseUtils.SET1;
|
||||||
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseTestUtils.getDataSourceIdByName;
|
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseUtils.getDataSourceIdByName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that cases which are created but have not run any ingest modules turn up
|
* Test that cases which are created but have not run any ingest modules turn up
|
||||||
@ -51,12 +51,12 @@ public class UningestedCasesIntraCaseTests extends NbTestCase {
|
|||||||
return conf.suite();
|
return conf.suite();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final IntraCaseTestUtils utils;
|
private final IntraCaseUtils utils;
|
||||||
|
|
||||||
public UningestedCasesIntraCaseTests(String name) {
|
public UningestedCasesIntraCaseTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
this.utils = new IntraCaseTestUtils(this, "UningestedCasesTests");
|
this.utils = new IntraCaseUtils(this, "UningestedCasesTests");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user