How to Inject Coinhive Miner into WiFi Network users using Bettercap


Coinhive is a most popular crypto network that offers it’s users to mine just with javascript. Users can insert this javascript wherever they want and mine Monero. Attacker use this java script to mine Monero by Injecting them into Public WiFi networks or by creating a rogue access point themselves. Hackers use automated tools inject their own javascript in the websites which his victim visit.

Whatever the site the victim visits, it will have the attackers js code embed into it. The general function of this javascript is to suck the CPU power of the users and make use of it for mining crypto currency. In this tutorial, let’s have a look on how hackers inject their JS code in to the websites that victim’s visit using a tool called Bettercap.

Warning : All the contents portrayed here are for educational purposes only

Inject Coinhive Miner into WiFi Network users using Bettercap :

Before we get started, lets have a look at the pre requisites for this tutorial

  • Kali Linux
  • Bettercap 1.6 (Bettercap 2.0 is not supported)
  • To install bettercap in linux, type
    apt-get install bettercap    
  • CoinHive Account
  • Victim’s Ip ( Scan using nmap or ettercap to find)

That’s it. Now if you have all the above, then lets begin.

  • Login to your CoinHive account
coinhive dashboard
coinhive dashboard
  • Head over to Settings and copy your API key
  • Create a File named JSMiner.html and paste the source code as show below along with your API key in the file
miner source code
miner source code
  • Save the file and open “Bettercap”
  • Type ” bettercap -I wlan0 -T <victim’s IP> –proxy-module injecthtml –html-file JSMiner.html


  • Run the command
bettercap on action
bettercap on action
  • Now all the websites that your victim visits will have your JS code embed.
  • This JS code will suck his CPU gradually and mine Monero.

You can view the working stats in your Coinhive Dashboard along with number of hash per second. Higher the has rate, you can soon earn more Monero. The minimum payout in Coinhive is 1 Monero. You must wait until you reach that value. Do not try this on any other public wifi networks since it is illegal.


  1. Re-write your article, You are pointing people to download Bettercap 2.0 that uses .cap files instead of .rb

    Argument flags are also different as in the images and flags displayed are from bettercap 1.6 (Which is now legacy and no longer supported).

    EIther update your article or change your download link on github to reflect the legacy version of Bettercap.

    Or re-write your article.

    Our github is being spammed with questions because of your article. (Questions to why your method is not working).

    Please fix or remove my github link.

    Thank you
    Evil Socket

    • Thanks Evil Socket for notifying us. We have removed the link which was pointing to your Github repo 🙂
      Adithyan AK


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.