Skip to content

Commit 9a74d63

Browse files
authored
Merge pull request #2746 from sepinf-inc/#2745_WA_Android_Enhance
WhatsApp Android Enhancements (#2745)
2 parents c0cf51b + 6ecc113 commit 9a74d63

File tree

14 files changed

+107
-20
lines changed

14 files changed

+107
-20
lines changed

iped-app/resources/localization/iped-parsers-messages.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ WhatsAppReport.UnknownVideoCall=Unknown type of video call
235235
WhatsAppReport.GroupCreated=Group created by
236236
WhatsAppReport.UserAddedToCommunity=added user to community
237237
WhatsAppReport.UserAddedToGroup=added user to group
238+
WhatsAppReport.WasAdded=was added
238239
WhatsAppReport.UserRequestToAddToGroup=requested to add
239240
WhatsAppReport.UserCommunityAdmin=set user as community admin
240241
WhatsAppReport.CommunityAdmin=is now community admin
@@ -328,6 +329,7 @@ WhatsAppReport.CommunityManagementAction=Community management action.
328329
WhatsAppReport.CommunityRenamed=changed the community's name
329330
WhatsAppReport.CommunityWelcome=Welcome to the community.
330331
WhatsAppReport.NewParticipantsNeedAdminApproval=New participants need admin approval to join this group.
332+
WhatsAppReport.AdvancedPrivacyOn=Advanced chat privacy was turned on.
331333
WhatsAppReport.ChatAddedPrivacy=This chat has added privacy for your profile and phone number.
332334
WhatsAppReport.ChannelAddedPrivacy=This channel has added privacy for your profile and phone number.
333335
WhatsAppReport.ChannelCreated=Channel was created.

iped-app/resources/localization/iped-parsers-messages_de_DE.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ WhatsAppReport.UnknownVideoCall=Videoanruf unbekannten Typs
235235
WhatsAppReport.GroupCreated=Gruppe erstellt von
236236
WhatsAppReport.UserAddedToCommunity=Benutzer zur Community hinzugefügt
237237
WhatsAppReport.UserAddedToGroup=Benutzer zur Community hinzugefügt
238+
WhatsAppReport.WasAdded=was added[TBT]
238239
WhatsAppReport.UserRequestToAddToGroup=hinzufügen angefragt
239240
WhatsAppReport.UserCommunityAdmin=ist nun Community-Administrator
240241
WhatsAppReport.CommunityAdmin=ist nun Community-Administrator
@@ -328,6 +329,7 @@ WhatsAppReport.CommunityManagementAction=Community Verwaltungsaktion
328329
WhatsAppReport.CommunityRenamed=hat den Community-Namen geändert.
329330
WhatsAppReport.CommunityWelcome=Willkommen in der Community.
330331
WhatsAppReport.NewParticipantsNeedAdminApproval=Neue Teilnehmer benötigen die Genehmigung des Administrators, um dieser Gruppe beizutreten.
332+
WhatsAppReport.AdvancedPrivacyOn=Advanced chat privacy was turned on.[TBT]
331333
WhatsAppReport.ChatAddedPrivacy=Dieser Chat bietet zusätzliche Privatsphäre für Ihr Profil und Ihre Telefonnummer.
332334
WhatsAppReport.ChannelAddedPrivacy=Dieser Kanal bietet zusätzliche Privatsphäre für Ihr Profil und Ihre Telefonnummer.
333335
WhatsAppReport.ChannelCreated=Kanal wurde erstellt

iped-app/resources/localization/iped-parsers-messages_es_AR.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ WhatsAppReport.UnknownVideoCall=Videollamada de tipo desconocida
235235
WhatsAppReport.GroupCreated=Grupo creado por
236236
WhatsAppReport.UserAddedToCommunity=usuario agregado a la comunidad
237237
WhatsAppReport.UserAddedToGroup=usuario agregado al grupo
238+
WhatsAppReport.WasAdded=was added[TBT]
238239
WhatsAppReport.UserRequestToAddToGroup=solicitó ser añadido al grupo
239240
WhatsAppReport.UserCommunityAdmin=ahora eres el administrador de la comunidad
240241
WhatsAppReport.CommunityAdmin=ahora eres el administrador de la comunidad
@@ -328,6 +329,7 @@ WhatsAppReport.CommunityManagementAction=Acción de gestión de la comunidad.
328329
WhatsAppReport.CommunityRenamed=cambió el nombre de la comunidad
329330
WhatsAppReport.CommunityWelcome=Bienvenido a la comunidad.
330331
WhatsAppReport.NewParticipantsNeedAdminApproval=Los nuevos participantes necesitan aprobación de un administrador para unirse a este grupo.
332+
WhatsAppReport.AdvancedPrivacyOn=Advanced chat privacy was turned on.[TBT]
331333
WhatsAppReport.ChatAddedPrivacy=Este chat ha añadido privacidad para tu perfil y número de teléfono.
332334
WhatsAppReport.ChannelAddedPrivacy=Este canal ha añadido privacidad para tu perfil y número de teléfono.
333335
WhatsAppReport.ChannelCreated=Se creó el canal.

iped-app/resources/localization/iped-parsers-messages_fr_FR.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ WhatsAppReport.UnknownVideoCall=Type d'appel vidéo inconnu
235235
WhatsAppReport.GroupCreated=Groupe créé par
236236
WhatsAppReport.UserAddedToCommunity=Utilisateur ajouté à la communauté
237237
WhatsAppReport.UserAddedToGroup=Utilisateur ajouté au groupe
238+
WhatsAppReport.WasAdded=was added[TBT]
238239
WhatsAppReport.UserRequestToAddToGroup=demande d'ajout au groupe
239240
WhatsAppReport.UserCommunityAdmin=Définir l'utilisateur en tant qu'administrateur
240241
WhatsAppReport.CommunityAdmin=est à présent administrateur
@@ -328,6 +329,7 @@ WhatsAppReport.CommunityManagementAction=Gestion de la communauté.
328329
WhatsAppReport.CommunityRenamed=Changer le nom de la communauté
329330
WhatsAppReport.CommunityWelcome=Bienvenue dans la communauté.
330331
WhatsAppReport.NewParticipantsNeedAdminApproval=Les nouveaux participants ont besoin de l'approbation de l'administrateur pour rejoindre ce groupe.
332+
WhatsAppReport.AdvancedPrivacyOn=Advanced chat privacy was turned on.[TBT]
331333
WhatsAppReport.ChatAddedPrivacy=Ce chat assure la confidentialité de votre profil et de votre numéro de téléphone.
332334
WhatsAppReport.ChannelAddedPrivacy=Cette chaîne assure la confidentialité de votre profil et de votre numéro de téléphone.
333335
WhatsAppReport.ChannelCreated=La chaîne a été créée.
@@ -577,4 +579,4 @@ OFXParser.Investment=Investissement
577579
OFXParser.BankTransactions=Opérations bancaires
578580
OFXParser.SubAccountFund=Fonds de sous-compte
579581
OFXParser.Investments=Investissements
580-
EmuleCollectionParser.CollectionTotalSize=Taille totale des fichiers dans la collection :
582+
EmuleCollectionParser.CollectionTotalSize=Taille totale des fichiers dans la collection:

iped-app/resources/localization/iped-parsers-messages_it_IT.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ WhatsAppReport.UnknownVideoCall=Tipo di chiamata video sconosciuto
235235
WhatsAppReport.GroupCreated=Gruppo creato da
236236
WhatsAppReport.UserAddedToCommunity=utente aggiunto alla comunità
237237
WhatsAppReport.UserAddedToGroup=utente aggiunto al gruppo
238+
WhatsAppReport.WasAdded=was added[TBT]
238239
WhatsAppReport.UserRequestToAddToGroup=Richiesta di aggiunta
239240
WhatsAppReport.UserCommunityAdmin=utente impostato come amministratore della comunità
240241
WhatsAppReport.CommunityAdmin=è ora amministratore della comunità
@@ -328,6 +329,7 @@ WhatsAppReport.CommunityManagementAction=Azioni di gestione della comunità.
328329
WhatsAppReport.CommunityRenamed=nome della comunità cambiato
329330
WhatsAppReport.CommunityWelcome=Benvenuto nella comunità.
330331
WhatsAppReport.NewParticipantsNeedAdminApproval=Nuovi partecipanti necessitano dell'approvazione dell'amministratore per unirsi a questo gruppo.
332+
WhatsAppReport.AdvancedPrivacyOn=Advanced chat privacy was turned on.[TBT]
331333
WhatsAppReport.ChatAddedPrivacy=Questa chat garantisce la privacy per il tuo profilo e numero di telefono.
332334
WhatsAppReport.ChannelAddedPrivacy=Questo canale garantisce la privacy per il tuo profilo e numero di telefono.
333335
WhatsAppReport.ChannelCreated=Canale creato.

iped-app/resources/localization/iped-parsers-messages_pt_BR.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ WhatsAppReport.UnknownVideoCall=Chamada de vídeo de tipo desconhecido
235235
WhatsAppReport.GroupCreated=Grupo criado por
236236
WhatsAppReport.UserAddedToCommunity=adicionou usuário à comunidade
237237
WhatsAppReport.UserAddedToGroup=adicionou usuário ao grupo
238+
WhatsAppReport.WasAdded=foi adicionado
238239
WhatsAppReport.UserRequestToAddToGroup=deseja adicionar
239240
WhatsAppReport.UserCommunityAdmin=tornou usuário admin da comunidade
240241
WhatsAppReport.CommunityAdmin=agora é admin da comunidade
@@ -328,6 +329,7 @@ WhatsAppReport.CommunityManagementAction=Ação de gerenciamento de comunidade.
328329
WhatsAppReport.CommunityRenamed=mudou o nome da comunidade
329330
WhatsAppReport.CommunityWelcome=Bem-vindo à comunidade.
330331
WhatsAppReport.NewParticipantsNeedAdminApproval=Novos participantes precisam da autorização de um admin para entrar no grupo.
332+
WhatsAppReport.AdvancedPrivacyOn=A privacidade avançada da conversa foi ativada.
331333
WhatsAppReport.ChatAddedPrivacy=Esta conversa oferece maior privacidade para seu perfil e número de telefone.
332334
WhatsAppReport.ChannelAddedPrivacy=Este canal oferece maior privacidade para seu perfil e número de telefone.
333335
WhatsAppReport.ChannelCreated=Canal foi criado.
@@ -577,4 +579,4 @@ OFXParser.Investment=Investimento
577579
OFXParser.BankTransactions=Transacões Bancárias
578580
OFXParser.SubAccountFund=Fundo da Conta Sub
579581
OFXParser.Investments=Investimentos
580-
EmuleCollectionParser.CollectionTotalSize=Tamanho total dos arquivos na coleção:
582+
EmuleCollectionParser.CollectionTotalSize=Tamanho total dos arquivos na coleção:

iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/whatsapp/ChatMerge.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public ChatMerge(List<Chat> main, String dbname) {
2020
}
2121
}
2222

23-
public boolean isBackup(List<Chat> backup) {
23+
public boolean isBackup(List<Chat> backup, WAContactsDirectory contacts) {
2424
if (backup == null) {
2525
return false;
2626
}
@@ -29,7 +29,8 @@ public boolean isBackup(List<Chat> backup) {
2929
for (Chat c : backup) {
3030
indexmain = findChat(main, c);
3131
if (indexmain >= 0) {// verify if the chats are compatible
32-
if (!c.getRemote().getId().equals(main.get(indexmain).getRemote().getId())) {
32+
if (!contacts.getContact(c.getRemote().getId())
33+
.matches(contacts.getContact(main.get(indexmain).getRemote().getId()))) {
3334
// if there is a chat incompatible the msgstore is not a backup
3435
return false;
3536
} else if (hasCompatibleMessage(c.getMessages(), main.get(indexmain).getMessages())) {

iped-parsers/iped-parsers-impl/src/main/java/iped/parsers/whatsapp/ExtractorAndroidNew.java

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package iped.parsers.whatsapp;
22

3+
import static iped.parsers.whatsapp.Message.MessageType.ADVANCED_PRIVACY_ON;
34
import static iped.parsers.whatsapp.Message.MessageType.AI_THIRD_PARTY;
45
import static iped.parsers.whatsapp.Message.MessageType.ANY_COMMUNITY_MEMBER_CAN_JOIN_GROUP;
56
import static iped.parsers.whatsapp.Message.MessageType.AUDIO_MESSAGE;
@@ -44,6 +45,7 @@
4445
import static iped.parsers.whatsapp.Message.MessageType.GROUP_INVITE;
4546
import static iped.parsers.whatsapp.Message.MessageType.GROUP_ONLY_ADMINS_CAN_SEND;
4647
import static iped.parsers.whatsapp.Message.MessageType.GROUP_REMOVED_FROM_COMMUNITY;
48+
import static iped.parsers.whatsapp.Message.MessageType.IGNORE_MESSAGE;
4749
import static iped.parsers.whatsapp.Message.MessageType.IMAGE_MESSAGE;
4850
import static iped.parsers.whatsapp.Message.MessageType.LOCATION_MESSAGE;
4951
import static iped.parsers.whatsapp.Message.MessageType.MESSAGE_ASSOCIATION;
@@ -128,6 +130,12 @@ public ExtractorAndroidNew(String itemPath, File databaseFile, WAContactsDirecto
128130

129131
@Override
130132
protected List<Chat> extractChatList() throws WAExtractorException {
133+
try {
134+
updateContactsDirectoryMapping();
135+
} catch (SQLException ex) {
136+
throw new WAExtractorException(ex);
137+
}
138+
131139
List<Chat> list = new ArrayList<>();
132140
Map<Long, Chat> idToChat = new HashMap<Long, Chat>();
133141

@@ -169,6 +177,25 @@ protected List<Chat> extractChatList() throws WAExtractorException {
169177
return list;
170178
}
171179

180+
private void updateContactsDirectoryMapping() throws SQLException {
181+
// Read LID -> JID mapping
182+
try (Connection conn = getConnection()) {
183+
if (SQLite3DBParser.containsTable("jid_map", conn)) {
184+
try (Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT_JID_MAP)) {
185+
while (rs.next()) {
186+
String lid = rs.getString("lid");
187+
if (lid != null && !lid.isBlank()) {
188+
String jid = rs.getString("jid");
189+
if (jid != null && !jid.isBlank()) {
190+
contacts.addContactMapping(lid, jid);
191+
}
192+
}
193+
}
194+
}
195+
}
196+
}
197+
}
198+
172199
private boolean isUnblocked(Connection conn, long id) throws SQLException {
173200
boolean isUnblocked = false;
174201
String query = getSelectBlockedQuery(conn);
@@ -440,8 +467,8 @@ private void extractMessages(Connection conn, Map<Long, Chat> idToChat) throws S
440467
m.setMessageType(decodeMessageType(type, status, edit_version, caption, actionType,
441468
rs.getInt("bizStateId"), rs.getInt("privacyType"), m.getMediaMime()));
442469

443-
if (m.getMessageType() == EPHEMERAL_SETTINGS_NOT_APPLIED) {
444-
// Ignore this type of message, as it does nothing and it is not visible in the application itself.
470+
if (m.getMessageType() == EPHEMERAL_SETTINGS_NOT_APPLIED || m.getMessageType() == IGNORE_MESSAGE) {
471+
// Ignore these type of message, as they do nothing and are not visible in the application itself.
445472
continue;
446473
}
447474

@@ -1065,6 +1092,13 @@ protected Message.MessageType decodeMessageType(int messageType, int status, Int
10651092
case 99:
10661093
result = MESSAGE_ASSOCIATION;
10671094
break;
1095+
case 112:
1096+
result = ADVANCED_PRIVACY_ON;
1097+
break;
1098+
case 116:
1099+
// Nothing is shown in the app itself
1100+
result = IGNORE_MESSAGE;
1101+
break;
10681102
default:
10691103
break;
10701104
}
@@ -1241,4 +1275,5 @@ private static String getSelectBlockedQuery(Connection conn) throws SQLException
12411275
private static final String SELECT_GROUP_MEMBERS = "select g._id as group_id, g.raw_string as group_name, u._id as user_id, u.raw_string as member "
12421276
+ "FROM group_participant_user gp inner join jid g on g._id=gp.group_jid_row_id inner join jid u on u._id=gp.user_jid_row_id where u.server='s.whatsapp.net' and u.type=0 and group_name=?"; //$NON-NLS-1$
12431277

1278+
private static final String SELECT_JID_MAP = "SELECT a.raw_string AS lid, b.raw_string AS jid FROM jid_map map, jid a, jid b WHERE map.lid_row_id = a._id AND map.jid_row_id = b._id";
12441279
}

0 commit comments

Comments
 (0)