Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View random ngrok URL when run in background

Tags:

ngrok

When I start an ngrok client with ./ngrok tcp 22 it runs in the foreground and I can see the randoming generated forwarding URL, such as tcp://0.tcp.ngrok.io:12345 -> localhost:22.

If I run in it the background with ./ngrok tcp &, I can't find any way to see the forwarding URL. How can I run ngrok in the background and still see the URL?

like image 212
Julia Ebert Avatar asked Dec 16 '15 22:12

Julia Ebert


People also ask

How do I find my Ngrok URL?

On your server, open the Administration area of Digital Assistant, by navigating to http://localhost/Admin/. Go to Settings → Global and under Base URL enter the ServerPublicURL determined by ngrok.


2 Answers

There are a couple of ways.

You can either:

1) Visit localhost:4040/status in your browser to see a bunch of information, or

2) Use curl to hit the API: localhost:4040/api/tunnels

like image 57
Abe Petrillo Avatar answered Sep 21 '22 01:09

Abe Petrillo


This little Python (2.7) script will call the ngrok API and print the current URL's:

import json import os   os.system("curl  http://localhost:4040/api/tunnels > tunnels.json")  with open('tunnels.json') as data_file:         datajson = json.load(data_file)   msg = "ngrok URL's: \n' for i in datajson['tunnels']:   msg = msg + i['public_url'] +'\n'  print (msg) 
like image 21
Gerard Avatar answered Sep 21 '22 01:09

Gerard