Advertisement
Guest User

Untitled

a guest
Mar 20th, 2016
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import argparse
  4. import os
  5.  
  6. key = (Your keys go here)
  7.  
  8.  
  9. parser = argparse.ArgumentParser(description='Decrypt .crypted files by ransomware')
  10.  
  11. parser.add_argument('-s', '--source_file', action='store', nargs="+", required=True, help="Crypted files (source files list)")
  12. args = parser.parse_args()
  13.  
  14. for source_file in args.source_file:
  15. path=os.getcwd()
  16. fullname=os.path.join(path,source_file)
  17. bf = open(fullname, "rb")
  18.  
  19.  
  20. sf = fullname.replace( ".crypted", " ")
  21. nf = open(sf, "wb")
  22.  
  23. i = 0
  24. # Uncomment the line below if you like verbosity
  25. # print("byte# bad key new str(new)")
  26. read_bytes = 0
  27. while read_bytes < 2048:
  28. bad_byte = bf.read(1)
  29. new_byte = (key[i] ^ ord(bad_byte))
  30. # Uncomment the line below if you like verbosity
  31. # print(str(read_bytes) + " " + hex(ord(bad_byte)) + " " + hex(key[i]) + " " + hex(new_byte) + " " + str(new_byte) + " ")
  32. nf.write(bytes([new_byte]))
  33. i = i + 1
  34. if i > 254:
  35. i = 0
  36. read_bytes = read_bytes + 1
  37.  
  38. while bad_byte:
  39. bad_byte = bf.read(1)
  40. nf.write(bad_byte)
  41.  
  42. nf.close()
  43. bf.close()
  44.  
  45. #decrypt_dir.bat
  46. #Run the python decryptor recursively in the current directory
  47. #You must have python in your path
  48. #and you must have specify full path (FULLPATHGOESHERE) to decrypt_file.py
  49. #
  50. for /r . %%X in ("*.crypted") do (python FULLPATHGOESHERE\decrypt_file.py -s "%%X")
  51. echo "done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement