Created
May 24, 2018 02:23
-
-
Save TheZoc/f356cb74958d148b252f7d466baeb84f to your computer and use it in GitHub Desktop.
A small script to help revert the damage caused by crab ransomware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# | |
# .crab file fixer | |
# This small script was created to help a friend who got attacked by a ransomware | |
# I hope this helps someone else out there :) | |
# | |
import os | |
from glob import glob | |
# Config | |
target_path = os.getcwd() # You can change the target directory here; By default, it uses the current directory | |
evil_extension = '.crab' | |
# Rename the files | |
evil_files = glob(target_path + '/**/*' + evil_extension, recursive=True) | |
print('Found {} evil "{}" files. Attempting to fix:\n'.format(len(evil_files), evil_extension)) | |
for evil in evil_files: | |
good = evil[:-len(evil_extension)] | |
print(good) | |
os.rename(evil, good) | |
print('\nDone!\n') | |
input('Press Enter to exit...') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment