diff --git a/web/reNgine/tasks.py b/web/reNgine/tasks.py index 26aa7d6f..8b248f1d 100644 --- a/web/reNgine/tasks.py +++ b/web/reNgine/tasks.py @@ -869,7 +869,6 @@ def http_crawler(task, domain, yaml_configuration, results_dir, activity_id, thr # add geo iso subprocess_output = subprocess.getoutput(['geoiplookup {}'.format(_ip)]) if 'IP Address not found' not in subprocess_output and "can't resolve hostname" not in subprocess_output: - print(subprocess_output) country_iso = subprocess_output.split(':')[1].strip().split(',')[0] country_name = subprocess_output.split(':')[1].strip().split(',')[1].strip() iso_object, _ = CountryISO.objects.get_or_create( @@ -890,7 +889,6 @@ def http_crawler(task, domain, yaml_configuration, results_dir, activity_id, thr # add geo iso subprocess_output = subprocess.getoutput(['geoiplookup {}'.format(_ip)]) if 'IP Address not found' not in subprocess_output and "can't resolve hostname" not in subprocess_output: - print(subprocess_output) country_iso = subprocess_output.split(':')[1].strip().split(',')[0] country_name = subprocess_output.split(':')[1].strip().split(',')[1].strip() iso_object, _ = CountryISO.objects.get_or_create( diff --git a/web/startScan/templates/startScan/detail_scan.html b/web/startScan/templates/startScan/detail_scan.html index 94d51052..4bc99c26 100644 --- a/web/startScan/templates/startScan/detail_scan.html +++ b/web/startScan/templates/startScan/detail_scan.html @@ -2471,7 +2471,7 @@ $(document).ready(function() { var countriesData = { {% for country in asset_countries %} - "{{country}}": {{country.count}}, + "{{country.iso}}": {{country.count}}, {% endfor %} }; @@ -2488,12 +2488,16 @@ $(document).ready(function() { series: { regions: [{ values: countriesData, - scale: ['#C8EEFF', '#0071A4'], + scale: [ + {% for country in asset_countries %} + shadeColor('#2C3E50', {{country.count}}), + {% endfor %} + ], normalizeFunction: 'polynomial' }] }, onRegionTipShow: function(e, el, code){ - el.html(el.html()+' (GDP - '+gdpData[code]+')'); + el.html(el.html() + ' (GDP - '); } }); diff --git a/web/static/custom/custom.js b/web/static/custom/custom.js index a858c090..e4644c94 100644 --- a/web/static/custom/custom.js +++ b/web/static/custom/custom.js @@ -2537,3 +2537,25 @@ function validURL(str) { '(\\#[-a-z\\d_]*)?$','i'); // fragment locator return !!pattern.test(str); } + + +function shadeColor(color, percent) { + //https://stackoverflow.com/a/13532993 + var R = parseInt(color.substring(1,3),16); + var G = parseInt(color.substring(3,5),16); + var B = parseInt(color.substring(5,7),16); + + R = parseInt(R * (100 + percent) / 100); + G = parseInt(G * (100 + percent) / 100); + B = parseInt(B * (100 + percent) / 100); + + R = (R<255)?R:255; + G = (G<255)?G:255; + B = (B<255)?B:255; + + var RR = ((R.toString(16).length==1)?"0"+R.toString(16):R.toString(16)); + var GG = ((G.toString(16).length==1)?"0"+G.toString(16):G.toString(16)); + var BB = ((B.toString(16).length==1)?"0"+B.toString(16):B.toString(16)); + + return "#"+RR+GG+BB; +}