Alert for no custom engines

This commit is contained in:
Yogesh Ojha
2020-07-07 13:42:48 +05:30
parent e8fc46563a
commit b84cd68a67
2 changed files with 21 additions and 30 deletions
@@ -9,13 +9,7 @@ Start Scan
{% block custom_js_css_link %}>
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/custom.css' %}">
<link href="{% static 'assets/css/components/custom-list-group.css' %}" rel="stylesheet" type="text/css">
<script src="{% static 'plugins/sweetalerts/promise-polyfill.js' %}"></script>
<link href="{% static 'plugins/sweetalerts/sweetalert2.min.css' %}" rel="stylesheet" type="text/css" />
<link href="{% static 'plugins/sweetalerts/sweetalert.css' %}" rel="stylesheet" type="text/css" />
<link href="{% static 'assets/css/components/custom-sweetalert.css' %}" rel="stylesheet" type="text/css" />
<link href="{% static 'assets/css/components/custom-modal.css' %}" rel="stylesheet" type="text/css" />
<script src="{% static 'plugins/sweetalerts/sweetalert2.min.js' %}"></script>
<script src="{% static 'plugins/sweetalerts/custom-sweetalert.js' %}"></script>
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/elements/alert.css' %}">
{% endblock custom_js_css_link %}
{% block breadcrumb_title %}
@@ -33,32 +27,29 @@ Start Scan for {{domain.domain_name}}
</div>
</div>
<div class="widget-content widget-content-area">
{% if engines.count == 0 %}
<script type="text/javascript">
swal({
title: 'Oops looks like you haven\'t defined any scan engines yet.',
text: "Please, define some engine before running any scans.",
type: 'info',
showCancelButton: true,
confirmButtonText: 'Sure',
padding: '2em',
showLoaderOnConfirm: true,
cancelButtonText: 'Cancel'
}).then(function(result){
if (result.value) {
location.href='/scanEngine/';
}
else {
location.href='/target/list/';
}
});
</script>
{% else %}
<form method="POST">
{% csrf_token %}
<div class="form-row">
<div class="col-md-12 mb-4">
<h6>Select the scan type</h6>
{% if custom_engine_count == 0 %}
<div class="alert custom-alert-1 mb-4" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" data-dismiss="alert" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x close"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></button>
<div class="media">
<div class="alert-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bell"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>
</div>
<div class="media-body">
<div class="alert-text">
<span><b>Tips! </b>You don't have any custom engines! Did you know you can create your own scan engine?</span>
</div>
<div class="alert-btn">
<a href="{% url 'add_engine' %}" class="btn btn-default btn-dismiss">Create Engine</a>
</div>
</div>
</div>
</div>
{% endif %}
<ul class="list-group task-list-group">
{% for engine in engines.all %}
<li class="list-group-item list-group-item-action">
@@ -150,7 +141,6 @@ Start Scan for {{domain.domain_name}}
</svg> Start Scan</button>
</div>
</form>
{% endif %}
</div>
</div>
</div>
+2 -1
View File
@@ -58,7 +58,8 @@ def start_scan_ui(request, host_id):
messages.add_message(request, messages.INFO, 'Scan Started for ' + domain.domain_name)
return HttpResponseRedirect(reverse('scan_history'))
engine = EngineType.objects
context = {'scan_history_active': 'true', 'domain': domain, 'engines': engine}
custom_engine_count = EngineType.objects.filter(default_engine=False).count()
context = {'scan_history_active': 'true', 'domain': domain, 'engines': engine, 'custom_engine_count': custom_engine_count}
return render(request, 'startScan/start_scan_ui.html', context)
def doScan(host_id, domain):