Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #!/usr/bin/env python
  2. #===================================================================================
  3. #
  4. #         FILE: HTS-Realistic-06.py
  5. #
  6. #        USAGE: HTS-Realistic-06.py
  7. #
  8. #  DESCRIPTION: This script is for level 6 challenge in HackThisSite
  9. #               realistic missions.
  10. #  _____  _              _         _____  _                     _____     _____
  11. # |   __||_| _____  ___ | | ___   |  _  || | ___  ___    ___   |   __|   |  _  |
  12. # |__   || ||     || . || || -_|  |   __|| || .'||   |  |___|  |__   | _ |   __|_
  13. # |_____||_||_|_|_||  _||_||___|  |__|   |_||__,||_|_|         |_____||_||__|  |_|
  14. #                  |_|
  15. #
  16. #===================================================================================
  17.  
  18. # read the ciphertext
  19. f = open('/root/HTS/ciphertext.txt', 'r')
  20. data = f.read().split('.')
  21. f.close()
  22.  
  23. statistic=[]
  24. message=""
  25. index=1
  26.  
  27. # statistic all encryption code
  28. while index < len (data) - 1 :
  29.     statistic.append(int(data[index]) + int(data[index+1]) + \
  30.         int(data[index+2]))
  31.     index += 3
  32.  
  33. # find the encryption password
  34. password = max(set(statistic), key=statistic.count) - 32
  35.  
  36. # convert ASCII to character
  37. for i in range(len(statistic)) :
  38.     message += chr(int(statistic[i]) - int(password))
  39.  
  40. # print the original message
  41. print message