19 package org.sleuthkit.autopsy.modules.hashdatabase;
21 import java.util.Collections;
22 import java.util.LinkedHashMap;
23 import java.util.List;
25 import javax.swing.SwingWorker;
26 import org.netbeans.api.progress.ProgressHandle;
36 class HashDbSearcher {
43 static List<AbstractFile> findFilesByMd5(String md5Hash) {
44 final Case currentCase = Case.getCurrentCase();
45 final SleuthkitCase skCase = currentCase.getSleuthkitCase();
55 static Map<String, List<AbstractFile>> findFilesBymd5(List<String> md5Hash) {
56 Map<String, List<AbstractFile>> map =
new LinkedHashMap<String, List<AbstractFile>>();
57 for(String md5 : md5Hash) {
58 List<AbstractFile> files = findFilesByMd5(md5);
59 if(!files.isEmpty()) {
66 static Map<String, List<AbstractFile>> findFilesBymd5(List<String> md5Hash, ProgressHandle progress, SwingWorker<Object,Void> worker) {
67 Map<String, List<AbstractFile>> map =
new LinkedHashMap<String, List<AbstractFile>>();
68 if(!worker.isCancelled()) {
69 progress.switchToDeterminate(md5Hash.size());
71 for(String md5 : md5Hash) {
72 if(worker.isCancelled()) {
75 List<AbstractFile> files = findFilesByMd5(md5);
76 if(!files.isEmpty()) {
80 if(!worker.isCancelled()) {
81 progress.progress(size);
94 static List<AbstractFile> findFiles(FsContent file) {
96 if((md5 = file.getMd5Hash()) != null) {
97 return findFilesByMd5(md5);
99 return Collections.<AbstractFile>emptyList();
108 static boolean allFilesMd5Hashed() {
109 final Case currentCase = Case.getCurrentCase();
110 final SleuthkitCase skCase = currentCase.getSleuthkitCase();
111 return skCase.allFilesMd5Hashed();
118 static int countFilesMd5Hashed() {
119 final Case currentCase = Case.getCurrentCase();
120 final SleuthkitCase skCase = currentCase.getSleuthkitCase();
121 return skCase.countFilesMd5Hashed();
List< AbstractFile > findFilesByMd5(String md5Hash)