This commit is contained in:
Hassan Hashmi
2022-07-23 22:22:39 +05:00
parent f66c56590d
commit 6e23924f00
6 changed files with 734 additions and 117 deletions

View File

@@ -622,11 +622,16 @@
title="{% trans 'DKIM Manager' %}"><span>{% trans "DKIM Manager" %}</span></a> title="{% trans 'DKIM Manager' %}"><span>{% trans "DKIM Manager" %}</span></a>
</li> </li>
{% endif %} {% endif %}
<li><a href="{% url 'EmailDebugger' %}"
title="{% trans 'Email Debugger' %}"><span>{% trans "Email Debugger" %}</span></a>
</li>
{% if admin or createEmail %} {% if admin or createEmail %}
<li><a href="/snappymail/index.php" title="{% trans 'Access Webmail' %}" <li><a href="/snappymail/index.php" title="{% trans 'Access Webmail' %}"
target="_blank"><span>{% trans "Access Webmail" %}</span></a> target="_blank"><span>{% trans "Access Webmail" %}</span></a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
</div><!-- .sidebar-submenu --> </div><!-- .sidebar-submenu -->

View File

@@ -1520,89 +1520,325 @@ app.controller('Rspamd', function ($scope, $http, $timeout, $window) {
} }
// function getUninstallationStatus(){
// $scope.RspamduninstallLoading = false;
// url = "/websites/installWordpressStatus";
//
// var data = {
// statusFile: statusFile
// };
// var config = {
// headers: {
// 'X-CSRFToken': getCookie('csrftoken')
// }
// };
//
//
// $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
//
//
// function ListInitialDatas(response) {
// $scope.RspamduninstallLoading = true;
//
// if (response.data.abort === 1) {
//
// if (response.data.installStatus === 1) {
//
//
// $scope.RspamduninstallLoading = true;
// $scope.uninstallationProgress = false;
// $scope.errorMessageBox = true;
// $scope.uninstallsuccess = false;
// $scope.couldNotConnect = true;
//
//
// $("#installProgress").css("width", "100%");
// $("#installProgressbackup").css("width", "100%");
// $scope.installPercentage = "100";
// $scope.currentStatus = response.data.currentStatus;
// $timeout.cancel();
//
//
// } else {
//
// $scope.RspamduninstallLoading = true;
// $scope.uninstallationProgress = false;
// $scope.errorMessageBox = false;
// $scope.uninstallsuccess = true;
// $scope.couldNotConnect = true;
// $scope.errorMessage = response.data.error_message;
//
// $("#installProgress").css("width", "0%");
// $("#installProgressbackup").css("width", "0%");
// $scope.installPercentage = "0";
// $scope.goBackDisable = false;
//
//
// }
//
// } else {
//
// $("#installProgress").css("width", response.data.uninstallationProgress + "%");
// $("#installProgressbackup").css("width", response.data.uninstallationProgress + "%");
// $scope.installPercentage = response.data.uninstallationProgress;
// $scope.currentStatus = response.data.currentStatus;
// $timeout(getCreationStatus, 1000);
//
// }
//
// }
//
// function cantLoadInitialDatas(response) {
// $('#wordpresshomeloading').hide();
// $scope.RspamduninstallLoading = true;
// $scope.uninstallationProgress = false;
// $scope.errorMessageBox = true;
// $scope.uninstallsuccess = true;
// $scope.couldNotConnect = false;
//
//
// }
// }
}); });
//// Email Debugger
app.controller('EmailDebuuger', function ($scope, $http, $timeout, $window) {
$scope.cyberpanelLoading = true;
$scope.ExecutionStatus = true;
$scope.ReportStatus = true;
$scope.RunServerLevelEmailChecks = function () {
$scope.cyberpanelLoading = false;
var url = "/emailPremium/RunServerLevelEmailChecks";
var data = {};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
statusFile = response.data.tempStatusPath;
reportFile = response.data.reportFile;
statusFunc();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialData(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Error',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
function statusFunc(){
$scope.cyberpanelLoading = false;
$scope.ExecutionStatus = false;
var url = "/emailPremium/statusFunc";
var data = {
statusFile: statusFile
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
if (response.data.status === 1) {
if (response.data.abort === 1) {
$scope.functionProgress = {"width": "100%"};
$scope.functionStatus = response.data.currentStatus;
$scope.cyberpanelLoading = true;
$scope.ReadReport();
$timeout.cancel();
} else {
$scope.functionProgress = {"width": response.data.installationProgress + "%"};
$scope.functionStatus = response.data.currentStatus;
$timeout(statusFunc, 3000);
}
} else {
$scope.cyberpanelLoading = true;
$scope.functionStatus = response.data.error_message;
$scope.functionProgress = {"width": response.data.installationProgress + "%"};
$timeout.cancel();
}
}
function cantLoadInitialData(response) {
$scope.functionProgress = {"width": response.data.installationProgress + "%"};
$scope.functionStatus = 'Could not connect to server, please refresh this page.';
$timeout.cancel();
}
}
$scope.ReadReport = function () {
if (reportFile === 'none') {
return;
}
$scope.cyberpanelLoading = false;
var url = "/emailPremium/ReadReport";
var data = {
reportFile: reportFile
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
var reportResult = JSON.parse(response.data.reportContent);
if (reportResult.MailSSL === 1) {
$scope.MailSSL = 'Issued and Valid';
} else {
$scope.MailSSL = 'Not issued or expired.'
}
var report = response.data.report;
console.log(report);
$scope.Port25 = report.Port25;
$scope.Port587 = report.Port587;
$scope.Port465 = report.Port465;
$scope.Port110 = report.Port110;
$scope.Port143 = report.Port143;
$scope.Port993 = report.Port993;
$scope.Port995 = report.Port995;
//document.getElementById('MailSSLURL').href = 'https://' + report.serverHostName + ":" + report.port + '/cloudAPI/access?token=' + report.token + "&serverUserName=" + report.userName + '&redirect=/manageSSL/sslForMailServer';
document.getElementById('MailSSLURL').href = '/manageSSL/sslForMailServer';
$scope.ReportStatus = false;
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialData(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Error',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.ResetEmailConfigurations = function () {
$scope.cyberpanelLoading = false;
var url = "/emailPremium/ResetEmailConfigurations";
var data = {};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
statusFile = response.data.tempStatusPath;
reportFile = response.data.reportFile;
reportFile = 'none';
statusFunc();
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialData(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Error',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
});
app.controller('emailDebuggerDomainLevel', function ($scope, $http, $timeout, $window) {
$scope.cyberpanelLoading = true;
$scope.ReportStatus = true;
$scope.debugEmailForSite = function () {
$scope.cyberpanelLoading = false;
url = "/emailPremium/debugEmailForSite";
var data = {
websiteName: $scope.websiteName
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
$scope.cyberpanelLoading = true;
$scope.status = response.data.status;
$scope.message = response.data.error_message;
$scope.ReportStatus = false;
}
function cantLoadInitialData(response) {
$scope.cyberhosting = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
$scope.fixMailSSL = function () {
$scope.cyberpanelLoading = false;
url = "/emailPremium/fixMailSSL";
var data = {
websiteName: $scope.websiteName
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
function ListInitialData(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Successfully fixed.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialData(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page.',
type: 'error'
});
}
};
});
/* Java script code for Email Policy Server */ /* Java script code for Email Policy Server */
app.controller('policyServer', function ($scope, $http, $timeout, $window) { app.controller('policyServer', function ($scope, $http, $timeout, $window) {

View File

@@ -0,0 +1,252 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Email Debugger - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<div id="page-title">
<h2 id="domainNamePage">{% trans "Email Debugger" %} - <a target="_blank"
href="https://go.cyberpanel.net/mailQueue"
style="height: 23px;line-height: 21px;"
class="btn btn-border btn-alt border-red btn-link font-red"
title=""><span>{% trans "Queue Docs" %}</span></a>
</h2>
<p>{% trans "On this page you manage your server Debug Email setting." %}</p>
</div>
<div ng-controller="EmailDebuuger" class="panel">
<div class="panel-body">
<h3 class="content-box-header">
{% trans "DEBUG EMAIL SERVER" %} <img
ng-hide="cyberpanelLoading" src="{% static 'images/loading.gif' %}">
</h3>
<div class="col-lg-3">
<button type="button" ng-click="RunServerLevelEmailChecks()"
class="btn btn-primary btn-lg btn-block">{% trans "Run Server Level Checks" %}
<img ng-hide="cyberpanelLoading" src="{% static 'images/loading.gif' %}"></button>
</div>
<div class="col-lg-5">
<button type="button" ng-click="ResetEmailConfigurations()"
class="btn btn-danger btn-lg btn-block">
<span>Reset Server wide Email Configurations <img
ng-hide="cyberpanelLoading" src="{% static 'images/loading.gif' %}"></span>
</button>
</div>
<div ng-hide="ExecutionStatus" class="row">
<div class="col-md-12">
<div class="form-group">
<h4> {$ functionStatus $} <img
ng-hide="cyberpanelLoading" src="{% static 'images/loading.gif' %}">
</h4>
<div class="progress">
<div ng-style="functionProgress"
class="progress-bar progress-bar-striped bg-info"
role="progressbar"
aria-valuenow="50" aria-valuemin="0"
aria-valuemax="100"></div>
</div>
</div>
</div>
</div> <!-- end row -->
<div ng-hide="ReportStatus" class="row">
<div class="col-md-12">
<div class="form-group">
<div class="table-responsive-sm">
<table class="table table-centered mb-0">
<thead>
<tr>
<th>Issue</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mail Server SSL</td>
<td>{$ MailSSL $}</td>
<td>
<a id="MailSSLURL" target="_blank" href="#">
<button data-toggle="modal" title="Manage CyberPanel" type="button"
class="btn btn-success">
Issue Now
</button>
</a>
</td>
</tr>
<tr>
<td>Port 25</td>
<td>{$ Port25 $}</td>
<td>
<a id="MailSSLURL" target="_blank"
href="https://go.cyberpanel.net/MailIssues">
<button data-toggle="modal" title="Manage CyberPanel" type="button"
class="btn btn-success">
Learn More
</button>
</a>
</td>
</tr>
<tr>
<td>Port 587</td>
<td>{$ Port587 $}</td>
<td>
<a id="MailSSLURL" target="_blank"
href="https://go.cyberpanel.net/MailIssues">
<button data-toggle="modal" title="Manage CyberPanel" type="button"
class="btn btn-success">
Learn More
</button>
</a>
</td>
</tr>
<tr>
<td>Port 465</td>
<td>{$ Port465 $}</td>
<td>
<a id="MailSSLURL" target="_blank"
href="https://go.cyberpanel.net/MailIssues">
<button data-toggle="modal" title="Manage CyberPanel" type="button"
class="btn btn-success">
Learn More
</button>
</a>
</td>
</tr>
<tr>
<td>Port 110</td>
<td>{$ Port110 $}</td>
<td>
<a id="MailSSLURL" target="_blank"
href="https://go.cyberpanel.net/MailIssues">
<button data-toggle="modal" title="Manage CyberPanel" type="button"
class="btn btn-success">
Learn More
</button>
</a>
</td>
</tr>
<tr>
<td>Port 143</td>
<td>{$ Port143 $}</td>
<td>
<a id="MailSSLURL" target="_blank"
href="https://go.cyberpanel.net/MailIssues">
<button data-toggle="modal" title="Manage CyberPanel" type="button"
class="btn btn-success">
Learn More
</button>
</a>
</td>
</tr>
<tr>
<td>Port 995</td>
<td>{$ Port995 $}</td>
<td>
<a id="MailSSLURL" target="_blank"
href="https://go.cyberpanel.net/MailIssues">
<button data-toggle="modal" title="Manage CyberPanel" type="button"
class="btn btn-success">
Learn More
</button>
</a>
</td>
</tr>
<tr>
<td>Port 993</td>
<td>{$ Port993 $}</td>
<td>
<a id="MailSSLURL" target="_blank"
href="https://go.cyberpanel.net/MailIssues">
<button data-toggle="modal" title="Manage CyberPanel" type="button"
class="btn btn-success">
Learn More
</button>
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- end row -->
<div class="example-box-wrapper">
</div>
</div>
</div>
<div ng-controller="emailDebuggerDomainLevel" class="panel">
<div class="panel-body">
<h3 class="content-box-header">
{% trans "WEBSITE LEVEL EMAIL ISSUES" %} <img
ng-hide="cyberpanelLoading" src="{% static 'images/loading.gif' %}">
</h3>
<div class="col-md-12">
<div class="form-group mb-3">
<label for="example-select">Websites</label>
<select ng-model="websiteName" class="form-control" ng-change="debugEmailForSite()"
id="example-select">
{% for items in websiteList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div ng-hide="ReportStatus" class="row">
<div class="col-md-12">
<div class="form-group">
<div class="table-responsive-sm">
<table class="table table-centered mb-0">
<thead>
<tr>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>{$ message $}</td>
<td>
<button ng-click="fixMailSSL()" ng-disabled='status==1' data-toggle="modal"
title="Manage CyberPanel" type="button"
class="btn btn-success">
Fix Now
</button>
<button ng-click="fixMailSSL()" data-toggle="modal"
title="Manage CyberPanel" type="button"
class="btn btn-success">
Force Fix
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -56,9 +56,23 @@ urlpatterns = [
url(r'^unistallRspamd$', views.unistallRspamd, name='unistallRspamd'), url(r'^unistallRspamd$', views.unistallRspamd, name='unistallRspamd'),
url(r'^uninstallStatusRspamd$', views.uninstallStatusRspamd, name='uninstallStatusRspamd'), url(r'^uninstallStatusRspamd$', views.uninstallStatusRspamd, name='uninstallStatusRspamd'),
url(r'^EmailDebugger$', views.EmailDebugger, name='EmailDebugger'),
url(r'^RunServerLevelEmailChecks$', views.RunServerLevelEmailChecks, name='RunServerLevelEmailChecks'),
url(r'^ResetEmailConfigurations$', views.ResetEmailConfigurations, name='ResetEmailConfigurations'),
url(r'^statusFunc$', views.statusFunc, name='statusFunc'),
url(r'^ReadReport$', views.ReadReport, name='ReadReport'),
url(r'^debugEmailForSite$', views.debugEmailForSite, name='debugEmailForSite'),
url(r'^fixMailSSL$', views.fixMailSSL, name='fixMailSSL'),
url(r'^(?P<domain>(.*))$', views.emailLimits, name='emailLimits'), url(r'^(?P<domain>(.*))$', views.emailLimits, name='emailLimits'),
] ]

View File

@@ -3,6 +3,8 @@ import time
from django.shortcuts import redirect from django.shortcuts import redirect
from django.http import HttpResponse from django.http import HttpResponse
from loginSystem.models import Administrator
from mailServer.models import Domains, EUsers from mailServer.models import Domains, EUsers
from plogical.applicationInstaller import ApplicationInstaller from plogical.applicationInstaller import ApplicationInstaller
from websiteFunctions.models import Websites from websiteFunctions.models import Websites
@@ -18,6 +20,7 @@ from random import randint
from plogical.acl import ACLManager from plogical.acl import ACLManager
from plogical.processUtilities import ProcessUtilities from plogical.processUtilities import ProcessUtilities
from plogical.httpProc import httpProc from plogical.httpProc import httpProc
from cloudAPI.cloudManager import CloudManager
## Email Policy Server ## Email Policy Server
@@ -1672,3 +1675,143 @@ def uninstallStatusRspamd(request):
'error_message': "Not Logged In, please refresh the page or login again."} 'error_message': "Not Logged In, please refresh the page or login again."}
final_json = json.dumps(final_dic) final_json = json.dumps(final_dic)
return HttpResponse(final_json) return HttpResponse(final_json)
##Email Debugger
def EmailDebugger(request):
userID = request.session['userID']
currentACL = ACLManager.loadedACL(userID)
websitesName = ACLManager.findAllSites(currentACL, userID)
proc = httpProc(request, 'emailPremium/EmailDebugger.html',
{'websiteList': websitesName}, 'admin')
return proc.render()
def RunServerLevelEmailChecks(request):
try:
userID = request.session['userID']
ob = CloudManager()
res = ob.RunServerLevelEmailChecks()
return res
except KeyError:
return redirect(loadLoginPage)
def ResetEmailConfigurations(request):
try:
userID = request.session['userID']
ob = CloudManager()
res = ob.ResetEmailConfigurations()
return res
except KeyError:
return redirect(loadLoginPage)
def statusFunc(request):
try:
userID = request.session['userID']
ob = CloudManager(json.loads(request.body))
#wm = WebsiteManager()
res = ob.statusFunc()
return res
except KeyError:
return redirect(loadLoginPage)
def ReadReport(request):
try:
userID = request.session['userID']
try:
ob = CloudManager(json.loads(request.body))
res = ob.ReadReport()
Result = json.loads(res.content)
status = Result['status']
#fetch Ip
IP = ACLManager.GetServerIP()
if status == 1:
def CheckPort(port):
import socket
# Create a TCP socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.settimeout(1)
s.connect((IP, port))
return 1
except socket.error as e:
return 0
finally:
s.close()
report = {}
if CheckPort(25):
report['Port25'] = 'Open'
else:
report['Port25'] = 'Closed, mail will not go through.'
if CheckPort(587):
report['Port587'] = 'Open'
else:
report['Port587'] = 'Closed, mail will not go through.'
if CheckPort(465):
report['Port465'] = 'Open'
else:
report['Port465'] = 'Closed, mail will not go through.'
if CheckPort(110):
report['Port110'] = 'Open'
else:
report['Port110'] = 'Closed, POP3 will not work.'
if CheckPort(143):
report['Port143'] = 'Open'
else:
report['Port143'] = 'Closed, IMAP will not work.'
if CheckPort(993):
report['Port993'] = 'Open'
else:
report['Port993'] = 'Closed, IMAP will not work.'
if CheckPort(995):
report['Port995'] = 'Open'
else:
report['Port995'] = 'Closed, POP3 will not work.'
report['serverHostName'] = IP
finalResult = Result
finalResult['report'] = report
final_json = json.dumps(finalResult)
return HttpResponse(final_json)
else:
return 0 , Result
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile("Result....3:" + str(msg))
except KeyError:
return redirect(loadLoginPage)
def debugEmailForSite(request):
try:
userID = request.session['userID']
ob = CloudManager(json.loads(request.body))
res = ob.debugEmailForSite()
return res
except KeyError:
return redirect(loadLoginPage)
def fixMailSSL(request):
try:
userID = request.session['userID']
admin = Administrator.objects.get(pk=userID)
data={}
cm = CloudManager(json.loads(request.body), admin)
res = cm.fixMailSSL(request)
logging.CyberCPLogFileWriter.writeToFile("Result....3:" + str(res.content))
return res
except KeyError:
return redirect(loadLoginPage)

View File

@@ -1,39 +1,6 @@
data ="""['# This is the right place to customize your installation of SpamAssassin.', '#', "# See 'perldoc Mail::SpamAssassin::Conf' for details of what can be", '# tweaked.', '#', '# Only a small subset of options are listed below', '#', '###########################################################################', '', '# Add *****SPAM***** to the Subject header of spam e-mails', '#', 'rewrite_header Subject *****SPAM*****', '', '', '# Save spam messages as a message/rfc822 MIME attachment instead of', '# modifying the original message (0: off, 2: use text/plain instead)', '#', 'report_safe 1', '', '', "# Set which networks or hosts are considered 'trusted' by your mail", '# server (i.e. not spammers)', '#', '# trusted_networks 212.17.35.', '', '', '# Set file-locking method (flock is not safe over NFS, but is faster)', '#', '# lock_method flock', '', '', '# Set the threshold at which a message is considered spam (default: 5.0)', '#', 'required_score 5.0', '', '', '# Use Bayesian classifier (default: 1)', '#', '# use_bayes 1', '', '', '# Bayesian classifier auto-learning (default: 1)', '#', '# bayes_auto_learn 1', '', '', '# Set headers which may provide inappropriate cues to the Bayesian', '# classifier', '#', '# bayes_ignore_header X-Bogosity', '# bayes_ignore_header X-Spam-Flag', '# bayes_ignore_header X-Spam-Status', '', '', '# Whether to decode non- UTF-8 and non-ASCII textual parts and recode', '# them to UTF-8 before the text is given over to rules processing.', '#', '# normalize_charset 1', '', '# Textual body scan limit (default: 50000)', '#', '# Amount of data per email text/* mimepart, that will be run through body', '# rules. This enables safer and faster scanning of large messages,', '# perhaps having very large textual attachments. There should be no need', '# to change this well tested default.', '#', '# body_part_scan_size 50000', '', '# Textual rawbody data scan limit (default: 500000)', '#', '# Amount of data per email text/* mimepart, that will be run through', '# rawbody rules.', '#', '# rawbody_part_scan_size 500000', '', '# Some shortcircuiting, if the plugin is enabled', '# ', 'ifplugin Mail::SpamAssassin::Plugin::Shortcircuit', '#', '# default: strongly-whitelisted mails are *really* whitelisted now, if the', '# shortcircuiting plugin is active, causing early exit to save CPU load.', '# Uncomment to turn this on', '#', '# SpamAssassin tries hard not to launch DNS queries before priority -100. ', '# If you want to shortcircuit without launching unneeded queries, make', '# sure such rule priority is below -100. These examples are already:', '#', '# shortcircuit USER_IN_WHITELIST on', '# shortcircuit USER_IN_DEF_WHITELIST on', '# shortcircuit USER_IN_ALL_SPAM_TO on', '# shortcircuit SUBJECT_IN_WHITELIST on', '', '# the opposite; blacklisted mails can also save CPU', '#', '# shortcircuit USER_IN_BLACKLIST on', '# shortcircuit USER_IN_BLACKLIST_TO on', '# shortcircuit SUBJECT_IN_BLACKLIST on', '', '# if you have taken the time to correctly specify your "trusted_networks",', '# this is another good way to save CPU', '#', '# shortcircuit ALL_TRUSTED on', '', '# and a well-trained bayes DB can save running rules, too', '#', '# shortcircuit BAYES_99 spam', '# shortcircuit BAYES_00 ham', '', 'endif # Mail::SpamAssassin::Plugin::Shortcircuit']""" Result = """b'{"status": 1, "reportContent": "{\\"MailSSL\\": 1}"}"""
report_safe = 0
required_hits = '5.0'
rewrite_header = 'Subject [SPAM]'
required_score = '5'
for items in data:
if items.find('report_safe ') > -1:
if items.find('0') > -1:
report_safe = 0
continue
else:
report_safe = 1
if items.find('rewrite_header ') > -1:
tempData = items.split(' ')
rewrite_header = ''
counter = 0
for headerData in tempData:
if counter == 0:
counter = counter + 1
continue
rewrite_header = rewrite_header + headerData.strip('\n') + ' '
continue
if items.find('required_score ') > -1:
required_score = items.split(' ')[1].strip('\n')
continue
if items.find('required_hits ') > -1:
required_hits = items.split(' ')[1].strip('\n')
continue
final_dic = {'fetchStatus': 1, if Result.find('"status": 1,') > -1:
'installed': 1, print("habbi")
'report_safe': report_safe, else:
'rewrite_header': rewrite_header, print(Result)
'required_score': required_score,
'required_hits': required_hits,
}
print(final_dic)