From 334f2a364d6c1173ff1df29f4ecdb87ed22193fc Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 18 Sep 2023 22:40:29 +0200 Subject: [PATCH] Added fetch mode to rncp --- RNS/Utilities/rncp.py | 4 ++-- docs/source/using.rst | 27 ++++++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/RNS/Utilities/rncp.py b/RNS/Utilities/rncp.py index f1614f1..170ee39 100644 --- a/RNS/Utilities/rncp.py +++ b/RNS/Utilities/rncp.py @@ -436,7 +436,7 @@ def fetch(configdir, verbosity = 0, quietness = 0, destination = None, file = No exit(0) elif request_status == "unknown": if not silent: print("\r \r", end="") - print("Fetch request failed due to an unknown error") + print("Fetch request failed due to an unknown error (probably not authorised)") link.teardown() time.sleep(1) exit(0) @@ -652,7 +652,7 @@ def main(): parser.add_argument('-q', '--quiet', action='count', default=0, help="decrease verbosity") parser.add_argument("-S", '--silent', action='store_true', default=False, help="disable transfer progress output") parser.add_argument("-l", '--listen', action='store_true', default=False, help="listen for incoming transfer requests") - parser.add_argument("-f", '--fetch', action='store_true', default=False, help="fetch file from remote listener") + parser.add_argument("-f", '--fetch', action='store_true', default=False, help="fetch file from remote listener instead of sending") parser.add_argument("-b", action='store', metavar="seconds", default=-1, help="announce interval, 0 to only announce at startup", type=int) parser.add_argument('-a', metavar="allowed_hash", dest="allowed", action='append', help="accept from this identity", type=str) parser.add_argument('-n', '--no-auth', action='store_true', default=False, help="accept files from anyone") diff --git a/docs/source/using.rst b/docs/source/using.rst index 44e8491..d31c015 100644 --- a/docs/source/using.rst +++ b/docs/source/using.rst @@ -418,16 +418,24 @@ files through Reticulum. # Run rncp on the receiving system, specifying which identities # are allowed to send files - rncp --receive -a 1726dbad538775b5bf9b0ea25a4079c8 -a c50cc4e4f7838b6c31f60ab9032cbc62 + rncp --listen -a 1726dbad538775b5bf9b0ea25a4079c8 -a c50cc4e4f7838b6c31f60ab9032cbc62 + + # You can also specify allowed identity hashes (one per line) + # in the file ~/.rncp/allowed_identities and simply running + # the program in listener mode + rncp --listen # From another system, copy a file to the receiving system rncp ~/path/to/file.tgz 73cbd378bb0286ed11a707c13447bb1e -You can specify as many allowed senders as needed, or complete disable authentication. + # Or fetch a file from the remote system + rncp --fetch ~/path/to/file.tgz 73cbd378bb0286ed11a707c13447bb1e + +You can specify as many allowed senders as needed, or completely disable authentication. .. code:: text - usage: rncp [-h] [--config path] [-v] [-q] [-p] [-r] [-b] [-a allowed_hash] [-n] [-w seconds] [--version] [file] [destination] + usage: rncp.py [-h] [--config path] [-v] [-q] [-S] [-l] [-f] [-b seconds] [-a allowed_hash] [-n] [-p] [-w seconds] [--version] [file] [destination] Reticulum File Transfer Utility @@ -435,19 +443,20 @@ You can specify as many allowed senders as needed, or complete disable authentic file file to be transferred destination hexadecimal hash of the receiver - optional arguments: + options: -h, --help show this help message and exit --config path path to alternative Reticulum config directory -v, --verbose increase verbosity -q, --quiet decrease verbosity - -p, --print-identity print identity and destination info and exit - -r, --receive wait for incoming files - -b, --no-announce don't announce at program start + -S, --silent disable transfer progress output + -l, --listen listen for incoming transfer requests + -f, --fetch fetch file from remote listener instead of sending + -b seconds announce interval, 0 to only announce at startup -a allowed_hash accept from this identity - -n, --no-auth accept files from anyone + -n, --no-auth accept files and fetches from anyone + -p, --print-identity print identity and destination info and exit -w seconds sender timeout before giving up --version show program's version number and exit - -v, --verbose The rnx Utility