Reversing Ransomware: Building Your Own Decrypter

We locked them up, now let’s set them free. In Part 1, we built a simple ransomware script to encrypt files in a directory. In this video, we complete the cycle by writing the Decrypter.

We’ll cover how to handle encryption keys properly, reverse the logic of our previous script, and restore our files to their original state.

⚠️ DISCLAIMER: This content is for educational purposes and cybersecurity research only. Understanding how malware functions is critical for Red Teaming and Blue Teaming alike. Do not use this code on systems you do not have permission to test.

What Changed from Part 1? In the previous video, we generated a random key but didn’t save it (my bad!).

In this video, we fix that by ensuring our script writes a key.txt file so we actually have a way to unlock our data – a critical component of symmetric encryption.

Key Concepts Covered:

• Symmetric Key Management: Reading the Fernet key from a file.

• Logic Reversal: Switching from encrypt() to decrypt() methods.

• File Integrity: How to iterate through a directory without corrupting the decryption script or the key itself.

• Sanity Checks: Verifying the data is actually readable after the process.

Timestamps:
00: 00 Introduction and Recap
00: 42 Reviewing the Ransomware Script
00: 51 Importing Necessary Libraries
01: 24 Generating and Saving the Encryption Key
02: 19 Encrypting Files
03: 34 Decrypting Files
04: 04 Avoiding Self-Encryption
05: 06 Reading and Decrypting Files
06: 43 Final Sanity Check
08: 18 Conclusion and Viewer Engagement

Links: 📺 Watch Part 1 (The Encryption): https://youtu.be/OxVGTVhCftA

#python #cybersecurity #ransomware #decryption #redteaming #codingtutorial #malwareanalysis #suitupandhack