-
Notifications
You must be signed in to change notification settings - Fork 7
/
hsts_cookie.html
76 lines (67 loc) · 2.7 KB
/
hsts_cookie.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
68
69
70
71
72
73
74
75
76
<html>
<head>
<script src="hsts_cookie.js">
</script>
<script>
var domains = [
'http://a.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://b.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://c.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://d.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://e.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://f.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://g.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://h.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://i.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://j.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://k.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://l.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://m.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://n.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://o.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://p.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://q.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://r.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://s.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://t.test.bar/sec/hsts_tracking/hsts_cookie.php',
'http://u.test.bar/sec/hsts_tracking/hsts_cookie.php',
];
var hsts_cookie = HSTS_Cookie(domains);
function enable_btn(state){
document.getElementById('btn_set').enabled = state;
}
function on_load(){
if(domains.length > 32){
alert('Only up to 32 domains (bits) are supported. If you want more fix the int_to_bool part');
return;
}
document.getElementById('domain_count').innerHTML = domains.length;
document.getElementById('max_value').innerHTML = Math.pow(2, domains.length) - 1;
do_refresh();
}
function do_set(){
var value = document.getElementById('cur_value').value;
hsts_cookie.set_hsts_as_int(value, function(){});
}
function do_refresh(){
fields = [];
hsts_cookie.get_hsts_as_int(function(valuea){
document.getElementById('cur_value').value = valuea;
});
}
function do_delete(){
hsts_cookie.set_hsts_as_int("0", function(){
document.getElementById('cur_value').value = 0;
});
}
</script>
</head>
<body onload="on_load()">
<h3>You have <strong id="domain_count">?</strong> domains/bits.</h3>
You are able to save positive integers up to <strong id="max_value">?</strong>.<br/>
Current Value: <input id="cur_value" type="text" value="?">
<button id="btn_set" onclick="do_set()">Set</button>
<button id="btn_refresh" onclick="do_refresh()">Load</button>
<button id="btn_del" onclick="do_delete()">Delete</button>
</body>
</html>