[Assignment 4] code 3,4 comments
This commit is contained in:
parent
c6cff93191
commit
10cb1766de
2 changed files with 4 additions and 0 deletions
|
@ -10,14 +10,17 @@ class Module:
|
||||||
self.incoming = incoming # incoming means module is on -im chain
|
self.incoming = incoming # incoming means module is on -im chain
|
||||||
self.find = None # if find is not None, this text will be highlighted
|
self.find = None # if find is not None, this text will be highlighted
|
||||||
|
|
||||||
|
# protocol 4: flag{4uth3nt1c4t10n_1s_1mp0rt4nt}
|
||||||
def execute(self, data):
|
def execute(self, data):
|
||||||
print(f"Incoming data: {data}")
|
print(f"Incoming data: {data}")
|
||||||
|
|
||||||
data_json = json.loads(data)
|
data_json = json.loads(data)
|
||||||
if data_json["id"] == 2:
|
if data_json["id"] == 2:
|
||||||
|
# Send Nonce N_S back to S without Alice encrypting it
|
||||||
data_json["id"] = 3
|
data_json["id"] = 3
|
||||||
data_json["sender"], data_json["receiver"] = data_json["receiver"], data_json["sender"]
|
data_json["sender"], data_json["receiver"] = data_json["receiver"], data_json["sender"]
|
||||||
elif data_json["id"] == 4:
|
elif data_json["id"] == 4:
|
||||||
|
# Reflect message back to S so that T does not decrypt it
|
||||||
data_json["id"] = 5
|
data_json["id"] = 5
|
||||||
data_json["sender"], data_json["receiver"] = data_json["receiver"], data_json["sender"]
|
data_json["sender"], data_json["receiver"] = data_json["receiver"], data_json["sender"]
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ class Module:
|
||||||
self.incoming = incoming # incoming means module is on -im chain
|
self.incoming = incoming # incoming means module is on -im chain
|
||||||
self.find = None # if find is not None, this text will be highlighted
|
self.find = None # if find is not None, this text will be highlighted
|
||||||
|
|
||||||
|
# protocol 3: flag{p4r4ll3l_fun}
|
||||||
def execute(self, data):
|
def execute(self, data):
|
||||||
print(f"Incoming data: {data}")
|
print(f"Incoming data: {data}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue