Ngrok: Make Your Localhost Accessible from anywhere

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys and welcome to hack explorer in today's episode we are going to look at a method to connect your computer at your home from anywhere in the world yes by using a tool called ngrok which is very easy to use so continue watching and welcome to hack explorer so let's see what ngoc is so ngrok as the definition says it exposed local servers behind nets and firewalls to the public internet over secure tunnels which means ngrok is a simple tool that actually helps you to expose yourself onto the internet securely let's see like what is exposing means so typically you will have a network like this this could be your host okay this could be a laptop or your server or your raspberry pi which is running any operating system the thing is you will be behind a router or in this case a firewall so a firewall ip usually be a net ip actually but what that means is you have a public ip exposed externally and internal ip so the mapping will be happening through net so if this client wants to connect to this host how do you configure it you have actually two options the most common options i'll just mention it over here one is port forwarding actually you have a public port open over here and a private port open here when the user connects to the public ip address this will actually map it to the local ip address that you need so just imagine you have a web server over here and you want your clients to connect that port forwarding will make sure all the web traffic will forwarded to this particular machine over here so that you actually have to configuring the router or the firewall the problem is this you could do in your home network you can go and configure your own router by reading the manual or something but you won't be able to do this in a public network or if you're in a corporate environment another option is uh if clients actually want to connect to this one they can actually use vpn services so vpn services actually as we know because we are using a lot of vpn services in this pandemic period it's like simply and install the vpn software over here and you can see you can actually connect make a connection through the vpn so whatever the service it'll be like just like the machine in your local network so you have port forwarding or vpn those were the two options so but remember the problem is we can't use this in most of the situations so how does ngrok help you so ngrok is one of the tools that you can help you in this type of situation where you want to securely expose your server or the host to the internet so remember always when you're exposing something you'll be exposing the service as i mentioned web service email service remember it'll be always some kind of a port for example if this is the service that you're going to run so this is a web server because you can see it's http so once you install the in group client ngra client will actually create a tunnel with angry.com cloud service okay so what happens here is actually once you register with the incro install and register website you will get a domain name like this and a specific port number that you want to connect to so this particular address will be actually given to this client so once the client connect to this ngrok address he'll basically connecting to our network through this tunnel so this is the secure tunnel we were talking about so ngrok is mostly used by web developers or application developers where they have a particular web service or they want to publish their demo sites to their client so they quickly register one of these things in reclined and make sure they send the client this particular ip address so they can actually check their website before they actually publish it so if you want to publish externally that's the most secure way that you can have and is this a free service yes this particular tunneling yes for one connection but if you want more connections you have to pay for that's the business model fortunately in our case we can actually use this for many options you can publish your test smtp server or if you want to make sure any port that you want our idea is we are going to like show how to expose a client into this one and get the service from there okay right so enough with the explanations now what we'll do is actually we'll go and install this client and see how it is working it's very fast it won't take this much time as the explanation to be very fast believe me so i actually have a kali running on this side so you have to visit this ngrok.com so once you first enter this site actually you have to create an account once you create account with your email address you will be landing in this page so here actually you want to run particular service so i'm going to expose this linux virtual machine into internet so you have to download the client your machine so it's supporting mac linux windows even arm distribution so this will be supporting your raspberry pi's so the best thing is if you are like running this on windows it'll be actually showing you run for windows because i'm running kali it says the client that you need these clients and you will get the steps on how to install this particular server okay so first of all we have to install it and actually connect this with our account that's how it actually maps how many connections that we have okay so i'll take my command prompt and let's me show you how to install this one so let me see where i am yeah i'm in home folder so i need to go to downloads and yeah so i have the ngrok stable file over here so it'll it's a zip file so first of all you have to do is unzip and grock okay so we have androg file over here so once you have this executable downloaded you have to do some one more small thing go here and you can see the commands already that i have given is over here and next one is you have to run this exact command on your computer uh because it's created for your account i'm going to paste the selection okay so what's token is saved actually now actually that's all with the installation two steps and you are completed now the next thing is you have to run a particular service on your computer and expose it let me show you this one so i'm going to use actually another command window and i'm going to go to the same i think i'm the home for your downloads and i'm going to create a small web server on this host machine so this command the python http so this is a very common method that you can actually create a small web server and you can just simply copy and paste if you have python it will be running page running in port 80. if you want to access this from your local machine actually you can check it if this is running correctly 127.00.1 yup i actually publish my fault and i'm exposing everything but if i go to this folder cafe this is my small website which is running so pretty small code but it can run a whole website so i can't give this to my client so i need to make sure this is exposed outside so what i'm going to do is since my web server is running from 80s so you can see there are three connections coming from 127.0.1 i'm going to use ngrok dot slash and go this is the execution method i'm going to say http protocol 080 okay once you're connected like this will show you a name that you given to your plan and this is the forwarding ip so you can see whoever is connecting to this particular domain name he'll be connecting to this particular address let's check this one so i'm copying the link address okay i'm going to paste this address over here so this is i'm trying from my host machine okay now you can see i got a connection from here and if i go here okay so my connections are working and i can see okay there are some problems where i can see stuff oh yeah it's it's actually loading one by one okay and js files yep it's loading one by one i think home will be loading again yeah it's actually loading early i actually had some connections but here you can see somebody's connecting from outside so this is the most popular way that they are using now the next important thing how do you actually run a ssh server the juicy stuff how do you connect your local machine i'm going to clear this i'm going to stop this also control c next we'll try to open ssh connection so this will be the fun part where you can actually connect your remote computer in this section we'll be opening ssh service so linux the most popular way you can use it to open ssh server in kali actually you can easily install it here actually i'm going to use the pseudo service ssh start yeah you might get this message you can say stages and you can see i'm running open bst secure sales server this should be running on port 22 okay now this one earlier you can see we use http if you are other than http if you are running any port you can actually ask the question what are the ports that you have yeah http tls okay so but if you are opening any other port you can say you have to use the port pcp so i'll just mention tcp 22. this actually what happens is you it will expose your ssh server so until this window is open your ssh connectivity will be there so if you're having a remote server or a raspberry pi or a host computer if you want to connect this is the ip that is that you have remember so this is the most popular way i connect to my raspberry pi at my home so i have something running like this and this thing is always random this because i'm using free service right so let's copy this address okay now what i'm going to do is i'm going to a copy selection user shhh client so let's get my ssh client over here so i'm actually using cmd over here you can use opensh client on windows also but this is my one of my favorite tools cmg which is the command line that is having a lot of options so ssh okay my username is kali at and this is the thing that you have to give so here actually you can't give the port number like this dash p and your port number so once you give this one yes it's asking this for my first connection and it's asking my password and i'm connected to my kali machine over the internet the idea is you just have to give your port number that you should open and make sure this is connected okay let me type my ip just to show you so it will actually show you my local ip even though i'm connected to this one because i'm inside the kali session right now so this is how you can actually connect to your localhost machine so i have android phone with net hunter installed and whenever i want to connect to that one over a public network i just turn on ngrok get my ssh uh public ip and just connect it from my local machine so i can work it in a desktop if i'm not in a wi-fi environment bi i get the same ip range so i hope you learned something from this episode and if there's any questions about this tool please post it on the comments below and yeah have fun with this tool thank you
Info
Channel: Hack eXPlorer
Views: 22,024
Rating: undefined out of 5
Keywords: #ngrok, localhost to web, ngrok, ngrok tutorial, ngrok how to, cybersecurity, reverse connection, c&c server, How to install and start Ngrok in kali linux, kali linux, ngrok on kali linux, ngrok http server, ngrok ssh server, ngrok local access, publish web server
Id: HwRnIZvNKVs
Channel Id: undefined
Length: 12min 16sec (736 seconds)
Published: Sat May 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.