Added Discovered IP adderess Widget

This commit is contained in:
Yogesh Ojha
2021-05-13 17:12:11 +05:30
parent 0d11b25ce1
commit f87f2d2cad
4 changed files with 345 additions and 138 deletions
+122 -112
View File
@@ -157,7 +157,7 @@ Detailed Scan Results for {{history.domain_name}}
<div class="tab-pane fade show active" id="pills-summary" role="tabpanel" aria-labelledby="pills-summary-tab">
<div class="row">
<div class="col-xl-4 col-lg-6 col-md-6 col-sm-12 col-12 layout-spacing">
<div class="widget widget-five">
<div class="widget widget-five widget-progress">
<div class="widget-heading">
<a href="javascript:void(0)" class="task-info">
<div class="usr-avatar">
@@ -235,12 +235,26 @@ Detailed Scan Results for {{history.domain_name}}
</div>
</div>
</div>
<div class="col-xl-8 col-lg-6 col-md-6 col-sm-12 col-12 layout-spacing">
<div class="widget widget-ip">
<div class="widget-heading">
<h6 class="">{{discovered_ip_length}} Discovered IP Addresses</h6>
</div>
<div class="widget-content">
<div class="mt-container mx-auto">
{% for ip in ip_list %}
<span class='badge badge-info badge-pills m-1'>{{ip}}</span>
{% endfor %}
</div>
</div>
</div>
</div>
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 layout-spacing">
{% include 'base/_items/interesting_recon.html' %}
</div>
{% if new_urls.count or removed_urls.count or new_subdomains or removed_subdomains %}
<div class="col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 layout-spacing">
<div class="widget widget-activity-four">
<div class="widget widget-five">
<div class="widget-heading">
<h6 class="">Subdomain Changes</h6>
<p class='text-muted small'>
@@ -581,18 +595,28 @@ Detailed Scan Results for {{history.domain_name}}
},
{
"render": function ( data, type, row ) {
badges = '';
interesting_badge = '';
cdn_badge = '';
if (row['is_cdn'])
{
cdn_badge = "<span class='m-1 badge badge-pills badge-warning'>CDN</span>"
}
if(row['is_interesting'])
{
interesting_badge = "<span class='mb-2 badge badge-pills badge-danger'>Interesting</span></br>"
interesting_badge = "<span class='m-1 badge badge-pills badge-danger'>Interesting</span>"
}
if(cdn_badge || interesting_badge)
{
badges = cdn_badge + interesting_badge + '</br>';
}
if (row['http_url']) {
if (row['cname']) {
return interesting_badge + `<a href="`+row['http_url']+`" class="text-info" target="_blank">`+data+`</a><br><span class="text-dark">CNAME<br><span class="text-warning"> ❯ </span>` + row['cname'].replace(',', '<br><span class="text-warning"> ❯ </span>')+`</span>`;
return badges + `<a href="`+row['http_url']+`" class="text-info" target="_blank">`+data+`</a><br><span class="text-dark">CNAME<br><span class="text-warning"> ❯ </span>` + row['cname'].replace(',', '<br><span class="text-warning"> ❯ </span>')+`</span>`;
}
return interesting_badge + `<a href="`+row['http_url']+`" class="text-info" target="_blank">`+data+`</a><br>`;
return badges + `<a href="`+row['http_url']+`" class="text-info" target="_blank">`+data+`</a><br>`;
}
return interesting_badge + `<a href="https://`+data+`" class="text-info" target="_blank">`+data+`</a>`;
return badges + `<a href="https://`+data+`" class="text-info" target="_blank">`+data+`</a>`;
},
"targets": 1
},
@@ -616,11 +640,9 @@ Detailed Scan Results for {{history.domain_name}}
},
{
"render": function ( data, type, row ) {
// display badge based on http status
// green for http status 2XX, orange for 3XX and warning for everything else
if (data)
{
return span_values(data, "info");
return parse_ip(data, row['is_cdn']);
}
return "";
},
@@ -1101,114 +1123,102 @@ Detailed Scan Results for {{history.domain_name}}
});
});
</script>
<script type="text/javascript">
// span values function will seperate the values by comma and put badge around it
function span_values(data, color)
{
var badge = "<span class='badge badge-pill badge-"+color+" m-1'>";
var data_with_span ="";
data.split(/\s*,\s*/).forEach(function(split_vals) {
data_with_span+=badge + split_vals + "</span>";
});
return data_with_span;
}
// apex charts for vulnerability summary
var options = {
chart: {
type: 'donut',
width: 355
</script>
<script type="text/javascript">
// apex charts for vulnerability summary
var options = {
chart: {
type: 'donut',
width: 355
},
colors: ['#D50000', '#F44336', '#FF6D00', '#FFD600', '#2962FF'],
dataLabels: {
enabled: false
},
legend: {
position: 'bottom',
horizontalAlign: 'center',
fontSize: '14px',
markers: {
width: 10,
height: 10,
},
colors: ['#D50000', '#F44336', '#FF6D00', '#FFD600', '#2962FF'],
dataLabels: {
enabled: false
},
legend: {
position: 'bottom',
horizontalAlign: 'center',
fontSize: '14px',
markers: {
width: 10,
height: 10,
},
itemMargin: {
horizontal: 0,
vertical: 8
}
},
plotOptions: {
pie: {
donut: {
size: '65%',
background: 'transparent',
labels: {
itemMargin: {
horizontal: 0,
vertical: 8
}
},
plotOptions: {
pie: {
donut: {
size: '65%',
background: 'transparent',
labels: {
show: true,
name: {
show: true,
name: {
show: true,
fontSize: '29px',
fontFamily: 'Nunito, sans-serif',
color: undefined,
offsetY: -10
},
value: {
show: true,
fontSize: '26px',
fontFamily: 'Nunito, sans-serif',
color: '20',
offsetY: 16,
formatter: function (val) {
return val
}
},
total: {
show: true,
showAlways: true,
label: 'Total',
color: '#888ea8',
formatter: function (w) {
return w.globals.seriesTotals.reduce( function(a, b) {
return a + b
}, 0)
}
fontSize: '29px',
fontFamily: 'Nunito, sans-serif',
color: undefined,
offsetY: -10
},
value: {
show: true,
fontSize: '26px',
fontFamily: 'Nunito, sans-serif',
color: '20',
offsetY: 16,
formatter: function (val) {
return val
}
},
total: {
show: true,
showAlways: true,
label: 'Total',
color: '#888ea8',
formatter: function (w) {
return w.globals.seriesTotals.reduce( function(a, b) {
return a + b
}, 0)
}
}
}
}
},
stroke: {
show: true,
width: 25,
},
series: [{{critical_count}}, {{high_count}}, {{medium_count}}, {{low_count}}, {{info_count}}],
labels: ['Critical', 'High', 'Medium', 'Low', 'Info']
}
var chart = new ApexCharts(
document.querySelector("#vulnerability-chart"),
options
);
chart.render();
//to remove the image element if there is no screenshot captured
function removeImageElement(element)
{
element.parentElement.remove();
}
function subdomain_status_change(checkbox, id)
{
if (checkbox.checked) {
checkbox.parentNode.parentNode.parentNode.className = "table-secondary text-strike";
}
else {
checkbox.parentNode.parentNode.parentNode.classList.remove("table-secondary");
checkbox.parentNode.parentNode.parentNode.classList.remove("text-strike");
}
change_subdomain_status(id);
}
},
stroke: {
show: true,
width: 25,
},
series: [{{critical_count}}, {{high_count}}, {{medium_count}}, {{low_count}}, {{info_count}}],
labels: ['Critical', 'High', 'Medium', 'Low', 'Info']
}
</script>
{% endblock page_level_script %}
var chart = new ApexCharts(
document.querySelector("#vulnerability-chart"),
options
);
chart.render();
//to remove the image element if there is no screenshot captured
function removeImageElement(element)
{
element.parentElement.remove();
}
function subdomain_status_change(checkbox, id)
{
if (checkbox.checked) {
checkbox.parentNode.parentNode.parentNode.className = "table-secondary text-strike";
}
else {
checkbox.parentNode.parentNode.parentNode.classList.remove("table-secondary");
checkbox.parentNode.parentNode.parentNode.classList.remove("text-strike");
}
change_subdomain_status(id);
}
</script>
{% endblock page_level_script %}
+8
View File
@@ -1,5 +1,6 @@
import os
import requests
import itertools
from datetime import datetime
@@ -114,6 +115,13 @@ def detail_scan(request, id=None):
context['removed_urls'] = endpoint_q2.difference(endpoint_q1)
context['last_scan_endpoint'] = last_scan
ip_addresses = Subdomain.objects.filter(scan_history=id).values('ip_addresses').distinct()
if ip_addresses:
ip_list = [ip['ip_addresses'].split(',') for ip in ip_addresses if ip['ip_addresses'] is not None]
ip_list = list(set(list(itertools.chain(*ip_list))))
context['ip_list'] = ip_list
context['discovered_ip_length'] = len(ip_list)
return render(request, 'startScan/detail_scan.html', context)
+162
View File
@@ -278,3 +278,165 @@ div.dataTables_wrapper div.dataTables_filter {
width: 22px;
border-radius: 50%;
}
.widget.widget-ip {
position: relative;
background: #fff;
border-radius: 6px;
height: 250px;
padding: 0; }
.widget.widget-ip .widget-heading {
display: flex;
justify-content: space-between;
border-bottom: 1px dashed #e0e6ed;
padding: 20px 20px;
padding-bottom: 20px;
margin-bottom: 0; }
.widget.widget-ip .widget-heading h5 {
font-size: 17px;
display: block;
color: #0e1726;
font-weight: 600;
margin-bottom: 0; }
.widget.widget-ip .widget-heading .task-action svg {
color: #888ea8;
width: 19px;
height: 19px; }
.widget.widget-ip .widget-heading .task-action .dropdown-menu {
transform: translate3d(-141px, 0, 0px); }
/*
=====================
Unique Visitors
=====================
*/
/*
=========================
Organic Vs Direct
=========================
*/
/*
========================
Recent Activities
========================
*/
.widget-ip .widget-content {
padding: 12px 10px 21px 20px; }
.widget-ip .w-shadow-top {
display: block;
position: absolute;
z-index: 2;
height: 17px;
width: 97%;
pointer-events: none;
margin-top: -10px;
left: 2px;
-webkit-filter: blur(9px);
filter: blur(9px);
background: -webkit-linear-gradient(180deg, #060818 44%, #060818eb 73%, #2C303C00);
background: linear-gradient(180deg, #ffffff 44%, #ffffffde 73%, #2C303C00); }
.widget-ip .w-shadow-bottom {
display: block;
position: absolute;
z-index: 2;
height: 17px;
width: 97%;
pointer-events: none;
margin-top: -3px;
left: 2px;
-webkit-filter: blur(9px);
filter: blur(9px);
background: -webkit-linear-gradient(180deg, #ffffff 44%, #ffffffde 73%, #2C303C00);
background: linear-gradient(180deg, #ffffff 44%, #ffffffde 73%, #2C303C00); }
.widget-ip .mt-container {
position: relative;
height: 170px;
overflow: auto;
padding: 15px 12px 0 12px; }
.widget-ip .timeline-line .item-timeline {
display: flex;
margin-bottom: 35px; }
.widget-ip .timeline-line .item-timeline .t-dot {
position: relative; }
.widget-ip .timeline-line .item-timeline .t-dot div {
background: transparent;
border-radius: 50%;
padding: 5px;
margin-right: 11px;
display: flex;
height: 32px;
justify-content: center;
width: 32px; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-primary {
background-color: #c2d5ff; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-primary svg {
color: #4361ee; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-secondary {
background-color: #dccff7; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-secondary svg {
color: #805dca; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-success {
background-color: #c7e6e4; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-success svg {
color: #009688; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-danger {
background-color: #ffe1e2; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-danger svg {
color: #e7515a; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-warning {
background-color: #ffeccb; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-warning svg {
color: #e2a03f; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-dark {
background-color: #acb0c3; }
.widget-ip .timeline-line .item-timeline .t-dot div.t-dark svg {
color: #3b3f5c; }
.widget-ip .timeline-line .item-timeline .t-dot svg {
color: #fff;
height: 15px;
width: 15px;
align-self: center; }
.widget-ip .timeline-line .item-timeline .t-content {
width: 100%; }
.widget-ip .timeline-line .item-timeline .t-content .t-uppercontent {
display: flex;
justify-content: space-between; }
.widget-ip .timeline-line .item-timeline .t-content .t-uppercontent h5 {
font-size: 14px;
letter-spacing: 0;
font-weight: 600;
margin-bottom: 0; }
.widget-ip .timeline-line .item-timeline .t-content .t-uppercontent span {
margin-bottom: 0;
font-size: 13px;
font-weight: 600;
color: #009688; }
.widget-ip .timeline-line .item-timeline .t-content p {
margin-bottom: 0;
font-size: 12px;
font-weight: 600;
color: #888ea8; }
.widget-ip .timeline-line .item-timeline .t-content p a {
font-weight: 700; }
.widget-ip .timeline-line .item-timeline .t-dot:after {
content: '';
position: absolute;
border-width: 1px;
border-style: solid;
left: 39%;
transform: translateX(-50%);
border-color: #bfc9d4;
width: 0;
height: auto;
top: 45px;
bottom: -23px;
border-right-width: 0;
border-top-width: 0;
border-bottom-width: 0;
border-radius: 0; }
.widget-ip .timeline-line .item-timeline:last-child .t-dot:after {
display: none; }
+53 -26
View File
@@ -131,42 +131,42 @@ function vuln_status_change(checkbox, id)
// truncate the long string and put ... in the end
function truncate(source, size) {
return source.length > size ? source.slice(0, size - 1) + "…" : source;
return source.length > size ? source.slice(0, size - 1) + "…" : source;
}
// splits really long strings into multiple lines
// Souce: https://stackoverflow.com/a/52395960
function split(str, maxWidth) {
const newLineStr = "</br>";
done = false;
res = '';
do {
found = false;
// Inserts new line at first whitespace of the line
for (i = maxWidth - 1; i >= 0; i--) {
if (testWhite(str.charAt(i))) {
res = res + [str.slice(0, i), newLineStr].join('');
str = str.slice(i + 1);
found = true;
break;
}
}
// Inserts new line at maxWidth position, the word is too long to wrap
if (!found) {
res += [str.slice(0, maxWidth), newLineStr].join('');
str = str.slice(maxWidth);
}
const newLineStr = "</br>";
done = false;
res = '';
do {
found = false;
// Inserts new line at first whitespace of the line
for (i = maxWidth - 1; i >= 0; i--) {
if (testWhite(str.charAt(i))) {
res = res + [str.slice(0, i), newLineStr].join('');
str = str.slice(i + 1);
found = true;
break;
}
}
// Inserts new line at maxWidth position, the word is too long to wrap
if (!found) {
res += [str.slice(0, maxWidth), newLineStr].join('');
str = str.slice(maxWidth);
}
if (str.length < maxWidth)
done = true;
} while (!done);
if (str.length < maxWidth)
done = true;
} while (!done);
return res + str;
return res + str;
}
function testWhite(x) {
const white = new RegExp(/^\s$/);
return white.test(x.charAt(0));
const white = new RegExp(/^\s$/);
return white.test(x.charAt(0));
};
@@ -180,3 +180,30 @@ function get_response_time_text(response_time){
}
return `<span class="text-${text_color}">${response_time.toFixed(4)}s</span>`;
}
// span values function will seperate the values by comma and put badge around it
function span_values(data, color)
{
var badge = `<span class='badge badge-pill badge-`+color+` m-1 bs-tooltip' title="Ok">`;
var data_with_span ="";
data.split(/\s*,\s*/).forEach(function(split_vals) {
data_with_span+=badge + split_vals + "</span>";
});
return data_with_span;
}
// span values function will seperate the values by comma and put badge around it
function parse_ip(data, cdn){
if (cdn)
{
var badge = `<span class='badge badge-pill badge-warning m-1 bs-tooltip' title="CDN IP Address">`;
}
else{
var badge = `<span class='badge badge-pill badge-info m-1'>`;
}
var data_with_span ="";
data.split(/\s*,\s*/).forEach(function(split_vals) {
data_with_span+=badge + split_vals + "</span>";
});
return data_with_span;
}