Created
April 8, 2016 09:56
-
-
Save fabsh/64c236cc10651b4f38d101a1bd6fab56 to your computer and use it in GitHub Desktop.
Refactor of my yowsup patch to log data from the axolotl decryption process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 9e15ce39c96a3537d2cc1e7593afccf441cb6379 | |
Author: Fabian A. Scherschel <fab@heise.de> | |
Date: Fri Apr 8 11:50:42 2016 +0200 | |
Changed data logging patch | |
diff --git a/yowsup/layers/axolotl/layer.py b/yowsup/layers/axolotl/layer.py | |
index 2e6f449..a639451 100644 | |
--- a/yowsup/layers/axolotl/layer.py | |
+++ b/yowsup/layers/axolotl/layer.py | |
@@ -277,12 +277,21 @@ 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) | |
if encMessageProtocolEntity.getVersion() == 2: | |
plaintext = self.unpadV2Plaintext(plaintext) | |
+ ### 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