32 lines
1018 B
Python
32 lines
1018 B
Python
#!/usr/bin/env python3
|
|
|
|
import os, binascii, argparse
|
|
|
|
def main(flag: str):
|
|
p1 = "OPERATION REPORT\nDate: 14-11-2025\nUnit: Alpha\nSubject: Routine status update\nDetails: All systems operational.\nEnd of report.\n"
|
|
p2 = f"CONFIDENTIAL MESSAGE\n{flag}\nProceed with exfil.\nRegards,\nField Agent\n"
|
|
|
|
p1 = p1.encode()
|
|
p2 = p2.encode()
|
|
|
|
L = max(len(p1), len(p2))
|
|
key = os.urandom(L)
|
|
|
|
c1 = bytes([p1[i] ^ key[i] for i in range(len(p1))])
|
|
c2 = bytes([p2[i] ^ key[i] for i in range(len(p2))])
|
|
|
|
print(binascii.hexlify(c1).decode())
|
|
print(binascii.hexlify(c2).decode())
|
|
|
|
# optionally write to cipher1.hex / cipher2.hex
|
|
with open("public/cipher1.hex","w+") as f:
|
|
f.write(binascii.hexlify(c1).decode())
|
|
with open("public/cipher2.hex","w+") as f:
|
|
f.write(binascii.hexlify(c2).decode())
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('--flag', required=True)
|
|
|
|
args = parser.parse_args()
|
|
print(main(args.flag)) |