Commit aab967fe authored by Elger Jonker's avatar Elger Jonker

bugfixes reporting: fixing several incorrect dead endpoints

Former-commit-id: 57985b70
parent 44b44650
......@@ -73,7 +73,7 @@ class UrlRatingAdmin(ImportExportModelAdmin, admin.ModelAdmin):
return format_html('<a href="../../organizations/url/{id}/change">inspect</a>',
list_display = ('url', 'high', 'medium', 'low', 'when', 'inspect_url')
list_display = ('url', 'high', 'medium', 'low', 'total_endpoints', 'when', 'inspect_url')
search_fields = (['url__organization__name', 'rating', 'high', 'medium', 'low', 'when', 'calculation'])
list_filter = ('url', 'rating', 'when')
fields = ('url', 'total_endpoints',
......@@ -508,8 +508,8 @@ def create_timeline(url: Url):
for endpoint in happenings['dead_endpoints']:
some_day =
timeline[some_day]["dead"] = True
if endpoint not in timeline[moment_date]["dead_endpoints"]:
if endpoint not in timeline[some_day]["dead_endpoints"]:
# unique endpoints only
for moment in moments:
......@@ -608,11 +608,13 @@ def rate_timeline(timeline, url: Url):
# we don't need to remove the previous ratings, unless we want to save memory (Nah :))
if "dead_endpoints" in timeline[moment]:
for dead_endpoint in timeline[moment]["dead_endpoints"]:
# endpoints can die this moment
if dead_endpoint in relevant_endpoints:
# endpoints can die this moment,
# note that this removes only once. if the endpoint was rated twice with the same rating, the older one
# is still in there. Therefore it's not an IF but a WHILE statement.
while dead_endpoint in relevant_endpoints:
# remove the endpoint from the past
if dead_endpoint in previous_endpoints:
while dead_endpoint in previous_endpoints:
endpoint_scan_types = ["Strict-Transport-Security", "X-Content-Type-Options", "X-Frame-Options",
......@@ -625,6 +627,7 @@ def rate_timeline(timeline, url: Url):
endpoint_issues_high, endpoint_issues_medium, endpoint_issues_low = 0, 0, 0
explained_endpoint_issues_high, explained_endpoint_issues_medium, explained_endpoint_issues_low = 0, 0, 0
for endpoint in relevant_endpoints:
# All endpoints of all time are iterated. The dead endpoints etc should be filtered out above.
total_endpoints += 1
url_was_once_rated = True
......@@ -736,6 +739,8 @@ def rate_timeline(timeline, url: Url):
calculations = sorted(calculations, key=lambda k: (k['high'], k['medium'], k['low']), reverse=True)
"concat": "%s/%s IPv%s" % (endpoint.protocol, endpoint.port, endpoint.ip_version),
"ip": endpoint.ip_version,
"ip_version": endpoint.ip_version,
"port": endpoint.port,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment