What is ngrok?
Ngrok is a reverse proxy that creates a secure tunnel from a public endpoint to a locally running web service. Ngrok captures and analyzes all traffic over the tunnel for later inspection and replay.
What can I do with ngrok?
- Expose HTTP services: Expose any HTTP service behind a NAT or firewall to the internet on a subdomain of ngrok.com
- Expose TCP services: Expose any TCP service behind a NAT or firewall to the internet on a random port of ngrok.com
- Inspect traffic: Inspect all HTTP requests/responses that are transmitted over the tunnel
- Replay requests: Replay any request that was transmitted over the tunnel
What is ngrok useful for?
- Development sharing: Temporarily sharing a website that is only running on your development machine
- Demo purposes: Demoing an app at a hackathon without deploying
- Webhook development: Developing any services which consume webhooks (HTTP callbacks) by allowing you to replay those requests
- Debugging: Debugging and understanding any web service by inspecting the HTTP traffic
- Bypassing firewalls: Running networked services on machines that are firewalled off from the internet
Steps to Install ngrok
Step 1: Create Account
- Go to ngrok.com
- Click on signup and signup by filling your details
- Alternatively, if you have GitHub or Google account, you can sign in using those
Step 2: Download ngrok
- After signup, you will see your dashboard
- Scroll down a little bit and you will see the download option
- Download the ZIP file and extract it to your main storage section
- Copy the Authtoken provided in your dashboard
Step 3: Install in Termux
Open Termux and execute the following commands:
$ apt-get update && upgrade // To update and upgrade Termux to latest version
$ ls // It will list all the files (directories)
$ termux-setup-storage // It will show a popup to get access to your storage - allow it
$ cd /sdcard // Change directory to sdcard
$ ls // You will see the file which you extracted on your storage
$ cp ngrok $HOME // This will copy the file to your Termux storage
$ ls
$ chmod +x ngrok // It will make the file executable
$ ls
Now you will see ngrok is in green color, which means it has been changed to an executable file.
Step 4: Authenticate ngrok
Now in order to run it, you will have to verify its Authtoken. Use the Authtoken which you copied from your dashboard:
$ ./ngrok authtoken YOUR_AUTHTOKEN_HERE
Paste the Authtoken and press enter.
Step 5: Run ngrok
Important: Before running ngrok, turn your hotspot on. Just turn it on or else it will not work.
$ ls
$ ./ngrok http 8080
Then press enter.
Now you will see it is successfully executed and you can see your status as online.
Note: Your data and hotspot both need to be active in order to achieve this.
Understanding ngrok’s Importance
I know you all will be thinking “what is its use? It does nothing.”
But let me tell you – it is one of the most essential tools of Termux and is going to help us a lot in the hacks we are going to perform in the coming lessons.
So don’t worry if you have installed it, you can relax and take a break because from now the real fun is going to start and you are going to enjoy a lot.
Troubleshooting
In case you are not able to install ngrok, don’t worry – just contact me and I will help you.
Key Features of ngrok
- Secure tunneling: Creates HTTPS tunnels to your local services
- Traffic inspection: Web interface to inspect all HTTP traffic
- Request replay: Ability to replay any captured request
- Custom domains: Option to use custom domains (paid feature)
- Authentication: Built-in authentication options
- Load balancing: Distribute traffic across multiple local services
Common Use Cases
- Local development: Test webhooks from external services
- Mobile app testing: Test apps against local backend services
- Client demos: Show work-in-progress to clients without deployment
- IoT development: Connect IoT devices to cloud services during development
- API testing: Test third-party integrations locally
See you in the next lesson!
Final Words
So folks, thanks for visiting our blog. I hope you find our article about ngrok installation helpful for you. Please share and comment your thoughts about this article and keep visiting to get hacking and gaming tools and news for free. Thank you!