⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.155
Server IP:
57.129.66.90
Server:
Linux vps-7f548908 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
LiteSpeed
PHP Version:
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
local
/
CyberCP
/
dockerManager
/
Edit File: decorators.py
from django.shortcuts import render,redirect from loginSystem.models import Administrator import os import docker import json from django.http import HttpResponse from loginSystem.views import loadLoginPage from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging from plogical.acl import ACLManager def preDockerRun(function): def wrap(request, *args, **kwargs): try: userID = request.session['userID'] except KeyError: return redirect(loadLoginPage) currentACL = ACLManager.loadedACL(userID) if request.method == "POST": isPost = True else: isPost = False # check if docker is installed dockerInstallPath = '/usr/bin/docker' if not os.path.exists(dockerInstallPath): if isPost: data_ret = {'status': 0, 'error_message': 'Docker not installed'} json_data = json.dumps(data_ret) return HttpResponse(json_data) else: from plogical.httpProc import httpProc proc = httpProc(request, 'dockerManager/install.html', {'status':currentACL['admin'], 'conErr':0}, 'admin') return proc.render() #return render(request, 'dockerManager/install.html', {'status':currentACL['admin'], 'conErr':0}) # Check if docker is running and we are able to connect try: client = docker.from_env() result = client.ping() except BaseException as msg: logging.writeToFile(str(msg)) if isPost: data_ret = {'status': 0, 'error_message': 'Docker daemon not running or not responsive'} json_data = json.dumps(data_ret) return HttpResponse(json_data) else: from plogical.httpProc import httpProc proc = httpProc(request, 'dockerManager/install.html', {'status': currentACL['admin'], 'conErr': 0}, 'admin') return proc.render() #return render(request, 'dockerManager/install.html', {'status':currentACL['admin'], 'conErr':1}) return function(request, *args, **kwargs) return wrap
Simpan