Fix LocalTunnel Download (#446)

* Fixing Settings.ini

* Update .gitignore

* Refactoring Code

* Refactoring/Formatting Code

* Fix LocalTunnel download

* Using requests module

* Fixing Code

* Remove comment
This commit is contained in:
Moltivie 2019-11-17 02:17:40 +01:00 committed by AnonUD4Y
parent cfac68c0a9
commit 77f7e768c8

View File

@ -1,8 +1,8 @@
import subprocess import subprocess
import ctypes import ctypes
from os import * from os import system, getuid, path
from time import sleep from time import sleep
from urllib.request import urlopen, urlretrieve import requests
from platform import system as systemos, architecture from platform import system as systemos, architecture
from subprocess import check_output from subprocess import check_output
from Defs.Languages import * from Defs.Languages import *
@ -16,12 +16,13 @@ languageSelector()
def checkConnection(host='https://google.com'): # Connection check def checkConnection(host='https://google.com'): # Connection check
system('clear') system('clear')
try: try:
urlopen(host, timeout=10) req = requests.get(host, timeout=10)
print("{0}HURRAY!! Internet is available.. We can Continue{1}".format( if req.status_code == 200:
GREEN, DEFAULT)) print("{0}HURRAY!! Internet is available.. We can Continue{1}".format(
print("\n\n{0}Wait! Checking for Neccesary Packages{1}...\n ".format( GREEN, DEFAULT))
GREEN, DEFAULT)) print("\n\n{0}Wait! Checking for Neccesary Packages{1}...\n ".format(
return True GREEN, DEFAULT))
return True
except: except:
return False return False
@ -50,7 +51,9 @@ def checkNgrok(): # Ngrok check
else: else:
filename = 'ngrok-stable-{0}-386.zip'.format(ostype) filename = 'ngrok-stable-{0}-386.zip'.format(ostype)
url = 'https://bin.equinox.io/c/4VmDzA7iaHb/' + filename url = 'https://bin.equinox.io/c/4VmDzA7iaHb/' + filename
urlretrieve(url, filename) req = requests.get(url)
with open(filename, "wb") as file_obj:
file_obj.write(req.content)
system('unzip ' + filename) system('unzip ' + filename)
system('mv ngrok Server/ngrok') system('mv ngrok Server/ngrok')
system('rm ' + filename) system('rm ' + filename)
@ -70,7 +73,9 @@ def checkLocalxpose(): # Localxpose check
else: else:
filename = 'loclx-linux-386.zip'.format(ostype) filename = 'loclx-linux-386.zip'.format(ostype)
url = 'https://lxpdownloads.sgp1.digitaloceanspaces.com/cli/'+filename url = 'https://lxpdownloads.sgp1.digitaloceanspaces.com/cli/'+filename
urlretrieve(url, "loclx-linux-download.zip") req = requests.get(url)
with open("loclx-linux-download.zip", "wb") as file_obj:
file_obj.write(req.content)
system('unzip loclx-linux-download.zip && rm loclx-linux-download.zip') system('unzip loclx-linux-download.zip && rm loclx-linux-download.zip')
system('mv loclx-linux-* loclx && mv loclx Server/') system('mv loclx-linux-* loclx && mv loclx Server/')
system('clear') system('clear')
@ -81,7 +86,9 @@ def checkbinaryLT(): # LocalTunnel Binary File check.
print('[*] LocalTunnel Binary File Not Found !!') print('[*] LocalTunnel Binary File Not Found !!')
print('[*] Downloading LocalTunnel...') print('[*] Downloading LocalTunnel...')
url = "https://www.wa4e.com/downloads/lt-linux.zip" url = "https://www.wa4e.com/downloads/lt-linux.zip"
urlretrieve(url, "lt-linux.zip") req = requests.get(url)
with open("lt-linux.zip", "wb") as file_obj:
file_obj.write(req.content)
system("unzip lt-linux.zip && rm lt-linux.zip") system("unzip lt-linux.zip && rm lt-linux.zip")
system("mv lt* lt && mv lt Server/lt ") system("mv lt* lt && mv lt Server/lt ")
system('clear') system('clear')