This commit is contained in:
Usman Nasir
2019-12-10 15:09:10 +05:00
parent d0dc397463
commit 5e7aeeb597
231 changed files with 1698 additions and 1697 deletions

View File

@@ -81,7 +81,7 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
return 1
else:
return 0
except BaseException, msg:
except BaseException as msg:
message = "%s. [%s]" % (str(msg), '[ApacheController.checkIfApacheInstalled]')
logging.CyberCPLogFileWriter.writeToFile(message)
@@ -94,7 +94,7 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
return 0
else:
return 1
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
return 0
@@ -157,7 +157,7 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
return 1
except BaseException, msg:
except BaseException as msg:
return str(msg)
@staticmethod
@@ -302,5 +302,5 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
return [0,result]
return [1, 'None']
except BaseException, msg:
except BaseException as msg:
return [0, str(msg)]

View File

@@ -144,7 +144,7 @@ class ApacheVhost:
ProcessUtilities.normalExecutioner(command)
return [1, 'None']
except BaseException, msg:
except BaseException as msg:
return [0, str(msg)]
@staticmethod
@@ -172,7 +172,7 @@ class ApacheVhost:
confFile.close()
return [1, 'None']
except BaseException, msg:
except BaseException as msg:
return [0, str(msg)]
@staticmethod
@@ -183,7 +183,7 @@ class ApacheVhost:
confFile.write("REWRITERULE ^(.*)$ HTTP://apachebackend/$1 [P]")
confFile.close()
return [1, 'None']
except BaseException, msg:
except BaseException as msg:
return [0, str(msg)]
@staticmethod
@@ -256,7 +256,7 @@ class ApacheVhost:
ProcessUtilities.normalExecutioner(command)
return [1, 'None']
except BaseException, msg:
except BaseException as msg:
return [0, str(msg)]
@staticmethod
@@ -285,7 +285,7 @@ class ApacheVhost:
command = "systemctl restart httpd"
ProcessUtilities.normalExecutioner(command)
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
@staticmethod
@@ -300,7 +300,7 @@ class ApacheVhost:
confFile.write(currentConf)
confFile.close()
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(
str(msg) + " [IO Error with per host config file [ApacheVhosts.perHostVirtualConf]]")
@@ -383,6 +383,6 @@ class ApacheVhost:
ProcessUtilities.normalExecutioner(command)
return 1
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
return 1

View File

@@ -14,7 +14,7 @@ class BackupUtil:
return 1
else:
return 0
except BaseException, msg:
except BaseException as msg:
return 0
@staticmethod
@@ -25,9 +25,9 @@ class BackupUtil:
try:
smtpObj = smtplib.SMTP('127.0.0.1')
smtpObj.sendmail(sender, receivers, message)
print "Successfully sent email"
except BaseException, msg:
print "Error: unable to send email %s" % str(msg)
print("Successfully sent email")
except BaseException as msg:
print("Error: unable to send email %s" % str(msg))
@staticmethod
def SyncHome():

View File

@@ -28,7 +28,7 @@ class CLManagerMain(multi.Thread):
elif self.function == 'enableOrDisable':
self.enableOrDisable()
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + ' [ContainerManager.run]')
def renderC(self):
@@ -77,7 +77,7 @@ class CLManagerMain(multi.Thread):
execPath = execPath + " --function submitCageFSInstall"
ProcessUtilities.outputExecutioner(execPath)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
def findWebsitesJson(self, currentACL, userID, pageNumber):
@@ -144,7 +144,7 @@ class CLManagerMain(multi.Thread):
'pagination': pagination, 'default': default}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
dic = {'status': 1, 'listWebSiteStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -160,7 +160,7 @@ class CLManagerMain(multi.Thread):
for items in websites:
command = '/usr/sbin/cagefsctl --disable %s' % (items.externalApp)
ProcessUtilities.executioner(command)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
def fetchPackages(self, currentACL):

View File

@@ -20,7 +20,7 @@ class CLinuxPackages:
try:
clPackage = CLPackages.objects.get(owner=itemPackage)
statement = '%s %s' % (pwd.getpwnam(items.externalApp).pw_uid, clPackage.name)
print statement
print(statement)
except:
pass
@@ -28,7 +28,7 @@ class CLinuxPackages:
@staticmethod
def listPackages():
for items in CLPackages.objects.all():
print items.name
print(items.name)
@staticmethod
def userIDPackage(user):
@@ -36,7 +36,7 @@ class CLinuxPackages:
itemPackage = website.package
try:
clPackage = CLPackages.objects.get(owner=itemPackage)
print clPackage
print(clPackage)
except:
pass
@@ -48,7 +48,7 @@ class CLinuxPackages:
try:
clPackage = CLPackages.objects.get(owner=itemPackage)
if clPackage.name == package:
print pwd.getpwnam(items.externalApp).pw_uid
print(pwd.getpwnam(items.externalApp).pw_uid)
except:
pass

View File

@@ -37,7 +37,7 @@ class CageFS:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
"Packages successfully installed.[200]\n", 1)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
def main():

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from packages.models import Package

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import redirect, HttpResponse
from loginSystem.views import loadLoginPage
@@ -43,7 +43,7 @@ def submitCageFSInstall(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -104,7 +104,7 @@ def enableOrDisable(request):
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -169,7 +169,7 @@ def submitCreatePackage(request):
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -213,7 +213,7 @@ def deleteCLPackage(request):
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -266,7 +266,7 @@ def saveSettings(request):
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -352,7 +352,7 @@ def getUsageData(request):
final_json = json.dumps(finalData)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg), 'cpu': 0, 'memory':0}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

View File

@@ -48,7 +48,7 @@ class secMiddleware:
try:
#logging.writeToFile(request.body)
data = json.loads(request.body)
for key, value in data.iteritems():
for key, value in data.items():
if request.path.find('gitNotify') > -1:
break
@@ -93,7 +93,7 @@ class secMiddleware:
final_dic = {'error_message': "Data supplied is not accepted.", "errorMessage": "Data supplied is not accepted."}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
response = self.get_response(request)
return response

View File

@@ -155,7 +155,7 @@ class IncJobs(multi.Thread):
metaFileXML.append(dnsRecordsXML)
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, '%s. [158:prepMeta]' % (str(msg)), 1)
## Email accounts XML
@@ -176,7 +176,7 @@ class IncJobs(multi.Thread):
emailRecordsXML.append(emailRecordXML)
metaFileXML.append(emailRecordsXML)
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(self.statusPath, '%s. [warning:179:prepMeta]' % (str(msg)), 1)
## Email meta generated!
@@ -196,7 +196,7 @@ class IncJobs(multi.Thread):
metaFile = open(metaPath, 'w')
metaFile.write(xmlpretty)
metaFile.close()
os.chmod(metaPath, 0640)
os.chmod(metaPath, 0o640)
## meta generated
@@ -211,7 +211,7 @@ class IncJobs(multi.Thread):
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, "%s [207][5009]" % (str(msg)), 1)
return 0
@@ -239,7 +239,7 @@ class IncJobs(multi.Thread):
logging.statusWriter(self.statusPath, 'Data for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath,'%s. [IncJobs.backupData.223][5009]' % str(msg), 1)
return 0
@@ -271,7 +271,7 @@ class IncJobs(multi.Thread):
destination=self.backupDestinations)
newSnapshot.save()
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath,'%s. [IncJobs.backupDatabases.269][5009]' % str(msg), 1)
return 0
@@ -304,7 +304,7 @@ class IncJobs(multi.Thread):
logging.statusWriter(self.statusPath, 'Emails for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath,'%s. [IncJobs.backupDatabases.269][5009]' % str(msg), 1)
return 0
@@ -323,7 +323,7 @@ class IncJobs(multi.Thread):
logging.statusWriter(self.statusPath, 'Repo %s initiated for %s.' % (self.backupDestinations, self.website.domain), 1)
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath,'%s. [IncJobs.initiateRepo.47][5009]' % str(msg), 1)
return 0

View File

@@ -115,7 +115,7 @@ class IncJobs(multi.Thread):
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
####
@@ -163,7 +163,7 @@ class IncJobs(multi.Thread):
logging.statusWriter(self.statusPath, result, 1)
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, "%s [88][5009]" % (str(msg)), 1)
return 0
@@ -240,7 +240,7 @@ class IncJobs(multi.Thread):
else:
self.awsFunction('restore', '', self.jobid.snapshotid)
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, "%s [138][5009]" % (str(msg)), 1)
return 0
@@ -274,10 +274,10 @@ class IncJobs(multi.Thread):
os.remove('/home/cyberpanel/%s' % (self.path.split('/')[-1]))
else:
os.remove('/home/cyberpanel/%s.sql' % (self.jobid.type.split(':')[1]))
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, "%s [160][5009]" % (str(msg)), 1)
return 0
@@ -297,7 +297,7 @@ class IncJobs(multi.Thread):
else:
self.awsFunction('restore', '', self.jobid.snapshotid)
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, "%s [46][5009]" % (str(msg)), 1)
return 0
@@ -328,7 +328,7 @@ class IncJobs(multi.Thread):
except:
pass
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, "%s [46][5009]" % (str(msg)), 1)
return 0
@@ -400,7 +400,7 @@ class IncJobs(multi.Thread):
logging.statusWriter(self.statusPath, message, 1)
logging.statusWriter(self.statusPath, 'Completed', 1)
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.extraArgs['tempPath'], str(msg), 1)
### Backup functions
@@ -520,7 +520,7 @@ class IncJobs(multi.Thread):
metaFileXML.append(dnsRecordsXML)
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, '%s. [158:prepMeta]' % (str(msg)), 1)
## Email accounts XML
@@ -541,7 +541,7 @@ class IncJobs(multi.Thread):
emailRecordsXML.append(emailRecordXML)
metaFileXML.append(emailRecordsXML)
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, '%s. [warning:179:prepMeta]' % (str(msg)), 1)
## Email meta generated!
@@ -561,7 +561,7 @@ class IncJobs(multi.Thread):
metaFile = open(metaPath, 'w')
metaFile.write(xmlpretty)
metaFile.close()
os.chmod(metaPath, 0640)
os.chmod(metaPath, 0o640)
## meta generated
@@ -573,7 +573,7 @@ class IncJobs(multi.Thread):
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, "%s [207][5009]" % (str(msg)), 1)
return 0
@@ -592,7 +592,7 @@ class IncJobs(multi.Thread):
logging.statusWriter(self.statusPath,
'Data for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, '%s. [IncJobs.backupData.223][5009]' % str(msg), 1)
return 0
@@ -617,11 +617,11 @@ class IncJobs(multi.Thread):
try:
os.remove('/home/cyberpanel/%s.sql' % (items.dbName))
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath,
'Failed to delete database: %s. [IncJobs.backupDatabases.456]' % str(msg), 1)
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, '%s. [IncJobs.backupDatabases.269][5009]' % str(msg), 1)
return 0
@@ -641,7 +641,7 @@ class IncJobs(multi.Thread):
logging.statusWriter(self.statusPath,
'Emails for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, '%s. [IncJobs.emailBackup.269][5009]' % str(msg), 1)
return 0
@@ -661,7 +661,7 @@ class IncJobs(multi.Thread):
logging.statusWriter(self.statusPath,
'Meta for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, '%s. [IncJobs.metaBackup.269][5009]' % str(msg), 1)
return 0
@@ -691,7 +691,7 @@ class IncJobs(multi.Thread):
logging.statusWriter(self.statusPath,
'Repo %s initiated for %s.' % (self.backupDestinations, self.website.domain), 1)
return 1
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath, '%s. [IncJobs.initiateRepo.47][5009]' % str(msg), 1)
return 0
@@ -763,7 +763,7 @@ Subject: %s
try:
command = 'rm -f %s' % (metaPathNew)
ProcessUtilities.executioner(command)
except BaseException, msg:
except BaseException as msg:
logging.statusWriter(self.statusPath,
'Failed to delete meta file: %s. [IncJobs.createBackup.591]' % str(msg), 1)

View File

@@ -82,7 +82,7 @@ class IncScheduler():
logging.statusWriter(IncScheduler.logPath, 'Failed backup for %s, error: %s.' % (web.website, result), 1)
break
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -1,4 +1,4 @@
from __future__ import unicode_literals
from django.db import models
from websiteFunctions.models import Websites

View File

@@ -49,7 +49,7 @@ class restoreMeta():
virtualHostUtilities.createDomain(masterDomain, domain, phpSelection, path, 0, 0, 0,
'admin', 0)
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg) + " [startRestore]")
return 0
@@ -92,7 +92,7 @@ class restoreMeta():
'Email created: %s' % (
email))
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg) + " [startRestore]")
return 0
@@ -148,7 +148,7 @@ class restoreMeta():
except:
pass
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg) + " [startRestore]")
def main():

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from plogical.acl import ACLManager
@@ -48,7 +48,7 @@ def createBackup(request):
destinations.append('s3:s3.amazonaws.com/%s' % (items))
return defRenderer(request, 'IncBackups/createBackup.html', {'websiteList': websitesName, 'destinations': destinations})
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
@@ -61,7 +61,7 @@ def backupDestinations(request):
return ACLManager.loadError()
return defRenderer(request, 'IncBackups/incrementalDestinations.html', {})
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
@@ -168,7 +168,7 @@ def addDestination(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -235,7 +235,7 @@ def populateCurrentRecords(request):
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -264,7 +264,7 @@ def removeDestination(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'destStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -337,7 +337,7 @@ def fetchCurrentBackups(request):
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -398,7 +398,7 @@ def submitBackupCreation(request):
final_json = json.dumps({'status': 1, 'error_message': "None", 'tempPath': tempPath})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
final_dic = {'status': 0, 'metaStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
@@ -456,7 +456,7 @@ def getBackupStatus(request):
final_json = json.dumps({'backupStatus': 1, 'error_message': "None", "status": 1, "abort": 0})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'backupStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
logging.writeToFile(str(msg) + " [backupStatus]")
@@ -483,7 +483,7 @@ def deleteBackup(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'destStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -528,7 +528,7 @@ def fetchRestorePoints(request):
json_data = json_data + ']'
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -576,7 +576,7 @@ def restorePoint(request):
final_json = json.dumps({'status': 1, 'error_message': "None", 'tempPath': tempPath})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
final_dic = {'status': 0, 'metaStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
@@ -607,7 +607,7 @@ def scheduleBackups(request):
destinations.append('s3:s3.amazonaws.com/%s' % (items))
return defRenderer(request, 'IncBackups/backupSchedule.html', {'websiteList': websitesName, 'destinations': destinations})
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
@@ -657,7 +657,7 @@ def submitBackupSchedule(request):
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
return HttpResponse(final_json)
@@ -690,7 +690,7 @@ def getCurrentBackupSchedules(request):
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -713,7 +713,7 @@ def scheduleDelete(request):
final_json = json.dumps({'status': 1, 'error_message': "None"})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
return HttpResponse(final_json)
@@ -741,6 +741,6 @@ def restoreRemoteBackups(request):
destinations.append('s3:s3.amazonaws.com/%s' % (items))
return defRenderer(request, 'IncBackups/restoreRemoteBackups.html', {'websiteList': websitesName, 'destinations': destinations})
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)

View File

@@ -82,14 +82,14 @@ class SSHServer(multi.Thread):
pass
else:
return 0
except BaseException, msg:
except BaseException as msg:
time.sleep(0.1)
def run(self):
try:
self.recvData()
except BaseException, msg:
print(str(msg))
except BaseException as msg:
print((str(msg)))
class WebTerminalServer(WebSocket):

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, redirect, HttpResponse
from plogical.acl import ACLManager
@@ -49,7 +49,7 @@ def terminal(request):
newFWRule.save()
return render(request, 'WebTerminal/WebTerminal.html', {'verifyPath': verifyPath, 'password': password})
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
return redirect(loadLoginPage)
@@ -73,7 +73,7 @@ def restart(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
import json

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
from django.shortcuts import redirect
from django.http import HttpResponse
@@ -46,7 +46,7 @@ def verifyConn(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'verifyConn': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -107,7 +107,7 @@ def getUserInfo(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -150,7 +150,7 @@ def changeUserPassAPI(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'changeStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -195,7 +195,7 @@ def changePackageAPI(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'changePackage': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -240,7 +240,7 @@ def deleteWebsite(request):
wm = WebsiteManager()
return wm.submitWebsiteDeletion(admin.pk, data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'websiteDeleteStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -271,7 +271,7 @@ def submitWebsiteStatus(request):
wm = WebsiteManager()
return wm.submitWebsiteStatus(admin.pk, json.loads(request.body))
except BaseException, msg:
except BaseException as msg:
data_ret = {'websiteStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -295,7 +295,7 @@ def loginAPI(request):
else:
return HttpResponse("Invalid Credentials.")
except BaseException, msg:
except BaseException as msg:
data = {'userID': 0, 'loginStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data)
return HttpResponse(json_data)
@@ -338,7 +338,7 @@ def fetchSSHkey(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data = {'status' : 0, 'pubKeyStatus': 0,'error_message': str(msg)}
json_data = json.dumps(data)
return HttpResponse(json_data)
@@ -390,7 +390,7 @@ def remoteTransfer(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data = {'transferStatus': 0,'error_message': str(msg)}
json_data = json.dumps(data)
return HttpResponse(json_data)
@@ -440,7 +440,7 @@ def fetchAccountsFromRemoteServer(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data = {'fetchStatus': 0,'error_message': str(msg)}
json_data = json.dumps(data)
return HttpResponse(json_data)
@@ -481,7 +481,7 @@ def FetchRemoteTransferStatus(request):
except BaseException, msg:
except BaseException as msg:
data = {'fetchStatus': 0,'error_message': str(msg)}
json_data = json.dumps(data)
return HttpResponse(json_data)
@@ -528,7 +528,7 @@ def cancelRemoteTransfer(request):
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data = {'cancelStatus': 1, 'error_message': str(msg)}
json_data = json.dumps(data)
return HttpResponse(json_data)
@@ -572,7 +572,7 @@ def cyberPanelVersion(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {
"getVersion": 0,
'error_message': str(msg)
@@ -590,7 +590,7 @@ def runAWSBackups(request):
if os.path.exists(randomFile):
s3 = S3Backups(request, None, 'runAWSBackups')
s3.start()
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg) + ' [API.runAWSBackups]')
@@ -620,7 +620,7 @@ def submitUserCreation(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'changeStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import DBUsers

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -33,7 +33,7 @@ class BackupManager:
try:
currentACL = ACLManager.loadedACL(userID)
return render(request, 'backup/index.html', currentACL)
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def backupSite(self, request = None, userID = None, data = None):
@@ -45,7 +45,7 @@ class BackupManager:
websitesName = ACLManager.findAllSites(currentACL, userID)
return render(request, 'backup/backup.html', {'websiteList': websitesName})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def restoreSite(self, request = None, userID = None, data = None):
@@ -73,7 +73,7 @@ class BackupManager:
return render(request, 'backup/restore.html', {'backups': all_files})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def getCurrentBackups(self, userID = None, data = None):
@@ -120,7 +120,7 @@ class BackupManager:
json_data = json_data + ']'
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": json_data})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -157,7 +157,7 @@ class BackupManager:
final_json = json.dumps({'status': 1, 'metaStatus': 1, 'error_message': "None", 'tempStorage': tempStoragePath})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
final_dic = {'status': 0, 'metaStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
@@ -240,7 +240,7 @@ class BackupManager:
final_json = json.dumps({'backupStatus': 0, 'error_message': "None", "status": 0, "abort": 0})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'backupStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [backupStatus]")
@@ -259,13 +259,13 @@ class BackupManager:
try:
backupOb = Backups.objects.get(fileName=fileName)
backupOb.delete()
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [cancelBackupCreation]")
final_json = json.dumps({'abortStatus': 1, 'error_message': "None", "status": 0})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'abortStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -291,7 +291,7 @@ class BackupManager:
final_json = json.dumps({'status': 1, 'deleteStatus': 1, 'error_message': "None"})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'deleteStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
@@ -321,7 +321,7 @@ class BackupManager:
final_dic = {'restoreStatus': 1, 'error_message': "None"}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'restoreStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -368,7 +368,7 @@ class BackupManager:
'running': 'Running..'})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
status = "Just Started"
final_json = json.dumps(
@@ -381,7 +381,7 @@ class BackupManager:
'abort': 1})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'restoreStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -395,7 +395,7 @@ class BackupManager:
return render(request, 'backup/backupDestinations.html', {})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def submitDestinationCreation(self, userID = None, data = None):
@@ -457,7 +457,7 @@ class BackupManager:
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'destStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -492,7 +492,7 @@ class BackupManager:
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'fetchStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -520,7 +520,7 @@ class BackupManager:
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'connStatus': 1, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -573,7 +573,7 @@ class BackupManager:
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'delStatus': 1, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -600,7 +600,7 @@ class BackupManager:
return render(request, 'backup/backupSchedule.html', {'destinations': destinations})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def getCurrentBackupSchedules(self, userID = None, data = None):
@@ -631,7 +631,7 @@ class BackupManager:
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'fetchStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -741,7 +741,7 @@ class BackupManager:
final_json = json.dumps({'scheduleStatus': 1, 'error_message': "None"})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_json = json.dumps({'scheduleStatus': 0, 'error_message': str(msg)})
return HttpResponse(final_json)
@@ -802,7 +802,7 @@ class BackupManager:
final_json = json.dumps({'delStatus': 1, 'error_message': "None"})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_json = json.dumps({'delStatus': 0, 'error_message': str(msg)})
return HttpResponse(final_json)
@@ -815,7 +815,7 @@ class BackupManager:
return render(request, 'backup/remoteBackups.html')
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def submitRemoteBackups(self, userID = None, data = None):
@@ -858,7 +858,7 @@ class BackupManager:
return HttpResponse(data_ret)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0,
'error_message': "Not able to fetch version of remote server. Error Message: " + str(
msg),
@@ -930,14 +930,14 @@ class BackupManager:
data['error_message'], "dir": "Null"}
data_ret = json.dumps(data_ret)
return HttpResponse(data_ret)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0,
'error_message': "Not able to fetch accounts from remote server. Error Message: " + str(
msg), "dir": "Null"}
data_ret = json.dumps(data_ret)
return HttpResponse(data_ret)
except BaseException, msg:
except BaseException as msg:
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
return HttpResponse(final_json)
@@ -995,13 +995,13 @@ class BackupManager:
data['error_message']})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_json = json.dumps({'remoteTransferStatus': 0,
'error_message': "Can not initiate remote transfer. Error message: " +
str(msg)})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_json = json.dumps({'remoteTransferStatus': 0, 'error_message': str(msg)})
return HttpResponse(final_json)
@@ -1045,7 +1045,7 @@ class BackupManager:
'backupsSent': 0}
json_data = json.dumps(data)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data = {'remoteTransferStatus': 0, 'error_message': str(msg), 'backupsSent': 0}
json_data = json.dumps(data)
return HttpResponse(json_data)
@@ -1075,7 +1075,7 @@ class BackupManager:
json_data = json.dumps(data)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data = {'remoteRestoreStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data)
return HttpResponse(json_data)
@@ -1122,7 +1122,7 @@ class BackupManager:
"complete": 0}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data = {'remoteTransferStatus': 0, 'error_message': str(msg), "status": "None", "complete": 0}
json_data = json.dumps(data)
return HttpResponse(json_data)
@@ -1168,7 +1168,7 @@ class BackupManager:
json_data = json.dumps(data)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data = {'cancelStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data)
return HttpResponse(json_data)

View File

@@ -1,4 +1,4 @@
from __future__ import unicode_literals
from django.db import models

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Create your views here.
import json
@@ -61,7 +61,7 @@ def submitBackupCreation(request):
return coreResult
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
@@ -337,5 +337,5 @@ def localInitiate(request):
if os.path.exists(randomFile):
wm = BackupManager()
return wm.submitBackupCreation(1, json.loads(request.body))
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render,redirect
from django.http import HttpResponse
@@ -199,7 +199,7 @@ def upgradeStatus(request):
return HttpResponse(final_json)
except BaseException,msg:
except BaseException as msg:
final_dic = {'upgradeStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -217,6 +217,6 @@ def upgradeVersion(request):
vers.build = latest['build']
vers.save()
return HttpResponse("Version upgrade OK.")
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
return HttpResponse(str(msg))

View File

@@ -24,5 +24,5 @@ class cliLogger:
return lastFewLines
except subprocess.CalledProcessError,msg:
except subprocess.CalledProcessError as msg:
return "File was empty"

View File

@@ -33,7 +33,7 @@ class cyberPanel:
data = json.dumps({'success': operationStatus,
'errorMessage': errorMessage
})
print data
print(data)
## Website Functions
@@ -51,7 +51,7 @@ class cyberPanel:
else:
self.printStatus(0, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -68,7 +68,7 @@ class cyberPanel:
else:
self.printStatus(0, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -77,9 +77,9 @@ class cyberPanel:
vhost.deleteVirtualHostConfigurations(domainName)
self.printStatus(1, 'None')
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def deleteChild(self, childDomain):
try:
@@ -91,9 +91,9 @@ class cyberPanel:
else:
self.printStatus(0, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def listWebsitesJson(self):
try:
@@ -122,11 +122,11 @@ class cyberPanel:
json_data = json_data + ']'
final_json = json.dumps(json_data)
print final_json
print(final_json)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def listWebsitesPretty(self):
try:
@@ -146,11 +146,11 @@ class cyberPanel:
else:
state = "Active"
table.add_row([items.id, items.domain, ipAddress, items.package.packageName, items.admin.userName, state, items.adminEmail])
print table
print(table)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def changePHP(self, virtualHostName, phpVersion):
try:
@@ -167,7 +167,7 @@ class cyberPanel:
else:
self.printStatus(0, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -186,7 +186,7 @@ class cyberPanel:
self.printStatus(1, 'None')
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -218,11 +218,11 @@ class cyberPanel:
json_data = json_data + ']'
final_json = json.dumps(json_data)
print final_json
print(final_json)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def listDNSPretty(self, virtualHostName):
try:
@@ -237,11 +237,11 @@ class cyberPanel:
else:
content = items.content
table.add_row([items.id, items.type, items.name, content, items.prio, items.ttl])
print table
print(table)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def listDNSZonesJson(self):
try:
@@ -264,11 +264,11 @@ class cyberPanel:
json_data = json_data + ']'
final_json = json.dumps(json_data)
print final_json
print(final_json)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def listDNSZonesPretty(self):
try:
@@ -280,18 +280,18 @@ class cyberPanel:
for items in records:
table.add_row([items.id, items.name])
print table
print(table)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def createDNSZone(self, virtualHostName, owner):
try:
admin = Administrator.objects.get(userName=owner)
DNS.dnsTemplate(virtualHostName, admin)
self.printStatus(1, 'None')
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -300,7 +300,7 @@ class cyberPanel:
zone = DNS.getZoneObject(virtualHostName)
DNS.createDNSRecord(zone, name, recordType, value, int(priority), int(ttl))
self.printStatus(1, 'None')
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -308,7 +308,7 @@ class cyberPanel:
try:
DNS.deleteDNSZone(virtualHostName)
self.printStatus(1, 'None')
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -316,7 +316,7 @@ class cyberPanel:
try:
DNS.deleteDNSRecord(recordID)
self.printStatus(1, 'None')
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -326,13 +326,13 @@ class cyberPanel:
try:
backupLogPath = "/usr/local/lscp/logs/backup_log."+time.strftime("%I-%M-%S-%a-%b-%Y")
print 'Backup logs to be generated in %s' % (backupLogPath)
print('Backup logs to be generated in %s' % (backupLogPath))
backupSchedule.createLocalBackup(virtualHostName, backupLogPath)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def restoreBackup(self, fileName):
try:
@@ -351,19 +351,19 @@ class cyberPanel:
data = json.loads(r.text)
if data['abort'] == 1 and data['running'] == "Error":
print 'Failed to restore backup, Error message : ' + data['status'] + '\n'
print('Failed to restore backup, Error message : ' + data['status'] + '\n')
break
elif data['abort'] == 1 and data['running'] == "Completed":
print '\n\n'
print 'Backup restore completed.\n'
print('\n\n')
print('Backup restore completed.\n')
break
else:
print 'Waiting for restore to complete. Current status: ' + data['status']
print('Waiting for restore to complete. Current status: ' + data['status'])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
## Packages
@@ -380,7 +380,7 @@ class cyberPanel:
self.printStatus(1, 'None')
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -391,7 +391,7 @@ class cyberPanel:
delPack.delete()
self.printStatus(1, 'None')
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -422,11 +422,11 @@ class cyberPanel:
json_data = json_data + ']'
final_json = json.dumps(json_data)
print final_json
print(final_json)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def listPackagesPretty(self):
try:
@@ -438,11 +438,11 @@ class cyberPanel:
for items in records:
table.add_row([items.packageName, items.allowedDomains, items.diskSpace, items.bandwidth, items.ftpAccounts, items.dataBases, items.emailAccounts])
print table
print(table)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
## Database functions
@@ -455,7 +455,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -468,7 +468,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -494,11 +494,11 @@ class cyberPanel:
json_data = json_data + ']'
final_json = json.dumps(json_data)
print final_json
print(final_json)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def listDatabasesPretty(self, virtualHostName):
try:
@@ -510,11 +510,11 @@ class cyberPanel:
for items in records:
table.add_row([items.id, items.dbName, items.dbUser])
print table
print(table)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
## Email functions
@@ -526,7 +526,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -538,7 +538,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -550,7 +550,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -575,11 +575,11 @@ class cyberPanel:
json_data = json_data + ']'
final_json = json.dumps(json_data)
print final_json
print(final_json)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def listEmailsPretty(self, virtualHostName):
try:
@@ -591,11 +591,11 @@ class cyberPanel:
for items in records:
table.add_row([items.email])
print table
print(table)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
## FTP Functions
@@ -612,7 +612,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -624,7 +624,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -636,7 +636,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -662,11 +662,11 @@ class cyberPanel:
json_data = json_data + ']'
final_json = json.dumps(json_data)
print final_json
print(final_json)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
def listFTPPretty(self, virtualHostName):
try:
@@ -678,11 +678,11 @@ class cyberPanel:
for items in records:
table.add_row([items.id, items.user, items.dir])
print table
print(table)
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
print 0
print(0)
## FTP Functions
@@ -709,7 +709,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -733,7 +733,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -757,7 +757,7 @@ class cyberPanel:
self.printStatus(1, 'None')
else:
self.printStatus(1, result[1])
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -786,7 +786,7 @@ class cyberPanel:
ProcessUtilities.restartLitespeed()
self.printStatus(1, 'None')
except BaseException, msg:
except BaseException as msg:
logger.writeforCLI(str(msg), "Error", stack()[0][3])
self.printStatus(0, str(msg))
@@ -803,23 +803,23 @@ def main():
completeCommandExample = 'cyberpanel createWebsite --package Detault --owner admin --domainName cyberpanel.net --email support@cyberpanel.net --php 5.6'
if not args.package:
print "\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.owner:
print "\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.domainName:
print "\n\nPlease enter the domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.email:
print "\n\nPlease enter the email. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the email. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.php:
print "\n\nPlease enter the PHP version such as 5.6 for PHP version 5.6. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the PHP version such as 5.6 for PHP version 5.6. For example:\n\n" + completeCommandExample + "\n\n")
return
if args.ssl:
@@ -843,7 +843,7 @@ def main():
completeCommandExample = 'cyberpanel deleteWebsite --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter the domain to delete. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the domain to delete. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.deleteWebsite(args.domainName)
@@ -853,19 +853,19 @@ def main():
' --owner admin --php 5.6'
if not args.masterDomain:
print "\n\nPlease enter Master domain. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter Master domain. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.childDomain:
print "\n\nPlease enter the Child Domain. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the Child Domain. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.owner:
print "\n\nPlease enter owner for this domain DNS records. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter owner for this domain DNS records. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.php:
print "\n\nPlease enter required PHP version. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter required PHP version. For example:\n\n" + completeCommandExample + "\n\n")
return
if args.ssl:
@@ -889,7 +889,7 @@ def main():
completeCommandExample = 'cyberpanel deleteChild --childDomain cyberpanel.net'
if not args.childDomain:
print "\n\nPlease enter the child domain to delete. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the child domain to delete. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.deleteChild(args.childDomain)
@@ -903,11 +903,11 @@ def main():
completeCommandExample = 'cyberpanel changePHP --domainName cyberpanel.net --php 5.6'
if not args.domainName:
print "\n\nPlease enter Domain. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter Domain. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.php:
print "\n\nPlease enter required PHP version. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter required PHP version. For example:\n\n" + completeCommandExample + "\n\n")
return
@@ -917,11 +917,11 @@ def main():
completeCommandExample = 'cyberpanel changePackage --domainName cyberpanel.net --packageName CLI'
if not args.domainName:
print "\n\nPlease enter the Domain. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the Domain. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.packageName:
print "\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.changePackage(args.domainName, args.packageName)
@@ -933,7 +933,7 @@ def main():
completeCommandExample = 'cyberpanel listDNSJson --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.listDNSJson(args.domainName)
@@ -942,7 +942,7 @@ def main():
completeCommandExample = 'cyberpanel listDNSPretty --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.listDNSPretty(args.domainName)
@@ -954,11 +954,11 @@ def main():
completeCommandExample = 'cyberpanel createDNSZone --owner admin --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.owner:
print "\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.createDNSZone(args.domainName, args.owner)
@@ -966,7 +966,7 @@ def main():
completeCommandExample = 'cyberpanel deleteDNSZone --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.deleteDNSZone(args.domainName)
@@ -975,27 +975,27 @@ def main():
' --recordType A --value 192.168.100.1 --priority 0 --ttl 3600'
if not args.domainName:
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.name:
print "\n\nPlease enter the record name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the record name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.recordType:
print "\n\nPlease enter the record type. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the record type. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.value:
print "\n\nPlease enter the record value. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the record value. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.priority:
print "\n\nPlease enter the priority. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the priority. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.ttl:
print "\n\nPlease enter the ttl. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the ttl. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.createDNSRecord(args.domainName, args.name, args.recordType, args.value, args.priority, args.ttl)
@@ -1003,7 +1003,7 @@ def main():
completeCommandExample = 'cyberpanel deleteDNSRecord --recordID 200'
if not args.recordID:
print "\n\nPlease enter the record ID to be deleted, you can find record ID by listing the current DNS records. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the record ID to be deleted, you can find record ID by listing the current DNS records. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.deleteDNSRecord(args.recordID)
@@ -1015,7 +1015,7 @@ def main():
completeCommandExample = 'cyberpanel createBackup --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.createBackup(args.domainName)
@@ -1024,7 +1024,7 @@ def main():
completeCommandExample = 'cyberpanel restoreBackup --fileName /home/talkshosting.com/backup/backup-talksho-01-30-53-Fri-Jun-2018.tar.gz'
if not args.fileName:
print "\n\nPlease enter the file name or complete path to file. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the file name or complete path to file. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.restoreBackup(args.fileName)
@@ -1037,33 +1037,33 @@ def main():
' --dataBases 100 --ftpAccounts 100 --allowedDomains 100'
if not args.owner:
print "\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.packageName:
print "\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.diskSpace:
print "\n\nPlease enter value for Disk Space. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter value for Disk Space. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.bandwidth:
print "\n\nPlease enter value for Bandwidth. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter value for Bandwidth. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.emailAccounts:
print "\n\nPlease enter value for Email accounts. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter value for Email accounts. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.dataBases:
print "\n\nPlease enter value for Databases. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter value for Databases. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.ftpAccounts:
print "\n\nPlease enter value for Ftp accounts. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter value for Ftp accounts. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.allowedDomains:
print "\n\nPlease enter value for Allowed Child Domains. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter value for Allowed Child Domains. For example:\n\n" + completeCommandExample + "\n\n")
return
@@ -1073,7 +1073,7 @@ def main():
elif args.function == "deletePackage":
completeCommandExample = 'cyberpanel deletePackage --packageName CLI'
if not args.packageName:
print "\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.deletePackage(args.packageName)
@@ -1090,24 +1090,24 @@ def main():
'--dbUsername cyberpanel --dbPassword cyberpanel'
if not args.databaseWebsite:
print "\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.dbName:
print "\n\nPlease enter the database name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the database name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.dbUsername:
print "\n\nPlease enter the database username. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the database username. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.dbPassword:
print "\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.createDatabase(args.dbName, args.dbUsername, args.dbPassword, args.databaseWebsite)
elif args.function == "deleteDatabase":
completeCommandExample = 'cyberpanel deleteDatabase --dbName cyberpanel'
if not args.dbName:
print "\n\nPlease enter the database name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the database name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.deleteDatabase(args.dbName)
@@ -1116,14 +1116,14 @@ def main():
completeCommandExample = 'cyberpanel listDatabasesJson --databaseWebsite cyberpanel.net'
if not args.databaseWebsite:
print "\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.listDatabasesJson(args.databaseWebsite)
elif args.function == "listDatabasesPretty":
completeCommandExample = 'cyberpanel listDatabasesPretty --databaseWebsite cyberpanel.net'
if not args.databaseWebsite:
print "\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.listDatabasesPretty(args.databaseWebsite)
@@ -1136,14 +1136,14 @@ def main():
'--password cyberpanel'
if not args.domainName:
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.userName:
print "\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.password:
print "\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.createEmail(args.domainName, args.userName, args.password)
@@ -1151,7 +1151,7 @@ def main():
completeCommandExample = 'cyberpanel deleteEmail --email cyberpanel@cyberpanel.net'
if not args.email:
print "\n\nPlease enter the email. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the email. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.deleteEmail(args.email)
@@ -1160,11 +1160,11 @@ def main():
completeCommandExample = 'cyberpanel changeEmailPassword --email cyberpanel@cyberpanel.net --password cyberpanel'
if not args.email:
print "\n\nPlease enter email. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter email. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.password:
print "\n\nPlease enter the password. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the password. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.changeEmailPassword(args.email, args.password)
@@ -1172,7 +1172,7 @@ def main():
completeCommandExample = 'cyberpanel listEmailsJson --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.listEmailsJson(args.domainName)
@@ -1180,7 +1180,7 @@ def main():
completeCommandExample = 'cyberpanel listEmailsPretty --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.listEmailsPretty(args.domainName)
@@ -1193,18 +1193,18 @@ def main():
'--password cyberpanel --owner admin'
if not args.domainName:
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.userName:
print "\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.password:
print "\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.owner:
print "\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.createFTPAccount(args.domainName, args.userName, args.password, args.owner)
@@ -1212,7 +1212,7 @@ def main():
completeCommandExample = 'cyberpanel deleteFTPAccount --userName cyberpanel'
if not args.userName:
print "\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.deleteFTPAccount(args.userName)
@@ -1221,11 +1221,11 @@ def main():
completeCommandExample = 'cyberpanel changeFTPPassword --userName cyberpanel --password cyberpanel'
if not args.userName:
print "\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n")
return
if not args.password:
print "\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.changeFTPPassword(args.userName, args.password)
@@ -1233,7 +1233,7 @@ def main():
completeCommandExample = 'cyberpanel listFTPJson --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.listFTPJson(args.domainName)
@@ -1241,7 +1241,7 @@ def main():
completeCommandExample = 'cyberpanel listFTPPretty --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.listFTPPretty(args.domainName)
@@ -1251,7 +1251,7 @@ def main():
completeCommandExample = 'cyberpanel issueSSL --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.issueSSL(args.domainName)
@@ -1259,7 +1259,7 @@ def main():
completeCommandExample = 'cyberpanel hostNameSSL --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.issueSSLForHostName(args.domainName)
@@ -1268,7 +1268,7 @@ def main():
completeCommandExample = 'cyberpanel mailServerSSL --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.issueSSLForMailServer(args.domainName)
@@ -1277,7 +1277,7 @@ def main():
completeCommandExample = 'cyberpanel issueSelfSignedSSL --domainName cyberpanel.net'
if not args.domainName:
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
return
cyberpanel.issueSelfSignedSSL(args.domainName)

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from cloudManager import CloudManager
import json
@@ -307,6 +307,6 @@ def router(request):
else:
return cm.ajaxPre(0, 'This function is not available in your version of CyberPanel.')
except BaseException, msg:
except BaseException as msg:
cm = CloudManager(None)
return cm.ajaxPre(0, str(msg))

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -18,12 +18,12 @@ class Container:
length = len(Container.users)
for items in Container.users:
if (counter + 1) == length:
print items + ' ' + Container.packages[counter]
print(items + ' ' + Container.packages[counter])
else:
print items + ' ' + Container.packages[counter] + ' '
print(items + ' ' + Container.packages[counter] + ' ')
counter = counter + 1
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
@staticmethod
@@ -33,12 +33,12 @@ class Container:
length = len(Container.users)
for items in Container.packages:
if (counter + 1) == length:
print items
print(items)
else:
print items + '\n'
print(items + '\n')
counter = counter + 1
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
@staticmethod
@@ -47,10 +47,10 @@ class Container:
counter = 0
for items in Container.users:
if items == user:
print Container.packages[counter]
print(Container.packages[counter])
return
counter = counter + 1
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
@staticmethod
@@ -59,10 +59,10 @@ class Container:
counter = 0
for items in Container.packages:
if items == package:
print Container.users[counter]
print(Container.users[counter])
return
counter = counter + 1
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
@staticmethod
@@ -88,7 +88,7 @@ class Container:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
"Packages successfully installed.[200]\n", 1)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
def main():

View File

@@ -43,7 +43,7 @@ class ContainerManager(multi.Thread):
self.addTrafficController()
elif self.function == 'removeLimits':
self.removeLimits()
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + ' [ContainerManager.run]')
@staticmethod
@@ -78,7 +78,7 @@ class ContainerManager(multi.Thread):
ioConf = ioConf.replace('{net_cls}', str(net_cls))
return ioConf
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
return 0
@@ -128,7 +128,7 @@ class ContainerManager(multi.Thread):
execPath = execPath + " --function submitContainerInstall"
ProcessUtilities.outputExecutioner(execPath)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
def restartServices(self):

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from websiteFunctions.models import Websites

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import HttpResponse, redirect
from loginSystem.views import loadLoginPage
@@ -42,7 +42,7 @@ def submitContainerInstall(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -117,7 +117,7 @@ def fetchWebsiteLimits(request):
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -264,7 +264,7 @@ def saveWebsiteLimits(request):
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -345,7 +345,7 @@ def getUsageData(request):
final_json = json.dumps(finalData)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg), 'cpu': 0, 'memory':0}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
import models

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -22,13 +22,13 @@ class DatabaseManager:
def loadDatabaseHome(self, request = None, userID = None):
try:
return render(request, 'databases/index.html')
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def phpMyAdmin(self, request = None, userID = None):
try:
return render(request, 'databases/phpMyAdmin.html')
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def createDatabase(self, request = None, userID = None):
@@ -40,7 +40,7 @@ class DatabaseManager:
websitesName = ACLManager.findAllSites(currentACL, userID)
return render(request, 'databases/createDatabase.html', {'websitesList': websitesName})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def submitDBCreation(self, userID = None, data = None, rAPI = None):
@@ -76,7 +76,7 @@ class DatabaseManager:
data_ret = {'status': 0, 'createDBStatus': 0, 'error_message': result[1]}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'createDBStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -91,7 +91,7 @@ class DatabaseManager:
websitesName = ACLManager.findAllSites(currentACL, userID)
return render(request, 'databases/deleteDatabase.html', {'websitesList': websitesName})
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
return HttpResponse(str(msg))
@@ -132,7 +132,7 @@ class DatabaseManager:
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": json_data})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
final_json = json.dumps({'status': 0, 'fetchStatus': 0, 'error_message': str(msg)})
return HttpResponse(final_json)
@@ -163,7 +163,7 @@ class DatabaseManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'deleteStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -177,7 +177,7 @@ class DatabaseManager:
websitesName = ACLManager.findAllSites(currentACL, userID)
return render(request, 'databases/listDataBases.html', {'websiteList': websitesName})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def changePassword(self, userID = None, data = None):
@@ -210,7 +210,7 @@ class DatabaseManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'changePasswordStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -238,10 +238,10 @@ class DatabaseManager:
for db in webs.databases_set.all():
mysqlUtilities.allowGlobalUserAccess(admin.userName, db.dbName)
print "1," + finalUserPassword
print("1," + finalUserPassword)
except BaseException, msg:
print "0," + str(msg)
except BaseException as msg:
print("0," + str(msg))
def main():

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from websiteFunctions.models import Websites

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
import json

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import redirect, HttpResponse
from loginSystem.views import loadLoginPage
@@ -151,7 +151,7 @@ def setupPHPMYAdminSession(request):
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'createDBStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import models
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -24,7 +24,7 @@ class DNSManager:
try:
admin = Administrator.objects.get(pk=userID)
return render(request, 'dns/index.html', {"type": admin.type})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def createNameserver(self, request = None, userID = None):
@@ -40,7 +40,7 @@ class DNSManager:
else:
return render(request, "dns/createNameServer.html", {"status": 0})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def NSCreation(self, userID = None, data = None):
@@ -94,7 +94,7 @@ class DNSManager:
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'NSCreation': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -109,7 +109,7 @@ class DNSManager:
return render(request, 'dns/createDNSZone.html', {"status": 1})
else:
return render(request, 'dns/createDNSZone.html', {"status": 0})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def zoneCreation(self, userID = None, data = None):
@@ -142,7 +142,7 @@ class DNSManager:
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'zoneCreation': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -161,7 +161,7 @@ class DNSManager:
return render(request, 'dns/addDeleteDNSRecords.html', {"domainsList": domainsList, "status": 1})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def getCurrentRecordsForDomain(self, userID = None, data = None):
@@ -233,7 +233,7 @@ class DNSManager:
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": json_data})
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -406,7 +406,7 @@ class DNSManager:
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'add_status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -436,7 +436,7 @@ class DNSManager:
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'delete_status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -456,7 +456,7 @@ class DNSManager:
return render(request, 'dns/deleteDNSZone.html', {"domainsList": domainsList, "status": 1})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def submitZoneDeletion(self, userID = None, data = None):
@@ -486,7 +486,7 @@ class DNSManager:
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'delete_status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -529,7 +529,7 @@ class DNSManager:
return render(request, 'dns/configureDefaultNameServers.html', data)
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
@@ -568,7 +568,7 @@ class DNSManager:
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)

View File

@@ -1,4 +1,4 @@
from __future__ import unicode_literals
from django.db import models
from loginSystem.models import Administrator

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import redirect
from loginSystem.views import loadLoginPage
from dnsManager import DNSManager

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -1,5 +1,5 @@
#!/usr/local/CyberCP/bin/python2
from __future__ import division
import os
import os.path
import sys
@@ -57,7 +57,7 @@ class ContainerManager(multi.Thread):
elif self.function == 'restartGunicorn':
command = 'sudo systemctl restart gunicorn.socket'
ProcessUtilities.executioner(command)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile( str(msg) + ' [ContainerManager.run]')
@staticmethod
@@ -68,7 +68,7 @@ class ContainerManager(multi.Thread):
return 0
else:
return 1
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
return 0
@@ -87,7 +87,7 @@ class ContainerManager(multi.Thread):
time.sleep(2)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
def createContainer(self, request=None, userID=None, data=None):
@@ -123,7 +123,7 @@ class ContainerManager(multi.Thread):
for item in inspectImage['Config']['Env']:
if '=' in item:
splitedItem = item.split('=', 1)
print splitedItem
print(splitedItem)
envList[splitedItem[0]] = splitedItem[1]
else:
envList[item] = ""
@@ -142,7 +142,7 @@ class ContainerManager(multi.Thread):
return render(request, 'dockerManager/runContainer.html', Data)
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def loadContainerHome(self, request=None, userID=None, data=None):
@@ -239,7 +239,7 @@ class ContainerManager(multi.Thread):
"unlistedContainers": unlistedContainers,
"adminNames": adminNames,
"showUnlistedContainer": showUnlistedContainer})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def getContainerLogs(self, userID=None, data=None):
@@ -262,7 +262,7 @@ class ContainerManager(multi.Thread):
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'containerLogStatus': 0, 'containerLog': 'Error', 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -290,7 +290,7 @@ class ContainerManager(multi.Thread):
# Formatting envList for usage
envDict = {}
for key, value in envList.iteritems():
for key, value in envList.items():
if (value['name'] != '') or (value['value'] != ''):
envDict[value['name']] = value['value']
@@ -304,7 +304,7 @@ class ContainerManager(multi.Thread):
portConfig[item] = data[item]
volumes = {}
for index, volume in volList.iteritems():
for index, volume in volList.items():
volumes[volume['src']] = {'bind': volume['dest'],
'mode': 'rw'}
@@ -325,7 +325,7 @@ class ContainerManager(multi.Thread):
container = client.containers.create(**containerArgs)
except Exception as err:
if "port is already allocated" in err: # We need to delete container if port is not available
print "Deleting container"
print("Deleting container")
container.remove(force=True)
data_ret = {'createContainerStatus': 0, 'error_message': str(err)}
json_data = json.dumps(data_ret)
@@ -348,7 +348,7 @@ class ContainerManager(multi.Thread):
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'createContainerStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -376,7 +376,7 @@ class ContainerManager(multi.Thread):
try:
image = client.images.pull(image, tag=tag)
print image.id
print(image.id)
except docker.errors.APIError as msg:
data_ret = {'installImageStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
@@ -387,7 +387,7 @@ class ContainerManager(multi.Thread):
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'installImageStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -457,7 +457,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
if called:
return str(msg)
else:
@@ -477,7 +477,7 @@ class ContainerManager(multi.Thread):
final_dic = {'listContainerStatus': 1, 'error_message': "None", "data": json_data}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException, msg:
except BaseException as msg:
dic = {'listContainerStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -551,7 +551,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'containerActionStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -581,7 +581,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'containerStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -611,7 +611,7 @@ class ContainerManager(multi.Thread):
response['Content-Disposition'] = 'attachment; filename="' + name + '.tar"'
return response
except BaseException, msg:
except BaseException as msg:
data_ret = {'containerStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -647,7 +647,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'containerTopStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -688,7 +688,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'assignContainerStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -714,7 +714,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
print json.dumps(matches)
print(json.dumps(matches))
for image in matches:
if "/" in image['name']:
@@ -726,7 +726,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'searchImageStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -763,7 +763,7 @@ class ContainerManager(multi.Thread):
getTag = tag.split(":")
if len(getTag) == 2:
tags.append(getTag[1])
print tags
print(tags)
if name in names:
images[name]['tags'].extend(tags)
else:
@@ -776,7 +776,7 @@ class ContainerManager(multi.Thread):
return render(request, 'dockerManager/images.html', {"images": images, "test": ''})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def manageImages(self, request=None, userID=None, data=None):
@@ -810,7 +810,7 @@ class ContainerManager(multi.Thread):
return render(request, 'dockerManager/manageImages.html', {"images": images})
except BaseException, msg:
except BaseException as msg:
return HttpResponse(str(msg))
def getImageHistory(self, userID=None, data=None):
@@ -836,7 +836,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'imageHistoryStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -857,7 +857,7 @@ class ContainerManager(multi.Thread):
action = client.images.prune()
else:
action = client.images.remove(name)
print action
print(action)
except docker.errors.APIError as err:
data_ret = {'removeImageStatus': 0, 'error_message': str(err)}
json_data = json.dumps(data_ret)
@@ -871,7 +871,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'removeImageStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -917,7 +917,7 @@ class ContainerManager(multi.Thread):
con.save()
return 0
except BaseException, msg:
except BaseException as msg:
return str(msg)
def saveContainerSettings(self, userID=None, data=None):
@@ -967,12 +967,12 @@ class ContainerManager(multi.Thread):
if 'envConfirmation' in data and data['envConfirmation']:
# Formatting envList for usage
envDict = {}
for key, value in envList.iteritems():
for key, value in envList.items():
if (value['name'] != '') or (value['value'] != ''):
envDict[value['name']] = value['value']
volumes = {}
for index, volume in volList.iteritems():
for index, volume in volList.items():
if volume['src'] == '' or volume['dest'] == '':
continue
volumes[volume['src']] = {'bind': volume['dest'],
@@ -1003,7 +1003,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'saveSettingsStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1053,7 +1053,7 @@ class ContainerManager(multi.Thread):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'recreateContainerStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -1073,7 +1073,7 @@ class ContainerManager(multi.Thread):
else:
image2 = "library/" + image
print image
print(image)
registryData = requests.get('https://registry.hub.docker.com/v2/repositories/' + image2 + '/tags',
{'page': page}).json()
@@ -1084,7 +1084,7 @@ class ContainerManager(multi.Thread):
data_ret = {'getTagsStatus': 1, 'list': tagList, 'next': registryData['next'], 'error_message': None}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'getTagsStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

View File

@@ -38,7 +38,7 @@ def preDockerRun(function):
try:
client = docker.from_env()
client.ping()
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
if isPost:
data_ret = {'status': 0, 'error_message': 'Docker daemon not running or not responsive'}

View File

@@ -39,7 +39,7 @@ class DockerInstall:
time.sleep(2)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
DockerInstall.submitInstallDocker()

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from loginSystem.models import Administrator

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, redirect, HttpResponse
from loginSystem.models import Administrator
@@ -48,7 +48,7 @@ def installDocker(request):
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -1,5 +1,5 @@
#!/usr/local/CyberCP/bin/python2
from __future__ import absolute_import
import os
import time
import csv
@@ -28,7 +28,7 @@ class emailMarketing(multi.Thread):
self.verificationJob()
elif self.function == 'startEmailJob':
self.startEmailJob()
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + ' [emailMarketing.run]')
def createEmailList(self):
@@ -58,7 +58,7 @@ class emailMarketing(multi.Thread):
newEmail.save()
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], str(counter) + ' emails read.')
counter = counter + 1
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
continue
elif self.extraArgs['path'].endswith('.txt'):
@@ -69,7 +69,7 @@ class emailMarketing(multi.Thread):
if re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', email) != None:
try:
getEmail = EmailsInList.objects.get(owner=newList, email=email)
except BaseException, msg:
except BaseException as msg:
newEmail = EmailsInList(owner=newList, email=email, verificationStatus='NOT CHECKED',
dateCreated=time.strftime("%I-%M-%S-%a-%b-%Y"))
newEmail.save()
@@ -78,7 +78,7 @@ class emailMarketing(multi.Thread):
emails = emailsList.readline()
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], str(counter) + 'Successfully read all emails. [200]')
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], str(msg) +'. [404]')
return 0
@@ -132,14 +132,14 @@ class emailMarketing(multi.Thread):
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(counter) + ' emails verified so far..')
counter = counter + 1
except BaseException, msg:
except BaseException as msg:
items.verificationStatus = 'Verification Failed'
items.save()
counter = counter + 1
logging.CyberCPLogFileWriter.writeToFile(str(msg))
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(counter) + ' emails successfully verified. [200]')
except BaseException, msg:
except BaseException as msg:
verificationList = EmailLists.objects.get(listName=self.extraArgs['listName'])
domain = verificationList.owner.domain
tempStatusPath = '/home/cyberpanel/' + domain + "/" + self.extraArgs['listName']
@@ -235,7 +235,7 @@ class emailMarketing(multi.Thread):
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'],
'Successfully sent: ' + str(sent) + ' Failed: ' + str(
failed))
except BaseException, msg:
except BaseException as msg:
failed = failed + 1
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'],
'Successfully sent: ' + str(
@@ -250,6 +250,6 @@ class emailMarketing(multi.Thread):
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'],
'Email job completed. [200]')
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], str(msg) + '. [404]')
return 0

View File

@@ -30,7 +30,7 @@ class EmailMarketingManager:
return ACLManager.loadError()
return render(self.request, 'emailMarketing/emailMarketing.html')
except KeyError, msg:
except KeyError as msg:
return redirect(loadLoginPage)
def fetchUsers(self):
@@ -74,7 +74,7 @@ class EmailMarketingManager:
data_ret = {"status": 1, 'data': json_data}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -103,7 +103,7 @@ class EmailMarketingManager:
data_ret = {"status": 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -123,7 +123,7 @@ class EmailMarketingManager:
return ACLManager.loadError()
return render(self.request, 'emailMarketing/createEmailList.html', {'domain': self.domain})
except KeyError, msg:
except KeyError as msg:
return redirect(loadLoginPage)
def submitEmailList(self):
@@ -157,7 +157,7 @@ class EmailMarketingManager:
data_ret = {"status": 1, 'tempStatusPath': extraArgs['tempStatusPath']}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -178,7 +178,7 @@ class EmailMarketingManager:
listNames = emACL.getEmailsLists(self.domain)
return render(self.request, 'emailMarketing/manageLists.html', {'listNames': listNames, 'domain': self.domain})
except KeyError, msg:
except KeyError as msg:
return redirect(loadLoginPage)
def fetchEmails(self):
@@ -251,7 +251,7 @@ class EmailMarketingManager:
data_ret = {"status": 1, 'data': json_data, 'pagination': pagination}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -281,7 +281,7 @@ class EmailMarketingManager:
data_ret = {"status": 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -314,7 +314,7 @@ class EmailMarketingManager:
data_ret = {"status": 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -344,7 +344,7 @@ class EmailMarketingManager:
data_ret = {"status": 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -370,7 +370,7 @@ class EmailMarketingManager:
for items in emailLists:
listNames.append(items.listName)
return render(self.request, 'emailMarketing/manageSMTPHosts.html', {'listNames': listNames, 'domain': self.domain})
except KeyError, msg:
except KeyError as msg:
return redirect(loadLoginPage)
def saveSMTPHost(self):
@@ -420,7 +420,7 @@ class EmailMarketingManager:
data_ret = {"status": 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -463,7 +463,7 @@ class EmailMarketingManager:
data_ret = {"status": 1, 'data': json_data}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -515,7 +515,7 @@ class EmailMarketingManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -529,7 +529,7 @@ class EmailMarketingManager:
return ACLManager.loadErrorJson()
return render(self.request, 'emailMarketing/composeMessages.html')
except KeyError, msg:
except KeyError as msg:
return redirect(loadLoginPage)
def saveEmailTemplate(self):
@@ -557,7 +557,7 @@ class EmailMarketingManager:
data_ret = {"status": 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -581,7 +581,7 @@ class EmailMarketingManager:
Data['hostNames'] = hostNames
Data['listNames'] = listNames
return render(self.request, 'emailMarketing/sendEmails.html', Data)
except KeyError, msg:
except KeyError as msg:
return redirect(loadLoginPage)
def templatePreview(self):
@@ -597,7 +597,7 @@ class EmailMarketingManager:
return ACLManager.loadError()
return HttpResponse(template.emailMessage)
except KeyError, msg:
except KeyError as msg:
return redirect(loadLoginPage)
def fetchJobs(self):
@@ -647,7 +647,7 @@ class EmailMarketingManager:
data_ret = {"status": 1, 'data': json_data}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -689,7 +689,7 @@ class EmailMarketingManager:
data_ret = {"status": 1, 'tempStatusPath': extraArgs['tempStatusPath']}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -714,7 +714,7 @@ class EmailMarketingManager:
data_ret = {"status": 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -734,7 +734,7 @@ class EmailMarketingManager:
data_ret = {"status": 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from websiteFunctions.models import Websites

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import redirect
from loginSystem.views import loadLoginPage
from emailMarketingManager import EmailMarketingManager

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from mailServer.models import Domains, EUsers

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render,redirect
from django.http import HttpResponse
@@ -13,7 +13,7 @@ import json
from .models import DomainLimits, EmailLimits
from math import ceil
from postfixSenderPolicy.client import cacheClient
import thread
import _thread
from plogical.mailUtilities import mailUtilities
from plogical.virtualHostUtilities import virtualHostUtilities
from random import randint
@@ -67,12 +67,12 @@ def fetchPolicyServerStatus(request):
return HttpResponse(json_data)
except BaseException,msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
@@ -115,12 +115,12 @@ def savePolicyServerStatus(request):
return HttpResponse(json_data)
except BaseException,msg:
except BaseException as msg:
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
data_ret = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
@@ -174,7 +174,7 @@ def listDomains(request):
return render(request,'emailPremium/listDomains.html',{"pagination":pagination, "installCheck": installCheck})
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
return HttpResponse("See CyberCP main log file.")
@@ -200,7 +200,7 @@ def getFurtherDomains(request):
status = data['page']
pageNumber = int(status)
except BaseException, msg:
except BaseException as msg:
status = str(msg)
finalPageNumber = ((pageNumber * 10)) - 10
@@ -224,7 +224,7 @@ def getFurtherDomains(request):
checker = 1
else:
json_data = json_data +',' + json.dumps(dic)
except BaseException, msg:
except BaseException as msg:
try:
domain = Domains.objects.get(domainOwner=items)
except:
@@ -249,13 +249,13 @@ def getFurtherDomains(request):
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
except BaseException,msg:
except BaseException as msg:
dic = {'listWebSiteStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
dic = {'listWebSiteStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -292,13 +292,13 @@ def enableDisableEmailLimits(request):
json_data = json.dumps(dic)
return HttpResponse(json_data)
except BaseException,msg:
except BaseException as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
dic = {'statusa': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -385,13 +385,13 @@ def changeDomainLimit(request):
json_data = json.dumps(dic)
return HttpResponse(json_data)
except BaseException,msg:
except BaseException as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
dic = {'statusa': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -435,7 +435,7 @@ def getFurtherEmail(request):
checker = 1
else:
json_data = json_data +',' + json.dumps(dic)
except BaseException, msg:
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
json_data = json_data + ']'
@@ -445,13 +445,13 @@ def getFurtherEmail(request):
return HttpResponse(final_json)
except BaseException,msg:
except BaseException as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -484,12 +484,12 @@ def enableDisableIndividualEmailLimits(request):
json_data = json.dumps(dic)
return HttpResponse(json_data)
except BaseException,msg:
except BaseException as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
dic = {'statusa': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -558,13 +558,13 @@ def getEmailStats(request):
return HttpResponse(final_json)
except BaseException,msg:
except BaseException as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -597,12 +597,12 @@ def enableDisableIndividualEmailLogs(request):
json_data = json.dumps(dic)
return HttpResponse(json_data)
except BaseException,msg:
except BaseException as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
dic = {'statusa': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -668,13 +668,13 @@ def changeDomainEmailLimitsIndividual(request):
json_data = json.dumps(dic)
return HttpResponse(json_data)
except BaseException,msg:
except BaseException as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
dic = {'statusa': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -722,13 +722,13 @@ def getEmailLogs(request):
return HttpResponse(final_json)
except BaseException,msg:
except BaseException as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -757,12 +757,12 @@ def flushEmailLogs(request):
json_data = json.dumps(dic)
return HttpResponse(json_data)
except BaseException,msg:
except BaseException as msg:
dic = {'status': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
dic = {'statusa': 0, 'error_message': str(msg)}
json_data = json.dumps(dic)
return HttpResponse(json_data)
@@ -807,7 +807,7 @@ def installSpamAssassin(request):
final_json = json.dumps({'status': 1, 'error_message': "None"})
return HttpResponse(final_json)
except BaseException,msg:
except BaseException as msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -865,7 +865,7 @@ def installStatusSpamAssassin(request):
'requestStatus': installStatus,
})
return HttpResponse(final_json)
except BaseException,msg:
except BaseException as msg:
final_dic = {'abort':1,'installed':0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -942,7 +942,7 @@ def fetchSpamAssassinSettings(request):
return HttpResponse(final_json)
except BaseException,msg:
except BaseException as msg:
final_dic = {'fetchStatus': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -1011,12 +1011,12 @@ def saveSpamAssassinConfigurations(request):
return HttpResponse(json_data)
except BaseException,msg:
except BaseException as msg:
data_ret = {'saveStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except KeyError,msg:
except KeyError as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg))
data_ret = {'saveStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, HttpResponse

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig

View File

@@ -6,7 +6,7 @@ from plogical.processUtilities import ProcessUtilities
from websiteFunctions.models import Websites
from random import randint
from django.core.files.storage import FileSystemStorage
import HTMLParser
import html.parser
import os
class FileManager:
@@ -21,7 +21,7 @@ class FileManager:
return HttpResponse(final_json)
def returnPathEnclosed(self, path):
htmlParser = HTMLParser.HTMLParser()
htmlParser = html.parser.HTMLParser()
path = htmlParser.unescape(path)
return path
return "'" + path + "'"
@@ -55,7 +55,7 @@ class FileManager:
for items in output:
try:
currentFile = items.split(' ')
currentFile = filter(lambda a: a != '', currentFile)
currentFile = [a for a in currentFile if a != '']
if currentFile[-1] == '.' or currentFile[-1] == '..' or currentFile[0] == 'total':
continue
@@ -72,13 +72,13 @@ class FileManager:
finalData[str(counter)] = [currentFile[-1], currentFile[-1], lastModified, size, currentFile[0],
dirCheck]
counter = counter + 1
except BaseException, msg:
except BaseException as msg:
logging.writeToFile(str(msg))
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def list(self):
@@ -97,7 +97,7 @@ class FileManager:
for items in output:
try:
currentFile = items.split(' ')
currentFile = filter(lambda a: a != '', currentFile)
currentFile = [a for a in currentFile if a != '']
if currentFile[-1] == '.' or currentFile[-1] == '..' or currentFile[0] == 'total':
continue
@@ -119,7 +119,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def createNewFile(self):
@@ -142,7 +142,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def createNewFolder(self):
@@ -160,7 +160,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def deleteFolderOrFile(self):
@@ -178,7 +178,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def copy(self):
@@ -212,7 +212,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def move(self):
@@ -238,7 +238,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def rename(self):
@@ -261,7 +261,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def readFileContents(self):
@@ -278,7 +278,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def writeFileContents(self):
@@ -313,7 +313,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def upload(self):
@@ -345,7 +345,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def extract(self):
@@ -372,7 +372,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def compress(self):
@@ -405,7 +405,7 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))
def changePermissions(self):
@@ -429,5 +429,5 @@ class FileManager:
json_data = json.dumps(finalData)
return HttpResponse(json_data)
except BaseException, msg:
except BaseException as msg:
return self.ajaxPre(0, str(msg))

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase

Some files were not shown because too many files have changed in this diff Show More