Pyransom – Ransomware script based on AES-CBC and RSA cryptosystem



Ransomware script based on AES-CBC (Fernet Token) and RSA (PKCS1-OAEP) cryptosystem.


This ransomware script implement AES and RSA cryptosystem to encrypt file. Target folder will encrypted using fernet cryptosystem based on 128-bit AES. The fernet key also encrypted using RSA cryptosystem based on PKCS1-OAEP standard.

How To Use

  1. Generate RSA key by run After that you will get a pair public and private key in PEM format.
  2. Run to start ransomware script.
  3. After the welcome message show up you need to input the target directory you want to attack. The default directory is C:/Users/<USERNAME>/Desktop.


Make sure you run this script on virtual machine. Don’t delete your private.pem key or your file will be encrypted forever. This program is for educational purpose and help CS/CE students understand how cryptography works in real world scenario.


  • PermissionError: [Errno 13] Permission denied: (To prevent this bug run cmd as administrator)

PS : This tool is only for testing and academic purposes and can only be used where strict consent has been given. Do not use it for illegal purposes! Code licensed by MIT with no warranty.