diff options
Diffstat (limited to 'client')
| -rwxr-xr-x | client/client.py | 9 |
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" | |||
| 14 | FORMAT = "utf-8" | 14 | FORMAT = "utf-8" |
| 15 | import configparser | 15 | import configparser |
| 16 | 16 | ||
| 17 | def die(msg): | ||
| 18 | print(msg) | ||
| 19 | sys.exit(1) | ||
| 20 | |||
| 17 | def parse_arguments(): | 21 | def 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) |
