From 83d2886e39af0ff30e95f7479d3105f98405bf50 Mon Sep 17 00:00:00 2001 From: Sarina Date: Sat, 20 Jul 2024 20:35:54 +0330 Subject: [PATCH] Restructure code --- cli.py => core/cli.py | 1 + install.sh => core/scripts/hysteria/install.sh | 0 core/utils.py | 9 +++++++++ 3 files changed, 10 insertions(+) rename cli.py => core/cli.py (99%) rename install.sh => core/scripts/hysteria/install.sh (100%) create mode 100644 core/utils.py diff --git a/cli.py b/core/cli.py similarity index 99% rename from cli.py rename to core/cli.py index 699f907..efe4998 100644 --- a/cli.py +++ b/core/cli.py @@ -1,5 +1,6 @@ import click import subprocess +import utils @click.group() def cli(): diff --git a/install.sh b/core/scripts/hysteria/install.sh similarity index 100% rename from install.sh rename to core/scripts/hysteria/install.sh diff --git a/core/utils.py b/core/utils.py new file mode 100644 index 0000000..800edb9 --- /dev/null +++ b/core/utils.py @@ -0,0 +1,9 @@ +import subprocess + +def generate_password() -> str: + ''' + Generates a random password using pwgen for user. + Could raise subprocess.CalledProcessError + ''' + result = subprocess.check_output(['pwgen', '-s', '32', '1']) + return result.decode().strip() \ No newline at end of file