1 var socket = io.connect('/');
3 function set_marker_caption(id, lat, lng, countrycode, city) {
4 markercaptions[id] = "<small>(" + lat + ", " + lng + ")</small><br/>";
6 markercaptions[id] += "<big>" + city + "</big> (" + countrycode + ")";
10 socket.on('marker', function(data) {
11 var lat1 = data.latitude, lng1 = data.longitude,
12 lat2 = data.latitude2, lng2 = data.longitude2;
14 if(lat1 == null || lng1 == null) {
18 var p1 = mapobj.latLngToPoint(lat1,lng1);
19 if(p1.x == 0 && p1.y == 0) { return; }
22 if(data.countrycode != null && mapobj.regions[data.countrycode] != null) {
23 region1 = mapobj.regions[data.countrycode].config.name;
25 region1 = get_regionname_ll(lat1, lng1);
29 if(data.countrycode2 != null && mapobj.regions[data.countrycode2] != null) {
30 region2 = mapobj.regions[data.countrycode2].config.name;
32 region2 = get_regionname_ll(lat2, lng2);
38 if(data.type == null) { data.type = "other"; }
40 logstr = '<div class="log_timestamp">';
41 logstr += new Date().toTimeString().substring(0,8);
43 logstr += ' <div class="log_bracket"><</div>' + data.type + '<div class="log_bracket">></div> ';
44 logstr += 'New ' + (data.type == "thug.events" ? "scan" : "attack") + ' from ' +
45 '<div class="log_country">' + (data.city ? (data.city + ", ") : "") + region1 + '</div>' +
46 ' <small>(' + lat1.toFixed(2) + "," + lng1.toFixed(2) + ")</small>";
49 logstr += ' to <div class="log_country">' + (data.city2 ? (data.city2 + ", ") : "") + region2 + "</div>" +
50 " <small>(" + lat2.toFixed(2) + "," + lng2.toFixed(2) + ")</small>";
54 logstr += ' <div class="log_bracket2">[</div><div class="log_info">md5: <a href="http://www.virustotal.com/search/?query=' + data.md5 + '">' + data.md5 + '</a><div class="log_bracket2">]</div></div>';
59 add_marker_ll(lat1, lng1, 'src', data.type, data.countrycode);
60 set_marker_caption(lat1+","+lng1, lat1, lng1, data.countrycode, data.city);
61 update_regioncolors();
63 if(lat2 == null || lng2 == null) { return; }
64 var p2 = mapobj.latLngToPoint(lat2,lng2);
65 if(p2.x == 0 || p2.y == 0) { return; }
66 add_marker_ll(lat2, lng2, 'dst', data.type, data.countrycode2);
67 set_marker_caption(lat2+","+lng2, lat2, lng2, data.countrycode2, data.city2);