How to Install & Use Ngrok on Kali Linux

How to Install & Use Ngrok on Kali Linux

September 28, 2021

What is Ngrok ?

Ngrok is a multi-platform application that provides us to forward our local development server to the internet without port forwarding. Ngrok hosts our locally hosted web server in to a subdomain of ngrok.com. That means we can easily show our localhost in the internet without owning domain names/static IP or port forwarding.

Ngrok is a very good tool for the developers to check and show the projects to the clients before launching the project. But as everything it also be misused by the bad guys. They always trying to host their localhost phishing page on Ngrok to capture victims on the internet. So as a cybersecurity expert we need to look up on this Ngrok.

How to install ngrok on Kali  Linux

Warning:- Learning is the most beneficial way to protect everyone in the cybersecurity field, so our this article will focus on educational things. Ngrok is like a knife, knife is created for helping people to cut vegetables, but bad guys misuse it. Same for Ngrok also, it is created to help developers but bad guys misuse it. So don’t try to misuse it against anyone. We will not responsible for that.

Download & Configure Ngrok on Kali Linux

To install Ngrok on our Kali Linux system we need to open our browser and navigate to the official Ngrok’s download page. Then we can see the webpage like the following screenshot:

ngrok download page

Here we need to click on “Download for Linux”, because we are using Linux. For other OS we can go on the “More Options”. After clicking on download we can see that download is started.

download ngrok

After download the starting it may not take much time with decent internet. The ZIP file will be downloaded on our “Downloads” directory. We need to go to the “Downloads” directory and decompress the compressed file.

We open the terminal and use following command to go to our “Downloads” directory.

cd Downloads

Then we unzip the downloaded ZIP file by using following command:

unzip ngrok-stable*zip

In the following screenshot we can see that our zip compressed file is extracted.

ngrok zip extracting

Now our ngrok file is decompressed. Before running it we need to give it executable permission by using following command:

chmod +x ngrok
executable permission ngrok

Now we are all set to run. But wait, we need to setup Ngrok before running. We need to set authentication with Ngrok API token. Where I can get my token? Well for that we need to sign up on Ngrok website. Lets navigate to Ngrok signup page on our browser.

ngrok signup page

Here we need to fill up our name and email and choose a password. If we want we can use disposable mail address to login and verify our mail address we don’t need to give our own mail address.

logged in on ngrok

After verifying our mail address we can get the API token on the “Your Authentication” area on the sidebar, as we can see in the following screenshot:

ngrok authentication command

In the above screenshot we can see our Ngrok authentication API key and the command to set it up. For security we had hided a part of our API keys. So we run the command with API key to set up the Ngrok.

./ngrok authtoken 1xyqb*****************25PTTHqMpHqB

In the above command again we hided our the same API key with *. In the following screenshot we can see the output of the command:

ngrok authentication command

Now we are all set to run Ngrok. For an example we forward a locally hosted demo website to the internet.

Using Ngrok on Kali Linux

Ngrok’s work is simple it just host our local website to internet. So first we need a local website. Here we have a demo html page on our desktop, and we had opened it on Firefox browser.

website demo

But it is just a html page we need to host it locally. For that, we need to run a localhost server on our desktop. We open another terminal and go to the directory where our html page is stored. Then run python localhost server there to host the html page on our localhost by using following command:

sudo python3 -m http.server 80

In the following screenshot we can see that our local web server is started:

python3 http server

Now we can check it by opening our localhost IP on our browser 127.0.0.1. In the following screenshot we can see that page is now accessible by using our local host IP (127.0.0.1).

localhost server is started

Now this is accessible from our computer by using localhost IP (127.0.0.1), and from devices on the same network by using our Local IP (IP assigned by router for our Kali Linux system). But it isn’t available for other network, because this web server isn’t hosted on internet.

Now we leave our web host terminal as it is, and back to our previous terminal window (where we setup Ngrok), and run the following command to run Ngrok:

./ngrok http 80

Here we run the Ngrok script on http with port number 80, because our localhost server is running on port 80. (If we can’t use the localhost port 80 then we can use other ports like 8080 or 8888, in that case we need to specify our that port on Ngrok).

After that we can see our Ngrok is started as we can see in the following screenshot:

ngrok is running

In the above screenshot we can see our forwarding link. Using that forwarding link (in actual links both http and https) we can see our that page from our browser.

ngrok forwards our localhost site on the internet

Not only from our browser we can access it from anywhere on the internet by the link provided by Ngrok.

Ngrok site on Mobile

We can see that page on our mobile which is connected to mobile data (not in our WiFi network). This link will be active until we don’t close the Ngrok tunnel, but in real life uses Ngrok can’t run this for a long time in their free plan. It can be a temporary solution.

This is how we can use Ngrok on Kali Linux, this is the solution for hosting our local website or web server on the internet. Here we don’t need a static IP address neither requires port forwarding.

Love our articles? Make sure to follow us on Twitter and GitHub, we post article updates there. To join our KaliLinuxIn family, join our Telegram Group. We are trying to build a community for Linux and Cybersecurity. For anything we always happy to help everyone on the comment section. As we know our comment section is always open to everyone. We read each and every comment and we always reply.

Article posted by: https://www.kalilinux.in/2021/09/how-to-install-ngrok-on-kali-linux.html
——————————————————————————————————————–
Infocerts, 5B 306 Riverside Greens, Panvel, Raigad 410206 Maharashtra, India
Contact us – https://www.infocerts.com

This is the article generated by feed coming from KaliLinux.in and Infocerts is only displaying the content.

Open Whatsapp chat
Whatsapp Us
Chat with us for faster replies.