mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
before checkout
This commit is contained in:
@@ -6,6 +6,8 @@ import sys
|
|||||||
import django
|
import django
|
||||||
import mimetypes
|
import mimetypes
|
||||||
|
|
||||||
|
from plogical.httpProc import httpProc
|
||||||
|
|
||||||
sys.path.append('/usr/local/CyberCP')
|
sys.path.append('/usr/local/CyberCP')
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
django.setup()
|
django.setup()
|
||||||
@@ -91,11 +93,6 @@ class ContainerManager(multi.Thread):
|
|||||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
|
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
|
||||||
|
|
||||||
def createContainer(self, request=None, userID=None, data=None):
|
def createContainer(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
admin = Administrator.objects.get(pk=userID)
|
|
||||||
if admin.acl.adminStatus != 1:
|
|
||||||
return ACLManager.loadError()
|
|
||||||
|
|
||||||
client = docker.from_env()
|
client = docker.from_env()
|
||||||
dockerAPI = docker.APIClient()
|
dockerAPI = docker.APIClient()
|
||||||
|
|
||||||
@@ -140,10 +137,9 @@ class ContainerManager(multi.Thread):
|
|||||||
Data = {"ownerList": adminNames, "image": image, "name": name, "tag": tag, "portConfig": portConfig,
|
Data = {"ownerList": adminNames, "image": image, "name": name, "tag": tag, "portConfig": portConfig,
|
||||||
"envList": envList}
|
"envList": envList}
|
||||||
|
|
||||||
return render(request, 'dockerManager/runContainer.html', Data)
|
template = 'dockerManager/runContainer.html'
|
||||||
|
proc = httpProc(request, template, Data, 'admin')
|
||||||
except BaseException as msg:
|
return proc.render()
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def loadContainerHome(self, request=None, userID=None, data=None):
|
def loadContainerHome(self, request=None, userID=None, data=None):
|
||||||
name = self.name
|
name = self.name
|
||||||
@@ -196,10 +192,11 @@ class ContainerManager(multi.Thread):
|
|||||||
data['memoryUsage'] = 0
|
data['memoryUsage'] = 0
|
||||||
data['cpuUsage'] = 0
|
data['cpuUsage'] = 0
|
||||||
|
|
||||||
return render(request, 'dockerManager/viewContainer.html', data)
|
template = 'dockerManager/viewContainer.html'
|
||||||
|
proc = httpProc(request, template, data, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
def listContainers(self, request=None, userID=None, data=None):
|
def listContainers(self, request=None, userID=None, data=None):
|
||||||
try:
|
|
||||||
client = docker.from_env()
|
client = docker.from_env()
|
||||||
dockerAPI = docker.APIClient()
|
dockerAPI = docker.APIClient()
|
||||||
|
|
||||||
@@ -235,12 +232,12 @@ class ContainerManager(multi.Thread):
|
|||||||
for i in range(1, finalPages):
|
for i in range(1, finalPages):
|
||||||
pagination.append('<li><a href="\#">' + str(i) + '</a></li>')
|
pagination.append('<li><a href="\#">' + str(i) + '</a></li>')
|
||||||
|
|
||||||
return render(request, 'dockerManager/listContainers.html', {"pagination": pagination,
|
template = 'dockerManager/listContainers.html'
|
||||||
|
proc = httpProc(request, template, {"pagination": pagination,
|
||||||
"unlistedContainers": unlistedContainers,
|
"unlistedContainers": unlistedContainers,
|
||||||
"adminNames": adminNames,
|
"adminNames": adminNames,
|
||||||
"showUnlistedContainer": showUnlistedContainer})
|
"showUnlistedContainer": showUnlistedContainer}, 'admin')
|
||||||
except BaseException as msg:
|
return proc.render()
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def getContainerLogs(self, userID=None, data=None):
|
def getContainerLogs(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
@@ -774,7 +771,9 @@ class ContainerManager(multi.Thread):
|
|||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return render(request, 'dockerManager/images.html', {"images": images, "test": ''})
|
template = 'dockerManager/images.html'
|
||||||
|
proc = httpProc(request, template, {"images": images, "test": ''}, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
return HttpResponse(str(msg))
|
return HttpResponse(str(msg))
|
||||||
@@ -808,7 +807,9 @@ class ContainerManager(multi.Thread):
|
|||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return render(request, 'dockerManager/manageImages.html', {"images": images})
|
template = 'dockerManager/manageImages.html'
|
||||||
|
proc = httpProc(request, template, {"images": images}, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
return HttpResponse(str(msg))
|
return HttpResponse(str(msg))
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
from django.shortcuts import render, redirect, HttpResponse
|
from django.shortcuts import redirect, HttpResponse
|
||||||
from loginSystem.models import Administrator
|
from loginSystem.models import Administrator
|
||||||
from loginSystem.views import loadLoginPage
|
from loginSystem.views import loadLoginPage
|
||||||
|
from plogical.httpProc import httpProc
|
||||||
from .container import ContainerManager
|
from .container import ContainerManager
|
||||||
from .decorators import preDockerRun
|
from .decorators import preDockerRun
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
@@ -25,15 +26,12 @@ def dockerPermission(request, userID, context):
|
|||||||
|
|
||||||
@preDockerRun
|
@preDockerRun
|
||||||
def loadDockerHome(request):
|
def loadDockerHome(request):
|
||||||
try:
|
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
perm = dockerPermission(request, userID, 'loadDockerHome')
|
|
||||||
if perm: return perm
|
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
return render(request,'dockerManager/index.html',{"type":admin.type})
|
template = 'dockerManager/index.html'
|
||||||
except KeyError:
|
|
||||||
return redirect(loadLoginPage)
|
proc = httpProc(request, template, {"type": admin.type}, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
def installDocker(request):
|
def installDocker(request):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ from loginSystem.views import loadLoginPage
|
|||||||
import json
|
import json
|
||||||
from random import randint
|
from random import randint
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from plogical.httpProc import httpProc
|
||||||
from .models import EmailMarketing, EmailLists, EmailsInList, EmailJobs
|
from .models import EmailMarketing, EmailLists, EmailsInList, EmailJobs
|
||||||
from websiteFunctions.models import Websites
|
from websiteFunctions.models import Websites
|
||||||
from .emailMarketing import emailMarketing as EM
|
from .emailMarketing import emailMarketing as EM
|
||||||
@@ -21,18 +23,8 @@ class EmailMarketingManager:
|
|||||||
self.domain = domain
|
self.domain = domain
|
||||||
|
|
||||||
def emailMarketing(self):
|
def emailMarketing(self):
|
||||||
try:
|
proc = httpProc(self.request, 'emailMarketing/emailMarketing.html', None, 'admin')
|
||||||
userID = self.request.session['userID']
|
return proc.render()
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
|
||||||
|
|
||||||
if currentACL['admin'] == 1:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
return ACLManager.loadError()
|
|
||||||
|
|
||||||
return render(self.request, 'emailMarketing/emailMarketing.html')
|
|
||||||
except KeyError as msg:
|
|
||||||
return redirect(loadLoginPage)
|
|
||||||
|
|
||||||
def fetchUsers(self):
|
def fetchUsers(self):
|
||||||
try:
|
try:
|
||||||
@@ -123,7 +115,8 @@ class EmailMarketingManager:
|
|||||||
if emACL.checkIfEMEnabled(admin.userName) == 0:
|
if emACL.checkIfEMEnabled(admin.userName) == 0:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
return render(self.request, 'emailMarketing/createEmailList.html', {'domain': self.domain})
|
proc = httpProc(self.request, 'emailMarketing/createEmailList.html', {'domain': self.domain}, 'admin')
|
||||||
|
return proc.render()
|
||||||
except KeyError as msg:
|
except KeyError as msg:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
@@ -178,7 +171,9 @@ class EmailMarketingManager:
|
|||||||
|
|
||||||
listNames = emACL.getEmailsLists(self.domain)
|
listNames = emACL.getEmailsLists(self.domain)
|
||||||
|
|
||||||
return render(self.request, 'emailMarketing/manageLists.html', {'listNames': listNames, 'domain': self.domain})
|
proc = httpProc(self.request, 'emailMarketing/manageLists.html', {'listNames': listNames, 'domain': self.domain}, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except KeyError as msg:
|
except KeyError as msg:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
@@ -196,7 +191,10 @@ class EmailMarketingManager:
|
|||||||
if emACL.checkIfEMEnabled(admin.userName) == 0:
|
if emACL.checkIfEMEnabled(admin.userName) == 0:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
return render(self.request, 'emailMarketing/configureVerify.html', {'domain': self.domain})
|
proc = httpProc(self.request, 'emailMarketing/configureVerify.html',
|
||||||
|
{'domain': self.domain}, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except KeyError as msg:
|
except KeyError as msg:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
@@ -490,7 +488,10 @@ class EmailMarketingManager:
|
|||||||
|
|
||||||
for items in emailLists:
|
for items in emailLists:
|
||||||
listNames.append(items.listName)
|
listNames.append(items.listName)
|
||||||
return render(self.request, 'emailMarketing/manageSMTPHosts.html', {'listNames': listNames, 'domain': self.domain})
|
|
||||||
|
proc = httpProc(self.request, 'emailMarketing/manageSMTPHosts.html',
|
||||||
|
{'listNames': listNames, 'domain': self.domain}, 'admin')
|
||||||
|
return proc.render()
|
||||||
except KeyError as msg:
|
except KeyError as msg:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
@@ -657,7 +658,9 @@ class EmailMarketingManager:
|
|||||||
if emACL.checkIfEMEnabled(admin.userName) == 0:
|
if emACL.checkIfEMEnabled(admin.userName) == 0:
|
||||||
return ACLManager.loadErrorJson()
|
return ACLManager.loadErrorJson()
|
||||||
|
|
||||||
return render(self.request, 'emailMarketing/composeMessages.html')
|
proc = httpProc(self.request, 'emailMarketing/composeMessages.html',
|
||||||
|
None, 'admin')
|
||||||
|
return proc.render()
|
||||||
except KeyError as msg:
|
except KeyError as msg:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
@@ -709,7 +712,11 @@ class EmailMarketingManager:
|
|||||||
Data['templateNames'] = templateNames
|
Data['templateNames'] = templateNames
|
||||||
Data['hostNames'] = hostNames
|
Data['hostNames'] = hostNames
|
||||||
Data['listNames'] = listNames
|
Data['listNames'] = listNames
|
||||||
return render(self.request, 'emailMarketing/sendEmails.html', Data)
|
|
||||||
|
proc = httpProc(self.request, 'emailMarketing/sendEmails.html',
|
||||||
|
Data, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except KeyError as msg:
|
except KeyError as msg:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from django.http import HttpResponse
|
|||||||
from mailServer.models import Domains, EUsers
|
from mailServer.models import Domains, EUsers
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
from loginSystem.models import Administrator
|
from loginSystem.models import Administrator
|
||||||
|
from plogical.httpProc import httpProc
|
||||||
from websiteFunctions.models import Websites
|
from websiteFunctions.models import Websites
|
||||||
from loginSystem.views import loadLoginPage
|
from loginSystem.views import loadLoginPage
|
||||||
import plogical.CyberCPLogFileWriter as logging
|
import plogical.CyberCPLogFileWriter as logging
|
||||||
@@ -34,7 +35,9 @@ def emailPolicyServer(request):
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
return render(request, 'emailPremium/policyServer.html')
|
proc = httpProc(request, 'emailPremium/policyServer.html',
|
||||||
|
None, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
@@ -171,8 +174,9 @@ def listDomains(request):
|
|||||||
for i in range(1, finalPages):
|
for i in range(1, finalPages):
|
||||||
pagination.append('<li><a href="\#">' + str(i) + '</a></li>')
|
pagination.append('<li><a href="\#">' + str(i) + '</a></li>')
|
||||||
|
|
||||||
|
proc = httpProc(request, 'emailPremium/listDomains.html',
|
||||||
return render(request,'emailPremium/listDomains.html',{"pagination":pagination, "installCheck": installCheck})
|
{"pagination":pagination, "installCheck": installCheck}, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
@@ -350,9 +354,12 @@ def emailLimits(request,domain):
|
|||||||
|
|
||||||
Data['pagination'] = pagination
|
Data['pagination'] = pagination
|
||||||
|
|
||||||
return render(request, 'emailPremium/emailLimits.html', Data)
|
proc = httpProc(request, 'emailPremium/emailLimits.html', Data, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return render(request, 'emailPremium/emailLimits.html', {"error":1,"domain": "This domain does not exists"})
|
proc = httpProc(request, 'emailPremium/emailLimits.html', {"error":1,"domain": "This domain does not exists"}, 'admin')
|
||||||
|
return proc.render()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
@@ -525,7 +532,9 @@ def emailPage(request, emailAddress):
|
|||||||
|
|
||||||
Data['pagination'] = pagination
|
Data['pagination'] = pagination
|
||||||
|
|
||||||
return render(request, 'emailPremium/emailPage.html', Data)
|
proc = httpProc(request, 'emailPremium/emailPage.html', Data, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
@@ -785,8 +794,8 @@ def spamAssassinHome(request):
|
|||||||
if mailUtilities.checkIfSpamAssassinInstalled() == 1:
|
if mailUtilities.checkIfSpamAssassinInstalled() == 1:
|
||||||
checkIfSpamAssassinInstalled = 1
|
checkIfSpamAssassinInstalled = 1
|
||||||
|
|
||||||
return render(request, 'emailPremium/SpamAssassin.html',{'checkIfSpamAssassinInstalled': checkIfSpamAssassinInstalled})
|
proc = httpProc(request, 'emailPremium/SpamAssassin.html', {'checkIfSpamAssassinInstalled': checkIfSpamAssassinInstalled}, 'admin')
|
||||||
|
return proc.render()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
@@ -1037,8 +1046,9 @@ def mailQueue(request):
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
return render(request, 'emailPremium/mailQueue.html')
|
proc = httpProc(request, 'emailPremium/mailQueue.html',
|
||||||
|
None, 'admin')
|
||||||
|
return proc.render()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
@@ -1195,7 +1205,9 @@ def MailScanner(request):
|
|||||||
if mailUtilities.checkIfMailScannerInstalled() == 1:
|
if mailUtilities.checkIfMailScannerInstalled() == 1:
|
||||||
checkIfMailScannerInstalled = 1
|
checkIfMailScannerInstalled = 1
|
||||||
|
|
||||||
return render(request, 'emailPremium/MailScanner.html',{'checkIfMailScannerInstalled': checkIfMailScannerInstalled, 'ipAddress': ipAddress})
|
proc = httpProc(request, 'emailPremium/MailScanner.html',
|
||||||
|
{'checkIfMailScannerInstalled': checkIfMailScannerInstalled, 'ipAddress': ipAddress}, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import os
|
|||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
import django
|
import django
|
||||||
|
|
||||||
|
from plogical.httpProc import httpProc
|
||||||
|
|
||||||
sys.path.append('/usr/local/CyberCP')
|
sys.path.append('/usr/local/CyberCP')
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
django.setup()
|
django.setup()
|
||||||
@@ -31,30 +34,14 @@ class FirewallManager:
|
|||||||
self.request = request
|
self.request = request
|
||||||
|
|
||||||
def securityHome(self, request = None, userID = None):
|
def securityHome(self, request = None, userID = None):
|
||||||
try:
|
proc = httpProc(request, 'firewall/index.html',
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
None, 'admin')
|
||||||
|
return proc.render()
|
||||||
if currentACL['admin'] == 1:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
return ACLManager.loadError()
|
|
||||||
|
|
||||||
return render(request, 'firewall/index.html')
|
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def firewallHome(self, request = None, userID = None):
|
def firewallHome(self, request = None, userID = None):
|
||||||
try:
|
proc = httpProc(request, 'firewall/firewall.html',
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
None, 'admin')
|
||||||
|
return proc.render()
|
||||||
if currentACL['admin'] == 1:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
return ACLManager.loadError()
|
|
||||||
|
|
||||||
return render(request, 'firewall/firewall.html')
|
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def getCurrentRules(self, userID = None):
|
def getCurrentRules(self, userID = None):
|
||||||
try:
|
try:
|
||||||
@@ -265,17 +252,9 @@ class FirewallManager:
|
|||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
def secureSSH(self, request = None, userID = None):
|
def secureSSH(self, request = None, userID = None):
|
||||||
try:
|
proc = httpProc(request, 'firewall/secureSSH.html',
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
None, 'admin')
|
||||||
|
return proc.render()
|
||||||
if currentACL['admin'] == 1:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
return ACLManager.loadError()
|
|
||||||
|
|
||||||
return render(request, 'firewall/secureSSH.html')
|
|
||||||
except BaseException as msg:
|
|
||||||
return HttpResponse(str(msg))
|
|
||||||
|
|
||||||
def getSSHConfigs(self, userID = None, data = None):
|
def getSSHConfigs(self, userID = None, data = None):
|
||||||
try:
|
try:
|
||||||
@@ -512,7 +491,10 @@ class FirewallManager:
|
|||||||
OLS = 0
|
OLS = 0
|
||||||
modSecInstalled = 1
|
modSecInstalled = 1
|
||||||
|
|
||||||
return render(request, 'firewall/modSecurity.html', {'modSecInstalled': modSecInstalled, 'OLS': OLS})
|
proc = httpProc(request, 'firewall/modSecurity.html',
|
||||||
|
{'modSecInstalled': modSecInstalled, 'OLS': OLS}, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
return HttpResponse(str(msg))
|
return HttpResponse(str(msg))
|
||||||
|
|
||||||
@@ -894,8 +876,9 @@ class FirewallManager:
|
|||||||
else:
|
else:
|
||||||
modSecInstalled = 1
|
modSecInstalled = 1
|
||||||
|
|
||||||
return render(request, 'firewall/modSecurityRules.html', {'modSecInstalled': modSecInstalled})
|
proc = httpProc(request, 'firewall/modSecurityRules.html',
|
||||||
|
{'modSecInstalled': modSecInstalled}, 'admin')
|
||||||
|
return proc.render()
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
return HttpResponse(str(msg))
|
return HttpResponse(str(msg))
|
||||||
|
|
||||||
@@ -1019,7 +1002,9 @@ class FirewallManager:
|
|||||||
else:
|
else:
|
||||||
modSecInstalled = 1
|
modSecInstalled = 1
|
||||||
|
|
||||||
return render(request, 'firewall/modSecurityRulesPacks.html', {'modSecInstalled': modSecInstalled})
|
proc = httpProc(request, 'firewall/modSecurityRulesPacks.html',
|
||||||
|
{'modSecInstalled': modSecInstalled}, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
return HttpResponse(msg)
|
return HttpResponse(msg)
|
||||||
@@ -1316,7 +1301,11 @@ class FirewallManager:
|
|||||||
csfInstalled = 0
|
csfInstalled = 0
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
csfInstalled = 0
|
csfInstalled = 0
|
||||||
return render(self.request,'firewall/csf.html', {'csfInstalled' : csfInstalled})
|
|
||||||
|
proc = httpProc(self.request, 'firewall/csf.html',
|
||||||
|
{'csfInstalled' : csfInstalled}, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
return HttpResponse(str(msg))
|
return HttpResponse(str(msg))
|
||||||
|
|
||||||
@@ -1575,11 +1564,17 @@ class FirewallManager:
|
|||||||
data['imunify'] = 0
|
data['imunify'] = 0
|
||||||
|
|
||||||
if data['CL'] == 0:
|
if data['CL'] == 0:
|
||||||
return render(self.request, 'firewall/notAvailable.html', data)
|
proc = httpProc(self.request, 'firewall/notAvailable.html',
|
||||||
|
data, 'admin')
|
||||||
|
return proc.render()
|
||||||
elif data['imunify'] == 0:
|
elif data['imunify'] == 0:
|
||||||
return render(self.request, 'firewall/notAvailable.html', data)
|
proc = httpProc(self.request, 'firewall/notAvailable.html',
|
||||||
|
data, 'admin')
|
||||||
|
return proc.render()
|
||||||
else:
|
else:
|
||||||
return render(self.request, 'firewall/imunify.html', data)
|
proc = httpProc(self.request, 'firewall/imunify.html',
|
||||||
|
data, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
@@ -1639,9 +1634,14 @@ class FirewallManager:
|
|||||||
data['imunify'] = 0
|
data['imunify'] = 0
|
||||||
|
|
||||||
if data['imunify'] == 0:
|
if data['imunify'] == 0:
|
||||||
return render(self.request, 'firewall/notAvailableAV.html', data)
|
proc = httpProc(self.request, 'firewall/notAvailableAV.html',
|
||||||
|
data, 'admin')
|
||||||
|
return proc.render()
|
||||||
else:
|
else:
|
||||||
return render(self.request, 'firewall/imunifyAV.html', data)
|
proc = httpProc(self.request, 'firewall/imunifyAV.html',
|
||||||
|
data, 'admin')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
import django
|
import django
|
||||||
|
|
||||||
|
from plogical.httpProc import httpProc
|
||||||
|
|
||||||
sys.path.append('/usr/local/CyberCP')
|
sys.path.append('/usr/local/CyberCP')
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
django.setup()
|
django.setup()
|
||||||
@@ -33,8 +36,9 @@ class FTPManager:
|
|||||||
|
|
||||||
def loadFTPHome(self):
|
def loadFTPHome(self):
|
||||||
try:
|
try:
|
||||||
val = self.request.session['userID']
|
proc = httpProc(self.request, 'ftp/index.html',
|
||||||
return render(self.request, 'ftp/index.html')
|
None, 'createFTPAccount')
|
||||||
|
return proc.render()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
@@ -49,12 +53,15 @@ class FTPManager:
|
|||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
if not os.path.exists('/home/cyberpanel/pureftpd'):
|
if not os.path.exists('/home/cyberpanel/pureftpd'):
|
||||||
return render(self.request, "ftp/createFTPAccount.html", {"status": 0})
|
proc = httpProc(self.request, 'ftp/createFTPAccount.html',
|
||||||
|
{ "status": 0}, 'createFTPAccount')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||||
|
|
||||||
return render(self.request, 'ftp/createFTPAccount.html',
|
proc = httpProc(self.request, 'ftp/createFTPAccount.html',
|
||||||
{'websiteList': websitesName, 'admin': admin.userName, "status": 1})
|
{'websiteList': websitesName, 'admin': admin.userName, "status": 1}, 'createFTPAccount')
|
||||||
|
return proc.render()
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
return HttpResponse(str(msg))
|
return HttpResponse(str(msg))
|
||||||
@@ -123,11 +130,16 @@ class FTPManager:
|
|||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
if not os.path.exists('/home/cyberpanel/pureftpd'):
|
if not os.path.exists('/home/cyberpanel/pureftpd'):
|
||||||
return render(self.request, "ftp/deleteFTPAccount.html", {"status": 0})
|
proc = httpProc(self.request, 'ftp/deleteFTPAccount.html',
|
||||||
|
{ "status": 0}, 'deleteFTPAccount')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||||
|
|
||||||
return render(self.request, 'ftp/deleteFTPAccount.html', {'websiteList': websitesName, "status": 1})
|
proc = httpProc(self.request, 'ftp/deleteFTPAccount.html',
|
||||||
|
{'websiteList': websitesName, "status": 1}, 'deleteFTPAccount')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
return HttpResponse(str(msg))
|
return HttpResponse(str(msg))
|
||||||
@@ -212,11 +224,14 @@ class FTPManager:
|
|||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
if not os.path.exists('/home/cyberpanel/pureftpd'):
|
if not os.path.exists('/home/cyberpanel/pureftpd'):
|
||||||
return render(self.request, "ftp/listFTPAccounts.html", {"status": 0})
|
proc = httpProc(self.request, 'ftp/listFTPAccounts.html',
|
||||||
|
{"status": 0}, 'listFTPAccounts')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||||
|
proc = httpProc(self.request, 'ftp/listFTPAccounts.html',
|
||||||
return render(self.request, 'ftp/listFTPAccounts.html', {'websiteList': websitesName, "status": 1})
|
{'websiteList': websitesName, "status": 1}, 'listFTPAccounts')
|
||||||
|
return proc.render()
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
return HttpResponse(str(msg))
|
return HttpResponse(str(msg))
|
||||||
|
|||||||
Reference in New Issue
Block a user