Fixed aquatone screenshot json parsing issue

This commit is contained in:
Yogesh Ojha
2021-05-25 09:12:16 +05:30
parent 969a6e9d23
commit 0d5f4b0b51
3 changed files with 16 additions and 26 deletions
+11 -15
View File
@@ -524,27 +524,23 @@ def grab_screenshot(task, yaml_configuration, results_dir, activity_id):
try:
if os.path.isfile(aqua_json_path):
logger.info('Gathering aquatone results')
with open(aqua_json_path, 'r') as json_file:
data = json.load(json_file)
for host in data['pages']:
sub_domain = Subdomain.objects.get(
try:
sub_domain = Subdomain.objects.get(
scan_history__id=task.id,
name=data['pages'][host]['hostname'])
# list_ip = data['pages'][host]['addrs']
# ip_string = ','.join(list_ip)
# sub_domain.ip_address = ip_string
sub_domain.screenshot_path = results_dir + \
'/aquascreenshots/' + data['pages'][host]['screenshotPath']
sub_domain.http_header_path = results_dir + \
'/aquascreenshots/' + data['pages'][host]['headersPath']
tech_list = []
if data['pages'][host]['tags'] is not None:
for tag in data['pages'][host]['tags']:
tech_list.append(tag['text'])
tech_string = ','.join(tech_list)
sub_domain.technology_stack = tech_string
sub_domain.save()
if data['pages'][host]['hasScreenshot']:
sub_domain.screenshot_path = results_dir + \
'/aquascreenshots/' + data['pages'][host]['screenshotPath']
sub_domain.http_header_path = results_dir + \
'/aquascreenshots/' + data['pages'][host]['headersPath']
sub_domain.save()
except Exception as e:
continue
except Exception as exception:
logging.error(exception)
update_last_activity(activity_id, 0)
+4 -10
View File
@@ -423,10 +423,11 @@ Detailed Scan Results for {{history.domain_name}}
<th>Screenshot</th>
<th>Response Time</th>
<th>Technology</th>
<th>Checked</th>
<th>HTTP URL</th>
<th>IS CDN</th>
<th>CNAME</th>
<th>Checked</th>
<th>is_interesting</th>
<th>Info</th>
<th>Low</th>
<th>Medium</th>
@@ -445,7 +446,7 @@ Detailed Scan Results for {{history.domain_name}}
<a href="/media{{subdomin.screenshot_path}}" target="_blank">
<img src="/media{{subdomin.screenshot_path}}" data-src="/media{{subdomin.screenshot_path}}" alt="{{subdomain.name}}">
<div class="x-thumbnail-content">
<p>{{subdomain.name}}</p>
<p>{{subdomain.name}}{{subdomain.screenshot_path}}</p>
</div>
</a>
<div class="x-content">
@@ -551,13 +552,6 @@ Detailed Scan Results for {{history.domain_name}}
// Collapse Sidebar
collapse_sidebar();
function fetch_http_headers(id, http_header_path, screenshot_path){
$('#screenshot'+id).attr('src', '/media/'+screenshot_path);
fetch('/media/'+http_header_path)
.then(response => response.text())
.then(text => $("#tabsModal"+id+" #txt-file-content").text(text));
}
$("#pills-subdomain-tab").click(function() {
$('#subdomain_scan_results').DataTable({
"destroy": true,
@@ -775,7 +769,7 @@ $("#pills-subdomain-tab").click(function() {
"render": function ( data, type, row ) {
if (data){
//return lightbox with caption as http link
return `<a href="/media/`+data+`" data-lightbox="screenshots" data-title="&lt;a target='_blank' href='`+row['http_url']+`'&gt;&lt;h3 style=&quot;color:white&quot;&gt;`+row['name']+`&lt;/h3&gt;&lt;/a&gt;"><img src="/media/`+data+`" class="img-fluid rounded mb-4 mt-4 screenshot" onerror="removeImageElement(this)"></a>`;
return `<a href="/media`+data+`" data-lightbox="screenshots" data-title="&lt;a target='_blank' href='`+row['http_url']+`'&gt;&lt;h3 style=&quot;color:white&quot;&gt;`+row['name']+`&lt;/h3&gt;&lt;/a&gt;"><img src="/media`+data+`" class="img-fluid rounded mb-4 mt-4 screenshot" onerror="removeImageElement(this)"></a>`;
}
return "";
},
+1 -1
View File
@@ -77,7 +77,7 @@ def detail_scan(request, id=None):
context['ip_addresses'] = IPAddress.objects.filter(scan_history=id).values_list('address', 'is_cdn').distinct().order_by()
context['ports'] = Port.objects.filter(scan_history=id).values_list('number', 'service_name', 'description', 'is_uncommon').distinct().order_by('number')
context['screenshot_subdomains'] = Subdomain.objects.filter(scan_history__id=id).exclude(screenshot_path__isnull=True,screenshot_path="")
context['screenshot_subdomains'] = Subdomain.objects.filter(scan_history__id=id).exclude(screenshot_path__isnull=True)
# badge count for gfs
if history.used_gf_patterns: