diff --git a/notification/admin.py b/notification/admin.py
index 8c38f3f3..6a9724a6 100644
--- a/notification/admin.py
+++ b/notification/admin.py
@@ -1,3 +1,4 @@
from django.contrib import admin
-
+from .models import NotificationHooks
# Register your models here.
+admin.site.register(NotificationHooks)
diff --git a/notification/migrations/0001_initial.py b/notification/migrations/0001_initial.py
new file mode 100644
index 00000000..17d5fe2b
--- /dev/null
+++ b/notification/migrations/0001_initial.py
@@ -0,0 +1,23 @@
+# Generated by Django 3.0.6 on 2020-05-22 03:59
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='NotificationHooks',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('hook_name', models.CharField(max_length=200)),
+ ('hook_url', models.CharField(max_length=500)),
+ ('send_notif', models.BooleanField()),
+ ],
+ ),
+ ]
diff --git a/notification/models.py b/notification/models.py
index 71a83623..45f3e0c6 100644
--- a/notification/models.py
+++ b/notification/models.py
@@ -1,3 +1,9 @@
from django.db import models
-# Create your models here.
+class NotificationHooks(models.Model):
+ hook_name = models.CharField(max_length=200)
+ hook_url = models.CharField(max_length=500)
+ send_notif = models.BooleanField()
+
+ def __str__(self):
+ return self.hook_name
diff --git a/notification/templates/notification/index.html b/notification/templates/notification/index.html
index 63f4f8fa..9a57b673 100644
--- a/notification/templates/notification/index.html
+++ b/notification/templates/notification/index.html
@@ -43,15 +43,13 @@ Push Notifications
- {% for domain in domains.all %}
+ {% for hook in all_hooks.all %}
- | {{ domain.id }} |
- {{ domain.domain_name }} |
- {{ domain.domain_description }} |
- {{ domain.insert_date }} |
- Never Scanned Before |
+ {{ hook.id }} |
+ {{ hook.hook_name }} |
+ {{ hook.hook_url }} |
-
+
diff --git a/notification/views.py b/notification/views.py
index 00ae11a4..f2f0b618 100644
--- a/notification/views.py
+++ b/notification/views.py
@@ -1,6 +1,7 @@
from django.shortcuts import render
-
+from .models import NotificationHooks
def index(request):
- context = {'notification_nav_active': 'true'}
+ notification_hooks = NotificationHooks.objects
+ context = {'notification_nav_active': 'true', 'all_hooks': notification_hooks}
return render(request, 'notification/index.html', context)
diff --git a/startScan/views.py b/startScan/views.py
index ff50cbe3..8f5eb7c6 100644
--- a/startScan/views.py
+++ b/startScan/views.py
@@ -3,12 +3,14 @@ from django.contrib import messages
from django.http import JsonResponse, HttpResponseRedirect
from django.urls import reverse
from .models import ScanHistory, ScannedSubdomains
+from notification.models import NotificationHooks
from targetApp.models import Domain
from scanEngine.models import EngineType
import threading
from . import sublist3r
from django.utils import timezone
-
+import requests
+import json
def index(request):
return render(request, 'startScan/index.html')
@@ -46,6 +48,7 @@ def start_scan_ui(request, id):
def doScan(id, domain):
task = ScanHistory.objects.get(pk=id)
+ notif_hook = NotificationHooks.objects.filter(send_notif=True)
subdomains = sublist3r.main(domain.domain_name, 40, False, ports= None, silent=False, verbose= False, enable_bruteforce= False, engines=None)
for subdomain in subdomains:
scanned = ScannedSubdomains()
@@ -59,6 +62,10 @@ def doScan(id, domain):
scanned.save()
task.scan_status = 2
task.save()
+ scan_status_msg = {'text': "reEngine finished scanning " + domain.domain_name}
+ headers = {'content-type': 'application/json'}
+ for notif in notif_hook:
+ requests.post(notif.hook_url, data=json.dumps(scan_status_msg), headers=headers)
def checkScanStatus(request, id):
task = Crawl.objects.get(pk=id)
|