mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-09-26 11:44:52 +02:00
scan activity completed
This commit is contained in:
@@ -40,9 +40,9 @@ Scan history
|
||||
<div class="t-text">
|
||||
<b>{{activity.title}}</b>
|
||||
<span class="badge {% if activity.status == 0 %}badge-success {% elif activity.status == 1 %}badge-warning{% elif activity.status == 2 %}badge-success{% endif %}">
|
||||
{% if activity.status == 0 %}Failed
|
||||
{% elif activity.status == 1 %}Inprogress
|
||||
{% elif activity.status == 2 %}Finised
|
||||
{% if activity.status == 0 %} Failed
|
||||
{% elif activity.status == 1 %} In progress
|
||||
{% elif activity.status == 2 %} Completed
|
||||
{% endif %}
|
||||
</span>
|
||||
<p class="t-time">{{activity.time}}</p>
|
||||
|
||||
+30
-8
@@ -56,12 +56,7 @@ def start_scan_ui(request, id):
|
||||
|
||||
def doScan(id, domain):
|
||||
task = ScanHistory.objects.get(pk=id)
|
||||
scan_activity = ScanActivity()
|
||||
scan_activity.scan_of = task
|
||||
scan_activity.title = "Scan Started for " + domain.domain_name
|
||||
scan_activity.time = dateformat.format(timezone.now(), 'M d H:i')
|
||||
scan_activity.status = 2
|
||||
scan_activity.save()
|
||||
save_scan_activity(task, "Scanning Started", 2)
|
||||
|
||||
notif_hook = NotificationHooks.objects.filter(send_notif=True)
|
||||
results_dir = '/app/tools/scan_results/'
|
||||
@@ -72,7 +67,9 @@ def doScan(id, domain):
|
||||
except:
|
||||
# do something here
|
||||
print("Oops!")
|
||||
# all scan happens here
|
||||
|
||||
save_scan_activity(task, "Subdomain Scanning", 1)
|
||||
# all subdomain scan happens here
|
||||
os.system('/app/tools/get_subdomain.sh %s %s' %(domain.domain_name, current_scan_dir))
|
||||
|
||||
subdomain_scan_results_file = results_dir + current_scan_dir + '/sorted_subdomain_collection.txt'
|
||||
@@ -84,6 +81,9 @@ def doScan(id, domain):
|
||||
scanned.scan_history = task
|
||||
scanned.save()
|
||||
|
||||
update_last_activity()
|
||||
save_scan_activity(task, "Port Scanning", 1)
|
||||
|
||||
# after all subdomain has been discovered run naabu to discover the ports
|
||||
port_results_file = results_dir + current_scan_dir + '/ports.json'
|
||||
|
||||
@@ -110,6 +110,8 @@ def doScan(id, domain):
|
||||
except:
|
||||
print('Port File doesnt exist')
|
||||
|
||||
update_last_activity()
|
||||
save_scan_activity(task, "HTTP Crawler", 1)
|
||||
|
||||
# once port scan is complete then run httpx, this has to run in background thread later
|
||||
httpx_results_file = results_dir + current_scan_dir + '/httpx.json'
|
||||
@@ -136,6 +138,9 @@ def doScan(id, domain):
|
||||
sub_domain.save()
|
||||
alive_file.close()
|
||||
|
||||
update_last_activity()
|
||||
save_scan_activity(task, "Visual Recon - Screenshot", 1)
|
||||
|
||||
# after subdomain discovery run aquatone for visual identification
|
||||
with_protocol_path = results_dir + current_scan_dir + '/alive.txt'
|
||||
output_aquatone_path = results_dir + current_scan_dir + '/aquascreenshots/'
|
||||
@@ -163,12 +168,29 @@ def doScan(id, domain):
|
||||
|
||||
task.scan_status = 2
|
||||
task.save()
|
||||
|
||||
# notify on slack
|
||||
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)
|
||||
|
||||
update_last_activity()
|
||||
save_scan_activity(task, "Scan Completed", 2)
|
||||
|
||||
def checkScanStatus(request, id):
|
||||
task = Crawl.objects.get(pk=id)
|
||||
return JsonResponse({'is_done':task.is_done, result:task.result})
|
||||
|
||||
def save_scan_activity(task, message, status):
|
||||
scan_activity = ScanActivity()
|
||||
scan_activity.scan_of = task
|
||||
scan_activity.title = message
|
||||
scan_activity.time = dateformat.format(timezone.now(), 'M d H:i')
|
||||
scan_activity.status = status
|
||||
scan_activity.save()
|
||||
|
||||
def update_last_activity():
|
||||
#save the last activity as successful
|
||||
last_activity = ScanActivity.objects.latest('id')
|
||||
last_activity.status = 2
|
||||
last_activity.save()
|
||||
|
||||
Reference in New Issue
Block a user