Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flag Whatsapp Forwarded messages #1287

Closed
gfd2020 opened this issue Aug 24, 2022 · 19 comments · Fixed by #1651
Closed

Flag Whatsapp Forwarded messages #1287

gfd2020 opened this issue Aug 24, 2022 · 19 comments · Fixed by #1651
Assignees

Comments

@gfd2020
Copy link
Collaborator

gfd2020 commented Aug 24, 2022

Suggestion
Include in whatsapp chat messages the indication if the message has been forwarded.

How
The flag of this behavior are indicated as below (unless I'm mistaken. In my tests, it seems correct.)

IPHONE
ZWAMESSAGE.ZFLAGS bit 7
Example and test: select (1 << 7 & ZFLAGS) as forwarded from ZWAMESSAGE

ANDROID NEW
message.origination_flags bit 1
Example and test: select (origination_flags & 1) as forwarded FROM message

ANDROID OLD
messages.forwarded bit 1
Example and test: select (forwarded & 1) as forwarded FROM messages

On the ReportGenerator.java, add something like this ...

if (message.getForwarded() > 0) {
out.println("<img src="" + RSRC_PATH + "img/forward.png" valign="top"/><i style="color:gray">Forwarded
");
}

@lfcnassif
Copy link
Member

Thanks @gfd2020, this can be very useful.

@gfd2020
Copy link
Collaborator Author

gfd2020 commented May 9, 2023

Hi @tc-wleite. Did it work as expected in your tests?

@wladimirleite
Copy link
Member

wladimirleite commented May 9, 2023

Hi @tc-wleite. Did it work as expected in your tests?

Hi @gfd2020!
Yes, it worked fine.
Thanks for sharing this information.
Android "old" is tricky because there are several scenarios (different columns/tables used), but that doesn't seem to affect the "forwarded" flag (at least I couldn't find any sample in which the column you pointed out was absent or use a different name).

@filipesimoes
Copy link
Contributor

filipesimoes commented May 10, 2023

Hello.
This is important. The absense of the Forwared flag may cause a lot of confusion during the analysis of Whatsapp.

@lfcnassif
Copy link
Member

lfcnassif commented May 10, 2023

I started a regression test yesterday on hundreds of whatsapp databases using PR #1651 and if everything looks good, I'll merge it. I noticed rendering lags when viewing large WhatsApp chats with that PR, I still need to check on master to confirm if it is a performance regression or not. Have you noticed something similar @tc-wleite?

@wladimirleite
Copy link
Member

I started a regression test yesterday on hundreds of whatsapp databases using PR #1651 and if everything looks good, I'll merge it. I noticed rendering lags when viewing large WhatsApp chats with that PR, I still need to check on master to confirm if it is a performance regression or not. Have you noticed something similar @tc-wleite?

Large chats (the ones that are broken into parts) do cause rendering lags. But it doesn't seem to be something critical, at least in the cases that I tested here. It seems to be the same kind of lag present when opening larger HTMLs in the internal viewer.
I didn't observe any noticeable difference in that sense, comparing to master.

Not sure if it is the same type of delay you are observing. You can send me a sample database if you see larger lags than we had before, so I can investigate in more detail.

@gfd2020
Copy link
Collaborator Author

gfd2020 commented May 10, 2023

Is the htmlviewer using javafx?
May be this could help ...
https://docs.oracle.com/javafx/2/ui_controls/pagination.htm
I make a small demo and works. We just need to split the chat in pages ...

@lfcnassif
Copy link
Member

We just need to split the chat in pages ...

This is already done explicitly for large chats, users can see many chat items referring to the same conversation. Maybe the max chat chunk size could be decreased, currently it is ~5MiB, but splitting too much can be annoying to users. Other approach could be splitting based on the number of messages, not on chat html size, actually it was done in the past and I don't know what is heavier to be rendered (5 MiB of text messages or 5MiB of multimedia messages).

@wladimirleite
Copy link
Member

Is the htmlviewer using javafx? May be this could help ... https://docs.oracle.com/javafx/2/ui_controls/pagination.htm I make a small demo and works. We just need to split the chat in pages ...

Large chats are already split into parts (different items). It doesn't use a pagination like this one, but I am not sure if this is really necessary. Simply reducing a bit the chat split threshold would help, but it is probably better to understand first if it is a regression or something else happening in particular chats, as I didn't observe any critical delay.

@lfcnassif
Copy link
Member

lfcnassif commented May 10, 2023

Hi @tc-wleite, I got more parsing exceptions with #1651 than master. After I confirm them, I'll send the triggering samples privately to you.

@lfcnassif
Copy link
Member

PS: Thanks for helping with this!

@lfcnassif
Copy link
Member

Hi @tc-wleite, I got more parsing exceptions with #1651 than master. After I confirm them, I'll send the triggering samples privately to you.

I confirmed 4 NPEs, 3 of them with this stacktrace for sure:

org.apache.tika.exception.TikaException: WAExtractorException Exception
	at iped.parsers.whatsapp.WhatsAppParser.parseWhatsappMessages(WhatsAppParser.java:377)
	at iped.parsers.whatsapp.WhatsAppParser.parse(WhatsAppParser.java:252)
	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:298)
	at iped.parsers.standard.StandardParser.parse(StandardParser.java:245)
	at iped.engine.io.ParsingReader$BackgroundParsing.run(ParsingReader.java:247)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
	at iped.parsers.whatsapp.ExtractorIOS.decodeReceiptInfo(ExtractorIOS.java:484)
	at iped.parsers.whatsapp.ExtractorIOS.createMessageFromDB(ExtractorIOS.java:377)
	at iped.parsers.whatsapp.ExtractorIOS.extractMessages(ExtractorIOS.java:269)
	at iped.parsers.whatsapp.ExtractorIOS.extractChatList(ExtractorIOS.java:198)
	at iped.parsers.whatsapp.Extractor.getChatList(Extractor.java:34)
	at iped.parsers.whatsapp.WhatsAppParser.parseWhatsappMessages(WhatsAppParser.java:369)

I just sent the triggering samples to you by Teams.

@wladimirleite
Copy link
Member

Thanks!
I will look into this tomorrow.

@patrickdalla
Copy link
Collaborator

We could improve some of this 'lag' implementing some lazy loading logic via 'javascript'. This could be done transparently via in HTMLViewer, so if it is a good idea, we can create new specific issue.

@wladimirleite
Copy link
Member

We could improve some of this 'lag' implementing some lazy loading logic via 'javascript'. This could be done transparently via in HTMLViewer, so if it is a good idea, we can create new specific issue.

I tested this again this morning, and didn't find any critical lag (obviously the "critical" threshold is kind of personal), neither observed any difference comparing to previous (master and 4.1.x) versions.
So unless @lfcnassif has any specific case that triggers a regression or a problematic delay, I wouldn't change the current behavior.

@lfcnassif
Copy link
Member

lfcnassif commented May 11, 2023

I tested this again this morning, and didn't find any critical lag (obviously the "critical" threshold is kind of personal), neither observed any difference comparing to previous (master and 4.1.x) versions.
So unless @lfcnassif has any specific case that triggers a regression or a problematic delay, I wouldn't change the current behavior.

Hi @tc-wleite, I took a closer look, there is no regression, sorry. The lag issue is with a specific database with a specific chat with a corrupted text message which is a few MBs of size, that message causes the slow rendering both on #1651 and on master, so that's an unrelated issue.

By the way, I'm getting a different number of messages within different runs caused by another unrelated issue, that is making comparisons harder. I'll describe it in another ticket.

@wladimirleite
Copy link
Member

Hi @tc-wleite, I got more parsing exceptions with #1651 than master. After I confirm them, I'll send the triggering samples privately to you.

I confirmed 4 NPEs, 3 of them with this stacktrace for sure:

I pushed a fix this morning that seems to fix this issue.

@lfcnassif
Copy link
Member

I pushed a fix this morning that seems to fix this issue.

I saw it, thank you!

@lfcnassif lfcnassif changed the title Whatsapp Forwarded messages Flag Whatsapp Forwarded messages Jun 29, 2023
@gfd2020
Copy link
Collaborator Author

gfd2020 commented Jul 11, 2023

Group chats tend to be large and have a lot of incoming messages. A real case with a chat size of 5 MB, it was quite slow. The slowdown is caused by the chat bubble arrow. If you remove the 'position: relative' from the '#conversation .incoming' class and the 'position: absolute' from the '#conversation .incoming:before' class, performance is fine. However, the arrow will be drawn wrong. It would be necessary to find another way of drawing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants