import des import os import random import signal import subprocess import socketserver…
- User
import des import os import random import signal import subprocess import socketserver from Crypto.Util.number import bytes_to_long import traceback des.core.ROTATES = ( 1, 1, 2, 2, 2, 2, )
ORACLE_TRIES = 50
def encrypt(pt, key): cipher = des.DesKey(key) return cipher.encrypt(pt).hex()
if name == "main": flag = open("flag.txt", "rb").read() oracle_counter = 0 print('Welcome to our encryption oracle.\n' + '1. Encrypt\n' + '2. Get the flag\n') key = os.urandom(8) while True: try: option = input('> ').strip() if option == '1' and oracle_counter < 50: pt = bytes.fromhex(input('Provide message to encrypt > '))
if b'flag' in pt or len(pt) != 8: print('No, I am not encrypting this.\n') continue else: ct = encrypt(pt, key)code
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.