Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions iped-api/src/main/java/iped/properties/ExtraProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ public class ExtraProperties {

public static final String FACE_AGE_LABELS = "faceAge:labels";

public static final String HASHDB_PREFIX = "hashDb:";
public static final String STATUS_PROPERTY = "status";
public static final String SET_PROPERTY = "set";
public static final String HASHDB_STATUS = HASHDB_PREFIX + STATUS_PROPERTY;
public static final String HASHDB_SET = HASHDB_PREFIX + SET_PROPERTY;

/**
* Property to be set if the evidence is a animated image (i.e. contain multiple
* frames). Only set if the number of frames is greater than one.
Expand Down
2 changes: 1 addition & 1 deletion iped-app/resources/config/conf/HashDBLookupConfig.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Excludes from the rest of processing (and from the case) known files according to hashes database (hash:status = known).
# Excludes from the rest of processing (and from the case) known files according to hashes database (hashDb:status = known).
excludeKnown = false
4 changes: 2 additions & 2 deletions iped-app/resources/config/conf/metadataTypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1811,8 +1811,8 @@ fileFragment = java.lang.Boolean
fileSystemId = java.lang.String
format-detection = java.lang.String
googlebot = java.lang.String
hash:set = java.lang.String
hash:status = java.lang.String
hashDb:set = java.lang.String
hashDb:status = java.lang.String
hasSubitem = java.lang.String
hasThumb = java.lang.Boolean
html:"Content-Type" = java.lang.String
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
excludeKnown = true

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void updateDinamicFields() {
regexFields.add(f);
else if (f.startsWith(LanguageDetectTask.LANGUAGE_PREFIX))
languageFields.add(f);
else if (f.startsWith(HashDBLookupTask.ATTRIBUTES_PREFIX)
else if (f.startsWith(ExtraProperties.HASHDB_PREFIX)
|| f.startsWith(PhotoDNALookup.PHOTO_DNA_HIT_PREFIX))
hashDbFields.add(f);
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.sqlite.SQLiteConfig.JournalMode;
import org.sqlite.SQLiteConfig.SynchronousMode;

import iped.properties.ExtraProperties;
import iped.utils.HashValue;

public class HashDBDataSource {
Expand All @@ -40,8 +41,8 @@ public class HashDBDataSource {
public static final String photoDna = "photoDna";
private static final int photoDnaBase64Len = 192;

private static final String propertySet = "set";
private static final String propertyStatus = "status";
private static final String propertySet = ExtraProperties.SET_PROPERTY;
private static final String propertyStatus = ExtraProperties.STATUS_PROPERTY;
private static final String pedoStatus = "pedo";

public HashDBDataSource(File dbFile) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private void processMonitorTimeout(IItem evidence) throws Exception {
}

/**
* Indica se itens ignorados (hash:status = ignore), devem ser processados pela
* Indica se itens ignorados (hashDb:status = known), devem ser processados pela
* tarefa ou não. O valor padrão é false, assim itens ignorados não são
* processados pelas tarefas seguintes. Tarefas específicas podem sobrescrever
* esse comportamento.
Expand Down
10 changes: 4 additions & 6 deletions iped-engine/src/main/java/iped/engine/task/HashDBLookupTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@
import iped.engine.hashdb.HashDBDataSource;
import iped.parsers.util.ChildPornHashLookup;
import iped.parsers.util.ChildPornHashLookup.LookupProvider;
import iped.properties.ExtraProperties;

public class HashDBLookupTask extends AbstractTask {

public static final String ATTRIBUTES_PREFIX = "hashDb:";
private static final String STATUS_PROPERTY = "status";
public static final String STATUS_ATTRIBUTE = ATTRIBUTES_PREFIX + STATUS_PROPERTY;
public static final String KNOWN_VALUE = "known";
private static final String NSRL_PRODUCT_NAME_PROPERTY = "nsrlProductName";

Expand Down Expand Up @@ -226,8 +224,8 @@ protected void process(IItem evidence) throws Exception {
}
}
if (!list.isEmpty()) {
evidence.setExtraAttribute(ATTRIBUTES_PREFIX + key, list);
if (key.equalsIgnoreCase(STATUS_PROPERTY)) {
evidence.setExtraAttribute(ExtraProperties.HASHDB_PREFIX + key, list);
if (key.equalsIgnoreCase(ExtraProperties.STATUS_PROPERTY)) {
status = list;
} else if (key.equalsIgnoreCase(NSRL_PRODUCT_NAME_PROPERTY)) {
nsrlProductName = value;
Expand Down Expand Up @@ -268,7 +266,7 @@ protected void process(IItem evidence) throws Exception {
}
if (modified) {
Collections.sort(status);
evidence.setExtraAttribute(STATUS_ATTRIBUTE, status);
evidence.setExtraAttribute(ExtraProperties.HASHDB_STATUS, status);
}
}
//Ignore only if there is a single status = "known"
Expand Down
3 changes: 2 additions & 1 deletion iped-engine/src/main/java/iped/engine/task/PhotoDNATask.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import iped.engine.config.PhotoDNAConfig;
import iped.engine.preview.PreviewRepositoryManager;
import iped.parsers.util.MetadataUtil;
import iped.properties.ExtraProperties;
import iped.utils.IOUtil;
import iped.utils.ImageUtil;

Expand Down Expand Up @@ -86,7 +87,7 @@ protected void process(IItem evidence) throws Exception {
if (!evidence.isToAddToCase())
return;

if (pdnaConfig.isSkipHashDBFiles() && evidence.getExtraAttribute(HashDBLookupTask.STATUS_ATTRIBUTE) != null)
if (pdnaConfig.isSkipHashDBFiles() && evidence.getExtraAttribute(ExtraProperties.HASHDB_STATUS) != null)
return;

if (evidence.getLength() != null && evidence.getLength() < pdnaConfig.getMinFileSize())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import iped.engine.task.die.DIETask;
import iped.engine.task.index.IndexItem;
import iped.parsers.util.MetadataUtil;
import iped.properties.ExtraProperties;
import iped.utils.ImageUtil;

/**
Expand Down Expand Up @@ -771,7 +772,7 @@ else if (mediaType.startsWith("video")) {
}

// Skip classification of images/videos with hits on IPED hashesDB database (see 'skipHashDBFiles' config property)
if (skipHashDBFiles && evidence.getExtraAttribute(HashDBLookupTask.STATUS_ATTRIBUTE) != null) {
if (skipHashDBFiles && evidence.getExtraAttribute(ExtraProperties.HASHDB_STATUS) != null) {
// Add skip classification info
evidence.setExtraAttribute(AI_CLASSIFICATION_STATUS_ATTR, AI_CLASSIFICATION_SKIP_HASHDB);
skipHashDBFilesCount.incrementAndGet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public class RegexTask extends AbstractTask {
ignoredKeys.add(IndexItem.CONTAINER_TRACK_ID);
ignoredKeys.add(IndexItem.EVIDENCE_UUID);
ignoredKeys.add(ExtraProperties.GLOBAL_ID);
ignoredKeys.add(HashDBLookupTask.ATTRIBUTES_PREFIX + HashDBDataSource.ledMd5_512);
ignoredKeys.add(HashDBLookupTask.ATTRIBUTES_PREFIX + HashDBDataSource.ledMd5_64k);
ignoredKeys.add(HashDBLookupTask.ATTRIBUTES_PREFIX + HashDBDataSource.photoDna);
ignoredKeys.add(ExtraProperties.HASHDB_PREFIX + HashDBDataSource.ledMd5_512);
ignoredKeys.add(ExtraProperties.HASHDB_PREFIX + HashDBDataSource.ledMd5_64k);
ignoredKeys.add(ExtraProperties.HASHDB_PREFIX + HashDBDataSource.photoDna);
ignoredKeys.add(PhotoDNALookup.PHOTO_DNA_HIT_PREFIX + HashTask.HASH.MD5.name());
ignoredKeys.add(PhotoDNALookup.PHOTO_DNA_NEAREAST_HASH);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected boolean isToProcess(IItem evidence) {
if (evidence.getLength() == null || evidence.getLength() == 0 || !evidence.isToAddToCase() || evidence.getMetadata().get(ExtraProperties.TRANSCRIPT_ATTR) != null) {
return false;
}
if (transcriptConfig.getSkipKnownFiles() && evidence.getExtraAttribute(HashDBLookupTask.STATUS_ATTRIBUTE) != null) {
if (transcriptConfig.getSkipKnownFiles() && evidence.getExtraAttribute(ExtraProperties.HASHDB_STATUS) != null) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ private void generateSubitems(IItem item, VideoThumbsOutputConfig config, List<F
newItem.setChangeDate(item.getChangeDate());

// replicate 'hashDb:*' item's extra attributes to subitem
Map<String, Object> hashDbAttrs = ((Item) item).getExtraAttributesStartWith(HashDBLookupTask.ATTRIBUTES_PREFIX);
Map<String, Object> hashDbAttrs = ((Item) item).getExtraAttributesStartWith(ExtraProperties.HASHDB_PREFIX);
for (String key : hashDbAttrs.keySet()) {
newItem.setExtraAttribute(key, hashDbAttrs.get(key));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import iped.data.IItem;
import iped.engine.task.HashDBLookupTask;
import iped.parsers.util.ItemInfo;
import iped.properties.ExtraProperties;

public class ItemInfoFactory {

Expand All @@ -17,7 +18,7 @@ public static ItemInfo getItemInfo(IItem evidence) {

// Check if there is a single status, and it is "known"
private static boolean isKnown(IItem evidence) {
Object hashDbStatus = evidence.getExtraAttribute(HashDBLookupTask.STATUS_ATTRIBUTE);
Object hashDbStatus = evidence.getExtraAttribute(ExtraProperties.HASHDB_STATUS);
if (hashDbStatus != null) {
if (hashDbStatus instanceof List) {
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ private Metadata getEntryMetadata(CloudGraphEntry entry, int i, List<String> has
metadataCloudGraphItem.add("doc_id", entry.getDoc_id());
metadataCloudGraphItem.add("parent_doc_id", entry.getParent_doc_id());
if (!hashSets.isEmpty()) {
metadataCloudGraphItem.set("hashDb:status", "pedo");
metadataCloudGraphItem.set(ExtraProperties.STATUS_PROPERTY, "pedo");
for (String set : hashSets) {
metadataCloudGraphItem.add("hashDb:set", set);
metadataCloudGraphItem.add(ExtraProperties.SET_PROPERTY, set);
}
}
if("yes".equalsIgnoreCase(entry.getShared()) || Boolean.valueOf(entry.getShared())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ private Metadata getEntryMetadata(SnapshotEntry entry, int i, List<String> hashS
metadataSnapshotItem.add("child_volume", entry.getChildVolume());
metadataSnapshotItem.add("parent_volume", entry.getParentVolume());
if (!hashSets.isEmpty()) {
metadataSnapshotItem.set("hashDb:status", "pedo");
metadataSnapshotItem.set(ExtraProperties.STATUS_PROPERTY, "pedo");
for (String set : hashSets) {
metadataSnapshotItem.add("hashDb:set", set);
metadataSnapshotItem.add(ExtraProperties.SET_PROPERTY, set);
}
}
if("yes".equalsIgnoreCase(entry.getShared()) || Boolean.valueOf(entry.getShared())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
meta.set(StandardParser.INDEXER_CONTENT_TYPE, ATTACHMENT_MIME_TYPE);
List<String> hashSets = ChildPornHashLookup.lookupHash(item.getHash());
if (!hashSets.isEmpty()) {
meta.set("hash:status", "pedo");
meta.set(ExtraProperties.HASHDB_STATUS, "pedo");
for (String set : hashSets) {
meta.add("hash:set", set);
meta.add(ExtraProperties.HASHDB_SET, set);
}
}
}
Expand Down Expand Up @@ -272,9 +272,9 @@ public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
}
List<String> hashSets = ChildPornHashLookup.lookupHash(t.getItem().getHash());
if (!hashSets.isEmpty()) {
tMetadata.set("hash:status", "pedo");
tMetadata.set(ExtraProperties.HASHDB_STATUS, "pedo");
for (String set : hashSets) {
tMetadata.add("hash:set", set);
tMetadata.add(ExtraProperties.HASHDB_SET, set);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ private void extractMessages(String chatName, List<Message> messages, Contact ac
meta.set(StandardParser.INDEXER_CONTENT_TYPE, TELEGRAM_ATTACHMENT.toString());
meta.set(ExtraProperties.LINKED_ITEMS, BasicProps.HASH + ":" + m.getMediaHash()); //$NON-NLS-1$
if (!m.getChildPornSets().isEmpty()) {
meta.set("hash:status", "pedo");
meta.set(ExtraProperties.HASHDB_STATUS, "pedo");
for (String set : m.getChildPornSets()) {
meta.add("hash:set", set);
meta.add(ExtraProperties.HASHDB_SET, set);
}
}
// TODO store thumb in metadata?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,15 @@ private void extractMessages(String chatName, Chat c, List<Message> messages, Th
}
if (m.getMediaQuery() != null && m.getMediaSize() > 2) {
meta.set(StandardParser.INDEXER_CONTENT_TYPE, THREEMA_ATTACHMENT.toString());
meta.set(ExtraProperties.LINKED_ITEMS, revertEscapeQuery(m.getMediaQuery())); // $NON-NLS-1$
meta.set(ExtraProperties.LINKED_ITEMS, revertEscapeQuery(m.getMediaQuery()));
}
if (m.getMediaItem() != null && m.getMediaItem().getThumb() != null) {
meta.set(ExtraProperties.THUMBNAIL_BASE64, Base64.getEncoder().encodeToString(m.getMediaItem().getThumb()));
}
if (!m.getChildPornSets().isEmpty()) {
meta.set("hash:status", "pedo"); //$NON-NLS-1$ //$NON-NLS-2$
meta.set(ExtraProperties.HASHDB_STATUS, "pedo");
for (String set : m.getChildPornSets()) {
meta.add("hash:set", set); //$NON-NLS-1$
meta.add(ExtraProperties.HASHDB_SET, set);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1082,12 +1082,12 @@ private void extractMessages(String chatName, Chat c, List<Message> messages, WA
}
if (m.getMediaQuery() != null && m.getMediaSize() > 2) {
meta.set(StandardParser.INDEXER_CONTENT_TYPE, WHATSAPP_ATTACHMENT.toString());
meta.set(ExtraProperties.LINKED_ITEMS, revertEscapeQuery(m.getMediaQuery())); // $NON-NLS-1$
meta.set(ExtraProperties.LINKED_ITEMS, revertEscapeQuery(m.getMediaQuery()));
}
if (!m.getChildPornSets().isEmpty()) {
meta.set("hash:status", "pedo"); //$NON-NLS-1$ //$NON-NLS-2$
meta.set(ExtraProperties.HASHDB_STATUS, "pedo");
for (String set : m.getChildPornSets()) {
meta.add("hash:set", set); //$NON-NLS-1$
meta.add(ExtraProperties.HASHDB_SET, set);
}
}

Expand Down