feat(runner): add the own code runner contract, client and nsjail service
This commit is contained in:
1 parent
5e1db37746
commit
cdf6bcbb91
109 files changed
+24084
-28
No files matched your search
+18
@@ -0,0 +1,18 @@
|
||||
# Isolation probe: every attempt to reach a network must fail.
|
||||
import socket
|
||||
|
||||
attempts = [
|
||||
(socket.AF_INET, ("1.1.1.1", 53)),
|
||||
(socket.AF_INET, ("127.0.0.1", 8080)),
|
||||
(socket.AF_INET6, ("::1", 8080)),
|
||||
]
|
||||
reached = []
|
||||
for family, address in attempts:
|
||||
try:
|
||||
with socket.socket(family, socket.SOCK_STREAM) as connection:
|
||||
connection.settimeout(1)
|
||||
connection.connect(address)
|
||||
reached.append(address[0])
|
||||
except OSError:
|
||||
pass
|
||||
print("blocked" if not reached else "reached " + " ".join(reached))
|
||||
Reference in new issue
Block a user