mirror of https://github.com/Box-boi/vubuntu.git
added NGROK_REGION env
This commit is contained in:
parent
8c892aea01
commit
dede11f84b
|
|
@ -24,7 +24,8 @@ ENV VNC_PASS="samplepass" \
|
||||||
#Ngrok Specific
|
#Ngrok Specific
|
||||||
NGROK_BINDTLS=1 \
|
NGROK_BINDTLS=1 \
|
||||||
NGROK_METHOD=tcp \
|
NGROK_METHOD=tcp \
|
||||||
NGROK_PORT=5900
|
NGROK_PORT=5900 \
|
||||||
|
NGROK_REGION="in"
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,34 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from pyngrok import ngrok, conf
|
from pyngrok import ngrok, conf
|
||||||
except:
|
except:
|
||||||
os.system('pip3 install pyngrok')
|
os.system('pip3 install pyngrok')
|
||||||
from pyngrok import ngrok, conf
|
from pyngrok import ngrok, conf
|
||||||
|
|
||||||
try:
|
try:
|
||||||
AUTH_TOKEN=os.environ['NGROK_AUTH_TOKEN']
|
AUTH_TOKEN=os.environ['NGROK_AUTH_TOKEN']
|
||||||
except:
|
except:
|
||||||
print('[!] Ngrok token not found, assign the token to NGROK_AUTH_TOKEN environment variable & try again.\n[-] Terminating...')
|
print('[-] Ngrok token not found, assign the token to NGROK_AUTH_TOKEN environment variable & try again.\n[-] Terminating...')
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
ngrok.set_auth_token(AUTH_TOKEN)
|
ngrok.set_auth_token(AUTH_TOKEN)
|
||||||
conf.get_default().region = "in"
|
|
||||||
|
if "NGROK_REGION" in os.environ:
|
||||||
|
conf.get_default().region = os.environ['NGROK_REGION']
|
||||||
|
else:
|
||||||
|
print("[!] NGROK_REGION unset, defaulting ngrok location to India.")
|
||||||
|
conf.get_default().region = "in"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
primary_tunnel = ngrok.connect(os.environ['NGROK_PORT'], os.environ['NGROK_METHOD'], bind_tls=bool(int(os.getenv('NGROK_BINDTLS', 1))))
|
primary_tunnel = ngrok.connect(os.environ['NGROK_PORT'], os.environ['NGROK_METHOD'], bind_tls=bool(int(os.getenv('NGROK_BINDTLS', 1))))
|
||||||
except:
|
except:
|
||||||
print('[!] NGROK_PORT or NGROK_METHOD environment variables has not been set properly, NGROK_METHOD should be http or tcp')
|
print('[-] NGROK_PORT or NGROK_METHOD environment variables has not been set properly, NGROK_METHOD should be http or tcp')
|
||||||
|
|
||||||
url=primary_tunnel.public_url
|
url=primary_tunnel.public_url
|
||||||
|
|
||||||
print(f'[>NGROK]: {url}')
|
print(f'[>NGROK]: {url}')
|
||||||
|
|
||||||
input()
|
input()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue