Skip to content

Commit

Permalink
sepinf-inc#1631: Consider ufed:id in ReferencedBy table and selection
Browse files Browse the repository at this point in the history
  • Loading branch information
aberenguel committed Aug 16, 2024
1 parent c9b0415 commit 0fde4ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
package iped.app.ui;

import java.util.Arrays;
import java.util.Objects;
import java.util.stream.Collectors;

import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;

import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.document.Document;

import iped.data.IItem;
Expand Down Expand Up @@ -74,7 +76,12 @@ public void listItems(Document doc) {
String sha1 = doc.get(HashTask.HASH.SHA1.toString());
String sha256 = doc.get(HashTask.HASH.SHA256.toString());
String edonkey = doc.get(HashTask.HASH.EDONKEY.toString());
String hashes = Arrays.asList(md5, sha1, sha256, edonkey).stream().filter(a -> a != null).collect(Collectors.joining(" "));
String ufedId = doc.get(ExtraProperties.UFED_META_PREFIX + "id");
if (StringUtils.isNotBlank(ufedId)) {
ufedId = "\"" + ufedId + "\"";
}

String hashes = Arrays.asList(md5, sha1, sha256, edonkey).stream().filter(Objects::nonNull).collect(Collectors.joining(" "));

if (hashes.isEmpty()) {
results = new LuceneSearchResult(0);
Expand Down
9 changes: 7 additions & 2 deletions iped-app/src/main/java/iped/app/ui/ResultTableListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.text.Collator;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
Expand All @@ -42,6 +43,7 @@
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause.Occur;
Expand Down Expand Up @@ -527,8 +529,11 @@ private void selectReferencedByItems(boolean state, IItemId rootId) {
String sha1 = doc.get(HashTask.HASH.SHA1.toString());
String sha256 = doc.get(HashTask.HASH.SHA256.toString());
String edonkey = doc.get(HashTask.HASH.EDONKEY.toString());
String hashes = Arrays.asList(md5, sha1, sha256, edonkey).stream().filter(a -> a != null)
.collect(Collectors.joining(" "));
String ufedId = doc.get(ExtraProperties.UFED_META_PREFIX + "id");
if (StringUtils.isNotBlank(ufedId)) {
ufedId = "\"" + ufedId + "\"";
}
String hashes = Arrays.asList(md5, sha1, sha256, edonkey).stream().filter(Objects::nonNull).collect(Collectors.joining(" "));

if (hashes.isEmpty()) {
return;
Expand Down

0 comments on commit 0fde4ba

Please sign in to comment.