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 {
45 static List<AbstractFile> findFilesByMd5(String md5Hash) {
46 final Case currentCase = Case.getCurrentCase();
47 final SleuthkitCase skCase = currentCase.getSleuthkitCase();
48 return skCase.findFilesByMd5(md5Hash);
59 static Map<String, List<AbstractFile>> findFilesBymd5(List<String> md5Hash) {
60 Map<String, List<AbstractFile>> map =
new LinkedHashMap<String, List<AbstractFile>>();
61 for (String md5 : md5Hash) {
62 List<AbstractFile> files = findFilesByMd5(md5);
63 if (!files.isEmpty()) {
72 static Map<String, List<AbstractFile>> findFilesBymd5(List<String> md5Hash, ProgressHandle progress, SwingWorker<Object, Void> worker) {
73 Map<String, List<AbstractFile>> map =
new LinkedHashMap<String, List<AbstractFile>>();
74 if (!worker.isCancelled()) {
75 progress.switchToDeterminate(md5Hash.size());
77 for (String md5 : md5Hash) {
78 if (worker.isCancelled()) {
81 List<AbstractFile> files = findFilesByMd5(md5);
82 if (!files.isEmpty()) {
86 if (!worker.isCancelled()) {
87 progress.progress(size);
102 static List<AbstractFile> findFiles(FsContent file) {
104 if ((md5 = file.getMd5Hash()) != null) {
105 return findFilesByMd5(md5);
107 return Collections.<AbstractFile>emptyList();
117 static boolean allFilesMd5Hashed() {
118 final Case currentCase = Case.getCurrentCase();
119 final SleuthkitCase skCase = currentCase.getSleuthkitCase();
120 return skCase.allFilesMd5Hashed();
128 static int countFilesMd5Hashed() {
129 final Case currentCase = Case.getCurrentCase();
130 final SleuthkitCase skCase = currentCase.getSleuthkitCase();
131 return skCase.countFilesMd5Hashed();