Fix Dates. Improve CSF integration. Fix Typos

This commit is contained in:
Michael Ramsey
2019-10-08 13:17:33 -04:00
parent 99c0c5a46b
commit 25848342f5
41 changed files with 379 additions and 108 deletions

View File

@@ -12,7 +12,7 @@ except:
pass pass
import threading as multi import threading as multi
from plogical.processUtilities import ProcessUtilities from plogical.processUtilities import ProcessUtilities
from IncBackups.models import IncJob, JobSnapshots from models import IncJob, JobSnapshots
from websiteFunctions.models import Websites from websiteFunctions.models import Websites
import plogical.randomPassword as randomPassword import plogical.randomPassword as randomPassword
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
@@ -316,7 +316,7 @@ class IncJobs(multi.Thread):
reparsed = minidom.parseString(rough_string) reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent=" ") return reparsed.toprettyxml(indent=" ")
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018/meta.xml -- metaPath ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52/meta.xml -- metaPath
metaPath = '/home/cyberpanel/%s' % (str(randint(1000, 9999))) metaPath = '/home/cyberpanel/%s' % (str(randint(1000, 9999)))

0
IncBackups/templates/IncBackups/createBackup.html Executable file → Normal file
View File

6
backup/backupManager.py Executable file → Normal file
View File

@@ -142,10 +142,10 @@ class BackupManager:
## /home/example.com/backup ## /home/example.com/backup
backupPath = os.path.join("/home", backupDomain, "backup/") backupPath = os.path.join("/home", backupDomain, "backup/")
domainUser = website.externalApp backupDomainName = data['websiteToBeBacked']
backupName = 'backup-' + domainUser + "-" + time.strftime("%I-%M-%S-%a-%b-%Y") backupName = 'backup-' + backupDomainName + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52
tempStoragePath = os.path.join(backupPath, backupName) tempStoragePath = os.path.join(backupPath, backupName)

0
baseTemplate/templates/baseTemplate/index.html Executable file → Normal file
View File

2
cli/cliLogger.py Executable file → Normal file
View File

@@ -10,7 +10,7 @@ class cliLogger:
try: try:
file = open(cliLogger.fileName, 'a') file = open(cliLogger.fileName, 'a')
file.writelines("[" + time.strftime( file.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] [" + level + ":" + method + "] " + message + "\n") "%m.%d.%Y_%H-%M-%S") + "] [" + level + ":" + method + "] " + message + "\n")
file.close() file.close()
file.close() file.close()
except IOError: except IOError:

0
emailPremium/templates/emailPremium/emailPage.html Executable file → Normal file
View File

2
emailPremium/templates/emailPremium/listDomains.html Executable file → Normal file
View File

@@ -11,7 +11,7 @@
<div class="container"> <div class="container">
<div id="page-title"> <div id="page-title">
<h2 id="domainNamePage">{% trans "List Domains" %} - <a target="_blank" href="http://go.cyberpanel.net/emailLimits" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Emai Limits Docs" %}</span></a></h2> <h2 id="domainNamePage">{% trans "List Domains" %} - <a target="_blank" href="http://go.cyberpanel.net/emailLimits" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Email Limits Docs" %}</span></a></h2>
<p>{% trans "On this page you manage emails limits for Domains/Email Addresses" %}</p> <p>{% trans "On this page you manage emails limits for Domains/Email Addresses" %}</p>
</div> </div>

2
emailPremium/templates/emailPremium/policyServer.html Executable file → Normal file
View File

@@ -10,7 +10,7 @@
<div class="container"> <div class="container">
<div id="page-title"> <div id="page-title">
<h2>{% trans "Email Policy Server Configurations!" %} - <a target="_blank" href="http://go.cyberpanel.net/emailLimits" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Emai Limits Docs" %}</span></a> </h2> <h2>{% trans "Email Policy Server Configurations!" %} - <a target="_blank" href="http://go.cyberpanel.net/emailLimits" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Email Limits Docs" %}</span></a> </h2>
<p>{% trans "Turn ON Email Policy Server to use Email Limits Feature. " %}</p> <p>{% trans "Turn ON Email Policy Server to use Email Limits Feature. " %}</p>
</div> </div>

46
firewall/templates/firewall/index.html Executable file → Normal file
View File

@@ -43,6 +43,52 @@
</a> </a>
</div> </div>
<div class="col-lg-5 col-md-6 btn-min-width">
<a href="{% url 'csf' %}" title="{% trans 'ConfigServer Security & Firewall (CSF)' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "CSF" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-lock"></i>
</div>
</a>
</div>
<div class="col-lg-5 col-md-6 btn-min-width">
<a href="{% url 'modSecurity' %}" title="{% trans 'ModSecurity Configurations' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "ModSecurity Conf" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-lock"></i>
</div>
</a>
</div>
<div class="col-lg-5 col-md-6 btn-min-width">
<a href="{% url 'modSecRules' %}" title="{% trans 'ModSecurity Rules' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "ModSecurity Rules" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-lock"></i>
</div>
</a>
</div>
<div class="col-lg-5 col-md-6 btn-min-width">
<a href="{% url 'modSecRulesPacks' %}" title="{% trans 'ModSecurity Rules Packs' %}" class="tile-box tile-box-shortcut btn-primary">
<div class="tile-header">
{% trans "ModSecurity Rules Packs" %}
</div>
<div class="tile-content-wrapper">
<i class="fa fa-lock"></i>
</div>
</a>
</div>
</div> </div>
</div> </div>

12
install/install.py Executable file → Normal file
View File

@@ -122,10 +122,10 @@ class preFlightsChecks:
def stdOut(message, log=0, do_exit=0, code=os.EX_OK): def stdOut(message, log=0, do_exit=0, code=os.EX_OK):
print("\n\n") print("\n\n")
print ("[" + time.strftime( print ("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n")
print("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + message + "\n") print("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] " + message + "\n")
print ("[" + time.strftime( print ("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n")
if log: if log:
logging.InstallLog.writeToFile(message) logging.InstallLog.writeToFile(message)
@@ -575,7 +575,7 @@ class preFlightsChecks:
if preFlightsChecks.resFailed(self.distro, res): if preFlightsChecks.resFailed(self.distro, res):
count = count + 1 count = count + 1
print("[" + time.strftime( print("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] " + "Unable to install Python setup tools, trying again, try number: " + str( "%m.%d.%Y_%H-%M-%S") + "] " + "Unable to install Python setup tools, trying again, try number: " + str(
count) + "\n") count) + "\n")
if count == 3: if count == 3:
logging.InstallLog.writeToFile( logging.InstallLog.writeToFile(
@@ -584,7 +584,7 @@ class preFlightsChecks:
os._exit(0) os._exit(0)
else: else:
logging.InstallLog.writeToFile("Python setup tools Successfully installed!") logging.InstallLog.writeToFile("Python setup tools Successfully installed!")
print("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + "Python setup tools Successfully installed!") print("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] " + "Python setup tools Successfully installed!")
break break
def install_python_requests(self): def install_python_requests(self):
@@ -2349,7 +2349,7 @@ enabled=1"""
else: else:
logging.InstallLog.writeToFile("Rainloop permissions changed!") logging.InstallLog.writeToFile("Rainloop permissions changed!")
print( print(
"[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + "Rainloop permissions changed!") "[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] " + "Rainloop permissions changed!")
break break
############# #############

2
install/installLog.py Executable file → Normal file
View File

@@ -7,5 +7,5 @@ class InstallLog:
def writeToFile(message): def writeToFile(message):
file = open(InstallLog.fileName,'a') file = open(InstallLog.fileName,'a')
file.writelines("[" + time.strftime( file.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] "+message + "\n") "%m.%d.%Y_%H-%M-%S") + "] "+message + "\n")
file.close() file.close()

View File

@@ -3692,7 +3692,7 @@ msgstr "SpamAssassin конфигурация е успешно променен
#: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/emailPage.html:13
#: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/listDomains.html:14
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Email лимити документация" msgstr "Email лимити документация"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3835,7 +3835,7 @@ msgstr " uspješno je kreiran."
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
#, fuzzy #, fuzzy
#| msgid "Email Logs" #| msgid "Email Logs"
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Email logovi" msgstr "Email logovi"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3773,7 +3773,7 @@ msgstr " 已成功创建."
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
#, fuzzy #, fuzzy
#| msgid "Email Logs" #| msgid "Email Logs"
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Email日志" msgstr "Email日志"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3780,7 +3780,7 @@ msgstr ""
#: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/emailPage.html:13
#: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/listDomains.html:14
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "" msgstr ""
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3706,7 +3706,7 @@ msgstr "Les configurations de SpamAssassin ont été enregistrées avec succès.
#: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/emailPage.html:13
#: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/listDomains.html:14
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Limites de messagerie documentations" msgstr "Limites de messagerie documentations"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3848,7 +3848,7 @@ msgstr "δημιουργήθηκε με επιτυχία."
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
#, fuzzy #, fuzzy
#| msgid "Email Logs" #| msgid "Email Logs"
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Αρχεία καταγραφής Email " msgstr "Αρχεία καταγραφής Email "
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3437,7 +3437,7 @@ msgstr ""
#: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/emailPage.html:13
#: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/listDomains.html:14
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "" msgstr ""
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3803,7 +3803,7 @@ msgstr "Le configurazioni di SpamAssassin sono state salvate correttamente."
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
#, fuzzy #, fuzzy
#| msgid "Email Logs" #| msgid "Email Logs"
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Documentazione Limiti Email" msgstr "Documentazione Limiti Email"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3682,7 +3682,7 @@ msgstr "SpamAssassin 設定が保存されました。"
#: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/emailPage.html:13
#: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/listDomains.html:14
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Eメールの制限ドキュメント" msgstr "Eメールの制限ドキュメント"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3676,7 +3676,7 @@ msgstr "Pomyślnie zapisano konfigurację SpamAssassin."
#: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/emailPage.html:13
#: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/listDomains.html:14
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Limity poczty dokumentacja" msgstr "Limity poczty dokumentacja"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3845,7 +3845,7 @@ msgstr " foi criado com sucesso."
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
#, fuzzy #, fuzzy
#| msgid "Email Logs" #| msgid "Email Logs"
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Logs de E-Mail" msgstr "Logs de E-Mail"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3801,7 +3801,7 @@ msgstr "Успешно запущен процесс резервного коп
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
#, fuzzy #, fuzzy
#| msgid "Email Logs" #| msgid "Email Logs"
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Лог-журнал Эл.почты" msgstr "Лог-журнал Эл.почты"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3775,7 +3775,7 @@ msgstr "Yedekleme işlemi başarıyla başlatıldı."
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
#, fuzzy #, fuzzy
#| msgid "Email Logs" #| msgid "Email Logs"
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Eposta günlükleri" msgstr "Eposta günlükleri"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

View File

@@ -3674,7 +3674,7 @@ msgstr "Đã lưu thành công cấu hình SpamAssassin."
#: emailPremium/templates/emailPremium/emailPage.html:13 #: emailPremium/templates/emailPremium/emailPage.html:13
#: emailPremium/templates/emailPremium/listDomains.html:14 #: emailPremium/templates/emailPremium/listDomains.html:14
#: emailPremium/templates/emailPremium/policyServer.html:13 #: emailPremium/templates/emailPremium/policyServer.html:13
msgid "Emai Limits Docs" msgid "Email Limits Docs"
msgstr "Tài liệu giới hạn Emai" msgstr "Tài liệu giới hạn Emai"
#: emailPremium/templates/emailPremium/emailLimits.html:14 #: emailPremium/templates/emailPremium/emailLimits.html:14

2
loginSystem/templates/loginSystem/login.html Executable file → Normal file
View File

@@ -67,7 +67,7 @@
<div class="col-md-8 col-lg-6 clearfix center-margin"> <div class="col-md-8 col-lg-6 clearfix center-margin">
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-5">
<h3 class="text-transform-upr font-size-17">CyberPanel <span class="opacity-80">v 1.8</span></h3> <h3 class="text-transform-upr font-size-17">CyberPanel <span class="opacity-80">v 1.9</span></h3>
<p class="font-gray">Web Hosting Control Panel</p> <p class="font-gray">Web Hosting Control Panel</p>
<div class="divider"></div> <div class="divider"></div>
<ul class="reset-ul"> <ul class="reset-ul">

4
plogical/CyberCPLogFileWriter.py Executable file → Normal file
View File

@@ -10,7 +10,7 @@ class CyberCPLogFileWriter:
try: try:
file = open(CyberCPLogFileWriter.fileName,'a') file = open(CyberCPLogFileWriter.fileName,'a')
file.writelines("[" + time.strftime( file.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] "+ message + "\n") "%m.%d.%Y_%H-%M-%S") + "] "+ message + "\n")
file.close() file.close()
except IOError,msg: except IOError,msg:
@@ -21,7 +21,7 @@ class CyberCPLogFileWriter:
try: try:
file = open(CyberCPLogFileWriter.fileName, 'a') file = open(CyberCPLogFileWriter.fileName, 'a')
file.writelines("[" + time.strftime( file.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] [" + level + ":" + method + "] " + message + "\n") "%m.%d.%Y_%H-%M-%S") + "] [" + level + ":" + method + "] " + message + "\n")
file.close() file.close()
file.close() file.close()
except IOError: except IOError:

8
plogical/backupSchedule.py Executable file → Normal file
View File

@@ -24,8 +24,8 @@ class backupSchedule:
def remoteBackupLogging(fileName, message): def remoteBackupLogging(fileName, message):
try: try:
file = open(fileName,'a') file = open(fileName,'a')
file.writelines("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] "+ message + "\n") file.writelines("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] "+ message + "\n")
print ("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] "+ message + "\n") print ("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] "+ message + "\n")
file.close() file.close()
except IOError,msg: except IOError,msg:
return "Can not write to error file." return "Can not write to error file."
@@ -192,10 +192,10 @@ class backupSchedule:
try: try:
destinations = backupUtilities.destinationsPath destinations = backupUtilities.destinationsPath
backupLogPath = "/usr/local/lscp/logs/backup_log."+time.strftime("%I-%M-%S-%a-%b-%Y") backupLogPath = "/usr/local/lscp/logs/backup_log."+time.strftime("%m.%d.%Y_%H-%M-%S")
backupSchedule.remoteBackupLogging(backupLogPath,"#################################################") backupSchedule.remoteBackupLogging(backupLogPath,"#################################################")
backupSchedule.remoteBackupLogging(backupLogPath," Backup log for: " +time.strftime("%I-%M-%S-%a-%b-%Y")) backupSchedule.remoteBackupLogging(backupLogPath," Backup log for: " +time.strftime("%m.%d.%Y_%H-%M-%S"))
backupSchedule.remoteBackupLogging(backupLogPath,"#################################################\n") backupSchedule.remoteBackupLogging(backupLogPath,"#################################################\n")
backupSchedule.remoteBackupLogging(backupLogPath, "") backupSchedule.remoteBackupLogging(backupLogPath, "")

4
plogical/backupScheduleLocal.py Executable file → Normal file
View File

@@ -11,12 +11,12 @@ class backupScheduleLocal:
@staticmethod @staticmethod
def prepare(): def prepare():
try: try:
backupLogPath = "/usr/local/lscp/logs/local_backup_log." + time.strftime("%I-%M-%S-%a-%b-%Y") backupLogPath = "/usr/local/lscp/logs/local_backup_log." + time.strftime("%m.%d.%Y_%H-%M-%S")
writeToFile = open(backupLogPath, "a") writeToFile = open(backupLogPath, "a")
backupSchedule.remoteBackupLogging(backupLogPath, "#################################################") backupSchedule.remoteBackupLogging(backupLogPath, "#################################################")
backupSchedule.remoteBackupLogging(backupLogPath," Local Backup log for: " + time.strftime("%I-%M-%S-%a-%b-%Y")) backupSchedule.remoteBackupLogging(backupLogPath," Local Backup log for: " + time.strftime("%m.%d.%Y_%H-%M-%S"))
backupSchedule.remoteBackupLogging(backupLogPath, "#################################################\n") backupSchedule.remoteBackupLogging(backupLogPath, "#################################################\n")
backupSchedule.remoteBackupLogging(backupLogPath, "") backupSchedule.remoteBackupLogging(backupLogPath, "")

18
plogical/backupUtilities.py Executable file → Normal file
View File

@@ -208,7 +208,7 @@ class backupUtilities:
reparsed = minidom.parseString(rough_string) reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent=" ") return reparsed.toprettyxml(indent=" ")
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018/meta.xml -- metaPath ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52/meta.xml -- metaPath
metaPath = '/tmp/%s' % (str(randint(1000, 9999))) metaPath = '/tmp/%s' % (str(randint(1000, 9999)))
@@ -221,7 +221,7 @@ class backupUtilities:
## meta generated ## meta generated
newBackup = Backups(website=website, fileName=backupName, date=time.strftime("%I-%M-%S-%a-%b-%Y"), newBackup = Backups(website=website, fileName=backupName, date=time.strftime("%m.%d.%Y_%H-%M-%S"),
size=0, status=1) size=0, status=1)
newBackup.save() newBackup.save()
@@ -238,7 +238,7 @@ class backupUtilities:
def startBackup(tempStoragePath, backupName, backupPath, metaPath = None): def startBackup(tempStoragePath, backupName, backupPath, metaPath = None):
try: try:
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 -- tempStoragePath ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath
## /home/example.com/backup - backupPath ## /home/example.com/backup - backupPath
##### Writing the name of backup file. ##### Writing the name of backup file.
@@ -256,7 +256,7 @@ class backupUtilities:
##### Parsing XML Meta file! ##### Parsing XML Meta file!
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 -- tempStoragePath ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath
metaPathInBackup = os.path.join(tempStoragePath,'meta.xml') metaPathInBackup = os.path.join(tempStoragePath,'meta.xml')
@@ -279,7 +279,7 @@ class backupUtilities:
if os.path.exists(backupUtilities.licenseKey): if os.path.exists(backupUtilities.licenseKey):
copy(completPathToConf, tempStoragePath + '/vhost.conf') copy(completPathToConf, tempStoragePath + '/vhost.conf')
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 -- tempStoragePath ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath
## shutil.make_archive ## shutil.make_archive
make_archive(os.path.join(tempStoragePath,"public_html"), 'gztar', os.path.join("/home",domainName,"public_html")) make_archive(os.path.join(tempStoragePath,"public_html"), 'gztar', os.path.join("/home",domainName,"public_html"))
@@ -534,7 +534,7 @@ class backupUtilities:
status = os.path.join(completPath,'status') status = os.path.join(completPath,'status')
logging.CyberCPLogFileWriter.statusWriter(status, "Extracting Main Archive!") logging.CyberCPLogFileWriter.statusWriter(status, "Extracting Main Archive!")
## Converting /home/backup/backup-example-06-50-03-Thu-Feb-2018.tar.gz -> /home/backup/backup-example-06-50-03-Thu-Feb-2018 ## Converting /home/backup/backup-example.com-02.13.2018_10-24-52.tar.gz -> /home/backup/backup-example.com-02.13.2018_10-24-52
tar = tarfile.open(originalFile) tar = tarfile.open(originalFile)
tar.extractall(completPath) tar.extractall(completPath)
@@ -690,7 +690,7 @@ class backupUtilities:
logging.CyberCPLogFileWriter.statusWriter(status, "Extracting web home data!") logging.CyberCPLogFileWriter.statusWriter(status, "Extracting web home data!")
# /home/backup/backup-example-06-50-03-Thu-Feb-2018/public_html.tar.gz # /home/backup/backup-example.com-02.13.2018_10-24-52/public_html.tar.gz
tar = tarfile.open(pathToCompressedHome) tar = tarfile.open(pathToCompressedHome)
tar.extractall(websiteHome) tar.extractall(websiteHome)
@@ -1027,8 +1027,8 @@ class backupUtilities:
def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain): def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain):
try: try:
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 -- tempStoragePath ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath
## backup-example-06-50-03-Thu-Feb-2018 -- backup name ## backup-example.com-02.13.2018_10-24-52 -- backup name
## /home/example.com/backup - backupPath ## /home/example.com/backup - backupPath
## /home/cyberpanel/1047.xml - metaPath ## /home/cyberpanel/1047.xml - metaPath

239
plogical/csf.py Executable file → Normal file
View File

@@ -11,6 +11,7 @@ from mailUtilities import mailUtilities
import threading as multi import threading as multi
from plogical.processUtilities import ProcessUtilities from plogical.processUtilities import ProcessUtilities
class CSF(multi.Thread): class CSF(multi.Thread):
installLogPath = "/home/cyberpanel/csfInstallLog" installLogPath = "/home/cyberpanel/csfInstallLog"
csfURL = 'https://download.configserver.com/csf.tgz' csfURL = 'https://download.configserver.com/csf.tgz'
@@ -58,25 +59,233 @@ class CSF(multi.Thread):
command = 'bash install.sh' command = 'bash install.sh'
ProcessUtilities.normalExecutioner(command) ProcessUtilities.normalExecutioner(command)
# install required packages for CSF perl and /usr/bin/host
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
command = 'yum install bind-utils perl-libwww-perl net-tools perl-LWP-Protocol-https -y'
ProcessUtilities.normalExecutioner(command)
elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
command = 'apt-get install dnsutils libwww-perl -y'
ProcessUtilities.normalExecutioner(command)
else:
## Some initial configurations logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath,
'CSF required packages successfully Installed.[200]\n', 1)
# Some initial configurations
data = open('/etc/csf/csf.conf', 'r').readlines() data = open('/etc/csf/csf.conf', 'r').readlines()
writeToConf = open('/etc/csf/csf.conf', 'w') writeToConf = open('/etc/csf/csf.conf', 'w')
for items in data: for items in data:
if items.find('TCP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'): if items.find('TCP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,8090,40110:40210"\n') writeToConf.writelines(
'TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,7080,8090,40110:40210"\n')
elif items.find('TCP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'): elif items.find('TCP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('TCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995,8090,40110:40210"\n') writeToConf.writelines('TCP_OUT = "20,21,22,25,53,80,110,113,443,587,993,995,8090,40110:40210"\n')
elif items.find('UDP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'): elif items.find('UDP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('UDP_IN = "20,21,53"\n') writeToConf.writelines('UDP_IN = "20,21,53"\n')
elif items.find('UDP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'): elif items.find('UDP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('UDP_OUT = "20,21,53,113,123"\n') writeToConf.writelines('UDP_OUT = "20,21,53,113,123"\n')
# setting RESTRICT_SYSLOG to "3" for use with option RESTRICT_SYSLOG_GROUP
elif items.find('RESTRICT_SYSLOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RESTRICT_SYSLOG = "3"\n')
# Send an email alert if an IP address is blocked by one of the [*] triggers: disabled
elif items.find('LF_EMAIL_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_EMAIL_ALERT = "0"\n')
# Set LF_PERMBLOCK_ALERT to "0" to disable this feature
elif items.find('LF_PERMBLOCK_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_PERMBLOCK_ALERT = "0"\n')
# Set LF_NETBLOCK_ALERT to "0" to disable this feature
elif items.find('LF_NETBLOCK_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_NETBLOCK_ALERT = "0"\n')
# Login Failure Blocking and Alerts
# LF_TRIGGER_PERM = "1800" => the IP is blocked temporarily for 30 minutes
elif items.find('LF_TRIGGER_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_TRIGGER_PERM = "1800"\n')
# Enable login failure detection of sshd connections: 10 failures triggers
elif items.find('LF_SSHD =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_SSHD = "10"\n')
# LF_SSHD_PERM = "1800" => the IP is blocked temporarily for 30 minutes
elif items.find('LF_SSHD_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_SSHD_PERM = "1800"\n')
# Enable login failure detection of ftp connections: 10 failures triggers
elif items.find('LF_FTPD =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_FTPD = "10"\n')
# LF_FTPD_PERM = "1800" => the IP is blocked temporarily for 30 minutes
elif items.find('LF_FTPD_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_FTPD_PERM = "1800"\n')
# Enable login failure detection of SMTP AUTH connections: 10 failures triggers
elif items.find('LF_SMTPAUTH =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_SMTPAUTH = "10"\n')
# LF_SMTPAUTH_PERM = "1800" => the IP is blocked temporarily for 30 minutes
elif items.find('LF_SMTPAUTH_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_SMTPAUTH_PERM = "1800"\n')
# Enable login failure detection of pop3 connections: 10 failures triggers
elif items.find('LF_POP3D =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_POP3D = "10"\n')
# LF_POP3D_PERM = "1800" => the IP is blocked temporarily for 30 minutes
elif items.find('LF_POP3D_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_POP3D_PERM = "1800"\n')
# Enable login failure detection of imap connections: 10 failures triggers
elif items.find('LF_IMAPD =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_IMAPD = "10"\n')
# LF_IMAPD_PERM = "1800" => the IP is blocked temporarily for 30 minutes
elif items.find('LF_IMAPD_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_IMAPD_PERM = "1800"\n')
# LF_HTACCESS_PERM = "1800" => the IP is blocked temporarily for 30 minutes
elif items.find('LF_HTACCESS_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_HTACCESS_PERM = "1800"\n')
# Enable failure detection of repeated Apache mod_security rule triggers: 10 failures triggers
elif items.find('LF_MODSEC =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_MODSEC = "10"\n')
# LF_MODSEC_PERM = "1800" => the IP is blocked temporarily for 30 minutes
elif items.find('LF_MODSEC_PERM') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_MODSEC_PERM = "1800"\n')
# MODSEC_LOG location
elif items.find('MODSEC_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('MODSEC_LOG = "/usr/local/lsws/logs/auditmodsec.log"\n')
# Send an email alert if anyone logs in successfully using SSH: Disabled
elif items.find('LF_SSH_EMAIL_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_SSH_EMAIL_ALERT = "0"\n')
# Send an email alert if anyone accesses webmin: Disabled not applicable
elif items.find('LF_WEBMIN_EMAIL_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_WEBMIN_EMAIL_ALERT = "0"\n')
# LF_QUEUE_ALERT disabled
elif items.find('LF_QUEUE_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_QUEUE_ALERT = "0"\n')
# LF_QUEUE_INTERVAL disabled
elif items.find('LF_QUEUE_INTERVAL = "0"') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('LF_TRIGGER_PERM = "1800"\n')
# Relay Tracking. This allows you to track email that is relayed through the server. Disabled
elif items.find('RT_RELAY_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_RELAY_ALERT = "0"\n')
# RT_[relay type]_LIMIT: the limit/hour afterwhich an email alert will be sent
elif items.find('RT_RELAY_LIMIT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_RELAY_LIMIT = "500"\n')
# RT_[relay type]_BLOCK: 0 = no block;1 = perm block;nn=temp block for nn secs
elif items.find('RT_RELAY_BLOCK') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_RELAY_BLOCK = "0"\n')
# This option triggers for email authenticated by SMTP AUTH disabled
elif items.find('RT_AUTHRELAY_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_AUTHRELAY_ALERT = "0"\n')
# RT_AUTHRELAY_LIMIT set to 100
elif items.find('RT_AUTHRELAY_LIMIT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_AUTHRELAY_LIMIT = "100"\n')
# RT_AUTHRELAY_LIMIT set to 0
elif items.find('RT_AUTHRELAY_BLOCK') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_AUTHRELAY_BLOCK = "0"\n')
# This option triggers for email authenticated by POP before SMTP
elif items.find('RT_POPRELAY_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_POPRELAY_ALERT = "0"\n')
# This option triggers for email authenticated by POP before SMTP
elif items.find('RT_POPRELAY_LIMIT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_POPRELAY_LIMIT = "100"\n')
# RT_POPRELAY_BLOCK disabled
elif items.find('RT_POPRELAY_BLOCK') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_POPRELAY_BLOCK = "0"\n')
# This option triggers for email sent via /usr/sbin/sendmail or /usr/sbin/exim: Disabled
elif items.find('RT_LOCALRELAY_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_LOCALRELAY_ALERT = "0"\n')
# This option triggers for email sent via a local IP addresses
elif items.find('RT_LOCALRELAY_LIMIT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_LOCALRELAY_LIMIT = "100"\n')
# This option triggers for email sent via a local IP addresses
elif items.find('RT_LOCALHOSTRELAY_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_LOCALHOSTRELAY_ALERT = "0"\n')
# This option triggers for email sent via a local IP addresses disabled
elif items.find('RT_LOCALHOSTRELAY_LIMIT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_LOCALHOSTRELAY_LIMIT = "100"\n')
# If an RT_* event is triggered, then if the following contains the path to a script
elif items.find('RT_ACTION') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('RT_ACTION = ""\n')
# Send an email alert if an IP address is blocked due to connection tracking disabled
elif items.find('CT_EMAIL_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('CT_EMAIL_ALERT = "0"\n')
# User Process Tracking. Set to 0 to disable this feature
elif items.find('PT_USERPROC =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('PT_USERPROC = "0"\n')
# This User Process Tracking option sends an alert if any user process exceeds the virtual memory usage set (MB)
elif items.find('PT_USERMEM =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('PT_USERMEM = "0"\n')
# This User Process Tracking option sends an alert if any user process exceeds the RSS memory usage set (MB) - RAM used, not virtual.
elif items.find('PT_USERRSS =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('PT_USERRSS = "0"\n')
# If this option is set then processes detected by PT_USERMEM, PT_USERTIME or PT_USERPROC are killed. Disabled
elif items.find('PT_USERTIME =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('PT_USERTIME = "0"\n')
# If you want to disable email alerts if PT_USERKILL is triggered, then set this option to 0. Disabled
elif items.find('PT_USERKILL_ALERT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('PT_USERKILL_ALERT = "0"\n')
# Check the PT_LOAD_AVG minute Load Average (can be set to 1 5 or 15 and defaults to 5 if set otherwise) on the server every PT_LOAD seconds. Disabled
elif items.find('PT_LOAD =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('PT_LOAD = "0"\n')
# HTACCESS_LOG is ins main error.log
elif items.find('HTACCESS_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('HTACCESS_LOG = "/usr/local/lsws/logs/error.log"\n')
elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
if items.find('SSHD_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('SSHD_LOG = "/var/log/auth.log"\n')
elif items.find('SU_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('SU_LOG = "/var/log/auth.log"\n')
elif items.find('SMTPAUTH_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('SMTPAUTH_LOG = "/var/log/mail.log"\n')
elif items.find('POP3D_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('POP3D_LOG = "/var/log/mail.log"\n')
elif items.find('IMAPD_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('IMAPD_LOG = "/var/log/mail.log"\n')
elif items.find('IPTABLES_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('IPTABLES_LOG = "/var/log/kern.log"\n')
elif items.find('SYSLOG_LOG =') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines('SYSLOG_LOG = "/var/log/syslog"\n')
else: else:
writeToConf.writelines(items) writeToConf.writelines(items)
writeToConf.close() writeToConf.close()
## ##
command = 'csf -s' command = 'csf -s'
@@ -144,7 +353,8 @@ class CSF(multi.Thread):
output = ProcessUtilities.outputExecutioner(command).splitlines() output = ProcessUtilities.outputExecutioner(command).splitlines()
for items in output: for items in output:
if items.find('TESTING') > -1 and items.find('=') > -1 and (items[0]!= '#') and items.find('TESTING_INTERVAL') == -1: if items.find('TESTING') > -1 and items.find('=') > -1 and (items[0] != '#') and items.find(
'TESTING_INTERVAL') == -1:
if items.find('0') > -1: if items.find('0') > -1:
currentSettings['TESTING'] = 0 currentSettings['TESTING'] = 0
else: else:
@@ -172,7 +382,6 @@ class CSF(multi.Thread):
if output.find('0.0.0.0/0') > -1: if output.find('0.0.0.0/0') > -1:
currentSettings['firewallStatus'] = 1 currentSettings['firewallStatus'] = 1
return currentSettings return currentSettings
except BaseException, msg: except BaseException, msg:
@@ -209,7 +418,7 @@ class CSF(multi.Thread):
except BaseException, msg: except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[changeStatus]") logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[changeStatus]")
print '0',str(msg) print '0', str(msg)
@staticmethod @staticmethod
def modifyPorts(protocol, portsPath): def modifyPorts(protocol, portsPath):
@@ -289,8 +498,23 @@ class CSF(multi.Thread):
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[blockIP]") logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[blockIP]")
def main(): def run_command(command):
p = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
return iter(p.stdout.readline, b'')
@staticmethod
def checkIP(ipAddress):
try:
command = "sudo csf -g ' + ipAddress.split()
for line in run_command(command):
print(line)
except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[checkIP]")
def main():
parser = argparse.ArgumentParser(description='CSF Manager') parser = argparse.ArgumentParser(description='CSF Manager')
parser.add_argument('function', help='Specific a function to call!') parser.add_argument('function', help='Specific a function to call!')
@@ -302,7 +526,7 @@ def main():
args = parser.parse_args() args = parser.parse_args()
if args.function == "installCSF": if args.function == "installCSF":
CSF.installCSF() CSF.installCSF()
elif args.function == 'removeCSF': elif args.function == 'removeCSF':
controller = CSF(args.function, {}) controller = CSF(args.function, {})
controller.run() controller.run()
@@ -311,5 +535,6 @@ def main():
elif args.function == 'modifyPorts': elif args.function == 'modifyPorts':
CSF.modifyPorts(args.protocol, args.ports) CSF.modifyPorts(args.protocol, args.ports)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

0
plogical/mailUtilities.py Executable file → Normal file
View File

0
plogical/mysqlUtilities.py Executable file → Normal file
View File

0
plogical/processUtilities.py Executable file → Normal file
View File

48
plogical/remoteBackup.py Executable file → Normal file
View File

@@ -43,7 +43,7 @@ class remoteBackup:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Starting restore for: "+backup+".\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Starting restore for: "+backup+".\n")
writeToFile.close() writeToFile.close()
finalData = json.dumps({'backupFile': backup, "dir": dir}) finalData = json.dumps({'backupFile': backup, "dir": dir})
@@ -63,9 +63,9 @@ class remoteBackup:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Restore aborted for: " + backup + ". Error message: "+data['status']+"\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Restore aborted for: " + backup + ". Error message: "+data['status']+"\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n") "%m.%d.%Y_%H-%M-%S") + "]" + " #########################################\n")
writeToFile.close() writeToFile.close()
break break
elif data['abort'] == 1 and data['running'] == "Completed": elif data['abort'] == 1 and data['running'] == "Completed":
@@ -73,9 +73,9 @@ class remoteBackup:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Restore Completed for: " + backup + ".\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Restore Completed for: " + backup + ".\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n") "%m.%d.%Y_%H-%M-%S") + "]" + " #########################################\n")
writeToFile.close() writeToFile.close()
break break
else: else:
@@ -83,7 +83,7 @@ class remoteBackup:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for restore to complete.\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Waiting for restore to complete.\n")
writeToFile.close() writeToFile.close()
time.sleep(3) time.sleep(3)
pass pass
@@ -93,7 +93,7 @@ class remoteBackup:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + "Could not start restore process for: " + backup + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + "Could not start restore process for: " + backup + "\n")
writeToFile.close() writeToFile.close()
writeToFile = open(backupLogPath, "a") writeToFile = open(backupLogPath, "a")
@@ -101,7 +101,7 @@ class remoteBackup:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Backup Restore complete\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Backup Restore complete\n")
writeToFile.writelines("completed[success]") writeToFile.writelines("completed[success]")
@@ -123,7 +123,7 @@ class remoteBackup:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("############################\n") writeToFile.writelines("############################\n")
writeToFile.writelines(" Starting Backup Restore\n") writeToFile.writelines(" Starting Backup Restore\n")
writeToFile.writelines(" Start date: " + time.strftime("%I-%M-%S-%a-%b-%Y") + "\n") writeToFile.writelines(" Start date: " + time.strftime("%m.%d.%Y_%H-%M-%S") + "\n")
writeToFile.writelines("############################\n") writeToFile.writelines("############################\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
@@ -172,9 +172,9 @@ class remoteBackup:
def createBackup(virtualHost, ipAddress,writeToFile, dir): def createBackup(virtualHost, ipAddress,writeToFile, dir):
try: try:
writeToFile.writelines("Location: "+dir + "\n") writeToFile.writelines("Location: "+dir + "\n")
writeToFile.writelines("["+time.strftime("%I-%M-%S-%a-%b-%Y")+"]"+" Preparing to create backup for: "+virtualHost+"\n") writeToFile.writelines("["+time.strftime("%m.%d.%Y_%H-%M-%S")+"]"+" Preparing to create backup for: "+virtualHost+"\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Backup started for: " + virtualHost + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Backup started for: " + virtualHost + "\n")
finalData = json.dumps({'websiteToBeBacked': virtualHost}) finalData = json.dumps({'websiteToBeBacked': virtualHost})
r = requests.post("http://localhost:5003/backup/submitBackupCreation", data=finalData,verify=False) r = requests.post("http://localhost:5003/backup/submitBackupCreation", data=finalData,verify=False)
@@ -191,16 +191,16 @@ class remoteBackup:
break break
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Backup created for:" + virtualHost + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Backup created for:" + virtualHost + "\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Preparing to send backup for: " + virtualHost +" to "+ipAddress+ "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Preparing to send backup for: " + virtualHost +" to "+ipAddress+ "\n")
writeToFile.flush() writeToFile.flush()
remoteBackup.sendBackup(backupPath+".tar.gz", ipAddress,writeToFile, dir) remoteBackup.sendBackup(backupPath+".tar.gz", ipAddress,writeToFile, dir)
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Backup for: " + virtualHost + " is sent to " + ipAddress + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Backup for: " + virtualHost + " is sent to " + ipAddress + "\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
@@ -240,7 +240,7 @@ class remoteBackup:
writeToFile = open(backupLogPath, "a") writeToFile = open(backupLogPath, "a")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Currently generating local backups for: " + virtualHost + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Currently generating local backups for: " + virtualHost + "\n")
writeToFile.close() writeToFile.close()
@@ -262,7 +262,7 @@ class remoteBackup:
writeToFile = open(backupLogPath, "a") writeToFile = open(backupLogPath, "a")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for backup to complete.. " + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Waiting for backup to complete.. " + "\n")
writeToFile.close() writeToFile.close()
@@ -272,7 +272,7 @@ class remoteBackup:
writeToFile = open(backupLogPath, "a") writeToFile = open(backupLogPath, "a")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Local Backup Completed for: " +virtualHost + " with status: "+ data['status'] +"\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Local Backup Completed for: " +virtualHost + " with status: "+ data['status'] +"\n")
## move the generated backup file to specified destination ## move the generated backup file to specified destination
@@ -283,16 +283,16 @@ class remoteBackup:
completedPathToSend = dir +"/" + completePathToBackupFile.split("/")[-1] completedPathToSend = dir +"/" + completePathToBackupFile.split("/")[-1]
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Sending " + completedPathToSend +" to "+ipAddress +".\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Sending " + completedPathToSend +" to "+ipAddress +".\n")
remoteBackup.sendBackup(completedPathToSend,ipAddress,str(folderNumber),writeToFile) remoteBackup.sendBackup(completedPathToSend,ipAddress,str(folderNumber),writeToFile)
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Sent " + completedPathToSend + " to " + ipAddress + ".\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Sent " + completedPathToSend + " to " + ipAddress + ".\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " #############################################" + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " #############################################" + "\n")
writeToFile.close() writeToFile.close()
break break
@@ -301,7 +301,7 @@ class remoteBackup:
writeToFile = open(backupLogPath, "a") writeToFile = open(backupLogPath, "a")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Backups are successfully generated and received on: " + ipAddress + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Backups are successfully generated and received on: " + ipAddress + "\n")
writeToFile.close() writeToFile.close()
## removing local directory where backups were generated ## removing local directory where backups were generated
@@ -325,7 +325,7 @@ class remoteBackup:
writeToFile.writelines("############################\n") writeToFile.writelines("############################\n")
writeToFile.writelines(" Starting remote Backup\n") writeToFile.writelines(" Starting remote Backup\n")
writeToFile.writelines(" Start date: " + time.strftime("%I-%M-%S-%a-%b-%Y") + "\n") writeToFile.writelines(" Start date: " + time.strftime("%m.%d.%Y_%H-%M-%S") + "\n")
writeToFile.writelines("############################\n") writeToFile.writelines("############################\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
@@ -335,14 +335,14 @@ class remoteBackup:
checkConn = backupUtil.backupUtilities.checkConnection(ipAddress) checkConn = backupUtil.backupUtilities.checkConnection(ipAddress)
if checkConn[0] == 0: if checkConn[0] == 0:
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Connection to:" + ipAddress + " Failed, please resetup this destination from CyberPanel, aborting." + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Connection to:" + ipAddress + " Failed, please resetup this destination from CyberPanel, aborting." + "\n")
writeToFile.close() writeToFile.close()
return [0, checkConn[1]] return [0, checkConn[1]]
else: else:
pass pass
else: else:
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Host:" + ipAddress + " is down, aborting." + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Host:" + ipAddress + " is down, aborting." + "\n")
writeToFile.close() writeToFile.close()
return [0, "Remote server is not able to communicate with this server."] return [0, "Remote server is not able to communicate with this server."]

36
plogical/remoteTransferUtilities.py Executable file → Normal file
View File

@@ -74,7 +74,7 @@ class remoteTransferUtilities:
writeToFile.writelines("############################\n") writeToFile.writelines("############################\n")
writeToFile.writelines(" Starting remote Backup\n") writeToFile.writelines(" Starting remote Backup\n")
writeToFile.writelines(" Start date: " + time.strftime("%I-%M-%S-%a-%b-%Y") + "\n") writeToFile.writelines(" Start date: " + time.strftime("%m.%d.%Y_%H-%M-%S") + "\n")
writeToFile.writelines("############################\n") writeToFile.writelines("############################\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
@@ -83,14 +83,14 @@ class remoteTransferUtilities:
checkConn = backupUtil.backupUtilities.checkConnection(ipAddress) checkConn = backupUtil.backupUtilities.checkConnection(ipAddress)
if checkConn[0] == 0: if checkConn[0] == 0:
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Connection to:" + ipAddress + " Failed, please resetup this destination from CyberPanel, aborting. [5010]" + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Connection to:" + ipAddress + " Failed, please resetup this destination from CyberPanel, aborting. [5010]" + "\n")
writeToFile.close() writeToFile.close()
return return
else: else:
pass pass
else: else:
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Host:" + ipAddress + " could be down, we are continuing..." + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Host:" + ipAddress + " could be down, we are continuing..." + "\n")
writeToFile.close() writeToFile.close()
writeToFile.close() writeToFile.close()
@@ -133,7 +133,7 @@ class remoteTransferUtilities:
writeToFile = open(backupLogPath, "a") writeToFile = open(backupLogPath, "a")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Currently generating local backups for: " + virtualHost + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Currently generating local backups for: " + virtualHost + "\n")
writeToFile.close() writeToFile.close()
retValue = backupSchedule.createLocalBackup(virtualHost, backupLogPath) retValue = backupSchedule.createLocalBackup(virtualHost, backupLogPath)
@@ -141,7 +141,7 @@ class remoteTransferUtilities:
if retValue[0] == 1: if retValue[0] == 1:
writeToFile = open(backupLogPath, 'a') writeToFile = open(backupLogPath, 'a')
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Local Backup Completed for: " + virtualHost + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Local Backup Completed for: " + virtualHost + "\n")
completePathToBackupFile = retValue[1] + '.tar.gz' completePathToBackupFile = retValue[1] + '.tar.gz'
@@ -153,20 +153,20 @@ class remoteTransferUtilities:
completedPathToSend = dir + "/" + completePathToBackupFile.split("/")[-1] completedPathToSend = dir + "/" + completePathToBackupFile.split("/")[-1]
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Sending " + completedPathToSend + " to " + ipAddress + ".\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Sending " + completedPathToSend + " to " + ipAddress + ".\n")
remoteTransferUtilities.sendBackup(completedPathToSend, ipAddress, str(folderNumber), remoteTransferUtilities.sendBackup(completedPathToSend, ipAddress, str(folderNumber),
writeToFile) writeToFile)
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Sent " + completedPathToSend + " to " + ipAddress + ".\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Sent " + completedPathToSend + " to " + ipAddress + ".\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " #############################################" + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " #############################################" + "\n")
writeToFile.close() writeToFile.close()
else: else:
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + "Failed to generate local backup for: " + virtualHost + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + "Failed to generate local backup for: " + virtualHost + "\n")
except BaseException, msg: except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [remoteTransferUtilities.backupProcess:173]") logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [remoteTransferUtilities.backupProcess:173]")
@@ -174,7 +174,7 @@ class remoteTransferUtilities:
writeToFile = open(backupLogPath, "a") writeToFile = open(backupLogPath, "a")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Backups are successfully generated and received on: " + ipAddress + "\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Backups are successfully generated and received on: " + ipAddress + "\n")
writeToFile.close() writeToFile.close()
## removing local directory where backups were generated ## removing local directory where backups were generated
@@ -212,7 +212,7 @@ class remoteTransferUtilities:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("############################\n") writeToFile.writelines("############################\n")
writeToFile.writelines(" Starting Backup Restore\n") writeToFile.writelines(" Starting Backup Restore\n")
writeToFile.writelines(" Start date: " + time.strftime("%I-%M-%S-%a-%b-%Y") + "\n") writeToFile.writelines(" Start date: " + time.strftime("%m.%d.%Y_%H-%M-%S") + "\n")
writeToFile.writelines("############################\n") writeToFile.writelines("############################\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
@@ -258,7 +258,7 @@ class remoteTransferUtilities:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Starting restore for: " + backup + ".\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Starting restore for: " + backup + ".\n")
writeToFile.close() writeToFile.close()
backupFile = backup backupFile = backup
@@ -282,9 +282,9 @@ class remoteTransferUtilities:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Restore Completed for: " + backup + ".\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Restore Completed for: " + backup + ".\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n") "%m.%d.%Y_%H-%M-%S") + "]" + " #########################################\n")
writeToFile.close() writeToFile.close()
break break
elif status.find("[5009]") > -1: elif status.find("[5009]") > -1:
@@ -296,10 +296,10 @@ class remoteTransferUtilities:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Restore aborted for: " + backup + ". Error message: " + "%m.%d.%Y_%H-%M-%S") + "]" + " Restore aborted for: " + backup + ". Error message: " +
status + "\n") status + "\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n") "%m.%d.%Y_%H-%M-%S") + "]" + " #########################################\n")
writeToFile.close() writeToFile.close()
break break
else: else:
@@ -307,7 +307,7 @@ class remoteTransferUtilities:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for restore to complete.\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Waiting for restore to complete.\n")
writeToFile.close() writeToFile.close()
time.sleep(3) time.sleep(3)
pass pass
@@ -317,7 +317,7 @@ class remoteTransferUtilities:
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("\n") writeToFile.writelines("\n")
writeToFile.writelines("[" + time.strftime( writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Backup Restore complete\n") "%m.%d.%Y_%H-%M-%S") + "]" + " Backup Restore complete\n")
writeToFile.writelines("completed[success]") writeToFile.writelines("completed[success]")
except BaseException, msg: except BaseException, msg:

6
plogical/upgrade.py Executable file → Normal file
View File

@@ -27,10 +27,10 @@ class Upgrade:
def stdOut(message, do_exit=0): def stdOut(message, do_exit=0):
print("\n\n") print("\n\n")
print ("[" + time.strftime( print ("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n")
print("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + message + "\n") print("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] " + message + "\n")
print ("[" + time.strftime( print ("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n")
if do_exit: if do_exit:
os._exit(0) os._exit(0)

6
pluginInstaller/pluginInstaller.py Executable file → Normal file
View File

@@ -17,10 +17,10 @@ class pluginInstaller:
def stdOut(message): def stdOut(message):
print("\n\n") print("\n\n")
print ("[" + time.strftime( print ("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n")
print("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + message + "\n") print("[" + time.strftime("%m.%d.%Y_%H-%M-%S") + "] " + message + "\n")
print ("[" + time.strftime( print ("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] #########################################################################\n") "%m.%d.%Y_%H-%M-%S") + "] #########################################################################\n")
### Functions Related to plugin installation. ### Functions Related to plugin installation.

4
postfixSenderPolicy/accept_traffic.py Executable file → Normal file
View File

@@ -117,7 +117,7 @@ class HandleRequest(multi.Thread):
else: else:
email = EUsers.objects.get(email=emailAddress) email = EUsers.objects.get(email=emailAddress)
if emailObj.logStatus == 1: if emailObj.logStatus == 1:
logEntry = EmailLogs(email=email, destination=destination, timeStamp=time.strftime("%I-%M-%S-%a-%b-%Y")) logEntry = EmailLogs(email=email, destination=destination, timeStamp=time.strftime("%m.%d.%Y_%H-%M-%S"))
logEntry.save() logEntry.save()
emailObj.monthlyUsed = emailObj.monthlyUsed + 1 emailObj.monthlyUsed = emailObj.monthlyUsed + 1
emailObj.hourlyUsed = emailObj.hourlyUsed + 1 emailObj.hourlyUsed = emailObj.hourlyUsed + 1
@@ -127,7 +127,7 @@ class HandleRequest(multi.Thread):
email = EUsers.objects.get(email=emailAddress) email = EUsers.objects.get(email=emailAddress)
if emailObj.logStatus == 1: if emailObj.logStatus == 1:
logEntry = EmailLogs(email=email, destination=destination, logEntry = EmailLogs(email=email, destination=destination,
timeStamp=time.strftime("%I-%M-%S-%a-%b-%Y")) timeStamp=time.strftime("%m.%d.%Y_%H-%M-%S"))
logEntry.save() logEntry.save()
emailObj.monthlyUsed = emailObj.monthlyUsed + 1 emailObj.monthlyUsed = emailObj.monthlyUsed + 1

4
s3Backups/s3Backups.py Executable file → Normal file
View File

@@ -424,9 +424,9 @@ class S3Backups(multi.Thread):
## /home/example.com/backup ## /home/example.com/backup
backupPath = os.path.join("/home", virtualHost, "backup/") backupPath = os.path.join("/home", virtualHost, "backup/")
domainUser = website.externalApp domainUser = website.externalApp
backupName = 'backup-' + domainUser + "-" + time.strftime("%I-%M-%S-%a-%b-%Y") backupName = 'backup-' + domainUser + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
## /home/example.com/backup/backup-example-06-50-03-Thu-Feb-2018 ## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52
tempStoragePath = os.path.join(backupPath, backupName) tempStoragePath = os.path.join(backupPath, backupName)
p = Process(target=backupUtil.submitBackupCreation, p = Process(target=backupUtil.submitBackupCreation,