Guest User

Untitled

a guest
Mar 21st, 2016
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import argparse
  4.  
  5. key = (0x4e, 0x32, 0x56, 0x6b, 0x4d, 0x54, 0x63, 0x7a, 0x59, 0x6a, 0x64, 0x6d, 0x59, 0x6d, 0x56, 0x69, 0x5a, 0x47, 0x4e, 0x6d, 0x59, 0x54, 0x4d, 0x33, 0x4d, 0x6d, 0x51, 0x35, 0x59, 0x54, 0x59, 0x77, 0x4e, 0x57, 0x56, 0x6d, 0x59, 0x57, 0x5a, 0x6d, 0x59, 0x57, 0x5a, 0x4d, 0x62, 0x55, 0x67, 0x7a, 0x51, 0x6b, 0x70, 0x4d, 0x61, 0x30, 0x46, 0x48, 0x56, 0x6d, 0x31, 0x4d, 0x65, 0x6b, 0x51, 0x79, 0x54, 0x48, 0x64, 0x34, 0x4d, 0x46, 0x70, 0x48, 0x52, 0x58, 0x5a, 0x61, 0x52, 0x33, 0x67, 0x78, 0x54, 0x56, 0x46, 0x4d, 0x4d, 0x45, 0x46, 0x36, 0x57, 0x6a, 0x4e, 0x4e, 0x65, 0x6b, 0x6c, 0x35, 0x57, 0x6e, 0x70, 0x4a, 0x51, 0x55, 0x5a, 0x35, 0x51, 0x54, 0x52, 0x48, 0x53, 0x32, 0x4e, 0x53, 0x62, 0x30, 0x67, 0x78, 0x4d, 0x30, 0x67, 0x7a, 0x54, 0x55, 0x39, 0x49, 0x53, 0x30, 0x56, 0x6d, 0x53, 0x6d, 0x46, 0x78, 0x4d, 0x47, 0x39, 0x49, 0x55, 0x31, 0x56, 0x79, 0x56, 0x47, 0x4e, 0x42, 0x52, 0x6e, 0x6c, 0x42, 0x4d, 0x6b, 0x64, 0x49, 0x63, 0x55, 0x4a, 0x42, 0x53, 0x57, 0x4e, 0x6e, 0x52, 0x56, 0x52, 0x72, 0x54, 0x33, 0x4a, 0x35, 0x59, 0x6a, 0x42, 0x48, 0x53, 0x48, 0x46, 0x48, 0x52, 0x7a, 0x46, 0x6a, 0x4e, 0x48, 0x46, 0x4b, 0x54, 0x56, 0x68, 0x79, 0x56, 0x45, 0x46, 0x55, 0x53, 0x6d, 0x46, 0x31, 0x52, 0x30, 0x5a, 0x53, 0x63, 0x55, 0x68, 0x4d, 0x4d, 0x46, 0x4e, 0x58, 0x53, 0x44, 0x46, 0x4e, 0x5a, 0x55, 0x56, 0x53, 0x59, 0x6d, 0x74, 0x49, 0x65, 0x6a, 0x55, 0x30, 0x53, 0x54, 0x46, 0x31, 0x56, 0x55, 0x68, 0x49, 0x4f, 0x55, 0x39, 0x77, 0x52, 0x30, 0x35, 0x72, 0x51, 0x56, 0x4a, 0x78, 0x56, 0x30, 0x67, 0x78, 0x59, 0x32, 0x35, 0x79, 0x53, 0x6b, 0x46, )
  6.  
  7. parser = argparse.ArgumentParser(description='Decrypt .crypted files by ransomware')
  8.  
  9. parser.add_argument('-s', '--source_file', action='store', nargs="+", required=True, help="Crypted files (source files list)")
  10. args = parser.parse_args()
  11.  
  12. for source_file in args.source_file:
  13. bf = open(source_file, "rb")
  14. nf = open(source_file + ".recovered", "wb")
  15.  
  16. i = 0
  17. print("byte# bad key new str(new)")
  18. read_bytes = 0
  19. while read_bytes < 2048:
  20. bad_byte = bf.read(1)
  21. new_byte = (key[i] ^ ord(bad_byte))
  22. print(str(read_bytes) + " " + hex(ord(bad_byte)) + " " + hex(key[i]) + " " + hex(new_byte) + " " + str(new_byte) + " ")
  23. nf.write(bytes([new_byte]))
  24. i = i + 1
  25. if i > 254:
  26. i = 0
  27. read_bytes = read_bytes + 1
  28.  
  29. while bad_byte:
  30. bad_byte = bf.read(1)
  31. nf.write(bad_byte)
  32.  
  33. nf.close()
  34. bf.close()
Advertisement
Add Comment
Please, Sign In to add comment