just for now
This commit is contained in:
@ -7,9 +7,9 @@ import socket
|
||||
from insecurelib import KDRV256, HMAC, encrypt, decrypt
|
||||
|
||||
# Fill in the right target here
|
||||
HOST = 'this.is.not.a.valid.domain' # TODO
|
||||
PORT1 = 20008
|
||||
PORT2 = 20108
|
||||
HOST = 'netsec.net.in.tum.de'
|
||||
PORT1 = 20206
|
||||
PORT2 = 20306
|
||||
|
||||
|
||||
# note the numbers you encounter may be small for demonstration purposes.
|
||||
@ -25,7 +25,7 @@ def debug_secure_channel(s1, s2, data: str):
|
||||
else:
|
||||
print(f"from {s1} to {s2}: '{data}...'")
|
||||
|
||||
iv, ciphertext, mac = data.split(',')
|
||||
iv, ciphertext, mac = data.split(';')
|
||||
assert len(iv) == 16 * 2 # a hexlified byte is two bytes long, the IV should be 16 bytes
|
||||
assert (
|
||||
len(ciphertext) % (16 * 2) == 0
|
||||
@ -52,9 +52,18 @@ def main():
|
||||
data = s1f.readline().rstrip('\n')
|
||||
print(f"from s1 to s2: '{data}'")
|
||||
p, g, X = map(int, data.split(','))
|
||||
p = int(p)
|
||||
g = int(g)
|
||||
X = int(X)
|
||||
print("p: {} g: {} X: {}".format(p, g, X))
|
||||
|
||||
# TODO: get the flag
|
||||
s2f.write(data)
|
||||
s2f.flush()
|
||||
|
||||
# Receive answer (second step of DH)
|
||||
data = s2f.readline().rstrip('\n')
|
||||
print("from s2 to s1: `{}'".format(data))
|
||||
s1f.close()
|
||||
s2f.close()
|
||||
s1.close()
|
||||
|
Reference in New Issue
Block a user