mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-09-18 07:47:42 +02:00
json parsed and saved to dn
This commit is contained in:
+19
-2
@@ -13,7 +13,6 @@ import requests
|
||||
import json
|
||||
import os
|
||||
|
||||
|
||||
def index(request):
|
||||
return render(request, 'startScan/index.html')
|
||||
|
||||
@@ -69,7 +68,7 @@ def doScan(id, domain):
|
||||
with open(scan_results_file) as subdomain_list:
|
||||
for subdomain in subdomain_list:
|
||||
scanned = ScannedHost()
|
||||
scanned.subdomain = subdomain
|
||||
scanned.subdomain = subdomain.rstrip('\n')
|
||||
scanned.scan_history = task
|
||||
scanned.takeover_possible = False
|
||||
scanned.save()
|
||||
@@ -79,6 +78,24 @@ def doScan(id, domain):
|
||||
aquatone_command = 'cat {} | /app/tools/aquatone -ports xlarge -out {}'.format(with_protocol_path, output_aquatone_path)
|
||||
os.system(aquatone_command)
|
||||
|
||||
aqua_json_path = output_aquatone_path + '/aquatone_session.json'
|
||||
with open(aqua_json_path, 'r') as json_file:
|
||||
data = json.load(json_file)
|
||||
subdomain_details = ScannedHost.objects.filter(scan_history__id=id)
|
||||
|
||||
# should be a better way for this
|
||||
for sub in subdomain_details:
|
||||
for host in data['pages']:
|
||||
if sub.subdomain == data['pages'][host]['hostname']:
|
||||
subdomain_proto = ScannedSubdomainWithProtocols()
|
||||
subdomain_proto.host = sub
|
||||
subdomain_proto.url = data['pages'][host]['url']
|
||||
subdomain_proto.ip_address = data['pages'][host]['addrs']
|
||||
subdomain_proto.page_title = data['pages'][host]['pageTitle']
|
||||
subdomain_proto.http_status = data['pages'][host]['status'][0:3]
|
||||
subdomain_proto.technology_stack = 'fake'
|
||||
subdomain_proto.save()
|
||||
|
||||
task.scan_status = 2
|
||||
task.save()
|
||||
# notify on slack
|
||||
|
||||
Reference in New Issue
Block a user