mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-09-17 15:27:43 +02:00
110 lines
3.6 KiB
Python
110 lines
3.6 KiB
Python
from django import forms
|
|
from scanEngine.models import EngineType
|
|
from django_ace import AceWidget
|
|
from reNgine.validators import validate_short_name
|
|
|
|
|
|
class AddEngineForm(forms.ModelForm):
|
|
class Meta:
|
|
model = EngineType
|
|
fields = '__all__'
|
|
engine_name = forms.CharField(
|
|
required=True,
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-control",
|
|
"id": "scan_engine_name",
|
|
"placeholder": "Custom Engine"}))
|
|
subdomain_discovery = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput(attrs={"checked": ""}))
|
|
dir_file_search = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput(attrs={}))
|
|
subdomain_takeover = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput(attrs={}))
|
|
port_scan = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput(attrs={"checked": ""}))
|
|
fetch_url = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput(attrs={"checked": ""}))
|
|
yaml_configuration = forms.CharField(widget=AceWidget(
|
|
mode="yaml",
|
|
theme="monokai",
|
|
width="100%",
|
|
height="450px",
|
|
tabsize=4,
|
|
fontsize=13,
|
|
toolbar=True,))
|
|
|
|
|
|
class UpdateEngineForm(forms.ModelForm):
|
|
class Meta:
|
|
model = EngineType
|
|
fields = '__all__'
|
|
engine_name = forms.CharField(
|
|
required=True,
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-control",
|
|
"id": "scan_engine_name",
|
|
"placeholder": "Custom Engine"}))
|
|
subdomain_discovery = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput())
|
|
dir_file_search = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput())
|
|
subdomain_takeover = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput())
|
|
port_scan = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput())
|
|
fetch_url = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput())
|
|
yaml_configuration = forms.CharField(widget=AceWidget(
|
|
mode="yaml",
|
|
theme="monokai",
|
|
width="100%",
|
|
height="450px",
|
|
tabsize=4,
|
|
fontsize=13,
|
|
toolbar=True,))
|
|
|
|
def set_value(self, engine):
|
|
self.initial['engine_name'] = engine.engine_name
|
|
self.initial['subdomain_discovery'] = engine.subdomain_discovery
|
|
self.initial['dir_file_search'] = engine.dir_file_search
|
|
self.initial['subdomain_takeover'] = engine.subdomain_takeover
|
|
self.initial['port_scan'] = engine.port_scan
|
|
self.initial['fetch_url'] = engine.fetch_url
|
|
self.initial['yaml_configuration'] = engine.yaml_configuration
|
|
|
|
|
|
class AddWordlistForm(forms.Form):
|
|
name = forms.CharField(
|
|
required=True,
|
|
widget=forms.TextInput(
|
|
attrs={'class': 'form-control',
|
|
'id': 'name',
|
|
'placeholder': 'my awesome wordlist', }))
|
|
short_name = forms.CharField(
|
|
required=True,
|
|
validators=[validate_short_name],
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
'class': 'form-control',
|
|
'id': 'short_name',
|
|
'placeholder': 'my_awesome_wordlist', }))
|
|
upload_file = forms.FileField(
|
|
required=True,
|
|
widget=forms.FileInput(
|
|
attrs={'class': 'custom-file-input',
|
|
'id': 'txtFile',
|
|
'multiple': '',
|
|
'accept': '.txt', }))
|