File: ipmap.html

package info (click to toggle)
wireshark 1.12.1+g01b65bf-4+deb8u14
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 234,068 kB
  • sloc: ansic: 1,912,971; xml: 84,598; cpp: 41,923; python: 30,175; perl: 25,286; lex: 6,416; sh: 6,406; pascal: 6,120; makefile: 3,968; yacc: 297; asm: 156; awk: 58; tcl: 35
file content (106 lines) | stat: -rw-r--r-- 4,147 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Wireshark: IP Location Map</title>
    <style type="text/css">
    body {
      font-family: Arial, Helvetica, sans-serif; font-size: 13px;
      line-height: 17px;
    }
    </style>
    <script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
    <script type="text/javascript" src="http://openstreetmap.org/openlayers/OpenStreetMap.js"></script>

    <script type="text/javascript">
        <!--
        var map, layer;
        var selectControl, selectedFeature;

        function onPopupClose(event) {
            selectControl.unselect(this.feature);
        }

        function EndpointSelected(event) {
            var feature = event.feature;
            popup = new OpenLayers.Popup.FramedCloud("endpoint",
                feature.geometry.getBounds().getCenterLonLat(),
                new OpenLayers.Size(25,25),
                "<h3>"+ feature.attributes.title + "</h3>" +
                feature.attributes.description,
                null, true, onPopupClose);
            feature.popup = popup;
            popup.feature = feature;
            map.addPopup(popup);
        }

        function EndpointUnselected(event) {
            var feature = event.feature;
            if (feature.popup) {
                popup.feature = null;
                map.removePopup(feature.popup);
                feature.popup.destroy();
                feature.popup = null;
            }
        }

        function init() {
            var endpoints = {
                "type": "FeatureCollection",
                "features": [ // Start endpoint list - MUST match hostlist_table.c
                ]
            };
            map = new OpenLayers.Map('map', {
                controls: [
                    new OpenLayers.Control.PanZoomBar(),
                    new OpenLayers.Control.ZoomBox(),
                    new OpenLayers.Control.ScaleLine(),
                    new OpenLayers.Control.MousePosition(),
                    new OpenLayers.Control.Navigation(),
                    new OpenLayers.Control.Attribution()
                    ]
                //projection: new OpenLayers.Projection("EPSG:900913"),
                //displayProjection: new OpenLayers.Projection("EPSG:4326"),
                //maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34, 20037508.34, 20037508.34),
                //numZoomLevels: 18,
                //maxResolution: 156543,
                //units: "m"
            });
            layer = new OpenLayers.Layer.WMS("OpenLayers WMS",
                    "http://vmap0.tiles.osgeo.org/wms/vmap0",
                    {layers: 'basic'},
                    {wrapDateLine: true} );
            map.addLayer(layer);
            //map.addLayer(new OpenLayers.Layer.OSM.Mapnik("Mapnik"));
            //map.addLayer(new OpenLayers.Layer.Text("IP Locations", {
            //    location: map_file, projection: new OpenLayers.Projection("EPSG:4326")} ) );
            //
            //map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);

            var geojson_format = new OpenLayers.Format.GeoJSON();
            var vector_layer = new OpenLayers.Layer.Vector("IP Endpoints");
            map.addLayer(vector_layer);
            vector_layer.addFeatures(geojson_format.read(endpoints));

            if (endpoints.features.length < 1) {
                document.getElementById("statusmsg").innerHTML = "No endpoints to map";
            } else {
                map.zoomToExtent(vector_layer.getDataExtent());
            }

            selectControl = new OpenLayers.Control.SelectFeature(vector_layer);
            map.addControl(selectControl);
            selectControl.activate();

            vector_layer.events.on({
                'featureselected': EndpointSelected,
                'featureunselected': EndpointUnselected
            });
        }
        // -->
    </script>
  </head>
  <body onload="init()">
    <div id="statusmsg" style="float: right; z-index: 9999;"></div>
    <div id="map" style="z-index: 0;"></div>
  </body>
</html>