diff --git a/arerules/enabled/lan_port_scan.json b/arerules/enabled/lan_port_scan.json new file mode 100644 index 000000000..ac4f0e782 --- /dev/null +++ b/arerules/enabled/lan_port_scan.json @@ -0,0 +1,25 @@ +{"name": "LAN Port Scan", + "author": "aburro & aussieklutz", + "browser": "ALL", + "browser_version": "ALL", + "os": "ALL", + "os_version": "ALL", + "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":"<>", + #"port":"80,8080" + } + } + ], + "execution_order": [0, 1], + "execution_delay": [0, 0], + "chain_mode": "nested-forward" +} diff --git a/core/main/rest/handlers/hookedbrowsers.rb b/core/main/rest/handlers/hookedbrowsers.rb index 9c2add985..0c51f134e 100644 --- a/core/main/rest/handlers/hookedbrowsers.rb +++ b/core/main/rest/handlers/hookedbrowsers.rb @@ -22,6 +22,7 @@ module BeEF # # @note Get online and offline hooked browsers details (like name, version, os, ip, port, ...) + # When websockets are enabled this will allow the ws_poll_timeout config to be used to check if the browser is online or not. # get '/' do if config.get('beef.http.websocket.enable') == false @@ -35,6 +36,13 @@ module BeEF offline_hooks = hb_to_json(BeEF::Core::Models::HookedBrowser.where('lastseen <= ?', (Time.new.to_i - timeout))) end + else + timeout = (config.get('beef.http.websocket.ws_poll_timeout').to_i / 1000) + 5 + online_hooks = hb_to_json(BeEF::Core::Models::HookedBrowser.where('lastseen >= ?', (Time.new.to_i - timeout))) + offline_hooks = hb_to_json(BeEF::Core::Models::HookedBrowser.where('lastseen <= ?', (Time.new.to_i - timeout))) + end + +>>>>>>> 6ebb8a0e04541f26c0aeb5f9034b7c99695c6ddd output = { 'hooked-browsers' => { 'online' => online_hooks,