Module: Rex::Post::Meterpreter::Ui::Console::CommandDispatcher::Stdapi::Stream

Included in:
Ui, Webcam
Defined in:
lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/stream.rb

Instance Method Summary collapse

Instance Method Details

#stream_html_template(name, host, stream_path) ⇒ Object



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
# File 'lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/stream.rb', line 11

def stream_html_template(name, host, stream_path)
  html = %|<html>
<head>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<title>Metasploit #{name} - #{host}</title>
<script language="javascript">
function updateStatus(msg) {
var status = document.getElementById("status");
status.innerText = msg;
}

function noImage() {
document.getElementById("streamer").style = "display:none";
updateStatus("Waiting");
}

var i = 0;
function updateFrame() {
var img = document.getElementById("streamer");
img.src = "#{stream_path}#" + i;
img.style = "display:";
updateStatus("Playing");
i++;
}

setInterval(function() {
updateFrame();
},25);

</script>
</head>
<body>
<noscript>
<h2><font color="red">Error: You need Javascript enabled to watch the stream.</font></h2>
</noscript>
<pre>
Target IP  : #{host}
Start time : #{::Time.now}
Status     : <span id="status"></span>
</pre>
<br>
<img onerror="noImage()" id="streamer">
<br><br>
<a href="http://www.metasploit.com" target="_blank">www.metasploit.com</a>
</body>
</html>
  |
  html
end