killchain-compendium/Steganography/StegoScripts/xor_key_file.py

16 lines
316 B
Python
Raw Normal View History

2022-11-12 23:18:06 +01:00
#!/usr/bin/env python
def xor(data, key):
keylen = len(key)
return bytearray((
(data[i] ^ key[i % keylen]) for i in range(0,len(data))
))
if __name__ == "__main__":
data = bytearray(open('topsecret.txt', 'rb').read())
key = b'key'
res = xor(data, key)
print(res.decode())