just for now

This commit is contained in:
2024-12-10 00:51:04 +09:00
parent c4c4547706
commit 022291f5af
18 changed files with 311 additions and 32 deletions

View File

@ -46,18 +46,19 @@ async def handle_client(client_reader: StreamReader, client_writer: StreamWriter
return
match resp.split(';'):
case [e, n]:
if not e.isdigit() or not n.isdigit():
if not e.isdigit() or not n.isdigit(): # has to be not
client_writer.write('Invalid input\n'.encode())
await client_writer.drain()
return
e, n = int(e), int(n)
if not (no_bits * 2 - 1 <= n.bit_length() <= no_bits * 2):
if not (no_bits * 2 - 1 <= n.bit_length() <= no_bits * 2): # has to be not
client_writer.write('Wrong bit count\n'.encode())
await client_writer.drain()
return
flag = subprocess.check_output('flag').decode().strip()
flag = "flaggy"
m = int.from_bytes(flag.encode(), 'big')
c = pow(m, e, n)
print(c)
client_writer.write(f'{c}\n'.encode())
case _:
client_writer.write('Invalid input\n'.encode())