import sys from hashlib import md5 from binascii import * from secret import salt, flag
defdie(*args): pr(*args) quit()
defpr(*args): s = " ".join(map(str, args)) sys.stdout.write(s + "\n") sys.stdout.flush()
defsc(): return sys.stdin.buffer.readline()
defxor(s1, s2): returnbytes([s1[_] ^ s2[_] for _ inrange(len(s1))])
defmain(): border = "โ" pr( "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ") pr(border, ".: Hi all, she did Mashy, you should do it too! Are you ready? :. ", border) pr( "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ")
REC = [] cnt, STEP = 0, 7 sh = md5(salt).digest()
whileTrue: pr(border, f'Please send your first input: ') d1 = sc().strip() pr(border, f'Please send your second input: ') d2 = sc().strip() try: d1 = hexlify(unhexlify(d1)) d2 = hexlify(unhexlify(d2)) h1 = md5(unhexlify(d1)).digest() h2 = md5(unhexlify(d2)).digest() except: die(border, 'Your inputs are not valid! Bye!!!') if d1 != d2 and d1 notin REC and d2 notin REC: if md5(xor(d1, d2)).hexdigest() != 'ae09d7510659ca40eda3e45ca70e9606': if hexlify(xor(xor(h1, h2), sh)) == b'a483b30944cbf762d4a3afc154aad825': REC += [d1, d2] if cnt == STEP: die(border, f'Congrats! the flag: {flag}') pr(border, 'Good job, try next level :P') cnt += 1 else: die(border, 'Your input is not correct! Bye!') else: die(border, 'No this one! Sorry!!') else: die(border, 'Kidding me!? Bye!!')
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Hey! It's time to solve the equation of a function f: N x N -> Z. โ โ Function f has given certain conditions. In each step, solve the โ โ equation f(x, y) = z with the given value of z. We know f(a+1, b) = โ โ f(a, b) + a, and f(a, b+1) = f(a, b) - b, for every `a' and `b'. โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ We know: f(1, 1) = 394111134899 and f(x, y) = 1085928033286 โ Please send x, y separated by comma:
ๅๆ
ๅฐๆๆa bๆปฟ่ถณ
็ตฆๅฎ
f(1,1)่ทf(x,y)๏ผ่ฆๆฑx่ทy
้้กๅ ถๅฏฆๅพ็ฐกๅฎ
ๅ ็บๆๅๅฏไปฅ็ฅ้
ๅฆๆ่จญๆ้ๆจฃๅฏไปฅๅพ
ๅพ่ญ
script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
from pwn import * r=remote('01.cr.yp.toc.tf', 17113)
r.recvlines(6) for i inrange(100): a=r.recvline().split() print(a) n1=int(a[6].decode()) n2=int(a[11].decode())
m=n2-n1 print(m) r.sendlineafter(b'Please send x, y separated by comma: ',f'{m+1},{m}'.encode()) r.recvlines(2) r.interactive()
import sys from Crypto.Util.number import * from string import * from random import * from flag import flag defdie(*args): pr(*args) quit() defpr(*args): s = " ".join(map(str, args)) sys.stdout.write(s + "\n") sys.stdout.flush() defsc(): return sys.stdin.buffer.readline()
defrandstr(l): return''.join([printable[randint(0, 90)] for _ inrange(l)])
defmain(): border = "โ" pr( "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ") pr(border, ".: Welcome to RM2 task! Your mission is break our cryptosystem :. ", border) pr( "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ") nbit, _b = 1024, False pr(border, f"Please provide your desired {nbit}-bit prime numbers p, q:") inp = sc().decode() try: p, q = [int(_) for _ in inp.split(',')] if p.bit_length() == q.bit_length() == nbit and isPrime(p) and isPrime(q) and p != q: _b = True except: die(border, f"The input you provided is is not valid!") if _b: e, n = 65537, p * q s = randstr(nbit >> 4).encode() m = bytes_to_long(s) assert m < n >> 2 c1, c2 = encrypt(s, p, q) pr(border, f'c1 = {c1}') pr(border, f'c2 = {c2}') pr(border, f'Now, send us the secret string to get the flag: ') _m = sc().strip() if _m == s: die(border, f'Congrats, you got the flag: {flag}') else: die(border, f'The secret string is not correct! Bye!!') else: die(border, f"Your input does not meet the requirements!!!")
โ Now, send us the secret string to get the flag: @:PG;RVp&o4Hm9];Hj;U9cZb'Y'DaU(+io%vn,=I3)Kpl.tj@C'xfK(CJ)Rfdj7c โ Congrats, you got the flag: b'CCTF{i_l0v3_5UpeR_S4fE_Pr1m3s!!}'
CCTF{i_l0v3_5UpeR_S4fE_Pr1m3s!!}
JOE-19
source code
1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/env sage
from GPT import GPT6 # deep fake from Crypto.Util.number import * from flag import flag
P = [GPT6('A 512-bit prime appears in consecutive digits of e') for _ inrange(4)] n, m = prod(P), bytes_to_long(flag) c = pow(m, 0x10001, n) print(f'n = {n}') print(f'c = {c}')
output.txt
1 2
n = 8098851734937207931222242323719278262039311278408396153102939840336549151541408692581651429325092535316359074019383926520363453725271849258924996783681725111665666420297112252565291898169877088446887149672943461236879128453847442584868198963005276340812322871768679441501282681171263391133217373094824601748838255306528243603493400515452224778867670063040337191204276832576625227337670689681430055765023322478267339944312535862682499007423158988134472889946113994555274385595499503495488202251032898470224056637967019786473820952632846823442509236976892995505554046850101313269847925347047514591030406052185186963433 c = 7109666883988892105091816608945789114105575520302872143453259352879355990908149124303310269223886289484842913063773914475282456079383409262649058768777227206800315566373109284537693635270488429501591721126853086090237488579840160957328710017268493911400151764046320861154478494943928510792105098343926542515526432005970840321142196894715037239909959538873866099850417570975505565638622448664580282210383639403173773002795595142150433695880167315674091756597784809792396452578104130341085213443116999368555639128246707794076354522200892568943534878523445909591352323861659891882091917178199085781803940677425823784662
from sage.allimport e, is_prime n = 8098851734937207931222242323719278262039311278408396153102939840336549151541408692581651429325092535316359074019383926520363453725271849258924996783681725111665666420297112252565291898169877088446887149672943461236879128453847442584868198963005276340812322871768679441501282681171263391133217373094824601748838255306528243603493400515452224778867670063040337191204276832576625227337670689681430055765023322478267339944312535862682499007423158988134472889946113994555274385595499503495488202251032898470224056637967019786473820952632846823442509236976892995505554046850101313269847925347047514591030406052185186963433
e_str = str(e.n(digits=100100))
deffind_prime_in_e(length): for i inrange(len(e_str) - length): num_str = e_str[i:i+length] if num_str.isdigit(): num = int(num_str) if is_prime(num) and n % num == 0: print(num) returnNone