Щербацевич-БПИ2302-на 3

This commit is contained in:
2026-11-27 22:15:42 +03:00
parent bd3a530df3
commit 579bcc0b97
13 changed files with 271 additions and 121 deletions
+6 -10
View File
@@ -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():