summaryrefslogtreecommitdiff
path: root/client/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'client/client.py')
-rwxr-xr-xclient/client.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/client/client.py b/client/client.py
index 1c7e155..70d85a0 100755
--- a/client/client.py
+++ b/client/client.py
@@ -14,6 +14,10 @@ DISCONNECT_MESSAGE = "BYE"
14FORMAT = "utf-8" 14FORMAT = "utf-8"
15import configparser 15import configparser
16 16
17def die(msg):
18 print(msg)
19 sys.exit(1)
20
17def parse_arguments(): 21def parse_arguments():
18 parser = argparse.ArgumentParser() 22 parser = argparse.ArgumentParser()
19 parser.add_argument("--server",type=str,help="IP of MFA Server") 23 parser.add_argument("--server",type=str,help="IP of MFA Server")
@@ -113,7 +117,10 @@ def main():
113 running = True 117 running = True
114 while running: 118 while running:
115 # Receive MFA prompt from server 119 # Receive MFA prompt from server
116 prompt_len = int(conn.recv(HEADER_LENGTH).decode(FORMAT)) 120 header = conn.recv(HEADER_LENGTH).decode(FORMAT)
121 if header == "":
122 die("error: lost connection to server")
123 prompt_len = int(header)
117 prompt = conn.recv(prompt_len).decode(FORMAT) 124 prompt = conn.recv(prompt_len).decode(FORMAT)
118 # Ask user for response 125 # Ask user for response
119 answer = prompt_user(prompt) 126 answer = prompt_user(prompt)