From 23ab114c2b22b7486ca51e2672c58fcb9a2e72c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Berenguel?= Date: Thu, 24 Oct 2024 15:33:57 -0300 Subject: [PATCH 1/5] #2286: lookup location in jumptargets if IsLocationSharing == true --- .../main/java/iped/parsers/ufed/Message.java | 16 +++++--- ...alization.java => ReferencedLocation.java} | 4 +- .../iped/parsers/ufed/ReportGenerator.java | 2 +- .../iped/parsers/ufed/UFEDChatParser.java | 38 +++++++++++++------ 4 files changed, 40 insertions(+), 20 deletions(-) rename iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/{ReferencedLocalization.java => ReferencedLocation.java} (89%) diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/Message.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/Message.java index 1ee2eef6d0..e0b93a89d5 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/Message.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/Message.java @@ -20,7 +20,7 @@ public class Message implements Comparable { private List activityLog = new ArrayList<>(); private List attachments = new ArrayList<>(); - private ReferencedLocalization referencedLocalization; + private ReferencedLocation referencedLocation; private List sharedContacts = new ArrayList<>(); private boolean systemMessage; @@ -95,6 +95,10 @@ public String getLongitude() { return readUfedMetadata(item, "Longitude"); } + public boolean isLocationSharing() { + return Boolean.parseBoolean(readUfedMetadata(item, "IsLocationSharing")); + } + public String getFrom() { String from = item.getMetadata().get(ExtraProperties.COMMUNICATION_FROM); if (from == null && isFromMe()) { @@ -203,13 +207,13 @@ public MessageAttachment addAttachment(IItemReader attachItem) { return attach; } - public ReferencedLocalization getReferencedLocalization() { - return referencedLocalization; + public ReferencedLocation getReferencedLocation() { + return referencedLocation; } - public ReferencedLocalization setReferencedLocalization(IItemReader localizationItem) { - referencedLocalization = new ReferencedLocalization(localizationItem); - return referencedLocalization; + public ReferencedLocation setReferencedLocation(IItemReader localizationItem) { + referencedLocation = new ReferencedLocation(localizationItem); + return referencedLocation; } public List getSharedContacts() { diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReferencedLocalization.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReferencedLocation.java similarity index 89% rename from iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReferencedLocalization.java rename to iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReferencedLocation.java index ded8afefb5..1100c10aef 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReferencedLocalization.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReferencedLocation.java @@ -5,9 +5,9 @@ import iped.data.IItemReader; import iped.properties.ExtraProperties; -public class ReferencedLocalization extends AbstractReferencedItem { +public class ReferencedLocation extends AbstractReferencedItem { - public ReferencedLocalization(IItemReader item) { + public ReferencedLocation(IItemReader item) { super(item); } diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java index cebfc4daa6..5391b58d10 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java @@ -61,7 +61,7 @@ private String formatLocation(Message message) { String lat = message.getLatitude(); String lon = message.getLongitude(); - ReferencedLocalization localization = message.getReferencedLocalization(); + ReferencedLocation localization = message.getReferencedLocation(); if (lat == null && lon == null && localization == null) { return StringUtils.EMPTY; diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java index b9508cd20e..2bb8e14ef1 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java @@ -572,7 +572,7 @@ private Chat createChat(IItemReader chatItem, IItemSearcher searcher) { private Message createMessage(IItemReader messageItem, Chat chat, IItemSearcher searcher) { Message message = new Message(messageItem, chat); - handleMessagePosition(message, searcher); + handleMessageLocation(message, searcher); List msgChildren = messageItem.getChildren(); if (msgChildren != null) { @@ -628,20 +628,36 @@ private void handleMessageSharedContact(Message message, IItemReader sharedConta } } - private void handleMessagePosition(Message message, IItemSearcher searcher) { + private void handleMessageLocation(Message message, IItemSearcher searcher) { - if (StringUtils.isBlank(message.getCoordinateId())) { - return; + if (!StringUtils.isBlank(message.getCoordinateId())) { + + // the message and location shares the same "ufed:coordinate_id" that was added when merging in UfedXmlReader + String query = searcher.escapeQuery(ExtraProperties.UFED_COORDINATE_ID) + ":\"" + message.getCoordinateId() + "\""; + List locationItems = searcher.search(query); + if (!locationItems.isEmpty()) { + if (locationItems.size() > 1) { + logger.warn("Found more than 1 location for coordinate: {}", locationItems); + } + message.setReferencedLocation(locationItems.get(0)); + } } - // the message and localizations shares the same "ufed:coordinate_id" that was added when merging in UfedXmlReader - String query = searcher.escapeQuery(ExtraProperties.UFED_COORDINATE_ID) + ":\"" + message.getCoordinateId() + "\""; - List locatizationItems = searcher.search(query); - if (!locatizationItems.isEmpty()) { - if (locatizationItems.size() > 1) { - logger.warn("Found more than 1 localization for coordinate: {}", locatizationItems); + if (message.isLocationSharing() && message.getReferencedLocation() == null) { + + // the location item is reference by jumptargets + String[] jumpTargets = message.getItem().getMetadata().getValues(ExtraProperties.UFED_JUMP_TARGETS); + if (jumpTargets.length > 0) { + String query = BasicProps.CONTENTTYPE + ":\"application/x-ufed-location\" && " // + + searcher.escapeQuery(ExtraProperties.UFED_ID) + ":(\"" + StringUtils.join(jumpTargets, "\" \"") + "\")"; + List locationItems = searcher.search(query); + if (!locationItems.isEmpty()) { + if (locationItems.size() > 1) { + logger.warn("Found more than 1 location for jumptargets: {}", locationItems); + } + message.setReferencedLocation(locationItems.get(0)); + } } - message.setReferencedLocalization(locatizationItems.get(0)); } } From a479b0a4dd6356f2afc15316408d364fd25e5715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Berenguel?= Date: Mon, 28 Oct 2024 12:17:17 -0300 Subject: [PATCH 2/5] #2286: fix longitude and better handling lat,lon --- .../iped/parsers/ufed/ReportGenerator.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java index 5391b58d10..a330e187e8 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java @@ -70,18 +70,23 @@ private String formatLocation(Message message) { if ((lat == null || lon == null) && localization != null) { String coord = localization.getLocations(); String[] coordSplit = coord.split(";"); - lat = StringUtils.firstNonBlank(lat, coordSplit[0]); - lon = StringUtils.firstNonBlank(lat, coordSplit[1]); + if (coordSplit.length == 2) { + lat = coordSplit[0]; + lon = coordSplit[1]; + } + } + + lat = StringUtils.replace(lat, ",", "."); + lon = StringUtils.replace(lon, ",", "."); + + DivTag div = div(img(attrs(".location")), b(Messages.getString("UfedChatReport.Location.Title")), br()); + + if (!StringUtils.isAllBlank(lat, lon)) { + div.with(table(attrs(".contact-table"), // + tr(td(Messages.getString("UfedChatReport.Location.Latitude")), td(lat)), // + tr(td(Messages.getString("UfedChatReport.Location.Longitude")), td(lon))), // + br()); } - - lat = StringUtils.defaultString(lat).replace(",", "."); - lon = StringUtils.defaultString(lon).replace(",", "."); - - DivTag div = div(img(attrs(".location")), b(Messages.getString("UfedChatReport.Location.Title")), br(), - table(attrs(".contact-table"), // - tr(td(Messages.getString("UfedChatReport.Location.Latitude")), td(lat)), - tr(td(Messages.getString("UfedChatReport.Location.Longitude")), td(lon))), - br()); if (localization != null) { String name = localization.getName(); From ec5dd1b44883dccaa5704a234cc8c103a48f5ebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Berenguel?= Date: Tue, 5 Nov 2024 16:07:16 -0300 Subject: [PATCH 3/5] #2286: handle "Channel" string in chat name --- .../iped-parsers-messages.properties | 35 ++++++------- .../iped-parsers-messages_de_DE.properties | 35 ++++++------- .../iped-parsers-messages_es_AR.properties | 35 ++++++------- .../iped-parsers-messages_fr_FR.properties | 35 ++++++------- .../iped-parsers-messages_it_IT.properties | 35 ++++++------- .../iped-parsers-messages_pt_BR.properties | 35 ++++++------- .../iped/parsers/ufed/ReportGenerator.java | 24 ++++----- .../iped/parsers/ufed/UFEDChatParser.java | 50 +++++++++++++------ 8 files changed, 155 insertions(+), 129 deletions(-) diff --git a/iped-app/resources/localization/iped-parsers-messages.properties b/iped-app/resources/localization/iped-parsers-messages.properties index 3e74388fc8..cb9a41e646 100644 --- a/iped-app/resources/localization/iped-parsers-messages.properties +++ b/iped-app/resources/localization/iped-parsers-messages.properties @@ -333,10 +333,6 @@ WhatsAppReport.PinnedMessage=pinned a message WhatsAppReport.AIThirdParty=This AI is from a third-party developer. Meta receives your AI chats to improve AI quality. WhatsAppReport.Over256MembersOnlyAdminsCanEdit=This group has over 256 members so now only admins can edit the groups settings. WhatsAppReport.SecurityNotificationsNoLongerAvailable=Security code notifications are no longer available for this chat. -UFEDChatParser.Broadcast=Broadcast -UFEDChatParser.Group=Group -UFEDChatParser.Status=Status -UFEDChatParser.Unknown=Unknown VCardParser.FormattedName=Formatted Name VCardParser.Name=Name VCardParser.Nickname=Nickname @@ -528,16 +524,21 @@ OFXParser.Investment=Investment OFXParser.BankTransactions=Bank Transactions OFXParser.SubAccountFund=Sub Account Fund OFXParser.Investments=Investments -UfedChatReport.Edited=Edited -UfedChatReport.Forwarded=Forwarded -UfedChatReport.Forwarded.By=by -UfedChatReport.SharedContact.Title=Contact -UfedChatReport.SharedContact.Name=Name -UfedChatReport.SharedContact.PhoneNumber=Phone Number -UfedChatReport.SharedContact.UserID=User ID -UfedChatReport.SharedContact.Username=Username -UfedChatReport.Location.Title=Location -UfedChatReport.Location.Latitude=Latitude -UfedChatReport.Location.Longitude=Longitude -UfedChatReport.MessageDeletedRecovered=Recovered deleted message -UfedChatReport.MessageRecovered=Recovered message +UFEDChatParser.Broadcast=Broadcast +UFEDChatParser.Channel=Channel +UFEDChatParser.Group=Group +UFEDChatParser.Status=Status +UFEDChatParser.Unknown=Unknown +UFEDChatParser.Edited=Edited +UFEDChatParser.Forwarded=Forwarded +UFEDChatParser.Forwarded.By=by +UFEDChatParser.SharedContact.Title=Contact +UFEDChatParser.SharedContact.Name=Name +UFEDChatParser.SharedContact.PhoneNumber=Phone Number +UFEDChatParser.SharedContact.UserID=User ID +UFEDChatParser.SharedContact.Username=Username +UFEDChatParser.Location.Title=Location +UFEDChatParser.Location.Latitude=Latitude +UFEDChatParser.Location.Longitude=Longitude +UFEDChatParser.MessageDeletedRecovered=Recovered deleted message +UFEDChatParser.MessageRecovered=Recovered message diff --git a/iped-app/resources/localization/iped-parsers-messages_de_DE.properties b/iped-app/resources/localization/iped-parsers-messages_de_DE.properties index fb3c8a3b80..8c73fe5baf 100644 --- a/iped-app/resources/localization/iped-parsers-messages_de_DE.properties +++ b/iped-app/resources/localization/iped-parsers-messages_de_DE.properties @@ -333,10 +333,6 @@ WhatsAppReport.PinnedMessage=pinned a message[TBT] WhatsAppReport.AIThirdParty=This AI is from a third-party developer. Meta receives your AI chats to improve AI quality.[TBT] WhatsAppReport.Over256MembersOnlyAdminsCanEdit=Diese Gruppe hat mehr als 256 Mitglieder. Daher können jetzt nur noch Admins die Gruppeneinstellungen bearbeiten. WhatsAppReport.SecurityNotificationsNoLongerAvailable=Benachrichtigungen zur Sicherheitsnummer sind für diesen Chat nicht länger verfügbar. -UFEDChatParser.Broadcast=Broadcast[TBT] -UFEDChatParser.Group=Group[TBT] -UFEDChatParser.Status=Status[TBT] -UFEDChatParser.Unknown=Unknown[TBT] VCardParser.FormattedName=Name formatiert VCardParser.Name=Name VCardParser.Nickname=Nickname @@ -528,16 +524,21 @@ OFXParser.Investment=Investment(TBT) OFXParser.BankTransactions=Bank Transactions(TBT) OFXParser.SubAccountFund=Sub Account Fund(TBT) OFXParser.Investments=Investments(TBT) -UfedChatReport.Edited=Edited(TBT) -UfedChatReport.Forwarded=Forwarded(TBT) -UfedChatReport.Forwarded.By=by(TBT) -UfedChatReport.SharedContact.Title=Contact(TBT) -UfedChatReport.SharedContact.Name=Name(TBT) -UfedChatReport.SharedContact.PhoneNumber=Phone Number(TBT) -UfedChatReport.SharedContact.UserID=User ID(TBT) -UfedChatReport.SharedContact.Username=Username(TBT) -UfedChatReport.Location.Title=Location(TBT) -UfedChatReport.Location.Latitude=Latitude(TBT) -UfedChatReport.Location.Longitude=Longitude(TBT) -UfedChatReport.MessageDeletedRecovered=Recovered deleted message(TBT) -UfedChatReport.MessageRecovered=Recovered message(TBT) +UFEDChatParser.Broadcast=Broadcast[TBT] +UFEDChatParser.Channel=Channel[TBT] +UFEDChatParser.Group=Group[TBT] +UFEDChatParser.Status=Status[TBT] +UFEDChatParser.Unknown=Unknown[TBT] +UFEDChatParser.Edited=Edited(TBT) +UFEDChatParser.Forwarded=Forwarded(TBT) +UFEDChatParser.Forwarded.By=by(TBT) +UFEDChatParser.SharedContact.Title=Contact(TBT) +UFEDChatParser.SharedContact.Name=Name(TBT) +UFEDChatParser.SharedContact.PhoneNumber=Phone Number(TBT) +UFEDChatParser.SharedContact.UserID=User ID(TBT) +UFEDChatParser.SharedContact.Username=Username(TBT) +UFEDChatParser.Location.Title=Location(TBT) +UFEDChatParser.Location.Latitude=Latitude(TBT) +UFEDChatParser.Location.Longitude=Longitude(TBT) +UFEDChatParser.MessageDeletedRecovered=Recovered deleted message(TBT) +UFEDChatParser.MessageRecovered=Recovered message(TBT) diff --git a/iped-app/resources/localization/iped-parsers-messages_es_AR.properties b/iped-app/resources/localization/iped-parsers-messages_es_AR.properties index 7492728f79..1bbf8d9ab1 100644 --- a/iped-app/resources/localization/iped-parsers-messages_es_AR.properties +++ b/iped-app/resources/localization/iped-parsers-messages_es_AR.properties @@ -333,10 +333,6 @@ WhatsAppReport.PinnedMessage=pinned a message[TBT] WhatsAppReport.AIThirdParty=This AI is from a third-party developer. Meta receives your AI chats to improve AI quality.[TBT] WhatsAppReport.Over256MembersOnlyAdminsCanEdit=This group has over 256 members so now only admins can edit the groups settings.[TBT] WhatsAppReport.SecurityNotificationsNoLongerAvailable=Security code notifications are no longer available for this chat.[TBT] -UFEDChatParser.Broadcast=Broadcast[TBT] -UFEDChatParser.Group=Group[TBT] -UFEDChatParser.Status=Status[TBT] -UFEDChatParser.Unknown=Unknown[TBT] VCardParser.FormattedName=Nombre con formato VCardParser.Name=Nombre VCardParser.Nickname=Sobrenombre @@ -528,16 +524,21 @@ OFXParser.Investment=Investment(TBT) OFXParser.BankTransactions=Bank Transactions(TBT) OFXParser.SubAccountFund=Sub Account Fund(TBT) OFXParser.Investments=Investments(TBT) -UfedChatReport.Edited=Edited(TBT) -UfedChatReport.Forwarded=Forwarded(TBT) -UfedChatReport.Forwarded.By=by(TBT) -UfedChatReport.SharedContact.Title=Contact(TBT) -UfedChatReport.SharedContact.Name=Name(TBT) -UfedChatReport.SharedContact.PhoneNumber=Phone Number(TBT) -UfedChatReport.SharedContact.UserID=User ID(TBT) -UfedChatReport.SharedContact.Username=Username(TBT) -UfedChatReport.Location.Title=Location(TBT) -UfedChatReport.Location.Latitude=Latitude(TBT) -UfedChatReport.Location.Longitude=Longitude(TBT) -UfedChatReport.MessageDeletedRecovered=Recovered deleted message(TBT) -UfedChatReport.MessageRecovered=Recovered message(TBT) +UFEDChatParser.Broadcast=Broadcast[TBT] +UFEDChatParser.Channel=Channel[TBT] +UFEDChatParser.Group=Group[TBT] +UFEDChatParser.Status=Status[TBT] +UFEDChatParser.Unknown=Unknown[TBT] +UFEDChatParser.Edited=Edited(TBT) +UFEDChatParser.Forwarded=Forwarded(TBT) +UFEDChatParser.Forwarded.By=by(TBT) +UFEDChatParser.SharedContact.Title=Contact(TBT) +UFEDChatParser.SharedContact.Name=Name(TBT) +UFEDChatParser.SharedContact.PhoneNumber=Phone Number(TBT) +UFEDChatParser.SharedContact.UserID=User ID(TBT) +UFEDChatParser.SharedContact.Username=Username(TBT) +UFEDChatParser.Location.Title=Location(TBT) +UFEDChatParser.Location.Latitude=Latitude(TBT) +UFEDChatParser.Location.Longitude=Longitude(TBT) +UFEDChatParser.MessageDeletedRecovered=Recovered deleted message(TBT) +UFEDChatParser.MessageRecovered=Recovered message(TBT) diff --git a/iped-app/resources/localization/iped-parsers-messages_fr_FR.properties b/iped-app/resources/localization/iped-parsers-messages_fr_FR.properties index 3f5d531307..afd97ac25e 100644 --- a/iped-app/resources/localization/iped-parsers-messages_fr_FR.properties +++ b/iped-app/resources/localization/iped-parsers-messages_fr_FR.properties @@ -333,10 +333,6 @@ WhatsAppReport.PinnedMessage=a epinglé un message WhatsAppReport.AIThirdParty=Cette IA provient d'un développeur tiers. Meta reçoit vos discussions IA pour améliorer la qualité de l'IA. WhatsAppReport.Over256MembersOnlyAdminsCanEdit=Comme ce groupe inclut plus de 256 membres, désormais, seulement les admins peuvent modifier les paramètres du groupe. WhatsAppReport.SecurityNotificationsNoLongerAvailable=Les notifications relatives aux codes de sécurité ne sont plus disponibles pour cette discoussion. -UFEDChatParser.Broadcast=Broadcast[TBT] -UFEDChatParser.Group=Group[TBT] -UFEDChatParser.Status=Status[TBT] -UFEDChatParser.Unknown=Unknown[TBT] VCardParser.FormattedName=Nom formaté VCardParser.Name=Nom VCardParser.Nickname=Surnom @@ -528,16 +524,21 @@ OFXParser.Investment=Investissement OFXParser.BankTransactions=Opérations bancaires OFXParser.SubAccountFund=Fonds de sous-compte OFXParser.Investments=Investissements -UfedChatReport.Edited=Modifié -UfedChatReport.Forwarded=Transféré -UfedChatReport.Forwarded.By=by(TBT) -UfedChatReport.SharedContact.Title=Contact -UfedChatReport.SharedContact.Name=Name(TBT) -UfedChatReport.SharedContact.PhoneNumber=Phone Number(TBT) -UfedChatReport.SharedContact.UserID=User ID(TBT) -UfedChatReport.SharedContact.Username=Username(TBT) -UfedChatReport.Location.Title=Location(TBT) -UfedChatReport.Location.Latitude=Latitude(TBT) -UfedChatReport.Location.Longitude=Longitude(TBT) -UfedChatReport.MessageDeletedRecovered=Recovered deleted message(TBT) -UfedChatReport.MessageRecovered=Recovered message(TBT) +UFEDChatParser.Broadcast=Broadcast[TBT] +UFEDChatParser.Channel=Channel[TBT] +UFEDChatParser.Group=Group[TBT] +UFEDChatParser.Status=Status[TBT] +UFEDChatParser.Unknown=Unknown[TBT] +UFEDChatParser.Edited=Modifié +UFEDChatParser.Forwarded=Transféré +UFEDChatParser.Forwarded.By=by(TBT) +UFEDChatParser.SharedContact.Title=Contact +UFEDChatParser.SharedContact.Name=Name(TBT) +UFEDChatParser.SharedContact.PhoneNumber=Phone Number(TBT) +UFEDChatParser.SharedContact.UserID=User ID(TBT) +UFEDChatParser.SharedContact.Username=Username(TBT) +UFEDChatParser.Location.Title=Location(TBT) +UFEDChatParser.Location.Latitude=Latitude(TBT) +UFEDChatParser.Location.Longitude=Longitude(TBT) +UFEDChatParser.MessageDeletedRecovered=Recovered deleted message(TBT) +UFEDChatParser.MessageRecovered=Recovered message(TBT) diff --git a/iped-app/resources/localization/iped-parsers-messages_it_IT.properties b/iped-app/resources/localization/iped-parsers-messages_it_IT.properties index 3a957d6257..f2b95d2ced 100644 --- a/iped-app/resources/localization/iped-parsers-messages_it_IT.properties +++ b/iped-app/resources/localization/iped-parsers-messages_it_IT.properties @@ -333,10 +333,6 @@ WhatsAppReport.PinnedMessage=pinned a message[TBT] WhatsAppReport.AIThirdParty=This AI is from a third-party developer. Meta receives your AI chats to improve AI quality.[TBT] WhatsAppReport.Over256MembersOnlyAdminsCanEdit=Dato che questo gruppo ha più di 256 membri, solo gli amministratori potranno modificarne le impostazioni. WhatsAppReport.SecurityNotificationsNoLongerAvailable=Le notifiche sul codice di sicurezza non sono più disponibili per questa chat. -UFEDChatParser.Broadcast=Broadcast[TBT] -UFEDChatParser.Group=Group[TBT] -UFEDChatParser.Status=Status[TBT] -UFEDChatParser.Unknown=Unknown[TBT] VCardParser.FormattedName=Nome formattato VCardParser.Name=Nome VCardParser.Nickname=Nickname @@ -528,16 +524,21 @@ OFXParser.Investment=Investment(TBT) OFXParser.BankTransactions=Bank Transactions(TBT) OFXParser.SubAccountFund=Sub Account Fund(TBT) OFXParser.Investments=Investments(TBT) -UfedChatReport.Edited=Edited(TBT) -UfedChatReport.Forwarded=Forwarded(TBT) -UfedChatReport.Forwarded.By=by(TBT) -UfedChatReport.SharedContact.Title=Contact(TBT) -UfedChatReport.SharedContact.Name=Name(TBT) -UfedChatReport.SharedContact.PhoneNumber=Phone Number(TBT) -UfedChatReport.SharedContact.UserID=User ID(TBT) -UfedChatReport.SharedContact.Username=Username(TBT) -UfedChatReport.Location.Title=Location(TBT) -UfedChatReport.Location.Latitude=Latitude(TBT) -UfedChatReport.Location.Longitude=Longitude(TBT) -UfedChatReport.MessageDeletedRecovered=Recovered deleted message(TBT) -UfedChatReport.MessageRecovered=Recovered message(TBT) +UFEDChatParser.Broadcast=Broadcast[TBT] +UFEDChatParser.Channel=Channel[TBT] +UFEDChatParser.Group=Group[TBT] +UFEDChatParser.Status=Status[TBT] +UFEDChatParser.Unknown=Unknown[TBT] +UFEDChatParser.Edited=Edited(TBT) +UFEDChatParser.Forwarded=Forwarded(TBT) +UFEDChatParser.Forwarded.By=by(TBT) +UFEDChatParser.SharedContact.Title=Contact(TBT) +UFEDChatParser.SharedContact.Name=Name(TBT) +UFEDChatParser.SharedContact.PhoneNumber=Phone Number(TBT) +UFEDChatParser.SharedContact.UserID=User ID(TBT) +UFEDChatParser.SharedContact.Username=Username(TBT) +UFEDChatParser.Location.Title=Location(TBT) +UFEDChatParser.Location.Latitude=Latitude(TBT) +UFEDChatParser.Location.Longitude=Longitude(TBT) +UFEDChatParser.MessageDeletedRecovered=Recovered deleted message(TBT) +UFEDChatParser.MessageRecovered=Recovered message(TBT) diff --git a/iped-app/resources/localization/iped-parsers-messages_pt_BR.properties b/iped-app/resources/localization/iped-parsers-messages_pt_BR.properties index b78922a5bb..5d6b28a4fe 100644 --- a/iped-app/resources/localization/iped-parsers-messages_pt_BR.properties +++ b/iped-app/resources/localization/iped-parsers-messages_pt_BR.properties @@ -333,10 +333,6 @@ WhatsAppReport.PinnedMessage=fixou uma mensagem WhatsAppReport.AIThirdParty=Esta IA pertence a um desenvolvedor terceirizado. A Meta recebe suas conversas com IA para melhorar a qualidade desse recurso. WhatsAppReport.Over256MembersOnlyAdminsCanEdit=Agora somente admins podem editar as configurações porque o grupo tem mais de 256 membros. WhatsAppReport.SecurityNotificationsNoLongerAvailable=As notificações sobre o código de segurança não estão mais disponíveis para esta conversa. -UFEDChatParser.Broadcast=Broadcast -UFEDChatParser.Group=Grupo -UFEDChatParser.Status=Status -UFEDChatParser.Unknown=Desconhecido VCardParser.FormattedName=Nome Formatado VCardParser.Name=Nome VCardParser.Nickname=Apelido @@ -528,16 +524,21 @@ OFXParser.Investment=Investimento OFXParser.BankTransactions=Transacões Bancárias OFXParser.SubAccountFund=Fundo da Conta Sub OFXParser.Investments=Investimentos -UfedChatReport.Edited=Editada -UfedChatReport.Forwarded=Encaminhada -UfedChatReport.Forwarded.By=por -UfedChatReport.SharedContact.Title=Contato -UfedChatReport.SharedContact.Name=Nome -UfedChatReport.SharedContact.PhoneNumber=Telefone -UfedChatReport.SharedContact.UserID=User ID -UfedChatReport.SharedContact.Username=Username -UfedChatReport.Location.Title=Localização -UfedChatReport.Location.Latitude=Latitude -UfedChatReport.Location.Longitude=Longitude -UfedChatReport.MessageDeletedRecovered=Mensagem apagada recuperada -UfedChatReport.MessageRecovered=Mensagem recuperada +UFEDChatParser.Broadcast=Broadcast +UFEDChatParser.Channel=Canal +UFEDChatParser.Group=Grupo +UFEDChatParser.Status=Status +UFEDChatParser.Unknown=Desconhecido +UFEDChatParser.Edited=Editada +UFEDChatParser.Forwarded=Encaminhada +UFEDChatParser.Forwarded.By=por +UFEDChatParser.SharedContact.Title=Contato +UFEDChatParser.SharedContact.Name=Nome +UFEDChatParser.SharedContact.PhoneNumber=Telefone +UFEDChatParser.SharedContact.UserID=User ID +UFEDChatParser.SharedContact.Username=Username +UFEDChatParser.Location.Title=Localização +UFEDChatParser.Location.Latitude=Latitude +UFEDChatParser.Location.Longitude=Longitude +UFEDChatParser.MessageDeletedRecovered=Mensagem apagada recuperada +UFEDChatParser.MessageRecovered=Mensagem recuperada diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java index a330e187e8..118ed3464a 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java @@ -79,12 +79,12 @@ private String formatLocation(Message message) { lat = StringUtils.replace(lat, ",", "."); lon = StringUtils.replace(lon, ",", "."); - DivTag div = div(img(attrs(".location")), b(Messages.getString("UfedChatReport.Location.Title")), br()); + DivTag div = div(img(attrs(".location")), b(Messages.getString("UFEDChatParser.Location.Title")), br()); if (!StringUtils.isAllBlank(lat, lon)) { div.with(table(attrs(".contact-table"), // - tr(td(Messages.getString("UfedChatReport.Location.Latitude")), td(lat)), // - tr(td(Messages.getString("UfedChatReport.Location.Longitude")), td(lon))), // + tr(td(Messages.getString("UFEDChatParser.Location.Latitude")), td(lat)), // + tr(td(Messages.getString("UFEDChatParser.Location.Longitude")), td(lon))), // br()); } @@ -124,7 +124,7 @@ private String formatSharedContacts(Message message) { return StringUtils.EMPTY; } - DivTag div = div(b(Messages.getString("UfedChatReport.SharedContact.Title")), br()); + DivTag div = div(b(Messages.getString("UFEDChatParser.SharedContact.Title")), br()); for (MessageContact msgContact : message.getSharedContacts()) { @@ -132,7 +132,7 @@ private String formatSharedContacts(Message message) { String name = StringUtils.firstNonBlank(msgContact.getName(), contact != null ? contact.getName() : null); TableTag table = table(attrs(".contact-table"), - tr(td(Messages.getString("UfedChatReport.SharedContact.Name")), td(name))); + tr(td(Messages.getString("UFEDChatParser.SharedContact.Name")), td(name))); if (contact != null) { @@ -141,15 +141,15 @@ private String formatSharedContacts(Message message) { String phone = contact.getPhoneNumber(); if (isNotBlank(userID)) { - table.with(tr(td(Messages.getString("UfedChatReport.SharedContact.UserID")), td(userID))); + table.with(tr(td(Messages.getString("UFEDChatParser.SharedContact.UserID")), td(userID))); } if (isNotBlank(username)) { - table.with(tr(td(Messages.getString("UfedChatReport.SharedContact.Username")), td(username))); + table.with(tr(td(Messages.getString("UFEDChatParser.SharedContact.Username")), td(username))); } if (isNotBlank(phone)) { - table.with(tr(td(Messages.getString("UfedChatReport.SharedContact.PhoneNumber")), td(phone))); + table.with(tr(td(Messages.getString("UFEDChatParser.SharedContact.PhoneNumber")), td(phone))); } } @@ -166,7 +166,7 @@ public byte[] generateNextChatHtml(Chat chat, List msgs) throws Unsuppo ByteArrayOutputStream bout = new ByteArrayOutputStream(); PrintWriter out = new PrintWriter(new OutputStreamWriter(bout, "UTF-8")); - String title = getChatTitle(chat); + String title = UFEDChatParser.getChatName2(chat); String source = readUfedMetadata(chat.getItem(), "Source"); printMessageFileHeader(out, title, title, chat.getContactPhotoThumb(), source); @@ -307,9 +307,9 @@ private void printMessage(PrintWriter out, Message message, boolean group, boole String forwardedBy = ""; String originalSender = message.getOriginalSender(); if (isNotBlank(originalSender)) { - forwardedBy = Messages.getString("UfedChatReport.Forwarded.By") + " " + originalSender; + forwardedBy = Messages.getString("UFEDChatParser.Forwarded.By") + " " + originalSender; } - out.println("" + Messages.getString("UfedChatReport.Forwarded") + " " + forwardedBy + "
"); + out.println("" + Messages.getString("UFEDChatParser.Forwarded") + " " + forwardedBy + "
"); } if (message.isQuoted()) { @@ -413,7 +413,7 @@ private void printMessage(PrintWriter out, Message message, boolean group, boole out.println(""); if (message.isEdited()) { - out.print(Messages.getString("UfedChatReport.Edited") + " "); + out.print(Messages.getString("UFEDChatParser.Edited") + " "); } if (message.getTimeStamp() != null) { out.println(timeFormat.format(message.getTimeStamp())); // $NON-NLS-1$ diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java index 2bb8e14ef1..b2d854bc63 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/UFEDChatParser.java @@ -87,6 +87,7 @@ public class UFEDChatParser extends AbstractParser { // Strings used in item names and titles protected static final String CHATTYPE_GROUP_TITLE = Messages.getString("UFEDChatParser.Group"); protected static final String CHATTYPE_BROADCAST_TITLE = Messages.getString("UFEDChatParser.Broadcast"); + protected static final String CHATTYPE_CHANNEL_TITLE = Messages.getString("UFEDChatParser.Channel"); protected static final String CHATTYPE_STATUS_TITLE = Messages.getString("UFEDChatParser.Status"); protected static final String CHATTYPE_UNKNOWN_TITLE = Messages.getString("UFEDChatParser.Unknown"); @@ -206,7 +207,7 @@ public void parse(InputStream inputStream, ContentHandler handler, Metadata chat Collections.sort(messages); String virtualId = chat.getId(); - String chatPrefix = getChatName(chat.getItem()); + String chatPrefix = getChatName2(chat); if (extractor.shouldParseEmbedded(chatMeta)) { ReportGenerator reportGenerator = new ReportGenerator(minChatSplitSize); @@ -797,6 +798,7 @@ public static String getChatName2(Chat chat) { Metadata chatMeta = chat.getItem().getMetadata(); String accountId = chatMeta.get(ExtraProperties.CONVERSATION_ACCOUNT + ExtraProperties.CONVERSATION_SUFFIX_ID); + String accountUsername = chatMeta.get(ExtraProperties.CONVERSATION_ACCOUNT + ExtraProperties.CONVERSATION_SUFFIX_USERNAME); String source = readUfedMetadata(chatMeta, "Source"); String chatType = readUfedMetadata(chatMeta, "ChatType"); String name = readUfedMetadata(chatMeta, "Name"); @@ -808,17 +810,35 @@ public static String getChatName2(Chat chat) { StringBuilder sb = new StringBuilder(); sb.append(source).append(' '); - if (!"Unknown".equalsIgnoreCase(chatType)) { - if ("OneOnOne".equalsIgnoreCase(chatType)) { - sb.append("Chat"); - } else if ("Telegram".equalsIgnoreCase(source) && "Broadcast".equalsIgnoreCase(chatType)) { - sb.append("Channel"); - } else if (chatTypeMap.containsKey(chatType)) { - sb.append(chatTypeMap.get(chatType)); - } else { - sb.append(chatType); + if (chatType != null) { + switch (chatType) { + case CHATTYPE_ONEONONE: + sb.append("Chat").append(' '); + break; + + case CHATTYPE_GROUP: + sb.append(CHATTYPE_GROUP_TITLE).append(' '); + break; + + case CHATTYPE_BROADCAST: + if (participants.length == 1 && StringUtils.containsAnyIgnoreCase(source, WHATSAPP, TELEGRAM)) { + sb.append(CHATTYPE_STATUS_TITLE); + } else if (TELEGRAM.equalsIgnoreCase(source)) { + sb.append(CHATTYPE_CHANNEL_TITLE); + } else { + sb.append(CHATTYPE_BROADCAST_TITLE); + } + sb.append(' '); + break; + + case CHATTYPE_UNKNOWN: + sb.append(CHATTYPE_UNKNOWN_TITLE).append(' '); + break; + + default: + sb.append(chatType).append(' '); + break; } - sb.append(' '); } sb.append("- "); @@ -828,9 +848,9 @@ public static String getChatName2(Chat chat) { sb.append(" (ID:").append(id).append(")"); } } else if (participantsIds.length == 2) { - if (participantsIds[0].equals(accountId)) { + if (StringUtils.equalsAny(participantsIds[0], accountId, accountUsername)) { sb.append(participants[1]); - } else if (participantsIds[1].equals(accountId)) { + } else if (StringUtils.equalsAny(participantsIds[1], accountId, accountUsername)) { sb.append(participants[0]); } else { sb.append(participants[0]).append('_').append(participants[1]); @@ -844,8 +864,8 @@ public static String getChatName2(Chat chat) { } String result = sb.toString(); - if ("WhatsApp".equalsIgnoreCase(source)) { - result = StringUtils.remove(result, "@s.whatsapp.net"); + if (StringUtils.containsIgnoreCase(source, WHATSAPP)) { + result = StringUtils.remove(result, WAContact.waSuffix); } return result; From 184110cd206668908417fef2b86d09bc916a1d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Berenguel?= Date: Tue, 5 Nov 2024 16:09:12 -0300 Subject: [PATCH 4/5] #2286: handle trashed files in UFDR and set as deleted --- .../iped/engine/datasource/UfedXmlReader.java | 8 +++++++ .../iped/parsers/ufed/ReportGenerator.java | 22 ++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/iped-engine/src/main/java/iped/engine/datasource/UfedXmlReader.java b/iped-engine/src/main/java/iped/engine/datasource/UfedXmlReader.java index 03d4e766cc..1d966b3a7c 100644 --- a/iped-engine/src/main/java/iped/engine/datasource/UfedXmlReader.java +++ b/iped-engine/src/main/java/iped/engine/datasource/UfedXmlReader.java @@ -566,6 +566,12 @@ public void startElement(String uri, String localName, String qName, Attributes boolean deleted = "deleted".equalsIgnoreCase(atts.getValue("deleted")); //$NON-NLS-1$ //$NON-NLS-2$ item.setDeleted(deleted); + boolean trash = "trash".equalsIgnoreCase(atts.getValue("deleted")); + if (trash) { + item.getMetadata().set(ExtraProperties.UFED_META_PREFIX + "deleted_trash", Boolean.toString(true)); + item.setDeleted(true); + } + fillCommonMeta(item, atts); itemSeq.add(item); @@ -601,6 +607,7 @@ public void startElement(String uri, String localName, String qName, Attributes boolean trash = "trash".equalsIgnoreCase(atts.getValue("deleted_state")); if (trash) { item.getMetadata().set(ExtraProperties.UFED_META_PREFIX + "deleted_trash", Boolean.toString(true)); + item.setDeleted(true); } fillCommonMeta(item, atts); @@ -645,6 +652,7 @@ public void startElement(String uri, String localName, String qName, Attributes boolean trash = "trash".equalsIgnoreCase(atts.getValue("deleted_state")); if (trash) { item.getMetadata().set(ExtraProperties.UFED_META_PREFIX + "deleted_trash", Boolean.toString(true)); + item.setDeleted(true); } fillCommonMeta(item, atts); diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java index 118ed3464a..4b0a2a15f9 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java @@ -448,15 +448,17 @@ private void printMessage(PrintWriter out, Message message, boolean group, boole out.println(""); if (chatDeleted || message.getItem().isDeleted()) { - out.println("
"); - out.println("" + Messages.getString("UfedChatReport.MessageDeletedRecovered") + ""); - out.println("
"); - out.println("
"); - } else if (message.isTrash()) { - out.println("
"); - out.println("" + Messages.getString("UfedChatReport.MessageRecovered") + ""); - out.println("
"); - out.println("
"); + if (message.isTrash()) { + out.println("
"); + out.println("" + Messages.getString("UFEDChatParser.MessageRecovered") + ""); + out.println("
"); + out.println("
"); + } else { + out.println("
"); + out.println("" + Messages.getString("UFEDChatParser.MessageDeletedRecovered") + ""); + out.println("
"); + out.println("
"); + } } if (isTo) out.println("
"); @@ -486,7 +488,7 @@ private void printQuote(PrintWriter out, Message message) { String quoteEnd = ""; if (messageQuote.getItem().isDeleted()) { quoteEnd = "
" - + Messages.getString("UfedChatReport.MessageDeletedRecovered") + "" + quoteEnd; + + Messages.getString("UFEDChatParser.MessageDeletedRecovered") + "" + quoteEnd; } StringBuilder msgStr = new StringBuilder(); From 28ef03d26b95d846d70d6f6f96ca198bdf5a8eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Berenguel?= Date: Tue, 5 Nov 2024 16:10:16 -0300 Subject: [PATCH 5/5] #2286: handle ufed:PositionAddress --- .../src/main/java/iped/parsers/ufed/ReferencedLocation.java | 3 +++ .../src/main/java/iped/parsers/ufed/ReportGenerator.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReferencedLocation.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReferencedLocation.java index 1100c10aef..f7d4e7fa40 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReferencedLocation.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReferencedLocation.java @@ -47,4 +47,7 @@ public String getCountry() { return readUfedMetadata(item, "Country"); } + public String getPositionAddress() { + return readUfedMetadata(item, "PositionAddress"); + } } diff --git a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java index 4b0a2a15f9..226b0f193b 100644 --- a/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java +++ b/iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/ufed/ReportGenerator.java @@ -96,11 +96,15 @@ private String formatLocation(Message message) { String city = localization.getCity(); String state = localization.getState(); String country = localization.getCountry(); + String positionAddress = localization.getPositionAddress(); String complement = Arrays.asList(city, state, country).stream().filter(StringUtils::isNotBlank).collect(Collectors.joining(" - ")); if (isNotBlank(name)) { div.with(span(name), br()); } + if (isNotBlank(positionAddress)) { + div.with(span(i(positionAddress)), br()); + } if (isNotBlank(street)) { String fullStreet = street; if (isNotBlank(houseNumber) && !"0".equals(houseNumber)) {