absolute ratings, graphs, nobegging,

parent 5cc564c1
......@@ -10,10 +10,10 @@ class OrganizationRatingAdmin(admin.ModelAdmin):
'<a href="../../organizations/organization/{id}/change">inspect organization</a>',
id=format(obj.organization_id))
list_display = ('organization', 'rating', 'when', 'inspect_organization')
search_fields = (['organization__name', 'rating', 'when', 'calculation'])
list_display = ('organization', 'rating', 'high', 'medium', 'low', 'when', 'inspect_organization')
search_fields = (['organization__name', 'rating', 'high', 'medium', 'low', 'when', 'calculation'])
list_filter = ('organization', 'rating', 'when')
fields = ('organization', 'rating', 'when', 'calculation')
fields = ('organization', 'rating', 'high', 'medium', 'low', 'when', 'calculation')
ordering = ["-when"]
......@@ -25,10 +25,10 @@ class UrlRatingAdmin(admin.ModelAdmin):
return format_html('<a href="../../organizations/url/{id}/change">inspect</a>',
id=format(obj.url_id))
list_display = ('url', 'rating', 'when', 'inspect_url')
search_fields = (['url__organization__name', 'rating', 'when', 'calculation'])
list_display = ('url', 'rating', 'high', 'medium', 'low', 'when', 'inspect_url')
search_fields = (['url__organization__name', 'rating', 'high', 'medium', 'low', 'when', 'calculation'])
list_filter = ('url', 'rating', 'when')
fields = ('url', 'rating', 'when', 'calculation')
fields = ('url', 'rating', 'high', 'medium', 'low', 'when', 'calculation')
ordering = ["-when"]
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-20 11:47+0000\n"
"POT-Creation-Date: 2017-11-29 14:12+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......@@ -21,147 +21,194 @@ msgstr ""
msgid "About Failmap"
msgstr ""
#: failmap_admin/map/templates/map/index.html:5
#: failmap_admin/map/templates/map/index.html:13
msgid "Site Title"
msgstr ""
#: failmap_admin/map/templates/map/index.html:30
#: failmap_admin/map/templates/map/index.html:52
msgid "Toggle navigation"
msgstr ""
#: failmap_admin/map/templates/map/index.html:35
#: failmap_admin/map/templates/map/index.html:53
#: failmap_admin/map/templates/map/index.html:57
#: failmap_admin/map/templates/map/index.html:89 failmap_admin/map/views.py:66
#: failmap_admin/map/views.py:67
msgid "Fail Map"
msgstr ""
#: failmap_admin/map/templates/map/index.html:39
#: failmap_admin/map/templates/map/index.html:61
msgid "Intro"
msgstr ""
#: failmap_admin/map/templates/map/index.html:40
#: failmap_admin/map/templates/map/index.html:62
msgid "Numbers"
msgstr ""
#: failmap_admin/map/templates/map/index.html:41
#: failmap_admin/map/templates/map/index.html:63
#: failmap_admin/map/templates/map/index.html:308
msgid "Graphs"
msgstr ""
#: failmap_admin/map/templates/map/index.html:64
#: failmap_admin/map/templates/map/index.html:350
msgid "Report"
msgstr ""
#: failmap_admin/map/templates/map/index.html:65
#: failmap_admin/map/templates/map/topfail.html:6
msgid "Top Fail"
msgstr ""
#: failmap_admin/map/templates/map/index.html:42
#: failmap_admin/map/templates/map/index.html:66
msgid "Explanation"
msgstr ""
#: failmap_admin/map/templates/map/index.html:54
#: failmap_admin/map/templates/map/index.html:76
msgid "Admin"
msgstr ""
#: failmap_admin/map/templates/map/index.html:90 failmap_admin/map/views.py:68
msgid "Fail Map Introduction"
msgstr ""
#: failmap_admin/map/templates/map/index.html:72
#: failmap_admin/map/templates/map/index.html:102
msgid "The Numbers"
msgstr ""
#: failmap_admin/map/templates/map/index.html:107
msgid "Organizations"
msgstr ""
#: failmap_admin/map/templates/map/index.html:73
#: failmap_admin/map/templates/map/index.html:108
msgid "Organizations Explained"
msgstr ""
#: failmap_admin/map/templates/map/index.html:93
#: failmap_admin/map/templates/map/index.html:130
#: failmap_admin/map/templates/map/index.html:111
msgid "Internet addresses"
msgstr ""
#: failmap_admin/map/templates/map/index.html:112
msgid "Internet addresses Explained"
msgstr ""
#: failmap_admin/map/templates/map/index.html:135
#: failmap_admin/map/templates/map/index.html:170
msgid "When"
msgstr ""
#: failmap_admin/map/templates/map/index.html:94
#: failmap_admin/map/templates/map/index.html:131
#: failmap_admin/map/templates/map/index.html:136
#: failmap_admin/map/templates/map/index.html:171
msgid "Number"
msgstr ""
#: failmap_admin/map/templates/map/index.html:95
#: failmap_admin/map/templates/map/index.html:132
#: failmap_admin/map/templates/map/index.html:137
#: failmap_admin/map/templates/map/index.html:172
msgid "Good"
msgstr ""
#: failmap_admin/map/templates/map/index.html:96
#: failmap_admin/map/templates/map/index.html:133
#: failmap_admin/map/templates/map/index.html:138
#: failmap_admin/map/templates/map/index.html:173
msgid "Average"
msgstr ""
#: failmap_admin/map/templates/map/index.html:97
#: failmap_admin/map/templates/map/index.html:134
#: failmap_admin/map/templates/map/index.html:139
#: failmap_admin/map/templates/map/index.html:174
msgid "Bad"
msgstr ""
#: failmap_admin/map/templates/map/index.html:114
msgid "Internet addresses"
#: failmap_admin/map/templates/map/index.html:194
msgid "Technical TLS"
msgstr ""
#: failmap_admin/map/templates/map/index.html:115
msgid "Internet addresses Explained"
#: failmap_admin/map/templates/map/index.html:195
msgid "Technical stats TLS explained"
msgstr ""
#: failmap_admin/map/templates/map/index.html:153
msgid "Technical TLS"
#: failmap_admin/map/templates/map/index.html:198
msgid "Technical stats headers"
msgstr ""
#: failmap_admin/map/templates/map/index.html:154
msgid "Technical stats TLS explained"
#: failmap_admin/map/templates/map/index.html:199
msgid "Technical stats headers explained"
msgstr ""
#: failmap_admin/map/templates/map/index.html:160
#: failmap_admin/map/templates/map/index.html:195
#: failmap_admin/map/templates/map/index.html:208
#: failmap_admin/map/templates/map/index.html:240
msgid "Technology"
msgstr ""
#: failmap_admin/map/templates/map/index.html:161
#: failmap_admin/map/templates/map/index.html:196
#: failmap_admin/map/templates/map/index.html:209
#: failmap_admin/map/templates/map/index.html:241
msgid "Result"
msgstr ""
#: failmap_admin/map/templates/map/index.html:162
#: failmap_admin/map/templates/map/index.html:197
#: failmap_admin/map/templates/map/index.html:210
#: failmap_admin/map/templates/map/index.html:242
msgid "Total"
msgstr ""
#: failmap_admin/map/templates/map/index.html:188
msgid "Technical stats headers"
#: failmap_admin/map/templates/map/index.html:267
msgid "Services"
msgstr ""
#: failmap_admin/map/templates/map/index.html:189
msgid "Technical stats headers explained"
#: failmap_admin/map/templates/map/index.html:268
msgid "Services explained"
msgstr ""
#: failmap_admin/map/templates/map/index.html:222
msgid "Services"
#: failmap_admin/map/templates/map/index.html:274
#: failmap_admin/map/templates/map/index.html:406
msgid "Service"
msgstr ""
#: failmap_admin/map/templates/map/index.html:223
msgid "Services explained"
#: failmap_admin/map/templates/map/index.html:274
msgid "Amount"
msgstr ""
#: failmap_admin/map/templates/map/index.html:235
#: failmap_admin/map/templates/map/index.html:274
msgid "Percentage"
msgstr ""
#: failmap_admin/map/templates/map/index.html:284
msgid "Services faq"
msgstr ""
#: failmap_admin/map/templates/map/index.html:261
#: failmap_admin/map/templates/map/index.html:355
msgid "Show report for organization"
msgstr ""
#: failmap_admin/map/templates/map/index.html:369
msgid "Data from"
msgstr ""
#: failmap_admin/map/templates/map/index.html:262
#: failmap_admin/map/templates/map/index.html:371
#: failmap_admin/map/templates/map/terrible_urls.html:17
#: failmap_admin/map/templates/map/topfail.html:16
#: failmap_admin/map/templates/map/topwin.html:16
msgid "Points"
#: failmap_admin/map/templates/map/topwin.html:17
msgid "High"
msgstr ""
#: failmap_admin/map/templates/map/index.html:262
msgid "congratulations"
#: failmap_admin/map/templates/map/index.html:372
#: failmap_admin/map/templates/map/terrible_urls.html:18
#: failmap_admin/map/templates/map/topfail.html:17
#: failmap_admin/map/templates/map/topwin.html:18
msgid "Medium"
msgstr ""
#: failmap_admin/map/templates/map/index.html:373
#: failmap_admin/map/templates/map/terrible_urls.html:19
#: failmap_admin/map/templates/map/topfail.html:18
#: failmap_admin/map/templates/map/topwin.html:19
msgid "Low"
msgstr ""
#: failmap_admin/map/templates/map/index.html:281
msgid "Address"
#: failmap_admin/map/templates/map/index.html:374
msgid "congratulations"
msgstr ""
#: failmap_admin/map/templates/map/index.html:285
#: failmap_admin/map/templates/map/index.html:410
msgid "Since"
msgstr ""
#: failmap_admin/map/templates/map/index.html:285
#: failmap_admin/map/templates/map/index.html:410
msgid "Last check"
msgstr ""
......@@ -187,13 +234,13 @@ msgstr ""
#: failmap_admin/map/templates/map/terrible_urls.html:14
#: failmap_admin/map/templates/map/topfail.html:14
#: failmap_admin/map/templates/map/topwin.html:14
#: failmap_admin/map/templates/map/topwin.html:15
msgid "Rank"
msgstr ""
#: failmap_admin/map/templates/map/terrible_urls.html:15
#: failmap_admin/map/templates/map/topfail.html:15
#: failmap_admin/map/templates/map/topwin.html:15
#: failmap_admin/map/templates/map/topwin.html:16
msgid "Organization"
msgstr ""
......@@ -205,8 +252,8 @@ msgstr ""
msgid "This is the top fail from"
msgstr ""
#: failmap_admin/map/templates/map/topfail.html:17
#: failmap_admin/map/templates/map/topwin.html:17
#: failmap_admin/map/templates/map/topfail.html:19
#: failmap_admin/map/templates/map/topwin.html:20
msgid "Tweet"
msgstr ""
......@@ -214,9 +261,6 @@ msgstr ""
msgid "Top Win!"
msgstr ""
#: failmap_admin/map/templates/map/topwin.html:9
#: failmap_admin/map/templates/map/topwin.html:10
msgid "This is the top win from"
msgstr ""
msgid "Report"
msgstr ""
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-27 14:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('map', '0006_auto_20171116_1451'),
]
operations = [
migrations.AddField(
model_name='organizationrating',
name='high',
field=models.IntegerField(default=0, help_text='The number of high risk vulnerabilities and failures.'),
),
migrations.AddField(
model_name='organizationrating',
name='low',
field=models.IntegerField(default=0, help_text='The number of low risk vulnerabilities and failures.'),
),
migrations.AddField(
model_name='organizationrating',
name='medium',
field=models.IntegerField(default=0, help_text='The number of medium risk vulnerabilities and failures.'),
),
migrations.AddField(
model_name='urlrating',
name='high',
field=models.IntegerField(default=0, help_text='The number of high risk vulnerabilities and failures.'),
),
migrations.AddField(
model_name='urlrating',
name='low',
field=models.IntegerField(default=0, help_text='The number of low risk vulnerabilities and failures.'),
),
migrations.AddField(
model_name='urlrating',
name='medium',
field=models.IntegerField(default=0, help_text='The number of medium risk vulnerabilities and failures.'),
),
]
......@@ -34,6 +34,10 @@ class OrganizationRating(models.Model):
" this moment. Rating -1 is used as a default first rating, which are displayed "
"in gray on the map. All next ratings are between 0 (perfect) and 2147483647."
)
high = models.IntegerField(help_text="The number of high risk vulnerabilities and failures.", default=0)
medium = models.IntegerField(help_text="The number of medium risk vulnerabilities and failures.", default=0)
low = models.IntegerField(help_text="The number of low risk vulnerabilities and failures.", default=0)
when = models.DateTimeField(db_index=True)
calculation = JSONField(
help_text="Contains JSON with a calculation of all scanners at this moment, for all urls "
......@@ -59,6 +63,11 @@ class UrlRating(models.Model):
"default value for when there are no ratings at all. Ratings can go from 0 "
"up to 2147483647."
)
high = models.IntegerField(help_text="The number of high risk vulnerabilities and failures.", default=0)
medium = models.IntegerField(help_text="The number of medium risk vulnerabilities and failures.", default=0)
low = models.IntegerField(help_text="The number of low risk vulnerabilities and failures.", default=0)
when = models.DateTimeField(db_index=True)
calculation = JSONField(
help_text="Contains JSON with a calculation of all scanners at this moment. The rating can "
......
This diff is collapsed.
......@@ -55,7 +55,7 @@ body {
}
.orange {
text-decoration: none;
text-decoration: none;
color: #FFA500;
}
......@@ -78,18 +78,20 @@ body {
/* bootstrap fixed menu terribleness... always overlaps content. */
body {
padding-top: 50px;
padding-top: 50px;
}
/* prevent dynamic content loading in the div before this element to scroll
the recently jumped anchor (report) out of view.
*/
div#report {
margin-top: 55px;
margin-top: 55px;
}
@media screen and (max-width: 768px) {
body { padding-top: 50px; }
body {
padding-top: 50px;
}
}
/* https://github.com/twbs/bootstrap/issues/1768 */
......@@ -101,7 +103,7 @@ div#report {
visibility: hidden;
}
.perurl{
.perurl {
width: 100%;
clear: both;
display: table;
......@@ -122,14 +124,13 @@ div#report {
display: inline-block;
float: left;
background-color: gainsboro;
background-image: repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255,255,255,.5) 35px, rgba(255,255,255,.5) 70px)
background-image: repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(255, 255, 255, .5) 35px, rgba(255, 255, 255, .5) 70px)
}
.servicelink {
margin-bottom: 15px;
}
.faildomain {
font-size: 23px;
}
......@@ -155,14 +156,14 @@ div#report {
padding-bottom: 20px;
}
@media (min-width: 768px){
@media (min-width: 768px) {
#lastrow .row {
width: 750px;
margin: auto;
}
}
@media (min-width: 992px){
@media (min-width: 992px) {
#lastrow .row {
width: 970px;
margin: auto;
......@@ -176,7 +177,7 @@ div#report {
}
}
.Donate{
.Donate {
border: 1px solid silver;
padding: 4px;
width: 60px;
......@@ -195,7 +196,6 @@ div#report {
color: #828578;
}
.Donate.a10 {
background-color: #EFB8BF;
}
......@@ -204,7 +204,6 @@ div#report {
color: #B65145;
}
.Donate.a20 {
background-color: #A9C7DE;
}
......@@ -213,7 +212,6 @@ div#report {
color: #5F627F;
}
.Donate.a50 {
background-color: #FACA8E;
}
......@@ -251,7 +249,7 @@ div#report {
background-color: pink;
}
.Donate.aother a:link, .Donate.aother a:visited {
.Donate.aother a:link, .Donate.aother a:visited {
color: darkgray;
}
......@@ -264,7 +262,7 @@ div#report {
margin-top: 11px;
}
.donate-content{
.donate-content {
background-color: lightgray;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
......@@ -303,7 +301,6 @@ div#report {
border-radius: 4px;
}
.total_awarded_points_orange {
border: 2px solid darkorange;
background-color: orange;
......@@ -334,7 +331,7 @@ div#report {
margin-left: 5px;
}
.fail_logo{
.fail_logo {
background-color: black;
padding: 5px;
border: 3px inset;
......@@ -355,9 +352,10 @@ div#report {
padding-bottom: 17px;
}
.git_logo img{
.git_logo img {
height: 70px;
}
.logo {
width: 100%;
text-align: center;
......@@ -403,7 +401,7 @@ div#report {
}
.navbar-default {
background-image: linear-gradient(to bottom,rgba(255,255,255,0.9) 0,rgba(255,255,255,0.8) 100%) !important;
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.9) 0, rgba(255, 255, 255, 0.8) 100%) !important;
backdrop-filter: blur(10px);
background-color: transparent !important;
}
......@@ -420,19 +418,18 @@ div#report {
color: darkred;
}
.greenrow{
.greenrow {
color: darkgreen;
}
.grayrow{
.grayrow {
color: darkgray;
}
/* awesome transition */
path {
-webkit-transition:fill 400ms;
transition:fill 400ms;
-webkit-transition: fill 400ms;
transition: fill 400ms;
}
#searchbar {
......@@ -441,12 +438,12 @@ path {
}
@keyframes dash {
to {
stroke-dashoffset: 1000;
}
to {
stroke-dashoffset: 1000;
}
}
.backtomap{
.backtomap {
float: right;
position: relative;
top: -15px;
......@@ -456,3 +453,33 @@ path {
font-size: inherit !important;
margin: 0 5px 0 0 !important;
}
/* Begin D3 JS*/
.axis path {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.axis text {
font-family: Verdana;
font-size: 13px;
}
.area {
opacity: 0.5;
shape-rendering: geometricPrecision;
}
.d3_tooltip {
border: 1px solid gray;
padding: 5px;
border-radius: 3px;
font-family: verdana;
font-size: 10px;
background: rgba(255, 255, 255, 0.5);
text-align: center;
position: absolute;
z-index: 2000;
}
/* End D3 JS */
\ No newline at end of file
This diff is collapsed.
......@@ -62,7 +62,7 @@ def update_stats():
metrics = metrics_per_url(url)
logger.info("Metrics found: %s" % len(metrics))
if metrics:
if not client.write_points(metrics):
if not client.write_points(metrics, batch_size=2500):
raise SyntaxError("Something went wrong inserting points. DB offline? Wrong syntax?")
logger.info("Done creating stats.")
......@@ -149,26 +149,27 @@ def metrics_per_url(url):
todays_metrics.append({
"measurement": "url_rating",
# removed tld: most of it will be a country tld. But we use the country field for this.
"tags": {
"ip_version": endpoint['ip'],
"port": endpoint['port'],
"protocol": endpoint['protocol'],
"scan_type": rating['type'],
"url": relevant_rating.url.url,
"subdomain": tldextract.extract(relevant_rating.url.url).subdomain,
"suffix": tldextract.extract(relevant_rating.url.url).suffix,
"organization": organization.name,
"organization_type": organization.type.name,
"country": organization.country.name,
"explanation": rating['explanation'],
"ip_version": endpoint['ip_version'], # 2
"port": endpoint['port'], # 10
"protocol": endpoint['protocol'], # 2
"scan_type": rating['type'], # 6
# "url": relevant_rating.url.url, # 4000 lower cardinality.
"subdomain": tldextract.extract(relevant_rating.url.url).subdomain, # 500
"organization": organization.name, # 400
"organization_type": organization.type.name, # 2
"country": organization.country.name, # 1
"explanation": rating['explanation'], # 10
},
"time": dt,