mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-09-12 21:07:42 +02:00
Added vulnerability in d3 mitch
This commit is contained in:
@@ -5,19 +5,41 @@ from reNgine.common_func import *
|
||||
from django.db.models import F, JSONField, Value
|
||||
|
||||
|
||||
class VisualisePortSerializer(serializers.ModelSerializer):
|
||||
class VisualiseVulnerabilitySerializer(serializers.ModelSerializer):
|
||||
|
||||
description = serializers.SerializerMethodField('get_description')
|
||||
|
||||
class Meta:
|
||||
model = Vulnerability
|
||||
fields = [
|
||||
'description',
|
||||
'http_url'
|
||||
]
|
||||
|
||||
def get_description(self, vulnerability):
|
||||
return vulnerability.name
|
||||
|
||||
|
||||
class VisualisePortSerializer(serializers.ModelSerializer):
|
||||
|
||||
description = serializers.SerializerMethodField('get_description')
|
||||
title = serializers.SerializerMethodField('get_title')
|
||||
|
||||
class Meta:
|
||||
model = Port
|
||||
fields = [
|
||||
'description'
|
||||
'description',
|
||||
'is_uncommon',
|
||||
'title',
|
||||
]
|
||||
|
||||
def get_description(self, port):
|
||||
return str(port.number) + "/" + port.service_name
|
||||
|
||||
def get_title(self, port):
|
||||
if port.is_uncommon:
|
||||
return "Uncommon Port"
|
||||
|
||||
|
||||
class VisualiseTechnologySerializer(serializers.ModelSerializer):
|
||||
|
||||
@@ -109,15 +131,91 @@ class VisualiseSubdomainSerializer(serializers.ModelSerializer):
|
||||
technologies = Technology.objects.filter(technologies__in=subdomain)
|
||||
tech_serializer = VisualiseTechnologySerializer(technologies, many=True)
|
||||
|
||||
vulnerability = Vulnerability.objects.filter(
|
||||
scan_history=self.context.get('scan_history')
|
||||
).filter(subdomain=subdomain_name)
|
||||
|
||||
return_data = []
|
||||
if ip_serializer.data:
|
||||
return_data.append({'description': 'IPs', 'children': ip_serializer.data})
|
||||
return_data.append({
|
||||
'description': 'IPs',
|
||||
'children': ip_serializer.data
|
||||
})
|
||||
if endpoint_serializer.data:
|
||||
return_data.append({'description': 'Endpoints', 'children': endpoint_serializer.data})
|
||||
return_data.append({
|
||||
'description': 'Endpoints',
|
||||
'children': endpoint_serializer.data
|
||||
})
|
||||
if tech_serializer.data:
|
||||
return_data.append({'description': 'Technologies', 'children': tech_serializer.data})
|
||||
return_data.append({
|
||||
'description': 'Technologies',
|
||||
'children': tech_serializer.data
|
||||
})
|
||||
|
||||
if vulnerability:
|
||||
vulnerability_data = []
|
||||
critical = vulnerability.filter(severity=4)
|
||||
if critical:
|
||||
critical_serializer = VisualiseVulnerabilitySerializer(
|
||||
critical,
|
||||
many=True
|
||||
)
|
||||
vulnerability_data.append({
|
||||
'description': 'Critical',
|
||||
'children': critical_serializer.data
|
||||
})
|
||||
high = vulnerability.filter(severity=3)
|
||||
if high:
|
||||
high_serializer = VisualiseVulnerabilitySerializer(
|
||||
high,
|
||||
many=True
|
||||
)
|
||||
vulnerability_data.append({
|
||||
'description': 'High',
|
||||
'children': high_serializer.data
|
||||
})
|
||||
medium = vulnerability.filter(severity=2)
|
||||
if medium:
|
||||
medium_serializer = VisualiseVulnerabilitySerializer(
|
||||
medium,
|
||||
many=True
|
||||
)
|
||||
vulnerability_data.append({
|
||||
'description': 'Medium',
|
||||
'children': medium_serializer.data
|
||||
})
|
||||
low = vulnerability.filter(severity=1)
|
||||
if low:
|
||||
low_serializer = VisualiseVulnerabilitySerializer(
|
||||
low,
|
||||
many=True
|
||||
)
|
||||
vulnerability_data.append({
|
||||
'description': 'Low',
|
||||
'children': low_serializer.data
|
||||
})
|
||||
info = vulnerability.filter(severity=0)
|
||||
if info:
|
||||
info_serializer = VisualiseVulnerabilitySerializer(
|
||||
info,
|
||||
many=True
|
||||
)
|
||||
vulnerability_data.append({
|
||||
'description': 'Informational',
|
||||
'children': info_serializer.data
|
||||
})
|
||||
|
||||
if vulnerability_data:
|
||||
return_data.append({
|
||||
'description': 'Vulnerabilities',
|
||||
'children': vulnerability_data
|
||||
})
|
||||
|
||||
if subdomain_name.screenshot_path:
|
||||
return_data.append({'description': 'Screenshot', 'screenshot_path': subdomain_name.screenshot_path})
|
||||
return_data.append({
|
||||
'description': 'Screenshot',
|
||||
'screenshot_path': subdomain_name.screenshot_path
|
||||
})
|
||||
return return_data
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ Detailed Scan
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'plugins/table/datatable/datatables.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/forms/theme-checkbox-radio.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'plugins/table/datatable/dt-global_style.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/custom.css' %}">
|
||||
<link href="{% static 'assets/css/dashboard/dash_1.css' %}" rel="stylesheet" type="text/css" />
|
||||
<link href="{% static 'assets/css/components/custom-modal.css' %}" rel="stylesheet" type="text/css" />
|
||||
<link href="{% static 'assets/css/elements/custom-tree_view.css' %}" rel="stylesheet" type="text/css" />
|
||||
@@ -24,12 +23,12 @@ Detailed Scan
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'plugins/select2/select2.min.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'plugins/gridzy/gridzy.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'plugins/gridzy/skins/gridzySkinBlank/style.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/custom.css' %}">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
|
||||
<script src="{% static 'plugins/gridzy/gridzy.js' %}"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/deltoss/d3-mitch-tree@1.0.2/dist/js/d3-mitch-tree.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'plugins/mitchtree/css/d3-mitch-tree.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'plugins/mitchtree/css/d3-mitch-tree-theme-default.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/custom.css' %}">
|
||||
{% endblock custom_js_css_link %}
|
||||
|
||||
{% block breadcrumb_title %}
|
||||
@@ -716,6 +715,11 @@ Detailed Scan Results for {{history.domain.name}}
|
||||
</div>
|
||||
<div id="visualisation" style="height: 900px; ">
|
||||
</div>
|
||||
<div class="float-right m-3">
|
||||
<small class="text-success text-right"style="display: block;">*Subdomains highlighted with green are 20X (OK) HTTP status</small>
|
||||
<small class="text-warning text-right"style="display: block;">*Subdomains highlighted with orange are 30X (Redirect) HTTP status</small>
|
||||
<small class="text-danger text-right" style="display: block;">*Subdomains highlighted with red are 40X (Not found) HTTP status</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -346,12 +346,6 @@ div.dataTables_wrapper div.dataTables_filter {
|
||||
background-color:#EEE;
|
||||
}
|
||||
|
||||
.node circle {
|
||||
fill: #fff;
|
||||
stroke: steelblue;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.node text {
|
||||
font-size:10px;
|
||||
font-family:sans-serif;
|
||||
|
||||
@@ -54,6 +54,7 @@ function visualise_scan_results(scan_id)
|
||||
}
|
||||
|
||||
updateTreeClasses(treePlugin);
|
||||
|
||||
}).fail(function(){
|
||||
$('#visualisation-loader').empty();
|
||||
$("#visualisation-loader").append(`<h5 class="text-danger">Sorry, could not visualize.</h5>`);
|
||||
@@ -66,15 +67,24 @@ function visualise_scan_results(scan_id)
|
||||
bg_class = '';
|
||||
var depthClass = "depth-" + data.depth;
|
||||
var existingClasses = this.getAttribute('class');
|
||||
if (data.data.http_status >= 400) {
|
||||
if (data.data.http_status >= 400 || data.data.is_uncommon || data.data.description == 'High') {
|
||||
bg_class = " danger-box "
|
||||
}
|
||||
else if (data.data.http_status > 200 && data.data.http_status < 400) {
|
||||
else if (data.data.http_status > 200 && data.data.http_status < 400 || data.data.description == 'Medium') {
|
||||
bg_class = " warning-box "
|
||||
}
|
||||
else if (data.data.http_status == 200) {
|
||||
bg_class = " success-box "
|
||||
}
|
||||
else if (data.data.description == 'Critical'){
|
||||
bg_class = " critical-box "
|
||||
}
|
||||
else if (data.data.description == 'Low'){
|
||||
bg_class = " low-box "
|
||||
}
|
||||
else if (data.data.description == 'Informational'){
|
||||
bg_class = " info-box "
|
||||
}
|
||||
if (!existingClasses)
|
||||
return depthClass;
|
||||
var hasDepthClassAlready = (' ' + existingClasses + ' ').indexOf(' ' + depthClass + ' ') > -1;
|
||||
|
||||
@@ -39,6 +39,21 @@
|
||||
fill: #e7515a !important;
|
||||
}
|
||||
|
||||
.critical-box .body-group .body-box{
|
||||
stroke: #AA2C00 !important;
|
||||
fill: #AA2C00 !important;
|
||||
}
|
||||
|
||||
.low-box .body-group .body-box{
|
||||
stroke: #FFD600 !important;
|
||||
fill: #FFD600 !important;
|
||||
}
|
||||
|
||||
.info-box .body-group .body-box{
|
||||
stroke: #2196f3 !important;
|
||||
fill: #2196f3 !important;
|
||||
}
|
||||
|
||||
.success-box .body-group .body-box{
|
||||
stroke: #1abc9c !important;
|
||||
fill: #1abc9c !important;
|
||||
@@ -50,7 +65,5 @@
|
||||
}
|
||||
|
||||
.title-group .d3plus-textBox text{
|
||||
font-size: 13px !important;
|
||||
font-weight: 400 !important;
|
||||
font-family: sans-serif !important;
|
||||
font-size: 10px !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user