Fixed Add Wordlist UI

This commit is contained in:
Yogesh Ojha
2022-04-24 22:57:30 +05:30
parent 0c00b55672
commit 5a135fddab
3 changed files with 46 additions and 48 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ class AddWordlistForm(forms.Form):
upload_file = forms.FileField(
required=True,
widget=forms.FileInput(
attrs={'class': 'custom-file-input',
attrs={'class': 'form-control',
'id': 'txtFile',
'multiple': '',
'accept': '.txt', }))
@@ -1,41 +0,0 @@
<div class="col-lg-12 layout-spacing">
<div class="statbox widget box box-shadow">
<div class="widget-header">
<div class="row">
<div class="col-12">
<h4>{{widget_title}}</h4>
</div>
</div>
</div>
<div class="widget-content widget-content-area">
<form class="simple-example" method="POST" enctype="multipart/form-data">
{% csrf_token %}
<div class="form-row">
<div class="col-md-6 mb-4">
<label for="name">Wordlist Name</label>
{{ form.name }}
</div>
<div class="col-md-6 mb-4">
<label for="short_name">Short Name</label>
{{ form.short_name }}
{% if form.errors.short_name %}
<div class="invalid-feedback" style="display: block;">
{{ form.errors.short_name|striptags }}
</div>
{% endif %}
<p class="text-warning mt-2">Please keep the short names without spaces, like my-wordlist or my_wordlist. The short names will be later used to reference wordlist in the YAML settings.</p>
</div>
<div>
<p>Select the wordlist file</p>
<p class="text-warning">Your wordlist must be in the *.txt file format and must be seperated by new line.</p>
</div>
<div class="custom-file mb-4">
{{ form.upload_file }}
<label class="custom-file-label" for="txtFile">Choose *.txt file</label>
</div>
</div>
<button class="btn btn-primary submit-fn mt-2 float-right" type="submit">{{button_title}}</button>
</form>
</div>
</div>
</div>
@@ -14,25 +14,64 @@ Add New Wordlist
<li class="breadcrumb-item active">Add Worldlist</li>
{% endblock breadcrumb_title %}
{% block page_title %}
Add New Wordlist for Bruteforce
{% endblock page_title %}
{% block main_content %}
{% include 'scanEngine/wordlist/_items/add_form.html' with button_title="Upload Wordlist" widget_title="Add new wordlist" form_action="add" %}
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<p>Wordlist can be used for directory bruteforce or subdomain bruteforce. Instructions on how to use the wordlist are <a href="https://rengine.wiki/usage/wordlist/">found here <i class="fe-external-link"></i></a></p>
<form class="simple-example" method="POST" enctype="multipart/form-data">
{% csrf_token %}
<div class="row">
<div class="col-6">
<label for="name" class="form-label">Wordlist Name</label>
{{ form.name }}
</div>
<div class="col-6">
<label for="short_name" class="form-label">Short Name</label>
{{ form.short_name }}
{% if form.errors.short_name %}
<div class="invalid-feedback" style="display: block;">
{{ form.errors.short_name|striptags }}
</div>
{% endif %}
<p class="text-primary mt-1">Please keep the short names without spaces, like my-wordlist or my_wordlist. The short names will be later used to reference wordlist in the YAML settings.</p>
</div>
<div>
<h4 class="header-title">Select the wordlist file</h4>
<p class="text-primary">Your wordlist must be a *.txt file and wordlists must seperated by new line.</p>
</div>
<div class="custom-file mb-4">
<label class="form-label" for="txtFile">Choose *.txt file</label>
{{ form.upload_file }}
</div>
</div>
<button class="btn btn-primary submit-fn mt-2 float-end" type="submit">Upload Wordlist</button>
</form>
</div>
</div>
</div>
</div>
{% endblock main_content %}
{% block page_level_script %}
<script src="{% static 'assets/js/scrollspyNav.js' %}"></script>
<script type="text/javascript">
var input = document.getElementById("name");
var shortName = document.getElementById("short_name");
input.addEventListener("input", function() {
inputValue = document.getElementById("name").value;
shortName.value = inputValue.replace(/[^a-zA-Z0-9]/g,'_').toLowerCase();;
inputValue = document.getElementById("name").value;
shortName.value = inputValue.replace(/[^a-zA-Z0-9]/g,'_').toLowerCase();;
});
shortName.addEventListener("input", function() {
inputValue = document.getElementById("short_name").value;
shortName.value = inputValue.replace(/[^a-zA-Z0-9]/g,'_').toLowerCase();;
inputValue = document.getElementById("short_name").value;
shortName.value = inputValue.replace(/[^a-zA-Z0-9]/g,'_').toLowerCase();;
});