Merge branch 'master' into master
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -102,3 +102,5 @@ $RECYCLE.BIN/
|
||||
# Project-level settings
|
||||
/.tgitconfig
|
||||
|
||||
test/thirdparty/msf/unit/.byebug_history
|
||||
/load
|
||||
|
||||
40
Gemfile
40
Gemfile
@@ -10,6 +10,7 @@ gem 'eventmachine'
|
||||
gem 'thin'
|
||||
gem 'sinatra'
|
||||
gem 'rack', '~> 1.6.5'
|
||||
gem 'rack-protection', '~> 1.5.4'
|
||||
gem 'em-websocket' # WebSocket support
|
||||
gem 'uglifier'
|
||||
gem 'mime-types'
|
||||
@@ -22,6 +23,7 @@ gem 'data_objects'
|
||||
gem 'rubyzip', '>= 1.2.1'
|
||||
gem 'espeak-ruby', '>= 1.0.4' # Text-to-Voice
|
||||
gem 'nokogiri', '>= 1.7'
|
||||
gem 'rake'
|
||||
|
||||
if RUBY_PLATFORM.downcase.include?('linux')
|
||||
gem 'therubyracer', '~> 0.12.2', '<= 0.12.2'
|
||||
@@ -69,9 +71,6 @@ end
|
||||
# DNS extension
|
||||
group :ext_dns do
|
||||
gem 'rubydns', '~> 0.7.3'
|
||||
# rubydns requires rainbow
|
||||
# which requires rake, but doesn't specify rake as a dependency
|
||||
gem 'rake'
|
||||
end
|
||||
|
||||
# network extension
|
||||
@@ -86,23 +85,24 @@ end
|
||||
|
||||
# For running unit tests
|
||||
group :test do
|
||||
if ENV['BEEF_TEST']
|
||||
gem 'rake'
|
||||
gem 'test-unit'
|
||||
gem 'test-unit-full'
|
||||
gem 'curb'
|
||||
gem 'selenium'
|
||||
# selenium-webdriver 3.x is incompatible with Firefox version 48 and prior
|
||||
gem 'selenium-webdriver', '~> 2.53.4'
|
||||
gem 'rspec'
|
||||
gem 'bundler-audit'
|
||||
# nokogirl is needed by capybara which may require one of the below commands
|
||||
# sudo apt-get install libxslt-dev libxml2-dev
|
||||
# sudo port install libxml2 libxslt
|
||||
gem 'capybara'
|
||||
# RESTful API tests/generic command module tests
|
||||
gem 'rest-client', '>= 2.0.1'
|
||||
end
|
||||
if ENV['BEEF_TEST']
|
||||
gem 'test-unit'
|
||||
gem 'test-unit-full'
|
||||
gem 'rspec'
|
||||
# curb gem requires curl libraries
|
||||
# sudo apt-get install libcurl4-openssl-dev
|
||||
gem 'curb'
|
||||
# selenium-webdriver 3.x is incompatible with Firefox version 48 and prior
|
||||
gem 'selenium'
|
||||
gem 'selenium-webdriver', '~> 2.53.4'
|
||||
# nokogirl is needed by capybara which may require one of the below commands
|
||||
# sudo apt-get install libxslt-dev libxml2-dev
|
||||
# sudo port install libxml2 libxslt
|
||||
gem 'capybara'
|
||||
# RESTful API tests/generic command module tests
|
||||
gem 'rest-client', '>= 2.0.1'
|
||||
gem 'byebug'
|
||||
end
|
||||
end
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
177
Gemfile.lock
177
Gemfile.lock
@@ -1,177 +0,0 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.5.2)
|
||||
public_suffix (>= 2.0.2, < 4.0)
|
||||
ansi (1.5.0)
|
||||
buftok (0.2.0)
|
||||
chunky_png (1.3.8)
|
||||
daemons (1.2.4)
|
||||
data_objects (0.10.17)
|
||||
addressable (~> 2.1)
|
||||
dm-core (1.2.1)
|
||||
addressable (~> 2.3)
|
||||
dm-do-adapter (1.2.0)
|
||||
data_objects (~> 0.10.6)
|
||||
dm-core (~> 1.2.0)
|
||||
dm-migrations (1.2.0)
|
||||
dm-core (~> 1.2.0)
|
||||
dm-serializer (1.2.2)
|
||||
dm-core (~> 1.2.0)
|
||||
fastercsv (~> 1.5)
|
||||
json (~> 1.6)
|
||||
json_pure (~> 1.6)
|
||||
multi_json (~> 1.0)
|
||||
dm-sqlite-adapter (1.2.0)
|
||||
dm-do-adapter (~> 1.2.0)
|
||||
do_sqlite3 (~> 0.10.6)
|
||||
do_sqlite3 (0.10.17)
|
||||
data_objects (= 0.10.17)
|
||||
domain_name (0.5.20170404)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
em-websocket (0.5.1)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
equalizer (0.0.11)
|
||||
erubis (2.7.0)
|
||||
espeak-ruby (1.0.4)
|
||||
eventmachine (1.0.9.1)
|
||||
execjs (2.7.0)
|
||||
fastercsv (1.5.5)
|
||||
filesize (0.1.1)
|
||||
geoip (1.6.3)
|
||||
http (3.0.0)
|
||||
addressable (~> 2.3)
|
||||
http-cookie (~> 1.0)
|
||||
http-form_data (>= 2.0.0.pre.pre2, < 3)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
http-form_data (2.0.0)
|
||||
http_parser.rb (0.6.0)
|
||||
jsobfu (0.4.2)
|
||||
rkelly-remix
|
||||
json (1.8.6)
|
||||
json_pure (1.8.6)
|
||||
memoizable (0.4.2)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
metasm (1.0.3)
|
||||
mime-types (3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2016.0521)
|
||||
mini_portile2 (2.3.0)
|
||||
mojo_magick (0.5.6)
|
||||
msfrpc-client (1.1.1)
|
||||
msgpack (~> 1)
|
||||
rex (~> 2)
|
||||
msgpack (1.1.0)
|
||||
multi_json (1.12.2)
|
||||
multipart-post (2.0.0)
|
||||
naught (1.1.0)
|
||||
netrc (0.11.0)
|
||||
nokogiri (1.8.1)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
parseconfig (1.0.8)
|
||||
public_suffix (3.0.0)
|
||||
qr4r (0.4.1)
|
||||
mojo_magick
|
||||
rqrcode
|
||||
rack (1.6.8)
|
||||
rack-protection (1.5.3)
|
||||
rack
|
||||
rainbow (2.2.2)
|
||||
rake
|
||||
rake (12.1.0)
|
||||
rb-readline (0.5.5)
|
||||
rest-client (2.0.2)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
rex (2.0.11)
|
||||
filesize
|
||||
jsobfu (~> 0.4.1)
|
||||
json
|
||||
metasm (~> 1.0.2)
|
||||
nokogiri
|
||||
rb-readline
|
||||
robots
|
||||
rexec (1.6.3)
|
||||
rainbow
|
||||
rkelly-remix (0.0.7)
|
||||
robots (0.10.1)
|
||||
rqrcode (0.10.1)
|
||||
chunky_png (~> 1.0)
|
||||
rubydns (0.7.3)
|
||||
eventmachine (~> 1.0.0)
|
||||
rexec (~> 1.6.2)
|
||||
rubyzip (1.2.1)
|
||||
rushover (0.3.0)
|
||||
json
|
||||
rest-client
|
||||
simple_oauth (0.3.1)
|
||||
sinatra (1.4.8)
|
||||
rack (~> 1.5)
|
||||
rack-protection (~> 1.4)
|
||||
tilt (>= 1.3, < 3)
|
||||
slack-notifier (2.3.1)
|
||||
term-ansicolor (1.6.0)
|
||||
tins (~> 1.0)
|
||||
thin (1.7.2)
|
||||
daemons (~> 1.0, >= 1.0.9)
|
||||
eventmachine (~> 1.0, >= 1.0.4)
|
||||
rack (>= 1, < 3)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.8)
|
||||
tins (1.15.0)
|
||||
twitter (6.2.0)
|
||||
addressable (~> 2.3)
|
||||
buftok (~> 0.2.0)
|
||||
equalizer (~> 0.0.11)
|
||||
http (~> 3.0)
|
||||
http-form_data (~> 2.0)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
memoizable (~> 0.4.0)
|
||||
multipart-post (~> 2.0)
|
||||
naught (~> 1.0)
|
||||
simple_oauth (~> 0.3.0)
|
||||
uglifier (3.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.4)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
ansi
|
||||
data_objects
|
||||
dm-core
|
||||
dm-migrations
|
||||
dm-serializer
|
||||
dm-sqlite-adapter
|
||||
em-websocket
|
||||
erubis
|
||||
espeak-ruby (>= 1.0.4)
|
||||
eventmachine
|
||||
execjs
|
||||
geoip
|
||||
json
|
||||
mime-types
|
||||
msfrpc-client
|
||||
nokogiri (>= 1.7)
|
||||
parseconfig
|
||||
qr4r
|
||||
rack (~> 1.6.5)
|
||||
rubydns (~> 0.7.3)
|
||||
rubyzip (>= 1.2.1)
|
||||
rushover
|
||||
sinatra
|
||||
slack-notifier
|
||||
term-ansicolor
|
||||
thin
|
||||
twitter (>= 5.0.0)
|
||||
uglifier
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.1
|
||||
132
INSTALL.txt
132
INSTALL.txt
@@ -6,98 +6,66 @@
|
||||
|
||||
===============================================================================
|
||||
|
||||
Source
|
||||
------
|
||||
|
||||
Obtain application source code either by downloading the latest archive:
|
||||
|
||||
$ wget https://github.com/beefproject/beef/archive/master.zip
|
||||
|
||||
Or cloning the Git repository from Github:
|
||||
|
||||
$ git clone https://github.com/beefproject/beef
|
||||
|
||||
|
||||
Prerequisites
|
||||
--------------
|
||||
|
||||
BeEF requires Ruby 2.3+.
|
||||
|
||||
If your operating system package manager does not support Ruby version 2.3,
|
||||
you can add the brightbox ppa repository for the latest version of Ruby:
|
||||
|
||||
$ sudo apt-add-repository -y ppa:brightbox/ruby-ng
|
||||
|
||||
Alternatively, consider using a Ruby environment manager such as rbenv or rvm
|
||||
to manager your Ruby versions. Refer to the following for more information:
|
||||
|
||||
* rbenv: https://github.com/rbenv/rbenv
|
||||
* rvm: https://rvm.io/rvm/install'
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
1. Prerequisites (platform independent)
|
||||
2. Prerequisites (Windows)
|
||||
3. Prerequisites (Linux)
|
||||
4. Prerequisites (Mac OSX)
|
||||
5. Install instructions
|
||||
6. Run instructions
|
||||
Once Ruby is installed, run the install script in the BeEF directory:
|
||||
|
||||
./install
|
||||
|
||||
This script installs the required operating system packages and all the
|
||||
prerequisite Ruby gems.
|
||||
|
||||
Upon successful installation, be sure to read the Configuration page
|
||||
on the wiki for important details on configuring and securing BeEF.
|
||||
|
||||
https://github.com/beefproject/beef/wiki/Configuration
|
||||
|
||||
|
||||
Start BeEF
|
||||
----------
|
||||
|
||||
1. Prerequisites (platform independent)
|
||||
To start BeEF, simply run:
|
||||
|
||||
BeEF requires Ruby 2.2+ and the "bundler" gem. Bundler can be installed by:
|
||||
|
||||
gem install bundler
|
||||
|
||||
|
||||
2. Prerequisites (Windows)
|
||||
|
||||
Windows is no longer supported. The following instructions are outdated.
|
||||
|
||||
!!! This must be done PRIOR to running the bundle install command !!!
|
||||
|
||||
Windows requires the sqlite.dll. Simply grab the zip file below and extract it to your Ruby bin directory:
|
||||
|
||||
http://www.sqlite.org/sqlitedll-3_7_0_1.zip
|
||||
|
||||
Other than that, you also need TheRubyRacer. As it's painful to install it on Windows, you can download 2 pre-compiled V8 DLLs and 2 gems from https://github.com/eakmotion/therubyracer_for_windows.
|
||||
|
||||
Finally, edit beef's gem lock file by replacing the required ruby racer version with the version downloaded from the link above.
|
||||
|
||||
3. Prerequisites (Linux)
|
||||
|
||||
!!! This must be done PRIOR to running the bundle install command !!!
|
||||
|
||||
On linux you will need to find the packages specific to your distribution for sqlite. An example build script for Ubuntu 14.04 systems is:
|
||||
|
||||
# Set your prefered build dir
|
||||
BUILDDIR=/opt && \
|
||||
cd $BUILDDIR && \
|
||||
\
|
||||
# Install dependences
|
||||
sudo apt-get update && \
|
||||
sudo apt-get install -y \
|
||||
build-essential \
|
||||
git \
|
||||
libsqlite3-dev \
|
||||
software-properties-common \
|
||||
sqlite3 \
|
||||
sqlite3-doc && \
|
||||
\
|
||||
# Add brightbox ppa for the latest version of ruby
|
||||
sudo apt-add-repository -y \
|
||||
ppa:brightbox/ruby-ng && \
|
||||
\
|
||||
# Install ruby (2.2 in this example)
|
||||
sudo apt-get update && \
|
||||
sudo apt-get install -y \
|
||||
ruby2.2 \
|
||||
ruby2.2-dev && \
|
||||
\
|
||||
# Install bundler using gem
|
||||
sudo gem install bundler
|
||||
|
||||
3.1. It is recommended not to use rvm. If you use rvm the ruby binaries are installed to locations outside of your default path which may cause problems later.
|
||||
|
||||
4. Prerequisites (Mac OSX)
|
||||
|
||||
- XCode: provides the sqlite support BeEF needs
|
||||
|
||||
- Ruby 2.1
|
||||
To install RVM and Ruby 2.1.5 on Mac OS:
|
||||
$ bash -s stable < <(curl -Ls https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer) source ~/.bash_profile
|
||||
$ rvm install 2.1.5
|
||||
$ rvm use 2.1.5
|
||||
$ ./beef
|
||||
|
||||
|
||||
5. Install instructions
|
||||
|
||||
Obtain application code either by downloading an archive from https://github.com/beefproject/beef/archive/master.zip or cloning the GIT repo https://github.com/beefproject/beef.git
|
||||
Updating
|
||||
--------
|
||||
|
||||
Enter into the newly created BeEF directory, and type:
|
||||
Due to the fast-paced nature of web browser development and webappsec landscape,
|
||||
it's best to regularly update BeEF to the latest version.
|
||||
|
||||
bundle install
|
||||
If you're using BeEF from the GitHub repository, updating is as simple as:
|
||||
|
||||
Bundler installs all the pre-requisite gems.
|
||||
|
||||
6. Run instructions
|
||||
|
||||
Simply run:
|
||||
|
||||
./beef -x
|
||||
$ git pull
|
||||
|
||||
|
||||
31
README.md
31
README.md
@@ -1,5 +1,5 @@
|
||||
===============================================================================
|
||||
|
||||
|
||||
Copyright (c) 2006-2018 Wade Alcorn - wade@bindshell.net
|
||||
Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
@@ -14,10 +14,10 @@ __BeEF__ is short for __The Browser Exploitation Framework__. It is a penetratio
|
||||
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
|
||||
Get Involved
|
||||
------------
|
||||
|
||||
You can get in touch with the BeEF team. Just check out the following:
|
||||
You can get in touch with the BeEF team. Just check out the following:
|
||||
|
||||
|
||||
__Please, send us pull requests!__
|
||||
@@ -36,30 +36,31 @@ __Twitter:__ @beefproject
|
||||
Requirements
|
||||
------------
|
||||
|
||||
* OSX 10.5.0 or higher, modern Linux
|
||||
* [Ruby](http://rubylang.org) version 2.2 or newer
|
||||
* [SQLite](http://sqlite.org) 3.x
|
||||
* Operating System: Mac OSX 10.5.0 or higher / modern Linux
|
||||
* [Ruby](http://rubylang.org): 2.3 or newer
|
||||
* [SQLite](http://sqlite.org): 3.x
|
||||
* The gems listed in the Gemfile: https://github.com/beefproject/beef/blob/master/Gemfile
|
||||
|
||||
* brew install selenium-server-standalone (See https://github.com/shvets/selenium)
|
||||
|
||||
Quick Start
|
||||
-----------
|
||||
-----------
|
||||
|
||||
__The following is for the impatient.__
|
||||
__The following is for the impatient.__
|
||||
|
||||
The `install` script installs the required operating system packages and all the prerequisite Ruby gems:
|
||||
|
||||
$ ./install
|
||||
|
||||
For full installation details, please refer to [INSTALL.txt](https://github.com/beefproject/beef/blob/master/INSTALL.txt).
|
||||
|
||||
We also have an [Installation](https://github.com/beefproject/beef/wiki/Installation) page on the wiki.
|
||||
|
||||
$ curl -L https://raw.githubusercontent.com/beefproject/beef/a6a7536e/install-beef | bash -s stable
|
||||
|
||||
Upon successful installation, be sure to read the [Configuration](https://github.com/beefproject/beef/wiki/Configuration) page on the wiki for important details on configuring and securing BeEF.
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
Usage
|
||||
-----
|
||||
|
||||
To get started, simply execute beef and follow the instructions:
|
||||
To get started, simply execute beef and follow the instructions:
|
||||
|
||||
$ ./beef
|
||||
|
||||
|
||||
73
Rakefile
73
Rakefile
@@ -3,6 +3,8 @@
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
require 'yaml'
|
||||
#require 'pry-byebug'
|
||||
|
||||
task :default => ["quick"]
|
||||
|
||||
@@ -50,33 +52,13 @@ task :rdoc do
|
||||
Rake::Task['rdoc:rerdoc'].invoke
|
||||
end
|
||||
|
||||
desc 'rest test examples'
|
||||
task :rest_test do
|
||||
Rake::Task['beef_start'].invoke
|
||||
|
||||
################################
|
||||
# run bundle-audit
|
||||
sh 'cd test/api/; ruby -W2 1333_auth_rate.rb'
|
||||
|
||||
namespace :bundle_audit do
|
||||
require 'bundler/audit/cli'
|
||||
|
||||
desc 'Update bundle-audit database'
|
||||
task :update do
|
||||
Bundler::Audit::CLI.new.update
|
||||
end
|
||||
|
||||
desc 'Check gems for vulns using bundle-audit'
|
||||
task :check do
|
||||
Bundler::Audit::CLI.new.check
|
||||
end
|
||||
|
||||
desc 'Update vulns database and check gems using bundle-audit'
|
||||
task :run do
|
||||
Rake::Task['bundle_audit:update'].invoke
|
||||
Rake::Task['bundle_audit:check'].invoke
|
||||
end
|
||||
end
|
||||
|
||||
desc "Run bundle-audit"
|
||||
task :bundle_audit do
|
||||
Rake::Task['bundle_audit:run'].invoke
|
||||
Rake::Task['beef_stop'].invoke
|
||||
end
|
||||
|
||||
################################
|
||||
@@ -155,28 +137,53 @@ end
|
||||
|
||||
task :xserver_stop do
|
||||
puts "\nShutting down X11 Server...\n"
|
||||
sh "ps -ef|grep Xvfb|grep -v grep|awk '{print $2}'|xargs kill"
|
||||
sh "ps -ef|grep Xvfb|grep -v grep|grep -v rake|awk '{print $2}'|xargs kill"
|
||||
end
|
||||
|
||||
################################
|
||||
# BeEF environment set up
|
||||
|
||||
@beef_process_id = nil;
|
||||
@beef_config_file = 'tmp/rk_beef_conf.yaml';
|
||||
|
||||
|
||||
task :beef_start => 'beef' do
|
||||
# read environment param for creds or use bad_fred
|
||||
test_user = ENV['TEST_BEEF_USER'] || 'bad_fred'
|
||||
test_pass = ENV['TEST_BEEF_PASS'] || 'bad_fred_no_access'
|
||||
|
||||
# write a rake config file for beef
|
||||
config = YAML.load(File.read('./config.yaml'))
|
||||
config['beef']['credentials']['user'] = test_user
|
||||
config['beef']['credentials']['passwd'] = test_pass
|
||||
File.open(@beef_config_file, 'w') { |f| YAML.dump(config, f) }
|
||||
|
||||
# set the environment creds -- in case we're using bad_fred
|
||||
ENV['TEST_BEEF_USER'] = test_user
|
||||
ENV['TEST_BEEF_PASS'] = test_pass
|
||||
config = nil
|
||||
puts "Using config file: #{@beef_config_file}\n"
|
||||
|
||||
printf "Starting BeEF (wait a few seconds)..."
|
||||
@beef_process_id = IO.popen("ruby ./beef -x 2> /dev/null", "w+")
|
||||
delays = [10, 10, 5, 5, 4, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
@beef_process_id = IO.popen("ruby ./beef -c #{@beef_config_file} -x 2> /dev/null", "w+")
|
||||
delays = [5, 5, 5, 4, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||
delays.each do |i| # delay for a few seconds
|
||||
printf '.'
|
||||
sleep (i)
|
||||
end
|
||||
puts '.'
|
||||
puts ".\n\n"
|
||||
end
|
||||
|
||||
task :beef_stop do
|
||||
puts "\nShutting down BeEF...\n"
|
||||
sh "ps -ef|grep beef|grep -v grep|awk '{print $2}'|xargs kill"
|
||||
# cleanup tmp/config files
|
||||
puts "\nCleanup config file:\n"
|
||||
rm_f @beef_config_file
|
||||
ENV['TEST_BEEF_USER'] = nil
|
||||
ENV['TEST_BEEF_PASS'] = nil
|
||||
|
||||
# shutting down
|
||||
puts "Shutting down BeEF...\n"
|
||||
sh "ps -ef|grep beef|grep -v grep|grep -v rake|awk '{print $2}'|xargs kill"
|
||||
end
|
||||
|
||||
################################
|
||||
@@ -233,7 +240,7 @@ end
|
||||
|
||||
################################
|
||||
# Create CDE Package
|
||||
# This will download and make the CDE Executable and
|
||||
# This will download and make the CDE Executable and
|
||||
# gnereate a CDE Package in cde-package
|
||||
|
||||
task :cde do
|
||||
@@ -270,5 +277,3 @@ end
|
||||
|
||||
|
||||
################################
|
||||
|
||||
|
||||
|
||||
6
beef
6
beef
@@ -12,11 +12,11 @@
|
||||
$VERBOSE = nil
|
||||
|
||||
#
|
||||
# @note Version check to ensure BeEF is running Ruby 2.2+
|
||||
# @note Version check to ensure BeEF is running Ruby 2.3+
|
||||
#
|
||||
if RUBY_VERSION < '2.2'
|
||||
if RUBY_VERSION < '2.3'
|
||||
puts
|
||||
puts "Ruby version #{RUBY_VERSION} is no longer supported. Please upgrade to Ruby version 2.2 or later."
|
||||
puts "Ruby version #{RUBY_VERSION} is no longer supported. Please upgrade to Ruby version 2.3 or later."
|
||||
puts
|
||||
exit 1
|
||||
end
|
||||
|
||||
@@ -27,6 +27,8 @@ beef:
|
||||
# subnet of IP addresses that can connect to the admin UI
|
||||
#permitted_ui_subnet: "127.0.0.1/32"
|
||||
permitted_ui_subnet: "0.0.0.0/0"
|
||||
# slow API calls to 1 every api_attempt_delay seconds
|
||||
api_attempt_delay: "0.05"
|
||||
|
||||
# HTTP server
|
||||
http:
|
||||
|
||||
5
core/main/client/lib/jquery-1.12.4.min.js
vendored
5
core/main/client/lib/jquery-1.12.4.min.js
vendored
File diff suppressed because one or more lines are too long
2
core/main/client/lib/jquery-3.3.1.min.js
vendored
Normal file
2
core/main/client/lib/jquery-3.3.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
215
core/main/client/lib/jquery-migrate-3.0.1.min.js
vendored
Normal file
215
core/main/client/lib/jquery-migrate-3.0.1.min.js
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
/*! jQuery Migrate v3.0.1 | (c) jQuery Foundation and other contributors | jquery.org/license */
|
||||
|
||||
void 0 === jQuery.migrateMute && (jQuery.migrateMute = !0), function(e) {
|
||||
"function" == typeof define && define.amd ? define([ "jquery" ], window, e) : "object" == typeof module && module.exports ? module.exports = e(require("jquery"), window) : e(jQuery, window);
|
||||
}(function(e, t) {
|
||||
"use strict";
|
||||
function r(r) {
|
||||
var n = t.console;
|
||||
o[r] || (o[r] = !0, e.migrateWarnings.push(r), n && n.warn && !e.migrateMute && (n.warn("JQMIGRATE: " + r),
|
||||
e.migrateTrace && n.trace && n.trace()));
|
||||
}
|
||||
function n(e, t, n, a) {
|
||||
Object.defineProperty(e, t, {
|
||||
configurable: !0,
|
||||
enumerable: !0,
|
||||
get: function() {
|
||||
return r(a), n;
|
||||
},
|
||||
set: function(e) {
|
||||
r(a), n = e;
|
||||
}
|
||||
});
|
||||
}
|
||||
function a(e, t, n, a) {
|
||||
e[t] = function() {
|
||||
return r(a), n.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
e.migrateVersion = "3.0.1", function() {
|
||||
var r = /^[12]\./;
|
||||
t.console && t.console.log && (e && !r.test(e.fn.jquery) || t.console.log("JQMIGRATE: jQuery 3.0.0+ REQUIRED"),
|
||||
e.migrateWarnings && t.console.log("JQMIGRATE: Migrate plugin loaded multiple times"),
|
||||
t.console.log("JQMIGRATE: Migrate is installed" + (e.migrateMute ? "" : " with logging active") + ", version " + e.migrateVersion));
|
||||
}();
|
||||
var o = {};
|
||||
e.migrateWarnings = [], void 0 === e.migrateTrace && (e.migrateTrace = !0), e.migrateReset = function() {
|
||||
o = {}, e.migrateWarnings.length = 0;
|
||||
}, "BackCompat" === t.document.compatMode && r("jQuery is not compatible with Quirks Mode");
|
||||
var i = e.fn.init, s = e.isNumeric, u = e.find, c = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/, l = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g;
|
||||
e.fn.init = function(e) {
|
||||
var t = Array.prototype.slice.call(arguments);
|
||||
return "string" == typeof e && "#" === e && (r("jQuery( '#' ) is not a valid selector"),
|
||||
t[0] = []), i.apply(this, t);
|
||||
}, e.fn.init.prototype = e.fn, e.find = function(e) {
|
||||
var n = Array.prototype.slice.call(arguments);
|
||||
if ("string" == typeof e && c.test(e)) try {
|
||||
t.document.querySelector(e);
|
||||
} catch (a) {
|
||||
e = e.replace(l, function(e, t, r, n) {
|
||||
return "[" + t + r + '"' + n + '"]';
|
||||
});
|
||||
try {
|
||||
t.document.querySelector(e), r("Attribute selector with '#' must be quoted: " + n[0]),
|
||||
n[0] = e;
|
||||
} catch (e) {
|
||||
r("Attribute selector with '#' was not fixed: " + n[0]);
|
||||
}
|
||||
}
|
||||
return u.apply(this, n);
|
||||
};
|
||||
var d;
|
||||
for (d in u) Object.prototype.hasOwnProperty.call(u, d) && (e.find[d] = u[d]);
|
||||
e.fn.size = function() {
|
||||
return r("jQuery.fn.size() is deprecated and removed; use the .length property"),
|
||||
this.length;
|
||||
}, e.parseJSON = function() {
|
||||
return r("jQuery.parseJSON is deprecated; use JSON.parse"), JSON.parse.apply(null, arguments);
|
||||
}, e.isNumeric = function(t) {
|
||||
var n = s(t), a = function(t) {
|
||||
var r = t && t.toString();
|
||||
return !e.isArray(t) && r - parseFloat(r) + 1 >= 0;
|
||||
}(t);
|
||||
return n !== a && r("jQuery.isNumeric() should not be called on constructed objects"),
|
||||
a;
|
||||
}, a(e, "holdReady", e.holdReady, "jQuery.holdReady is deprecated"), a(e, "unique", e.uniqueSort, "jQuery.unique is deprecated; use jQuery.uniqueSort"),
|
||||
n(e.expr, "filters", e.expr.pseudos, "jQuery.expr.filters is deprecated; use jQuery.expr.pseudos"),
|
||||
n(e.expr, ":", e.expr.pseudos, "jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos");
|
||||
var p = e.ajax;
|
||||
e.ajax = function() {
|
||||
var e = p.apply(this, arguments);
|
||||
return e.promise && (a(e, "success", e.done, "jQXHR.success is deprecated and removed"),
|
||||
a(e, "error", e.fail, "jQXHR.error is deprecated and removed"), a(e, "complete", e.always, "jQXHR.complete is deprecated and removed")),
|
||||
e;
|
||||
};
|
||||
var f = e.fn.removeAttr, y = e.fn.toggleClass, m = /\S+/g;
|
||||
e.fn.removeAttr = function(t) {
|
||||
var n = this;
|
||||
return e.each(t.match(m), function(t, a) {
|
||||
e.expr.match.bool.test(a) && (r("jQuery.fn.removeAttr no longer sets boolean properties: " + a),
|
||||
n.prop(a, !1));
|
||||
}), f.apply(this, arguments);
|
||||
}, e.fn.toggleClass = function(t) {
|
||||
return void 0 !== t && "boolean" != typeof t ? y.apply(this, arguments) : (r("jQuery.fn.toggleClass( boolean ) is deprecated"),
|
||||
this.each(function() {
|
||||
var r = this.getAttribute && this.getAttribute("class") || "";
|
||||
r && e.data(this, "__className__", r), this.setAttribute && this.setAttribute("class", r || !1 === t ? "" : e.data(this, "__className__") || "");
|
||||
}));
|
||||
};
|
||||
var h = !1;
|
||||
e.swap && e.each([ "height", "width", "reliableMarginRight" ], function(t, r) {
|
||||
var n = e.cssHooks[r] && e.cssHooks[r].get;
|
||||
n && (e.cssHooks[r].get = function() {
|
||||
var e;
|
||||
return h = !0, e = n.apply(this, arguments), h = !1, e;
|
||||
});
|
||||
}), e.swap = function(e, t, n, a) {
|
||||
var o, i, s = {};
|
||||
h || r("jQuery.swap() is undocumented and deprecated");
|
||||
for (i in t) s[i] = e.style[i], e.style[i] = t[i];
|
||||
o = n.apply(e, a || []);
|
||||
for (i in t) e.style[i] = s[i];
|
||||
return o;
|
||||
};
|
||||
var g = e.data;
|
||||
e.data = function(t, n, a) {
|
||||
var o;
|
||||
if (n && "object" == typeof n && 2 === arguments.length) {
|
||||
o = e.hasData(t) && g.call(this, t);
|
||||
var i = {};
|
||||
for (var s in n) s !== e.camelCase(s) ? (r("jQuery.data() always sets/gets camelCased names: " + s),
|
||||
o[s] = n[s]) : i[s] = n[s];
|
||||
return g.call(this, t, i), n;
|
||||
}
|
||||
return n && "string" == typeof n && n !== e.camelCase(n) && (o = e.hasData(t) && g.call(this, t)) && n in o ? (r("jQuery.data() always sets/gets camelCased names: " + n),
|
||||
arguments.length > 2 && (o[n] = a), o[n]) : g.apply(this, arguments);
|
||||
};
|
||||
var v = e.Tween.prototype.run, j = function(e) {
|
||||
return e;
|
||||
};
|
||||
e.Tween.prototype.run = function() {
|
||||
e.easing[this.easing].length > 1 && (r("'jQuery.easing." + this.easing.toString() + "' should use only one argument"),
|
||||
e.easing[this.easing] = j), v.apply(this, arguments);
|
||||
}, e.fx.interval = e.fx.interval || 13, t.requestAnimationFrame && n(e.fx, "interval", e.fx.interval, "jQuery.fx.interval is deprecated");
|
||||
var Q = e.fn.load, b = e.event.add, w = e.event.fix;
|
||||
e.event.props = [], e.event.fixHooks = {}, n(e.event.props, "concat", e.event.props.concat, "jQuery.event.props.concat() is deprecated and removed"),
|
||||
e.event.fix = function(t) {
|
||||
var n, a = t.type, o = this.fixHooks[a], i = e.event.props;
|
||||
if (i.length) for (r("jQuery.event.props are deprecated and removed: " + i.join()); i.length; ) e.event.addProp(i.pop());
|
||||
if (o && !o._migrated_ && (o._migrated_ = !0, r("jQuery.event.fixHooks are deprecated and removed: " + a),
|
||||
(i = o.props) && i.length)) for (;i.length; ) e.event.addProp(i.pop());
|
||||
return n = w.call(this, t), o && o.filter ? o.filter(n, t) : n;
|
||||
}, e.event.add = function(e, n) {
|
||||
return e === t && "load" === n && "complete" === t.document.readyState && r("jQuery(window).on('load'...) called after load event occurred"),
|
||||
b.apply(this, arguments);
|
||||
}, e.each([ "load", "unload", "error" ], function(t, n) {
|
||||
e.fn[n] = function() {
|
||||
var e = Array.prototype.slice.call(arguments, 0);
|
||||
return "load" === n && "string" == typeof e[0] ? Q.apply(this, e) : (r("jQuery.fn." + n + "() is deprecated"),
|
||||
e.splice(0, 0, n), arguments.length ? this.on.apply(this, e) : (this.triggerHandler.apply(this, e),
|
||||
this));
|
||||
};
|
||||
}), e.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "), function(t, n) {
|
||||
e.fn[n] = function(e, t) {
|
||||
return r("jQuery.fn." + n + "() event shorthand is deprecated"), arguments.length > 0 ? this.on(n, null, e, t) : this.trigger(n);
|
||||
};
|
||||
}), e(function() {
|
||||
e(t.document).triggerHandler("ready");
|
||||
}), e.event.special.ready = {
|
||||
setup: function() {
|
||||
this === t.document && r("'ready' event is deprecated");
|
||||
}
|
||||
}, e.fn.extend({
|
||||
bind: function(e, t, n) {
|
||||
return r("jQuery.fn.bind() is deprecated"), this.on(e, null, t, n);
|
||||
},
|
||||
unbind: function(e, t) {
|
||||
return r("jQuery.fn.unbind() is deprecated"), this.off(e, null, t);
|
||||
},
|
||||
delegate: function(e, t, n, a) {
|
||||
return r("jQuery.fn.delegate() is deprecated"), this.on(t, e, n, a);
|
||||
},
|
||||
undelegate: function(e, t, n) {
|
||||
return r("jQuery.fn.undelegate() is deprecated"), 1 === arguments.length ? this.off(e, "**") : this.off(t, e || "**", n);
|
||||
},
|
||||
hover: function(e, t) {
|
||||
return r("jQuery.fn.hover() is deprecated"), this.on("mouseenter", e).on("mouseleave", t || e);
|
||||
}
|
||||
});
|
||||
var x = e.fn.offset;
|
||||
e.fn.offset = function() {
|
||||
var n, a = this[0], o = {
|
||||
top: 0,
|
||||
left: 0
|
||||
};
|
||||
return a && a.nodeType ? (n = (a.ownerDocument || t.document).documentElement, e.contains(n, a) ? x.apply(this, arguments) : (r("jQuery.fn.offset() requires an element connected to a document"),
|
||||
o)) : (r("jQuery.fn.offset() requires a valid DOM element"), o);
|
||||
};
|
||||
var k = e.param;
|
||||
e.param = function(t, n) {
|
||||
var a = e.ajaxSettings && e.ajaxSettings.traditional;
|
||||
return void 0 === n && a && (r("jQuery.param() no longer uses jQuery.ajaxSettings.traditional"),
|
||||
n = a), k.call(this, t, n);
|
||||
};
|
||||
var A = e.fn.andSelf || e.fn.addBack;
|
||||
e.fn.andSelf = function() {
|
||||
return r("jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()"),
|
||||
A.apply(this, arguments);
|
||||
};
|
||||
var S = e.Deferred, q = [ [ "resolve", "done", e.Callbacks("once memory"), e.Callbacks("once memory"), "resolved" ], [ "reject", "fail", e.Callbacks("once memory"), e.Callbacks("once memory"), "rejected" ], [ "notify", "progress", e.Callbacks("memory"), e.Callbacks("memory") ] ];
|
||||
return e.Deferred = function(t) {
|
||||
var n = S(), a = n.promise();
|
||||
return n.pipe = a.pipe = function() {
|
||||
var t = arguments;
|
||||
return r("deferred.pipe() is deprecated"), e.Deferred(function(r) {
|
||||
e.each(q, function(o, i) {
|
||||
var s = e.isFunction(t[o]) && t[o];
|
||||
n[i[1]](function() {
|
||||
var t = s && s.apply(this, arguments);
|
||||
t && e.isFunction(t.promise) ? t.promise().done(r.resolve).fail(r.reject).progress(r.notify) : r[i[0] + "With"](this === a ? r.promise() : this, s ? [ t ] : arguments);
|
||||
});
|
||||
}), t = null;
|
||||
}).promise();
|
||||
}, t && t.call(n, n), n;
|
||||
}, e.Deferred.exceptionHook = S.exceptionHook, e;
|
||||
});
|
||||
327
core/main/client/lib/json2-2001-02-23.js
Normal file
327
core/main/client/lib/json2-2001-02-23.js
Normal file
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
https://github.com/douglascrockford/JSON-js/blob/master/json2.js
|
||||
2011-02-23
|
||||
|
||||
// Create a JSON object only if one does not already exist. We create the
|
||||
// methods in a closure to avoid creating global variables.
|
||||
*/
|
||||
|
||||
var JSON;
|
||||
if (!JSON) {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
if (typeof Date.prototype.toJSON !== 'function') {
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
|
||||
return isFinite(this.valueOf()) ?
|
||||
this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z' : null;
|
||||
};
|
||||
|
||||
String.prototype.toJSON =
|
||||
Number.prototype.toJSON =
|
||||
Boolean.prototype.toJSON = function (key) {
|
||||
return this.valueOf();
|
||||
};
|
||||
}
|
||||
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
rep;
|
||||
|
||||
|
||||
function quote(string) {
|
||||
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
|
||||
escapable.lastIndex = 0;
|
||||
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === 'string' ? c :
|
||||
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + '"' : '"' + string + '"';
|
||||
}
|
||||
|
||||
|
||||
function str(key, holder) {
|
||||
|
||||
// Produce a string from holder[key].
|
||||
|
||||
var i, // The loop counter.
|
||||
k, // The member key.
|
||||
v, // The member value.
|
||||
length,
|
||||
mind = gap,
|
||||
partial,
|
||||
value = holder[key];
|
||||
|
||||
// If the value has a toJSON method, call it to obtain a replacement value.
|
||||
|
||||
if (value && typeof value === 'object' &&
|
||||
typeof value.toJSON === 'function') {
|
||||
value = value.toJSON(key);
|
||||
}
|
||||
|
||||
// If we were called with a replacer function, then call the replacer to
|
||||
// obtain a replacement value.
|
||||
|
||||
if (typeof rep === 'function') {
|
||||
value = rep.call(holder, key, value);
|
||||
}
|
||||
|
||||
// What happens next depends on the value's type.
|
||||
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
return quote(value);
|
||||
|
||||
case 'number':
|
||||
|
||||
// JSON numbers must be finite. Encode non-finite numbers as null.
|
||||
|
||||
return isFinite(value) ? String(value) : 'null';
|
||||
|
||||
case 'boolean':
|
||||
case 'null':
|
||||
|
||||
// If the value is a boolean or null, convert it to a string. Note:
|
||||
// typeof null does not produce 'null'. The case is included here in
|
||||
// the remote chance that this gets fixed someday.
|
||||
|
||||
return String(value);
|
||||
|
||||
// If the type is 'object', we might be dealing with an object or an array or
|
||||
// null.
|
||||
|
||||
case 'object':
|
||||
|
||||
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
||||
// so watch out for that case.
|
||||
|
||||
if (!value) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
// Make an array to hold the partial results of stringifying this object value.
|
||||
|
||||
gap += indent;
|
||||
partial = [];
|
||||
|
||||
// Is the value an array?
|
||||
|
||||
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
||||
|
||||
// The value is an array. Stringify every element. Use null as a placeholder
|
||||
// for non-JSON values.
|
||||
|
||||
length = value.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
partial[i] = str(i, value) || 'null';
|
||||
}
|
||||
|
||||
// Join all of the elements together, separated with commas, and wrap them in
|
||||
// brackets.
|
||||
|
||||
v = partial.length === 0 ? '[]' : gap ?
|
||||
'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
|
||||
'[' + partial.join(',') + ']';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
|
||||
// If the replacer is an array, use it to select the members to be stringified.
|
||||
|
||||
if (rep && typeof rep === 'object') {
|
||||
length = rep.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (typeof rep[i] === 'string') {
|
||||
k = rep[i];
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Otherwise, iterate through all of the keys in the object.
|
||||
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Join all of the member texts together, separated with commas,
|
||||
// and wrap them in braces.
|
||||
|
||||
v = partial.length === 0 ? '{}' : gap ?
|
||||
'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
|
||||
'{' + partial.join(',') + '}';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
// If the JSON object does not yet have a stringify method, give it one.
|
||||
|
||||
if (typeof JSON.stringify !== 'function') {
|
||||
JSON.stringify = function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
// space parameter, and returns a JSON text. The replacer can be a function
|
||||
// that can replace values, or an array of strings that will select the keys.
|
||||
// A default replacer method can be provided. Use of the space parameter can
|
||||
// produce text that is more easily readable.
|
||||
|
||||
var i;
|
||||
gap = '';
|
||||
indent = '';
|
||||
|
||||
// If the space parameter is a number, make an indent string containing that
|
||||
// many spaces.
|
||||
|
||||
if (typeof space === 'number') {
|
||||
for (i = 0; i < space; i += 1) {
|
||||
indent += ' ';
|
||||
}
|
||||
|
||||
// If the space parameter is a string, it will be used as the indent string.
|
||||
|
||||
} else if (typeof space === 'string') {
|
||||
indent = space;
|
||||
}
|
||||
|
||||
// If there is a replacer, it must be a function or an array.
|
||||
// Otherwise, throw an error.
|
||||
|
||||
rep = replacer;
|
||||
if (replacer && typeof replacer !== 'function' &&
|
||||
(typeof replacer !== 'object' ||
|
||||
typeof replacer.length !== 'number')) {
|
||||
throw new Error('JSON.stringify');
|
||||
}
|
||||
|
||||
// Make a fake root object containing our value under the key of ''.
|
||||
// Return the result of stringifying the value.
|
||||
|
||||
return str('', {'': value});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// If the JSON object does not yet have a parse method, give it one.
|
||||
|
||||
if (typeof JSON.parse !== 'function') {
|
||||
JSON.parse = function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
// a JavaScript value if the text is a valid JSON text.
|
||||
|
||||
var j;
|
||||
|
||||
function walk(holder, key) {
|
||||
|
||||
// The walk method is used to recursively walk the resulting structure so
|
||||
// that modifications can be made.
|
||||
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
if (v !== undefined) {
|
||||
value[k] = v;
|
||||
} else {
|
||||
delete value[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return reviver.call(holder, key, value);
|
||||
}
|
||||
|
||||
|
||||
// Parsing happens in four stages. In the first stage, we replace certain
|
||||
// Unicode characters with escape sequences. JavaScript handles many characters
|
||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||
|
||||
text = String(text);
|
||||
cx.lastIndex = 0;
|
||||
if (cx.test(text)) {
|
||||
text = text.replace(cx, function (a) {
|
||||
return '\\u' +
|
||||
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
});
|
||||
}
|
||||
|
||||
// In the second stage, we run the text against regular expressions that look
|
||||
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
||||
// because they can cause invocation, and '=' because it can cause mutation.
|
||||
// But just to be safe, we want to reject all unexpected forms.
|
||||
|
||||
// We split the second stage into 4 regexp operations in order to work around
|
||||
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
||||
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
||||
// replace all simple value tokens with ']' characters. Third, we delete all
|
||||
// open brackets that follow a colon or comma or that begin the text. Finally,
|
||||
// we look to see that the remaining characters are only whitespace or ']' or
|
||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||
|
||||
if (/^[\],:{}\s]*$/
|
||||
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
||||
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
||||
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
|
||||
// In the third stage we use the eval function to compile the text into a
|
||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
||||
// in parens to eliminate the ambiguity.
|
||||
|
||||
j = eval('(' + text + ')');
|
||||
|
||||
// In the optional fourth stage, we recursively walk the new structure, passing
|
||||
// each name/value pair to a reviver function for possible transformation.
|
||||
|
||||
return typeof reviver === 'function' ?
|
||||
walk({'': j}, '') : j;
|
||||
}
|
||||
|
||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||
|
||||
throw new SyntaxError('JSON.parse');
|
||||
};
|
||||
}
|
||||
}());
|
||||
@@ -1,58 +1,70 @@
|
||||
/*
|
||||
https://github.com/douglascrockford/JSON-js/blob/master/json2.js
|
||||
2011-02-23
|
||||
// json2.js
|
||||
// 2016-10-28
|
||||
// Public Domain.
|
||||
// NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
// See http://www.JSON.org/js.html
|
||||
// This code should be minified before deployment.
|
||||
// See http://javascript.crockford.com/jsmin.html
|
||||
|
||||
// USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
||||
// NOT CONTROL.
|
||||
|
||||
// This file creates a global JSON object containing two methods: stringify
|
||||
// and parse. This file provides the ES5 JSON capability to ES3 systems.
|
||||
// If a project might run on IE8 or earlier, then this file should be included.
|
||||
// This file does nothing on ES5 systems.
|
||||
|
||||
// Create a JSON object only if one does not already exist. We create the
|
||||
// methods in a closure to avoid creating global variables.
|
||||
*/
|
||||
|
||||
var JSON;
|
||||
if (!JSON) {
|
||||
if (typeof JSON !== "object") {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var rx_one = /^[\],:{}\s]*$/;
|
||||
var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
|
||||
var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
|
||||
var rx_four = /(?:^|:|,)(?:\s*\[)+/g;
|
||||
var rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
||||
var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
|
||||
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
return n < 10
|
||||
? "0" + n
|
||||
: n;
|
||||
}
|
||||
|
||||
if (typeof Date.prototype.toJSON !== 'function') {
|
||||
function this_value() {
|
||||
return this.valueOf();
|
||||
}
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
if (typeof Date.prototype.toJSON !== "function") {
|
||||
|
||||
return isFinite(this.valueOf()) ?
|
||||
this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z' : null;
|
||||
Date.prototype.toJSON = function () {
|
||||
|
||||
return isFinite(this.valueOf())
|
||||
? this.getUTCFullYear() + "-" +
|
||||
f(this.getUTCMonth() + 1) + "-" +
|
||||
f(this.getUTCDate()) + "T" +
|
||||
f(this.getUTCHours()) + ":" +
|
||||
f(this.getUTCMinutes()) + ":" +
|
||||
f(this.getUTCSeconds()) + "Z"
|
||||
: null;
|
||||
};
|
||||
|
||||
String.prototype.toJSON =
|
||||
Number.prototype.toJSON =
|
||||
Boolean.prototype.toJSON = function (key) {
|
||||
return this.valueOf();
|
||||
};
|
||||
Boolean.prototype.toJSON = this_value;
|
||||
Number.prototype.toJSON = this_value;
|
||||
String.prototype.toJSON = this_value;
|
||||
}
|
||||
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
rep;
|
||||
var gap;
|
||||
var indent;
|
||||
var meta;
|
||||
var rep;
|
||||
|
||||
|
||||
function quote(string) {
|
||||
@@ -62,12 +74,15 @@ if (!JSON) {
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
|
||||
escapable.lastIndex = 0;
|
||||
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === 'string' ? c :
|
||||
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + '"' : '"' + string + '"';
|
||||
rx_escapable.lastIndex = 0;
|
||||
return rx_escapable.test(string)
|
||||
? "\"" + string.replace(rx_escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === "string"
|
||||
? c
|
||||
: "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + "\""
|
||||
: "\"" + string + "\"";
|
||||
}
|
||||
|
||||
|
||||
@@ -75,59 +90,61 @@ if (!JSON) {
|
||||
|
||||
// Produce a string from holder[key].
|
||||
|
||||
var i, // The loop counter.
|
||||
k, // The member key.
|
||||
v, // The member value.
|
||||
length,
|
||||
mind = gap,
|
||||
partial,
|
||||
value = holder[key];
|
||||
var i; // The loop counter.
|
||||
var k; // The member key.
|
||||
var v; // The member value.
|
||||
var length;
|
||||
var mind = gap;
|
||||
var partial;
|
||||
var value = holder[key];
|
||||
|
||||
// If the value has a toJSON method, call it to obtain a replacement value.
|
||||
|
||||
if (value && typeof value === 'object' &&
|
||||
typeof value.toJSON === 'function') {
|
||||
if (value && typeof value === "object" &&
|
||||
typeof value.toJSON === "function") {
|
||||
value = value.toJSON(key);
|
||||
}
|
||||
|
||||
// If we were called with a replacer function, then call the replacer to
|
||||
// obtain a replacement value.
|
||||
|
||||
if (typeof rep === 'function') {
|
||||
if (typeof rep === "function") {
|
||||
value = rep.call(holder, key, value);
|
||||
}
|
||||
|
||||
// What happens next depends on the value's type.
|
||||
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
case "string":
|
||||
return quote(value);
|
||||
|
||||
case 'number':
|
||||
case "number":
|
||||
|
||||
// JSON numbers must be finite. Encode non-finite numbers as null.
|
||||
|
||||
return isFinite(value) ? String(value) : 'null';
|
||||
return isFinite(value)
|
||||
? String(value)
|
||||
: "null";
|
||||
|
||||
case 'boolean':
|
||||
case 'null':
|
||||
case "boolean":
|
||||
case "null":
|
||||
|
||||
// If the value is a boolean or null, convert it to a string. Note:
|
||||
// typeof null does not produce 'null'. The case is included here in
|
||||
// typeof null does not produce "null". The case is included here in
|
||||
// the remote chance that this gets fixed someday.
|
||||
|
||||
return String(value);
|
||||
|
||||
// If the type is 'object', we might be dealing with an object or an array or
|
||||
// If the type is "object", we might be dealing with an object or an array or
|
||||
// null.
|
||||
|
||||
case 'object':
|
||||
case "object":
|
||||
|
||||
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
||||
// Due to a specification blunder in ECMAScript, typeof null is "object",
|
||||
// so watch out for that case.
|
||||
|
||||
if (!value) {
|
||||
return 'null';
|
||||
return "null";
|
||||
}
|
||||
|
||||
// Make an array to hold the partial results of stringifying this object value.
|
||||
@@ -137,36 +154,42 @@ if (!JSON) {
|
||||
|
||||
// Is the value an array?
|
||||
|
||||
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
||||
if (Object.prototype.toString.apply(value) === "[object Array]") {
|
||||
|
||||
// The value is an array. Stringify every element. Use null as a placeholder
|
||||
// for non-JSON values.
|
||||
|
||||
length = value.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
partial[i] = str(i, value) || 'null';
|
||||
partial[i] = str(i, value) || "null";
|
||||
}
|
||||
|
||||
// Join all of the elements together, separated with commas, and wrap them in
|
||||
// brackets.
|
||||
|
||||
v = partial.length === 0 ? '[]' : gap ?
|
||||
'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
|
||||
'[' + partial.join(',') + ']';
|
||||
v = partial.length === 0
|
||||
? "[]"
|
||||
: gap
|
||||
? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]"
|
||||
: "[" + partial.join(",") + "]";
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
|
||||
// If the replacer is an array, use it to select the members to be stringified.
|
||||
|
||||
if (rep && typeof rep === 'object') {
|
||||
if (rep && typeof rep === "object") {
|
||||
length = rep.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (typeof rep[i] === 'string') {
|
||||
if (typeof rep[i] === "string") {
|
||||
k = rep[i];
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
partial.push(quote(k) + (
|
||||
gap
|
||||
? ": "
|
||||
: ":"
|
||||
) + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,7 +201,11 @@ if (!JSON) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
partial.push(quote(k) + (
|
||||
gap
|
||||
? ": "
|
||||
: ":"
|
||||
) + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,9 +214,11 @@ if (!JSON) {
|
||||
// Join all of the member texts together, separated with commas,
|
||||
// and wrap them in braces.
|
||||
|
||||
v = partial.length === 0 ? '{}' : gap ?
|
||||
'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
|
||||
'{' + partial.join(',') + '}';
|
||||
v = partial.length === 0
|
||||
? "{}"
|
||||
: gap
|
||||
? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}"
|
||||
: "{" + partial.join(",") + "}";
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
@@ -197,7 +226,16 @@ if (!JSON) {
|
||||
|
||||
// If the JSON object does not yet have a stringify method, give it one.
|
||||
|
||||
if (typeof JSON.stringify !== 'function') {
|
||||
if (typeof JSON.stringify !== "function") {
|
||||
meta = { // table of character substitutions
|
||||
"\b": "\\b",
|
||||
"\t": "\\t",
|
||||
"\n": "\\n",
|
||||
"\f": "\\f",
|
||||
"\r": "\\r",
|
||||
"\"": "\\\"",
|
||||
"\\": "\\\\"
|
||||
};
|
||||
JSON.stringify = function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
@@ -207,20 +245,20 @@ if (!JSON) {
|
||||
// produce text that is more easily readable.
|
||||
|
||||
var i;
|
||||
gap = '';
|
||||
indent = '';
|
||||
gap = "";
|
||||
indent = "";
|
||||
|
||||
// If the space parameter is a number, make an indent string containing that
|
||||
// many spaces.
|
||||
|
||||
if (typeof space === 'number') {
|
||||
if (typeof space === "number") {
|
||||
for (i = 0; i < space; i += 1) {
|
||||
indent += ' ';
|
||||
indent += " ";
|
||||
}
|
||||
|
||||
// If the space parameter is a string, it will be used as the indent string.
|
||||
|
||||
} else if (typeof space === 'string') {
|
||||
} else if (typeof space === "string") {
|
||||
indent = space;
|
||||
}
|
||||
|
||||
@@ -228,23 +266,23 @@ if (!JSON) {
|
||||
// Otherwise, throw an error.
|
||||
|
||||
rep = replacer;
|
||||
if (replacer && typeof replacer !== 'function' &&
|
||||
(typeof replacer !== 'object' ||
|
||||
typeof replacer.length !== 'number')) {
|
||||
throw new Error('JSON.stringify');
|
||||
if (replacer && typeof replacer !== "function" &&
|
||||
(typeof replacer !== "object" ||
|
||||
typeof replacer.length !== "number")) {
|
||||
throw new Error("JSON.stringify");
|
||||
}
|
||||
|
||||
// Make a fake root object containing our value under the key of ''.
|
||||
// Make a fake root object containing our value under the key of "".
|
||||
// Return the result of stringifying the value.
|
||||
|
||||
return str('', {'': value});
|
||||
return str("", {"": value});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// If the JSON object does not yet have a parse method, give it one.
|
||||
|
||||
if (typeof JSON.parse !== 'function') {
|
||||
if (typeof JSON.parse !== "function") {
|
||||
JSON.parse = function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
@@ -257,8 +295,10 @@ if (!JSON) {
|
||||
// The walk method is used to recursively walk the resulting structure so
|
||||
// that modifications can be made.
|
||||
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
var k;
|
||||
var v;
|
||||
var value = holder[key];
|
||||
if (value && typeof value === "object") {
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
@@ -279,49 +319,54 @@ if (!JSON) {
|
||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||
|
||||
text = String(text);
|
||||
cx.lastIndex = 0;
|
||||
if (cx.test(text)) {
|
||||
text = text.replace(cx, function (a) {
|
||||
return '\\u' +
|
||||
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
rx_dangerous.lastIndex = 0;
|
||||
if (rx_dangerous.test(text)) {
|
||||
text = text.replace(rx_dangerous, function (a) {
|
||||
return "\\u" +
|
||||
("0000" + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
});
|
||||
}
|
||||
|
||||
// In the second stage, we run the text against regular expressions that look
|
||||
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
||||
// because they can cause invocation, and '=' because it can cause mutation.
|
||||
// for non-JSON patterns. We are especially concerned with "()" and "new"
|
||||
// because they can cause invocation, and "=" because it can cause mutation.
|
||||
// But just to be safe, we want to reject all unexpected forms.
|
||||
|
||||
// We split the second stage into 4 regexp operations in order to work around
|
||||
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
||||
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
||||
// replace all simple value tokens with ']' characters. Third, we delete all
|
||||
// replace the JSON backslash pairs with "@" (a non-JSON character). Second, we
|
||||
// replace all simple value tokens with "]" characters. Third, we delete all
|
||||
// open brackets that follow a colon or comma or that begin the text. Finally,
|
||||
// we look to see that the remaining characters are only whitespace or ']' or
|
||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||
// we look to see that the remaining characters are only whitespace or "]" or
|
||||
// "," or ":" or "{" or "}". If that is so, then the text is safe for eval.
|
||||
|
||||
if (/^[\],:{}\s]*$/
|
||||
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
||||
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
||||
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
if (
|
||||
rx_one.test(
|
||||
text
|
||||
.replace(rx_two, "@")
|
||||
.replace(rx_three, "]")
|
||||
.replace(rx_four, "")
|
||||
)
|
||||
) {
|
||||
|
||||
// In the third stage we use the eval function to compile the text into a
|
||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||
// JavaScript structure. The "{" operator is subject to a syntactic ambiguity
|
||||
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
||||
// in parens to eliminate the ambiguity.
|
||||
|
||||
j = eval('(' + text + ')');
|
||||
j = eval("(" + text + ")");
|
||||
|
||||
// In the optional fourth stage, we recursively walk the new structure, passing
|
||||
// each name/value pair to a reviver function for possible transformation.
|
||||
|
||||
return typeof reviver === 'function' ?
|
||||
walk({'': j}, '') : j;
|
||||
return (typeof reviver === "function")
|
||||
? walk({"": j}, "")
|
||||
: j;
|
||||
}
|
||||
|
||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||
|
||||
throw new SyntaxError('JSON.parse');
|
||||
throw new SyntaxError("JSON.parse");
|
||||
};
|
||||
}
|
||||
}());
|
||||
|
||||
@@ -21,7 +21,7 @@ module BeEF
|
||||
beef_js_path = "#{$root_dir}/core/main/client/"
|
||||
|
||||
# @note External libraries (like jQuery) that are not evaluated with Eruby and possibly not obfuscated
|
||||
ext_js_sub_files = %w(lib/jquery-1.12.4.min.js lib/jquery-migrate-1.2.1.min.js lib/evercookie.js lib/json2.js lib/mdetect.js lib/jquery.blockUI.js)
|
||||
ext_js_sub_files = %w(lib/jquery-3.3.1.min.js lib/jquery-migrate-3.0.1.min.js lib/evercookie.js lib/json2.js lib/mdetect.js lib/jquery.blockUI.js)
|
||||
|
||||
# @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 geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js are.js)
|
||||
|
||||
@@ -63,7 +63,7 @@ module BeEF
|
||||
# This is from extensions/admin_ui/controllers/authentication/authentication.rb
|
||||
#
|
||||
def self.permitted_source?(ip)
|
||||
# get permitted subnet
|
||||
# get permitted subnet
|
||||
permitted_ui_subnet = BeEF::Core::Configuration.instance.get("beef.restrictions.permitted_ui_subnet")
|
||||
target_network = IPAddr.new(permitted_ui_subnet)
|
||||
|
||||
@@ -74,6 +74,32 @@ module BeEF
|
||||
return target_network.include?(ip)
|
||||
end
|
||||
|
||||
#
|
||||
# Rate limit through timeout
|
||||
# This is from extensions/admin_ui/controllers/authentication/
|
||||
#
|
||||
# Brute Force Mitigation
|
||||
# Only one login request per config_delay_id seconds
|
||||
#
|
||||
# @param config_delay_id <string> configuration name for the timeout
|
||||
# @param last_time_attempt <Time> last time this was attempted
|
||||
# @param time_record_set_fn <lambda> callback, setting time on failure
|
||||
#
|
||||
# @return <boolean>
|
||||
def self.timeout?(config_delay_id, last_time_attempt, time_record_set_fn)
|
||||
success = true
|
||||
time = Time.now()
|
||||
config = BeEF::Core::Configuration.instance
|
||||
fail_delay = config.get(config_delay_id)
|
||||
|
||||
if (time - last_time_attempt < fail_delay.to_f)
|
||||
time_record_set_fn.call(time)
|
||||
success = false
|
||||
end
|
||||
|
||||
success
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,10 +10,20 @@ module BeEF
|
||||
class Admin < BeEF::Core::Router::Router
|
||||
|
||||
config = BeEF::Core::Configuration.instance
|
||||
time_since_last_failed_auth = 0
|
||||
|
||||
|
||||
before do
|
||||
# error 401 unless params[:token] == config.get('beef.api_token')
|
||||
halt 401 if not BeEF::Core::Rest.permitted_source?(request.ip)
|
||||
|
||||
# halt if requests are inside beef.restrictions.api_attempt_delay
|
||||
if time_since_last_failed_auth != 0
|
||||
halt 401 if not BeEF::Core::Rest.timeout?('beef.restrictions.api_attempt_delay',
|
||||
time_since_last_failed_auth,
|
||||
lambda { |time| time_since_last_failed_auth = time})
|
||||
end
|
||||
|
||||
headers 'Content-Type' => 'application/json; charset=UTF-8',
|
||||
'Pragma' => 'no-cache',
|
||||
'Cache-Control' => 'no-cache',
|
||||
@@ -46,6 +56,9 @@ module BeEF
|
||||
# check username and password
|
||||
if not (data['username'].eql? config.get('beef.credentials.user') and data['password'].eql? config.get('beef.credentials.passwd') )
|
||||
BeEF::Core::Logger.instance.register('Authentication', "User with ip #{request.ip} has failed to authenticate in the application.")
|
||||
|
||||
# failed attempts
|
||||
time_since_last_failed_auth = Time.now()
|
||||
halt 401
|
||||
else
|
||||
{ "success" => true,
|
||||
@@ -62,4 +75,4 @@ module BeEF
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ module BeEF
|
||||
module Extension
|
||||
module AdminUI
|
||||
module API
|
||||
|
||||
|
||||
#
|
||||
# We use this module to register all the http handler for the Administrator UI
|
||||
#
|
||||
@@ -31,7 +31,7 @@ module API
|
||||
js_files = ""
|
||||
|
||||
#NOTE: order counts! make sure you know what you're doing if you add files
|
||||
esapi = %w(esapi/Class.create.js esapi/jquery-1.12.4.min.js esapi/jquery-encoder-0.1.0.js)
|
||||
esapi = %w(esapi/Class.create.js esapi/jquery-3.3.1.min.js esapi/jquery-encoder-0.1.0.js)
|
||||
ux = %w(ui/common/beef_common.js ux/PagingStore.js ux/StatusBar.js ux/TabCloseMenu.js)
|
||||
panel = %w(ui/panel/common.js ui/panel/DistributedEngine.js ui/panel/PanelStatusBar.js ui/panel/tabs/ZombieTabDetails.js ui/panel/tabs/ZombieTabLogs.js ui/panel/tabs/ZombieTabCommands.js ui/panel/tabs/ZombieTabRider.js ui/panel/tabs/ZombieTabXssRays.js wterm/wterm.jquery.js ui/panel/tabs/ZombieTabIpec.js ui/panel/tabs/ZombieTabAutorun.js ui/panel/PanelViewer.js ui/panel/DataGrid.js ui/panel/MainPanel.js ui/panel/ZombieTab.js ui/panel/ZombieTabs.js ui/panel/zombiesTreeList.js ui/panel/ZombiesMgr.js ui/panel/tabs/ZombieTabNetwork.js ui/panel/tabs/ZombieTabRTC.js ui/panel/Logout.js ui/panel/WelcomeTab.js ui/panel/ModuleSearching.js)
|
||||
|
||||
@@ -81,7 +81,7 @@ module API
|
||||
mod_name = File.basename http_module, '.rb'
|
||||
beef_server.mount("#{bp}/#{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/'
|
||||
beef_server.mount("#{bp}/media", Rack::File.new(media_dir))
|
||||
|
||||
@@ -12,33 +12,33 @@ module Controllers
|
||||
# The authentication web page for BeEF.
|
||||
#
|
||||
class Authentication < BeEF::Extension::AdminUI::HttpController
|
||||
|
||||
|
||||
#
|
||||
# Constructor
|
||||
#
|
||||
def initialize
|
||||
super({
|
||||
'paths' => {
|
||||
'/' => method(:index),
|
||||
'/' => method(:index),
|
||||
'/login' => method(:login),
|
||||
'/logout' => method(:logout)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@session = BeEF::Extension::AdminUI::Session.instance
|
||||
end
|
||||
|
||||
|
||||
# Function managing the index web page
|
||||
def index
|
||||
def index
|
||||
@headers['Content-Type']='text/html; charset=UTF-8'
|
||||
@headers['X-Frame-Options']='sameorigin'
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Function managing the login
|
||||
#
|
||||
def login
|
||||
|
||||
|
||||
username = @params['username-cfrm'] || ''
|
||||
password = @params['password-cfrm'] || ''
|
||||
config = BeEF::Core::Configuration.instance
|
||||
@@ -46,54 +46,52 @@ class Authentication < BeEF::Extension::AdminUI::HttpController
|
||||
@headers['X-Frame-Options']='sameorigin'
|
||||
ua_ip = @request.ip # get client ip address
|
||||
@body = '{ success : false }' # attempt to fail closed
|
||||
|
||||
|
||||
# check if source IP address is permited to authenticate
|
||||
if not permited_source?(ua_ip)
|
||||
BeEF::Core::Logger.instance.register('Authentication', "IP source address (#{@request.ip}) attempted to authenticate but is not within permitted subnet.")
|
||||
return
|
||||
end
|
||||
|
||||
# check if under brute force attack
|
||||
time = Time.new
|
||||
if not timeout?(time)
|
||||
@session.set_auth_timestamp(time)
|
||||
return
|
||||
end
|
||||
|
||||
# check if under brute force attack
|
||||
return if not BeEF::Core::Rest.timeout?('beef.extension.admin_ui.login_fail_delay',
|
||||
@session.get_auth_timestamp(),
|
||||
lambda { |time| @session.set_auth_timestamp(time)})
|
||||
|
||||
# check username and password
|
||||
if not (username.eql? config.get('beef.credentials.user') and password.eql? config.get('beef.credentials.passwd') )
|
||||
BeEF::Core::Logger.instance.register('Authentication', "User with ip #{@request.ip} has failed to authenticate in the application.")
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
# establish an authenticated session
|
||||
|
||||
# set up session and set it logged in
|
||||
@session.set_logged_in(ua_ip)
|
||||
|
||||
# create session cookie
|
||||
@session.set_logged_in(ua_ip)
|
||||
|
||||
# create session cookie
|
||||
session_cookie_name = config.get('beef.http.session_cookie_name') # get session cookie name
|
||||
Rack::Utils.set_cookie_header!(@headers, session_cookie_name, {:value => @session.get_id, :path => "/", :httponly => true})
|
||||
|
||||
|
||||
BeEF::Core::Logger.instance.register('Authentication', "User with ip #{@request.ip} has successfully authenticated in the application.")
|
||||
@body = "{ success : true }"
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Function managing the logout
|
||||
#
|
||||
def logout
|
||||
|
||||
|
||||
# test if session is unauth'd
|
||||
(print_error "invalid nonce";return @body = "{ success : true }") if not @session.valid_nonce?(@request)
|
||||
(print_error "invalid session";return @body = "{ success : true }") if not @session.valid_session?(@request)
|
||||
|
||||
|
||||
@headers['Content-Type']='application/json; charset=UTF-8'
|
||||
@headers['X-Frame-Options']='sameorigin'
|
||||
|
||||
|
||||
# set the session to be log out
|
||||
@session.set_logged_out
|
||||
|
||||
|
||||
# clean up UA and expire the session cookie
|
||||
config = BeEF::Core::Configuration.instance
|
||||
session_cookie_name = config.get('beef.http.session_cookie_name') # get session cookie name
|
||||
@@ -101,14 +99,14 @@ class Authentication < BeEF::Extension::AdminUI::HttpController
|
||||
|
||||
BeEF::Core::Logger.instance.register('Authentication', "User with ip #{@request.ip} has successfully logged out.")
|
||||
@body = "{ success : true }"
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# Check the UI browser source IP is within the permitted subnet
|
||||
#
|
||||
def permited_source?(ip)
|
||||
# get permitted subnet
|
||||
# get permitted subnet
|
||||
config = BeEF::Core::Configuration.instance
|
||||
permitted_ui_subnet = config.get('beef.restrictions.permitted_ui_subnet')
|
||||
target_network = IPAddr.new(permitted_ui_subnet)
|
||||
@@ -117,18 +115,7 @@ class Authentication < BeEF::Extension::AdminUI::HttpController
|
||||
# test if ip within subnet
|
||||
return target_network.include?(ip)
|
||||
end
|
||||
|
||||
#
|
||||
# Brute Force Mitigation
|
||||
# Only one login request per login_fail_delay seconds
|
||||
#
|
||||
def timeout?(time)
|
||||
config = BeEF::Core::Configuration.instance
|
||||
login_fail_delay = config.get('beef.extension.admin_ui.login_fail_delay') # get fail delay
|
||||
|
||||
# test if the last login attempt was less then login_fail_delay seconds
|
||||
time - @session.get_auth_timestamp > login_fail_delay.to_i
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
extensions/admin_ui/media/javascript/esapi/jquery-3.3.1.min.js
vendored
Normal file
2
extensions/admin_ui/media/javascript/esapi/jquery-3.3.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -10,18 +10,18 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>The Butcher</title>
|
||||
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="butch.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script src="jquery-1.12.4.min.js"></script>
|
||||
<script src="jquery-3.3.1.min.js"></script>
|
||||
<script>
|
||||
|
||||
function showfriends() {
|
||||
$("#hamper").hide();
|
||||
$("#friends").show();
|
||||
}
|
||||
|
||||
|
||||
function showHamper() {
|
||||
$("#friends").hide();
|
||||
$("#hamper").show();
|
||||
|
||||
@@ -9,7 +9,7 @@ beef:
|
||||
enable: false
|
||||
name: 'Evasion'
|
||||
authors: ["antisnatchor"]
|
||||
exclude_core_js: ["lib/jquery-1.12.4.min.js", "lib/json2.js", "lib/jools.min.js", "lib/mdetect.js"]
|
||||
exclude_core_js: ["lib/jquery-3.3.1.min.js", "lib/json2.js", "lib/jools.min.js", "lib/mdetect.js"]
|
||||
scramble_variables: true
|
||||
scramble_cookies: true
|
||||
scramble:
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
# Ensure that the IP address supplied to Metasploit with the 'ServerHost'
|
||||
# parameter is the same IP address as specified in beef.extension.metasploit.host
|
||||
#
|
||||
#
|
||||
# Ensure that the IP address specified in beef.extension.metasploit.callback_host
|
||||
# is the publicly accessible IP address for victim connections to Metasploit.
|
||||
|
||||
@@ -37,7 +37,7 @@ beef:
|
||||
# Start msfrpcd automatically with BeEF
|
||||
auto_msfrpcd: false
|
||||
auto_msfrpcd_timeout: 120
|
||||
msf_path: [
|
||||
msf_path: [
|
||||
{os: 'osx', path: '/opt/local/msf/'},
|
||||
{os: 'livecd', path: '/opt/metasploit-framework/'},
|
||||
{os: 'bt5r3', path: '/opt/metasploit/msf3/'},
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
module BeEF
|
||||
module Extension
|
||||
module Metasploit
|
||||
|
||||
|
||||
extend BeEF::API::Extension
|
||||
|
||||
@short_name = 'msf'
|
||||
@@ -26,7 +26,7 @@ module Metasploit
|
||||
v['value'] = v['default'] if k != "URIPATH"
|
||||
v['value'] = BeEF::Core::Configuration.instance.get('beef.extension.metasploit.callback_host') if k == "LHOST"
|
||||
|
||||
|
||||
|
||||
when "bool"
|
||||
v['type'] = 'checkbox'
|
||||
when "enum"
|
||||
@@ -56,16 +56,16 @@ module Metasploit
|
||||
defaultPayload = 'generic/shell_bind_tcp' if values.include? 'generic/shell_bind_tcp'
|
||||
|
||||
if values.length > 0
|
||||
return {
|
||||
'name' => 'PAYLOAD',
|
||||
'type' => 'combobox',
|
||||
'ui_label' => 'Payload',
|
||||
return {
|
||||
'name' => 'PAYLOAD',
|
||||
'type' => 'combobox',
|
||||
'ui_label' => 'Payload',
|
||||
'store_type' => 'arraystore',
|
||||
'store_fields' => ['payload'],
|
||||
'store_fields' => ['payload'],
|
||||
'store_data' => values,
|
||||
'valueField' => 'payload',
|
||||
'displayField' => 'payload',
|
||||
'mode' => 'local',
|
||||
'valueField' => 'payload',
|
||||
'displayField' => 'payload',
|
||||
'mode' => 'local',
|
||||
'autoWidth' => true,
|
||||
'defaultPayload' => defaultPayload,
|
||||
'reloadOnChange' => true
|
||||
@@ -83,8 +83,8 @@ module Metasploit
|
||||
}
|
||||
return values
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
require_relative '../../../core/main/router/router.rb'
|
||||
#
|
||||
# Copyright (c) 2006-2018 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
|
||||
3
install
3
install
@@ -16,7 +16,7 @@ fatal() { echo -e "\\033[1;31m[FATAL]\\033[0m $*"; exit 1 ; }
|
||||
|
||||
command_exists () {
|
||||
|
||||
command -v "${1}" /dev/null 2&>1
|
||||
command -v "$1" /dev/null 2&>/dev/null
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ install_linux () {
|
||||
|
||||
|
||||
install_mac () {
|
||||
# brew install ...
|
||||
echo
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
class Fake_evernote_clipper < BeEF::Core::Command
|
||||
|
||||
|
||||
def pre_send
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/social_engineering/fake_evernote_clipper/login.html','/ev/login','html')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/social_engineering/fake_evernote_clipper/login.css','/ev/login','css')
|
||||
@@ -14,15 +14,15 @@ class Fake_evernote_clipper < BeEF::Core::Command
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/social_engineering/fake_evernote_clipper/evernote_web_clipper.png','/ev/evernote_web_clipper','png')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/social_engineering/fake_evernote_clipper/GothamSSm-Medium.otf','/ev/GothamSSm-Medium','otf')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/social_engineering/fake_evernote_clipper/GothamSSm-Bold.otf','/ev/GothamSSm-Bold','otf')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/core/main/client/lib/jquery-1.12.4.min.js','/ev/jquery','js')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/core/main/client/lib/jquery-3.3.1.min.js','/ev/jquery','js')
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# This method is being called when a zombie sends some
|
||||
# data back to the framework.
|
||||
#
|
||||
def post_execute
|
||||
if (@datastore['meta'] == "KILLFRAME")
|
||||
if (@datastore['meta'] == "KILLFRAME")
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/ev/login.html')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/ev/login.css')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/ev/clipboard.png')
|
||||
@@ -37,5 +37,5 @@ class Fake_evernote_clipper < BeEF::Core::Command
|
||||
content['result'] = @datastore['result']
|
||||
save content
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -4,31 +4,31 @@
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
class Fake_lastpass < BeEF::Core::Command
|
||||
|
||||
|
||||
def pre_send
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/core/main/client/lib/jquery-1.12.4.min.js','/lp/jquery','js')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/core/main/client/lib/jquery-3.3.1.min.js','/lp/jquery','js')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/social_engineering/fake_lastpass/index-new.html','/lp/index','html')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/social_engineering/fake_lastpass/lp_signin_logo.png','/lp/lp_signin_logo','png')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/social_engineering/fake_lastpass/cancel.png','/lp/cancel','png')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/social_engineering/fake_lastpass/keyboard.png','/lp/keyboard','png')
|
||||
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# This method is being called when a zombie sends some
|
||||
# data back to the framework.
|
||||
#
|
||||
def post_execute
|
||||
if (@datastore['meta'] == "KILLFRAME")
|
||||
if (@datastore['meta'] == "KILLFRAME")
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/lp/index.html')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/lp/jquery.js')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/lp/lp_signin_logo.png')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/lp/cancel.png')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/lp/keyboard.png')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/lp/jquery.js')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/lp/lp_signin_logo.png')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/lp/cancel.png')
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/lp/keyboard.png')
|
||||
end
|
||||
content = {}
|
||||
content['result'] = @datastore['result']
|
||||
save content
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
73
test/api/1333_auth_rate.rb
Normal file
73
test/api/1333_auth_rate.rb
Normal file
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# Copyright (c) 2006-2017 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
require 'test/unit'
|
||||
|
||||
#require 'pry-byebug'
|
||||
require 'rest-client'
|
||||
require 'json'
|
||||
require 'optparse'
|
||||
require 'pp'
|
||||
|
||||
require '../common/test_constants'
|
||||
require_relative './lib/beef_rest_client'
|
||||
|
||||
class TC_1333_auth_rate < Test::Unit::TestCase
|
||||
|
||||
def test_auth_rate
|
||||
# tests rate of auth calls
|
||||
# this takes some time - with no output
|
||||
# beef must be running
|
||||
|
||||
passwds = (1..9).map { |i| "broken_pass"}
|
||||
passwds.push BEEF_PASSWD
|
||||
apis = passwds.map { |pswd| BeefRestClient.new('http', ATTACK_DOMAIN, '3000', BEEF_USER, pswd) }
|
||||
l = apis.length
|
||||
|
||||
# t0 = Time.now()
|
||||
|
||||
|
||||
(0..2).each do |again| # multiple sets of auth attempts
|
||||
# first pass -- apis in order, valid passwd on 9th attempt
|
||||
# subsequent passes apis shuffled
|
||||
|
||||
# puts "speed requesets" # all should return 401
|
||||
(0..50).each do |i|
|
||||
# t = Time.now()
|
||||
# puts "#{i} : #{t - t0} : #{apis[i%l].auth()[:payload]}"
|
||||
|
||||
test_api = apis[i%l]
|
||||
assert_match("401", test_api.auth()[:payload]) # all (unless the valid is first 1 in 10 chance)
|
||||
|
||||
# t0 = t
|
||||
end
|
||||
|
||||
# again with more time between calls -- there should be success (1st iteration)
|
||||
# puts "delayed requests"
|
||||
(0..(l*2)).each do |i|
|
||||
# t = Time.now()
|
||||
# puts "#{i} : #{t - t0} : #{apis[i%l].auth()[:payload]}"
|
||||
|
||||
test_api = apis[i%l]
|
||||
if (test_api.is_pass?(BEEF_PASSWD))
|
||||
assert(test_api.auth()[:payload]["success"]) # valid pass should succeed
|
||||
else
|
||||
assert_match("401", test_api.auth()[:payload])
|
||||
end
|
||||
|
||||
sleep(0.5)
|
||||
# t0 = t
|
||||
end
|
||||
|
||||
apis.shuffle! # new order for next iteration
|
||||
apis.reverse if (apis[0].is_pass?(BEEF_PASSWD)) # prevent the first from having valid passwd
|
||||
|
||||
end # multiple sets of auth attempts
|
||||
|
||||
end # test_auth_rate
|
||||
|
||||
|
||||
end
|
||||
49
test/api/lib/beef_rest_client.rb
Normal file
49
test/api/lib/beef_rest_client.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# Copyright (c) 2006-2017 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
# less noisy verson of BeeRestAPI found in tools.
|
||||
class BeefRestClient
|
||||
def initialize proto, host, port, user, pass
|
||||
@user = user
|
||||
@pass = pass
|
||||
@url = "#{proto}://#{host}:#{port}/api/"
|
||||
@token = nil
|
||||
end
|
||||
|
||||
|
||||
def is_pass?(passwd)
|
||||
@pass == passwd
|
||||
end
|
||||
|
||||
|
||||
def auth
|
||||
begin
|
||||
response = RestClient.post "#{@url}admin/login",
|
||||
{ 'username' => "#{@user}",
|
||||
'password' => "#{@pass}" }.to_json,
|
||||
:content_type => :json,
|
||||
:accept => :json
|
||||
result = JSON.parse(response.body)
|
||||
@token = result['token']
|
||||
{:success => result['success'], :payload => result}
|
||||
rescue => e
|
||||
{:success => false, :payload => e.message }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def version
|
||||
return {:success => false, :payload => 'no token'} if @token.nil?
|
||||
begin
|
||||
response = RestClient.get "#{@url}server/version", {:params => {:token => @token}}
|
||||
result = JSON.parse(response.body)
|
||||
|
||||
{:success => result['success'], :payload => result}
|
||||
rescue => e
|
||||
print_error "Could not retrieve BeEF version: #{e.message}"
|
||||
{:success => false, :payload => e.message}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -12,8 +12,8 @@ ATTACK_URL = "http://" + ATTACK_DOMAIN + ":3000/ui/panel"
|
||||
VICTIM_URL = "http://" + VICTIM_DOMAIN + ":3000/demos/basic.html"
|
||||
|
||||
# Credentials
|
||||
BEEF_USER = "beef"
|
||||
BEEF_PASSWD = "test"
|
||||
BEEF_USER = ENV["TEST_BEEF_USER"] || 'beef'
|
||||
BEEF_PASSWD = ENV["TEST_BEEF_PASS"] || "beef"
|
||||
|
||||
# RESTful API root endpoints
|
||||
RESTAPI_HOOKS = "http://" + ATTACK_DOMAIN + ":3000/api/hooks"
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#
|
||||
|
||||
# @note Version check to ensure BeEF is running Ruby 2.0+
|
||||
if RUBY_VERSION < '2.2'
|
||||
if RUBY_VERSION < '2.3'
|
||||
puts "\n"
|
||||
puts "Ruby version #{RUBY_VERSION} is no longer supported. Please upgrade to Ruby version 2.2 or later."
|
||||
puts "Ruby version #{RUBY_VERSION} is no longer supported. Please upgrade to Ruby version 2.3 or later."
|
||||
puts "\n"
|
||||
exit 1
|
||||
end
|
||||
|
||||
@@ -76,7 +76,7 @@ class TC_Login < Test::Unit::TestCase
|
||||
|
||||
attacker.should have_content(VICTIM_DOMAIN)
|
||||
attacker.should have_content('127.0.0.1')
|
||||
attacker.click_on('127.0.0.1')
|
||||
attacker.click_on("127.0.0.1", match: :first)
|
||||
|
||||
sleep 1.0
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ require './tc_debug_modules' # RESTful API tests (as well as debug modules)
|
||||
require './tc_login' # Basic log in and log out tests
|
||||
require './tc_proxy' # Basic tests for Proxy extension
|
||||
require './tc_network_rest' # Basic tests for Network extension RESTful API interface
|
||||
require '../api/1333_auth_rate' # API rate testing issue #1333'
|
||||
|
||||
# Experimental extensions
|
||||
#require './tc_jools' # Basic tests for jools
|
||||
@@ -34,6 +35,9 @@ class TS_BeefIntegrationTests
|
||||
suite << TC_Proxy.suite
|
||||
suite << TC_NetworkRest.suite
|
||||
|
||||
# issue raised
|
||||
suite << TC_1333_auth_rate.suite
|
||||
|
||||
# Tests for experimental extensions
|
||||
#suite << TC_SocialEngineeringRest.suite
|
||||
#suite << TC_Jools.suite
|
||||
@@ -45,4 +49,3 @@ class TS_BeefIntegrationTests
|
||||
end
|
||||
|
||||
Test::Unit::UI::Console::TestRunner.run(TS_BeefIntegrationTests)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user