Fixed Wordlist UI

This commit is contained in:
Yogesh Ojha
2022-04-24 22:57:30 +05:30
parent c74857d98f
commit 19dce5efad
3 changed files with 55 additions and 108 deletions
@@ -6,16 +6,9 @@ Wordlist
{% endblock title %}
{% block custom_js_css_link %}
<link rel="stylesheet" type="text/css" href="{% static 'plugins/table/datatable/datatables.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'plugins/table/datatable/custom_dt_miscellaneous.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/forms/theme-checkbox-radio.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'plugins/table/datatable/dt-global_style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'plugins/table/datatable/custom_dt_custom.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" />
<link rel="stylesheet" type="text/css" href="{% static 'plugins/datatable/datatables.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'plugins/datatable/global.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'plugins/datatable/custom.css' %}">
{% endblock custom_js_css_link %}
{% block breadcrumb_title %}
@@ -23,21 +16,30 @@ Wordlist
<li class="breadcrumb-item active">All Worldlists</li>
{% endblock breadcrumb_title %}
{% block page_title %}
Add New Wordlist
{% endblock page_title %}
{% block main_content %}
<div class="statbox widget box box-shadow">
<div class="widget-header">
<div class="row" style="margin-top: 1%">
<div class="col-xl-6 col-md-6 col-sm-6 col-6">
<h4>Wordlist</h4>
</div>
<div class="col-xl-6 col-md-6 col-sm-6 col-6">
<a href="{% url 'add_wordlist' %}" class="btn btn-primary mb-2 float-right">Add New Wordlist</a>
<div class="row">
<div class="col-12">
<div class="card">
<div class="p-2">
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
<a class="btn btn-soft-primary float-end ms-1" href="{% url 'add_wordlist' %}" data-toggle="tooltip" data-placement="top" title="Add New Wordlist">Add New Wordlist</a>
</div>
</div>
</div>
</div>
</div>
<div class="widget-content widget-content-area">
<div class="table-responsive mb-4">
<table id="style-2" class="table style-2 table-hover">
</div>
<div class="row">
<div class="col-12">
<div class="card">
<table id="wordlist_table" class="table style-3 table-hover">
<thead>
<tr>
<th>Wordlist Name</th>
@@ -53,8 +55,8 @@ Wordlist
<td>{{ wordlist.short_name }}</td>
<td>{{ wordlist.count }}</td>
<td class="text-center">
<a onclick="delete_api({{ wordlist.id }}, '{{ wordlist.name }}', 'wordlist')" class="bs-tooltip btnDelWordlist" href="#" data-toggle="tooltip" data-placement="top" title="" data-original-title="Delete Wordlist">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather table-delete feather-x-circle">
<a onclick="delete_api({{ wordlist.id }}, '{{ wordlist.name }}', 'wordlist')" class="btnDelWordlist text-danger" href="#" data-toggle="tooltip" data-placement="top" title="Delete Wordlist">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather table-delete feather-x-circle">
<circle cx="12" cy="12" r="10"></circle>
<line x1="15" y1="9" x2="9" y2="15"></line>
<line x1="9" y1="9" x2="15" y2="15"></line>
@@ -72,28 +74,30 @@ Wordlist
{% block page_level_script %}
<script src="{% static 'custom/custom.js' %}"></script>
<script src="{% static 'scanEngine/js/custom_scan_engine.js' %}"></script>
<script src="{% static 'plugins/sweetalerts/sweetalert2.min.js' %}"></script>
<script src="{% static 'plugins/sweetalerts/custom-sweetalert.js' %}"></script>
<script src="{% static 'plugins/table/datatable/datatables.js' %}"></script>
<script src="{% static 'plugins/datatable/datatables.js' %}"></script>
<script src="{% static 'custom/custom.js' %}"></script>
<script src="{% static 'targetApp/js/custom_organization.js' %}"></script>
<script>
// var e;
c1 = $('#style-2').DataTable({
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
"sProcessing": "Processing... Please wait..."
},
"dom": "<'row'<'col-lg-10 col-md-10 col-12'f><'col-lg-2 col-md-2 col-12'l>>" +
"<'row'<'col'tr>>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"lengthMenu": [5, 10, 20, 50],
"pageLength": 5
$(document).ready(function() {
var wordlist_table = $('#wordlist_table').DataTable({
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center mt-sm-0 mt-3'f><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center'l>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"lengthMenu": [5, 10, 20, 50],
"pageLength": 5,
"initComplete": function(settings, json) {
$('[data-toggle="tooltip"]').tooltip();
}
});
multiCheck(wordlist_table);
});
multiCheck(c1);
</script>
{% endblock page_level_script %}
+7 -64
View File
@@ -121,13 +121,16 @@ def add_wordlist(request):
def delete_wordlist(request, id):
obj = get_object_or_404(Wordlist, id=id)
if request.method == "POST":
os.remove(
settings.TOOL_LOCATION +
obj.delete()
try:
os.remove(
'/usr/src/' +
'wordlist/' +
obj.short_name +
'.txt')
obj.delete()
responseData = {'status': 'true'}
responseData = {'status': True}
except Exception as e:
responseData = {'status': False}
messages.add_message(
request,
messages.INFO,
@@ -141,66 +144,6 @@ def delete_wordlist(request, id):
return http.JsonResponse(responseData)
def configuration_list(request):
configurations = Configuration.objects.all().order_by('id')
context = {
'configuration_nav_active':
'true', 'configurations': configurations}
return render(request, 'scanEngine/configuration/index.html', context)
def add_configuration(request):
context = {'configuration_nav_active': 'true'}
form = ConfigurationForm(request.POST or None)
if request.method == "POST":
if form.is_valid():
form.save()
messages.add_message(
request,
messages.INFO,
'Configuration added successfully')
return http.HttpResponseRedirect(reverse('configuration_list'))
context['form'] = form
return render(request, 'scanEngine/configuration/add.html', context)
def delete_configuration(request, id):
obj = get_object_or_404(Configuration, id=id)
if request.method == "POST":
obj.delete()
responseData = {'status': 'true'}
messages.add_message(
request,
messages.INFO,
'Configuration successfully deleted!')
else:
responseData = {'status': 'false'}
messages.add_message(
request,
messages.ERROR,
'Oops! Configuration could not be deleted!')
return http.JsonResponse(responseData)
def update_configuration(request, id):
configuration = get_object_or_404(Configuration, id=id)
form = ConfigurationForm()
if request.method == "POST":
form = ConfigurationForm(request.POST, instance=configuration)
if form.is_valid():
form.save()
messages.add_message(
request,
messages.INFO,
'Configuration edited successfully')
return http.HttpResponseRedirect(reverse('configuration_list'))
else:
form.set_value(configuration)
context = {
'configuration_nav_active':
'true', 'form': form}
return render(request, 'scanEngine/configuration/update.html', context)
def interesting_lookup(request):
lookup_keywords = None
context = {}
@@ -29,7 +29,7 @@ Organizations
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
<a class="btn btn-soft-success float-end ms-1" href="{% url 'add_organization' %}" data-toggle="tooltip" data-placement="top" title="Add Organization">Add New Organization</a>
<a class="btn btn-soft-primary float-end ms-1" href="{% url 'add_organization' %}" data-toggle="tooltip" data-placement="top" title="Add Organization">Add New Organization</a>
</div>
</div>
</div>