From b4c72829564def89fb5bc636d98d405459a53507 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 20 Dec 2022 13:28:48 +0000 Subject: [PATCH] password from file --- bin/partyfuse.py | 2 +- bin/up2k.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/partyfuse.py b/bin/partyfuse.py index 824984bd..53261d96 100755 --- a/bin/partyfuse.py +++ b/bin/partyfuse.py @@ -997,7 +997,7 @@ def main(): ap.add_argument( "-cf", metavar="NUM_BLOCKS", type=int, default=nf, help="file cache" ) - ap.add_argument("-a", metavar="PASSWORD", help="password") + ap.add_argument("-a", metavar="PASSWORD", help="password or $filepath") ap.add_argument("-d", action="store_true", help="enable debug") ap.add_argument("-te", metavar="PEM_FILE", help="certificate to expect/verify") ap.add_argument("-td", action="store_true", help="disable certificate check") diff --git a/bin/up2k.py b/bin/up2k.py index 2304735a..8f44fb8f 100755 --- a/bin/up2k.py +++ b/bin/up2k.py @@ -994,7 +994,7 @@ source file/folder selection uses rsync syntax, meaning that: ap.add_argument("url", type=unicode, help="server url, including destination folder") ap.add_argument("files", type=unicode, nargs="+", help="files and/or folders to process") ap.add_argument("-v", action="store_true", help="verbose") - ap.add_argument("-a", metavar="PASSWORD", help="password") + ap.add_argument("-a", metavar="PASSWORD", help="password or $filepath") ap.add_argument("-s", action="store_true", help="file-search (disables upload)") ap.add_argument("--ok", action="store_true", help="continue even if some local files are inaccessible") @@ -1041,6 +1041,12 @@ source file/folder selection uses rsync syntax, meaning that: if "://" not in ar.url: ar.url = "http://" + ar.url + if ar.a and ar.a.startswith("$"): + fn = ar.a[1:] + print("reading password from file [{}]".format(fn)) + with open(fn, "rb") as f: + ar.a = f.read().decode("utf-8").strip() + if ar.cls: print("\x1b\x5b\x48\x1b\x5b\x32\x4a\x1b\x5b\x33\x4a", end="")