metasploit-framework/data/webcam/answerer.html

100 lines
2.4 KiB
HTML
Raw Normal View History

2014-02-06 16:44:24 +00:00
<!DOCTYPE html>
<head>
2014-02-08 04:17:42 +00:00
<script src="=WEBRTCAPIJS="> </script>
2014-02-06 16:44:24 +00:00
</head>
<body>
2014-02-08 09:53:49 +00:00
<div id="message">
Please wait to allow the video chat to be accepted by the remote target...<br>
If the remote target has accepted, you will be asked to allow the webcam to run.
<br><br>
</div>
2014-02-08 04:17:42 +00:00
<div id="chat_area"></div>
<a href="http://metasploit.com/" target="_blank">Metasploit.com</a>
2014-02-06 16:44:24 +00:00
<script>
var channel = 'msfsinn3rtest123';
var websocket = new WebSocket('ws://wsnodejs.jit.su:80');
2014-02-08 21:41:44 +00:00
var inSession = false;
2014-02-06 16:44:24 +00:00
websocket.onopen = function() {
websocket.push(JSON.stringify({
open: true,
channel: channel
}));
};
websocket.push = websocket.send;
websocket.send = function(data) {
websocket.push(JSON.stringify({
data: data,
channel: channel
}));
};
var peer = new PeerConnection(websocket);
peer.onUserFound = function(userid) {
2014-02-08 21:41:44 +00:00
if (inSession) {
console.debug("Already in session, will not send another participation request");
return;
};
2014-02-06 16:44:24 +00:00
console.debug("Found userid: " + userid);
getUserMedia(function(stream) {
peer.addStream(stream);
peer.sendParticipationRequest(userid);
2014-02-08 21:41:44 +00:00
inSession = true;
2014-02-06 16:44:24 +00:00
});
};
peer.onStreamAdded = function(e) {
var video = e.mediaElement;
video.setAttribute('width', 600);
video.setAttribute('controls', true);
2014-02-08 09:53:49 +00:00
document.getElementById("message").style.display = "none";
2014-02-08 04:17:42 +00:00
document.getElementById("chat_area").appendChild(video);
2014-02-06 16:44:24 +00:00
video.play();
};
peer.onStreamEnded = function(e) {
var video = e.mediaElement;
if (video) {
video.style.opacity = 0;
setTimeout(function() {
video.parentNode.removeChild(video);
}, 1000);
}
2014-02-08 21:41:44 +00:00
document.getElementById("message").innerHTML = "The video session has ended.";
document.getElementById("message").style.display = "";
2014-02-06 16:44:24 +00:00
};
function getUserMedia(callback) {
var hints = {audio:true,video:{
optional: [],
mandatory: {
minWidth: 1280,
minHeight: 720,
maxWidth: 1920,
maxHeight: 1080,
minAspectRatio: 1.77
}
}};
navigator.getUserMedia(hints,function(stream) {
var video = document.createElement('video');
video.src = URL.createObjectURL(stream);
video.controls = true;
2014-02-07 17:25:20 +00:00
video.muted = false;
video.volume = 0.2;
2014-02-06 16:44:24 +00:00
peer.onStreamAdded({
mediaElement: video,
userid: 'self',
stream: stream
});
callback(stream);
});
}
</script>
</body>
</html>