-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.html
More file actions
121 lines (99 loc) · 2.89 KB
/
Copy pathindex.html
File metadata and controls
121 lines (99 loc) · 2.89 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html>
<head>
<title>Wifi Probe Mapper</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
#wifiDemo {
width: 100%;
height: 100%;
}
#demoTitle {
width:100%;
font-size: 21pt;
background-color: #111111;
color: #11FF11;
}
#ssidListTitle {
font-size: 18pt;
color: #11FF11;
}
#ssidList {
float: left;
overflow: auto;
width: 20%;
height: 100%;
background-color: #111111;
color: #EEEEEE;
}
#map {
height: 100%;
width: 80%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="wifiDemo">
<div id="demoTitle">
Does your phone's Wifi show where you've been?
</div>
<div id="ssidList"><hr><hr><p id="ssidListTitle">Captured SSIDs</p><hr></div>
<div id="map"></div>
</div>
<<script src="config.js"></script>
<script type="text/javascript">
//Configuration options can be found in config.js
var map;
function initMap() {
var centerOn = new google.maps.LatLng(config.defaultLat, config.defaultLong);
map = new google.maps.Map(document.getElementById('map'), {
center: centerOn,
zoom: config.defaultZoom
});
webSocketConnect(map)
}
function webSocketConnect(map) {
var serverURL = "ws://" + config.serverIp + ":" + config.serverPort
serverURL += "?Upgrade=websocket"
websocket = new WebSocket(serverURL)
//Register event handlers
websocket.onopen = function(event) {
};
websocket.onclose = function(event) {
alert("Lost connection to websocket.")
};
websocket.onmessage = function(event) {
var msg = JSON.parse(event.data)
var loc;
for(i=0;i<msg.location.length;i++) { //>
if(msg.location[i].lat == 0.0 && msg.location[i].lng == 0.0) {
loc = new google.maps.LatLng(config.defaultLat, config.defaultLong)
} else {
loc = new google.maps.LatLng(msg.location[i].lat, msg.location[i].lng)
}
var marker = new google.maps.Marker({
label: msg.ssid,
position: loc,
map: map
});
}
document.getElementById("ssidList").innerHTML = document.getElementById("ssidList").innerHTML + msg.ssid + "<br>"
};
websocket.onerror = function(event) {
var error = event.data
};
}
var script = document.createElement('script')
script.async = true
script.defer = true
script.src = "https://maps.googleapis.com/maps/api/js?key=" + config.googleMapsAPIKey + "&callback=initMap"
document.body.appendChild(script);
</script>
</body>
</html>