This commit is contained in:
+6
-10
@@ -50,16 +50,12 @@ def untrusted():
|
||||
|
||||
|
||||
def closed_port():
|
||||
import socket
|
||||
|
||||
sock = socket.socket()
|
||||
sock.settimeout(2)
|
||||
try:
|
||||
result = sock.connect_ex(("127.0.0.1", 8080))
|
||||
finally:
|
||||
sock.close()
|
||||
if result == 0:
|
||||
raise SystemExit("plaintext port 8080 is reachable on the host")
|
||||
proc = compose("ps", "--format", "{{.Name}} {{.Ports}}")
|
||||
if proc.returncode != 0:
|
||||
raise SystemExit("cannot list compose ports")
|
||||
for line in proc.stdout.splitlines():
|
||||
if "8080->" in line or ":8080->" in line:
|
||||
raise SystemExit("lab7 publishes plaintext port 8080: %s" % line.strip())
|
||||
|
||||
|
||||
def rate_limit():
|
||||
|
||||
Reference in New Issue
Block a user