Exemplo n.º 1
0
 def test_token_missing(self):
     with self.assertRaises(Exception) as e:
         launch_ssh("")
     exception = e.exception
     self.assertEqual(
         str(exception),
         "Ngrok AuthToken is missing, copy it from https://dashboard.ngrok.com/auth"
     )
Exemplo n.º 2
0
 def test_token_is_wrong(self):
     with self.assertRaises(Exception) as e:
         launch_ssh(", ")
     exception = e.exception
     self.assertEqual(
         str(exception),
         "It looks like something went wrong, please make sure your token is valid"
     )
Exemplo n.º 3
0
    def runNGROK():
        from colab_ssh import launch_ssh
        from IPython.display import clear_output
        launch_ssh(ngrokToken, password)
        clear_output()

        print("ssh", username, end='@')
        os.system("bash -c ' curl -s http://localhost:4040/api/tunnels | python3 -c \"import sys, json; print(json.load(sys.stdin)[\'tunnels\'][0][\'public_url\'][6:].replace(\':\', \' -p \'))\"'")
Exemplo n.º 4
0
def runNGROK():
    from colab_ssh import launch_ssh
    from IPython.display import clear_output
    launch_ssh('1nKzuFd4Oe16GysXPLuMhOragQZ_2HxHA13X5Fd1mqSYF4Avr', 'root')
    clear_output()

    print("ssh", username, end='@')
    os.system('''curl -s http://localhost:4040/api/tunnels | python3 -c \
            "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'][6:].replace(':', ' -p '))"'''
              )
Exemplo n.º 5
0
def ssh_to_colab():
    password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))

    #Ask token
    print("Copy authtoken from https://dashboard.ngrok.com/auth")

    authtoken = getpass.getpass()

    #Create tunnel
    launch_ssh(authtoken, password)
    #Print root password
    print("Root password: {}".format(password))
Exemplo n.º 6
0
def test_success_with_region(ngorkToken):
    launch_ssh(ngorkToken, verbose=True, region="eu")
Exemplo n.º 7
0
def test_success(ngorkToken):
    launch_ssh(ngorkToken, verbose=True)
Exemplo n.º 8
0
def test_token_missing():
    with pytest.raises(Exception) as e:
        launch_ssh("")
    exception = e.value
    assert str(exception) == "Ngrok AuthToken is missing, copy it from https://dashboard.ngrok.com/auth"
Exemplo n.º 9
0
def test_token_is_wrong():
    with pytest.raises(Exception) as e:
        launch_ssh(", ")
    exception = e.value
    assert str(exception) == "It looks like something went wrong, please make sure your token is valid"
Exemplo n.º 10
0
from colab_ssh import launch_ssh
import os


token = os.environ["NGROK_TOKEN"]
ssh_password = os.environ["SSH_PASSWORD"]

launch_ssh(ssh_password, token)
Exemplo n.º 11
0
 def test_success_with_region(self):
     launch_ssh(NGROK_TOKEN, verbose=True, region="eu")
Exemplo n.º 12
0
 def test_success(self):
     launch_ssh(NGROK_TOKEN, verbose=True)
Exemplo n.º 13
0
#!/usr/bin/python3.8

import json
from colab_ssh import launch_ssh
from colab_ssh import get_tunnel_config

launch_ssh('1ih6ACosTCp4vtqmz0kMEObj6US_4WKtwytKGHJxCH6DThVfr', '777')

f = open("/content/connection/service_server_connection_info", "w")
f.write(json.dumps(get_tunnel_config()))
f.close()