From 891c8570a5ecc0776ee784d168c136925f8f9acb Mon Sep 17 00:00:00 2001 From: Partha Mandal <43367843+partham16@users.noreply.github.com> Date: Sat, 10 Oct 2020 02:58:04 +0000 Subject: [PATCH] Add password randomization --- colabcode/code.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/colabcode/code.py b/colabcode/code.py index 341f025..f909cbb 100644 --- a/colabcode/code.py +++ b/colabcode/code.py @@ -1,6 +1,7 @@ """base code""" import os import subprocess +import random from pyngrok import ngrok @@ -33,7 +34,7 @@ def __init__( self, port=10000, password=None, mount_drive=False, add_extensions=None ): self.port = port - self.password = password + self.password = int(random.random() * 1e4) if password is None else password self._mount = mount_drive self._install_code() self.extensions = EXTENSIONS @@ -89,5 +90,6 @@ def _run_code(self): bufsize=1, universal_newlines=True, ) as proc: + print(f"Use password {self.password} to login") for line in proc.stdout: print(line, end="")