edge004-base0.2.1
Corrected the NetSock and made the install script compliant
This commit is contained in:
15
main.py
15
main.py
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
This is the PyJail, a jailing tool for running Python apps in a sandboxed environment.
|
||||
Version: edge0003-base0.2.1
|
||||
Version: edge0004-base0.2.1
|
||||
"""
|
||||
import os
|
||||
import time
|
||||
@@ -58,8 +58,10 @@ class PyJail:
|
||||
msg = f"[{time.time}] [{caller}] [{log_level}] {message}"
|
||||
with open(self.fs("/proc/klog"), "a+") as f:
|
||||
f.write(msg)
|
||||
if emit is True:
|
||||
if emit is True and (log_level.upper() == "ERROR" or log_level.upper() == "CRITICAL"):
|
||||
print(msg)
|
||||
elif emit is True:
|
||||
|
||||
return 0
|
||||
|
||||
def fs(self, check_path=None, resolve_symlinks=True):
|
||||
@@ -135,7 +137,7 @@ class PyJail:
|
||||
"""
|
||||
Returns the kernel version
|
||||
"""
|
||||
return "edge0003-base0.2.1"
|
||||
return "edge0004-base0.2.1"
|
||||
|
||||
def netsock(self, ip, port, mode, msg):
|
||||
"""
|
||||
@@ -183,9 +185,10 @@ class PyJail:
|
||||
with open(self.fs(f"/usr/netsock/cache/{pkg}.pmd"), "a+") as f:
|
||||
f.write(file_io)
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
else:
|
||||
with open(self.fs(f"/usr/netsock/cache/{pkg}.py"))
|
||||
f.write(file_io)
|
||||
f.close()
|
||||
else:
|
||||
raise NotImplementedError("TODO: UDP will be implemented later!")
|
||||
|
||||
|
Reference in New Issue
Block a user