-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
67 lines (61 loc) · 2.06 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>Sousveillance</title>
<meta charset="utf-8"/>
<script src="jquery-2.2.4.min.js"></script>
<script>
<!--
function parselog(log) {
lines = log.split('\n');
lastl = lines[lines.length-2];
last = JSON && JSON.parse(lastl) || $.parseJSON(lastl);
if (Object.keys(last).length == 0) return;
kind = last.action.split("/")[2].split(" ")[0].split(".")[0];
datetime = Date.parse(last.time.replace(":", " "));
start = false;
if (kind == "stream") start = last.action.indexOf(".html") > -1;
return {kind: kind, ip: last.ip, datetime: datetime, ua: last.agent,
start: start, line: lastl};
}
function checklog() {
var lastchecked = '';
$.ajax({url: 'agent.log?' + Math.random(),
contentType: 'text/plain; charset=UTF-8'})
.done(function(d, l=lastchecked) {
var result = parselog(d);
if (!result) return;
var now = new Date().getTime() / 1000;
var then = result.datetime / 1000;
if (result.kind == "stream") {
var notify = result.start ? "Stream started" : "Stream ended";
} else {
var notify = "Snapshot taken!";
}
notify = { body: notify + "\nby: " + result.ip + "\n" + result.ua }
if (now - then < 6 && result.line != l) {
new Notification("Hack Manhattan Webcam Access", notify);
l = result.line;
}
});
}
$(function() {
Notification.requestPermission(function(result) {
if (result === 'denied') {
return;
} else if (result === 'default') {
return;
}
new Notification("Webcam access notifications now on!");
});
setInterval(checklog, 5000);
});
-->
</script>
</head>
<body>
<center>
<a target="_blank" href="https://en.wikipedia.org/wiki/Sousveillance"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/7f/SurSousVeillanceByStephanieMannAge6.png/575px-SurSousVeillanceByStephanieMannAge6.png" /></a>
</center>
</body>
</html>