From 845c596a0aca071c72766f386b960525dde8974f Mon Sep 17 00:00:00 2001
From: "Ion-Dorinel FILIP (25005)" <dorinel.filip@upb.ro>
Date: Wed, 31 May 2023 13:14:05 +0000
Subject: [PATCH] pep8 reformat

---
 lab12/https_server.py | 8 ++++----
 lab12/ssl_client.py   | 7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lab12/https_server.py b/lab12/https_server.py
index 3b5649d..86d2515 100644
--- a/lab12/https_server.py
+++ b/lab12/https_server.py
@@ -8,7 +8,7 @@ SERVER_CERT = './server.crt'
 SERVER_PRIVATE = './server.key'
 
 context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
-#context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) # Ubuntu 16.04
+# context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) # Ubuntu 16.04
 context.load_cert_chain(SERVER_CERT, SERVER_PRIVATE)
 
 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
@@ -18,7 +18,7 @@ sock.listen(5)
 while True:
     newsock, fromaddr = sock.accept()
     ssock = context.wrap_socket(newsock, server_side=True)
-    data = ssock.recv(1024) # Read data over TLS
-    ssock.sendall(html.encode('utf-8')) # Send data over TLS
-    ssock.shutdown(socket.SHUT_RDWR) # Close the TLS connection
+    data = ssock.recv(1024)  # Read data over TLS
+    ssock.sendall(html.encode('utf-8'))  # Send data over TLS
+    ssock.shutdown(socket.SHUT_RDWR)  # Close the TLS connection
     ssock.close()
diff --git a/lab12/ssl_client.py b/lab12/ssl_client.py
index 10bb560..a0f4345 100644
--- a/lab12/ssl_client.py
+++ b/lab12/ssl_client.py
@@ -1,5 +1,6 @@
 #!/usr/bin/python3
 import socket, ssl, sys, pprint
+
 # Primim ca argument hostname-ul serverului, de exemplu google.com
 hostname = sys.argv[1]
 
@@ -16,15 +17,15 @@ cadir = '/etc/ssl/certs'
 
 # Set up the TLS context
 context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
-#context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) # For Ubuntu 16.04
+# context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) # For Ubuntu 16.04
 context.load_verify_locations(capath=cadir)
 context.verify_mode = ssl.CERT_REQUIRED
 context.check_hostname = True
 
 # Add the TLS
 ssock = context.wrap_socket(sock, server_hostname=hostname,
-do_handshake_on_connect=False)
-ssock.do_handshake() # Start the handshake
+                            do_handshake_on_connect=False)
+ssock.do_handshake()  # Start the handshake
 pprint.pprint(ssock.getpeercert())
 
 input("After handshake. Press any key to continue ...")
-- 
GitLab