Updated vector map

This commit is contained in:
Yogesh Ojha
2022-07-10 19:26:36 +05:30
parent ceb318f576
commit 0bb77ec38d
3 changed files with 29 additions and 5 deletions
-2
View File
@@ -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(
@@ -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 - ');
}
});
+22
View File
@@ -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;
}