mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
pulled the two subclasses into their own files
This commit is contained in:
parent
bcfa75c5f9
commit
9fb65e6ff2
@ -0,0 +1,39 @@
|
||||
/*
|
||||
*
|
||||
* 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.commonfilesearch;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Provides logic for selecting common files from all data sources.
|
||||
*/
|
||||
class AllDataSources extends CommonFilesMetaDataBuilder {
|
||||
|
||||
private static final String WHERE_CLAUSE = "md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) order by md5";
|
||||
|
||||
public AllDataSources(Map<Long, String> dataSourceIdMap) {
|
||||
super(dataSourceIdMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String buildSqlWhereClause() {
|
||||
return AllDataSources.WHERE_CLAUSE;
|
||||
}
|
||||
}
|
@ -43,7 +43,6 @@ import org.sleuthkit.datamodel.TskCoreException;
|
||||
abstract class CommonFilesMetaDataBuilder {
|
||||
|
||||
private final Map<Long, String> dataSourceIdToNameMap;
|
||||
//TODO subclass this class to specify where clause and/or additional algorithms.
|
||||
|
||||
CommonFilesMetaDataBuilder(Map<Long, String> dataSourceIdMap) {
|
||||
dataSourceIdToNameMap = dataSourceIdMap;
|
||||
@ -119,36 +118,4 @@ abstract class CommonFilesMetaDataBuilder {
|
||||
List<AbstractFile> files = sleuthkitCase.findAllFilesWhere(whereClause);
|
||||
return files;
|
||||
}
|
||||
}
|
||||
|
||||
class SingleDataSource extends CommonFilesMetaDataBuilder {
|
||||
|
||||
private static final String allDataSourcesWhereClause = "md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) order by md5";
|
||||
|
||||
private final Long selectedDataSourceId;
|
||||
|
||||
public SingleDataSource(Long dataSourceId, Map<Long, String> dataSourceIdMap) {
|
||||
super(dataSourceIdMap);
|
||||
this.selectedDataSourceId = dataSourceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String buildSqlWhereClause() {
|
||||
Object[] args = new String[]{Long.toString(this.selectedDataSourceId), Long.toString(this.selectedDataSourceId)};
|
||||
return String.format(SingleDataSource.allDataSourcesWhereClause, args);
|
||||
}
|
||||
}
|
||||
|
||||
class AllDataSources extends CommonFilesMetaDataBuilder {
|
||||
|
||||
private static final String singleDataSourceWhereClause = "md5 in (select md5 from tsk_files where data_source_obj_id=%s and (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) AND data_source_obj_id=%s order by md5";
|
||||
|
||||
public AllDataSources(Map<Long, String> dataSourceIdMap) {
|
||||
super(dataSourceIdMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String buildSqlWhereClause() {
|
||||
return AllDataSources.singleDataSourceWhereClause;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
*
|
||||
* 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.commonfilesearch;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Provides logic for selecting common files from a single data source.
|
||||
*/
|
||||
class SingleDataSource extends CommonFilesMetaDataBuilder {
|
||||
|
||||
private static final String WHERE_CLAUSE = "md5 in (select md5 from tsk_files where data_source_obj_id=%s and (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) AND data_source_obj_id=%s order by md5";
|
||||
private final Long selectedDataSourceId;
|
||||
|
||||
public SingleDataSource(Long dataSourceId, Map<Long, String> dataSourceIdMap) {
|
||||
super(dataSourceIdMap);
|
||||
this.selectedDataSourceId = dataSourceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String buildSqlWhereClause() {
|
||||
Object[] args = new String[]{Long.toString(this.selectedDataSourceId), Long.toString(this.selectedDataSourceId)};
|
||||
return String.format(SingleDataSource.WHERE_CLAUSE, args);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user