Using the “cryptography” library we can encrypt and decrypt the bidirectional socket messages sent back and forth to the client and the server.
We use “symmetric” encryption in the example below which means the “key” to decrypt the message is shared with the client and the server.
Copy to Clipboard
Copy to Clipboard
To verify that our data is being transmitted as ciphertext (base64 encoded ciphertext), let’s load up Wireshark and packet capture the message data exchange between the server and client.
Notice below the encrypted and encoded ciphertext found during packet capture. We can use the shared (between client and server) symmetric secret key to decrypt this message manually.

Copy to Clipboard
Latest posts by Jesse Shelley (see all)
- Symmetric Encryption –Bidirectional Python Socket - April 27, 2022
- Python Socket Programming – Simple Bidirectional Communication - April 27, 2022
- Python wpnuker a collection of WordPress Pentesting Tools - April 19, 2022
View project on Github:
Leave A Comment