chris124567 / zoomer

Chat bots (& more) for Zoom by figuring out their websocket protocol
MIT License
59 stars 7 forks source link

feat: add screen share decryption #4

Open RealKeyboardWarrior opened 1 year ago

RealKeyboardWarrior commented 1 year ago

This PR adds support for decryption of the screen share video feed. This works quite, well and will spit out recording files by default if you enable it, it's disabled by default.

There are quite a few changes in this PR, some breaking and honestly I haven't tested the rebased version.

Here's a sample of the outputted H264 stream (had to change the extension to log to allow upload). It's unplayable in its current form, I hope someone else out there figures out how to actually decode the H264 stream. I managed to decode a a tiny bit of a frame, enough to see some letters but otherwise it's complete garbage. 2022-10-09-18-45-27.h264.log note: constraint_set7_flag, 1111 1110 = 0xFE - ffmpeg will reject, rewriting to 0 does help a bit

It took me a few months to get to this stage, the ZoomRtpEncoder is untested, never got around to that. They seem to be using their own version of RTP Frame marking as well.

chris124567 commented 1 year ago

This is pretty amazing! I wanted to add this originally but it seemed orders of magnitude more complicated than chat support. I will review & merge into this when I get time later this week. Surprised to see someone using this repository.

chris124567 commented 1 year ago

Apologies for the delay I had some work and school stuff that got in the way. Very impressive work. I can't seem to get it to record me screensharing though. I have the bot join the meeting, then I enable screen sharing, and the recording file (.h264) is created but is always empty. 2022-11-24-12-25-06.log

Also, joining with as_type=2 will break how chat is currently handled (plaintext) but I will fix that as soon as I get this to work.

RealKeyboardWarrior commented 1 year ago

@chris124567

  1. You must first create the ZoomSession
  2. Add the participant to the ParticipantRoster which is used for deriving the secret key used in encryption / decryption session.ParticipantRoster.AddParticipant(person.ID, person.ZoomID)
  3. Listen for SharingStatusIndication and subscribe to the screenshare stream

Another thing you might to try is re-enable the raw json message logging, because I had to upgrade the version to mimic 2.5.0 because my WebSocket were being forcibly closed!

Over the past weekend, I've successfully managed to decrypt and decode the normal webcam streams! I've resorted to just push the changes to my fork, and then once I consider my efforts finished, I will try and upstream the changes.

taylorchu commented 1 year ago

It will be really helpful if you can describe how rtp works in sdk if someone wants to contribute to audio decoding .

RealKeyboardWarrior commented 1 year ago

@taylorchu I have a working audio decryptor which I will push to my fork by 2023 but I have not figured out how to package the audio into a format that ffmpeg or fflpay can decode.