import requests from time import sleep from base64 import b64decode import sys URL = 'https://t800.codectf.localos.io/challenge' OUTPUT = 'challenges.csv' SIGCOUNT = 4 INTERVAL = 30 # chall ändert sich alle 30s ORDER = 115792089210356248762697446949407573529996955224135760342422259061068512044369 #NIST256p HPNAME = "ctf2023" HPPASS = "t,FcUGJ>h:7=.woy" def sigdecode(sig, order): bl = (order.bit_length() + 7) // 8 # bytelength sig = b64decode(sig.encode('utf-8')) assert len(sig) == 2 * bl r = int.from_bytes(sig[:bl], 'big') # ab bytelength s = int.from_bytes(sig[bl:], 'big') # bis bytelength return r % order, s % order if __name__ == '__main__': with open(OUTPUT, 'w') as outfile: count = 0 last_chal = None while count < SIGCOUNT: s = requests.Session() s.auth = (HPNAME, HPPASS) # session auth resp = s.get(URL, verify = False) data = resp.json() r, s = sigdecode(data['sig'], ORDER) chal = data['challenge'] if chal != last_chal: print(chal, r, s, sep=',', file=outfile) last_chal = chal count += 1 sleep(INTERVAL / 2)