Skip to content

Instantly share code, notes, and snippets.

@fabsh fabsh/logging.patch
Created Apr 29, 2015

Embed
What would you like to do?
Yowsup patch to log data from the axolotl decryption process
commit 3b8f21fa7102d8dea5ec6097ef680ad3916ad7bc
Author: Fabian A. Scherschel <fab@heise.de>
Date: Sun Apr 19 17:36:25 2015 +0200
Patched in data logging for axolotl decryption process
diff --git a/yowsup/layers/axolotl/layer.py b/yowsup/layers/axolotl/layer.py
index 2e82ec5..cf84a27 100644
--- a/yowsup/layers/axolotl/layer.py
+++ b/yowsup/layers/axolotl/layer.py
@@ -191,9 +191,18 @@ class YowAxolotlLayer(YowProtocolLayer):
encMessageProtocolEntity = EncryptedMessageProtocolEntity.fromProtocolTreeNode(node)
whisperMessage = WhisperMessage(serialized=encMessageProtocolEntity.getEncData())
+
+ ### Get the received message, convert it to hex
+ ### Print it out as a logger message
+ whisperMessageHex = binascii.hexlify(encMessageProtocolEntity.getEncData())
+ logger.info("Received cyphertext: %s" % whisperMessageHex)
+
sessionCipher = self.getSessionCipher(encMessageProtocolEntity.getFrom(False))
plaintext = sessionCipher.decryptMsg(whisperMessage)
+ ### Write the resulting plaintext out as a logger message
+ logger.info("Plaintext: %s" % plaintext)
+
bodyNode = ProtocolTreeNode("body", data = plaintext)
node.addChild(bodyNode)
self.toUpper(node)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.