Ingin menangid
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
614 B

преди 5 години
  1. import base64
  2. secret_out = ''
  3. secret_str = ''.join("gksk-secret-code".split("-"))
  4. for count, loop in enumerate(secret_str):
  5. if count % 2 == 0:
  6. secret_out += ''.join([chr(ord(ch) + 0x3) for ch in loop])
  7. else:
  8. secret_out += loop
  9. print secret_out
  10. enc = open("flag.enc", "r").read()
  11. shift_key = 0
  12. while True:
  13. shift_key += 1
  14. cipher = base64.b64decode(enc)
  15. alphabet = secret_out * 50
  16. shifted_alphabet = alphabet[shift_key:] + alphabet[:shift_key]
  17. flag = ''
  18. for i in range(len(cipher[:-1])):
  19. flag += chr((ord(cipher[i]) ^ shift_key) - ord(shifted_alphabet[i]))
  20. if "GKSK{" in flag:
  21. print flag
  22. break