Lookup title added

This commit is contained in:
Yogesh Ojha
2021-04-25 23:44:11 +05:30
parent 21f1780e3a
commit 71ccb7b5b0
4 changed files with 54 additions and 12 deletions
+23 -11
View File
@@ -28,20 +28,32 @@ def get_interesting_subdomains(scan_history=None, target=None):
page_title_lookup_query = Q()
for key in lookup_keywords:
subdomain_lookup_query |= Q(subdomain__icontains=key)
page_title_lookup_query |= Q(page_title__iregex="\\y{}\\y".format(key))
if InterestingLookupModel.objects.filter(custom_type=True):
if InterestingLookupModel.objects.filter(custom_type=True).order_by('-id')[0].url_lookup:
subdomain_lookup_query |= Q(subdomain__icontains=key)
if InterestingLookupModel.objects.filter(custom_type=True).order_by('-id')[0].title_lookup:
page_title_lookup_query |= Q(page_title__iregex="\\y{}\\y".format(key))
else:
subdomain_lookup_query |= Q(subdomain__icontains=key)
page_title_lookup_query |= Q(page_title__iregex="\\y{}\\y".format(key))
subdomain_lookup = ScannedHost.objects.none()
title_lookup = ScannedHost.objects.none()
if target:
subdomain_lookup = ScannedHost.objects.filter(
target_domain__id=target).filter(subdomain_lookup_query).distinct('subdomain')
title_lookup = ScannedHost.objects.filter(page_title_lookup_query).filter(
target_domain__id=target).distinct('subdomain')
if subdomain_lookup_query:
subdomain_lookup = ScannedHost.objects.filter(
target_domain__id=target).filter(subdomain_lookup_query).distinct('subdomain')
if page_title_lookup_query:
title_lookup = ScannedHost.objects.filter(page_title_lookup_query).filter(
target_domain__id=target).distinct('subdomain')
elif scan_history:
subdomain_lookup = ScannedHost.objects.filter(
scan_history__id=scan_history).filter(subdomain_lookup_query)
title_lookup = ScannedHost.objects.filter(
scan_history__id=scan_history).filter(page_title_lookup_query)
if subdomain_lookup_query:
subdomain_lookup = ScannedHost.objects.filter(
scan_history__id=scan_history).filter(subdomain_lookup_query)
if page_title_lookup_query:
title_lookup = ScannedHost.objects.filter(
scan_history__id=scan_history).filter(page_title_lookup_query)
return subdomain_lookup | title_lookup
+16
View File
@@ -178,5 +178,21 @@ class InterestingLookupForm(forms.ModelForm):
"value": 'true'
}))
title_lookup = forms.BooleanField(
required=False,
widget=forms.CheckboxInput(
attrs={
"class": "new-control-input",
}))
url_lookup = forms.BooleanField(
required=False,
widget=forms.CheckboxInput(
attrs={
"class": "new-control-input",
}))
def set_value(self, key):
self.initial['keywords'] = key.keywords
self.initial['title_lookup'] = key.title_lookup
self.initial['url_lookup'] = key.url_lookup
+2
View File
@@ -45,3 +45,5 @@ class Configuration(models.Model):
class InterestingLookupModel(models.Model):
keywords = models.TextField(null=True, blank=True)
custom_type = models.BooleanField(default=False)
title_lookup = models.BooleanField(default=True)
url_lookup = models.BooleanField(default=True)
+13 -1
View File
@@ -7,6 +7,7 @@ Interesting entries Lookup
{% block custom_js_css_link %}
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/forms/theme-checkbox-radio.css' %}">
{% endblock custom_js_css_link %}
{% block breadcrumb_title %}
@@ -48,7 +49,18 @@ Interesting entries lookup
{{ form.custom_type }}
<span class="text-danger"><b>Press comma , to add and separate the keywords</b></span>
<br>
<button class="btn btn-primary submit-fn mt-2 float-right" type="submit">Update Keywords</button>
<h6 class="mt-2">Lookup in</h6>
<div class="n-chk">
<label class="new-control new-checkbox checkbox-primary">
{{form.url_lookup}}
<span class="new-control-indicator"></span><span class="text-dark">Subdomains/URLs</span>
</label>
<label class="new-control new-checkbox checkbox-primary">
{{form.title_lookup}}
<span class="new-control-indicator"></span><span class="text-dark">Page Title</span>
</label>
</div>
<button class="btn btn-primary submit-fn mt-2 float-right" type="submit">Update Lookup</button>
</form>
</div>
</div>