Added fetch mode to rncp

This commit is contained in:
Mark Qvist 2023-09-18 22:40:29 +02:00
parent b477354235
commit 334f2a364d
2 changed files with 20 additions and 11 deletions

View File

@ -436,7 +436,7 @@ def fetch(configdir, verbosity = 0, quietness = 0, destination = None, file = No
exit(0) exit(0)
elif request_status == "unknown": elif request_status == "unknown":
if not silent: print("\r \r", end="") 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() link.teardown()
time.sleep(1) time.sleep(1)
exit(0) exit(0)
@ -652,7 +652,7 @@ def main():
parser.add_argument('-q', '--quiet', action='count', default=0, help="decrease verbosity") 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("-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("-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("-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('-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") parser.add_argument('-n', '--no-auth', action='store_true', default=False, help="accept files from anyone")

View File

@ -418,16 +418,24 @@ files through Reticulum.
# Run rncp on the receiving system, specifying which identities # Run rncp on the receiving system, specifying which identities
# are allowed to send files # 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 # From another system, copy a file to the receiving system
rncp ~/path/to/file.tgz 73cbd378bb0286ed11a707c13447bb1e 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 .. 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 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 file file to be transferred
destination hexadecimal hash of the receiver destination hexadecimal hash of the receiver
optional arguments: options:
-h, --help show this help message and exit -h, --help show this help message and exit
--config path path to alternative Reticulum config directory --config path path to alternative Reticulum config directory
-v, --verbose increase verbosity -v, --verbose increase verbosity
-q, --quiet decrease verbosity -q, --quiet decrease verbosity
-p, --print-identity print identity and destination info and exit -S, --silent disable transfer progress output
-r, --receive wait for incoming files -l, --listen listen for incoming transfer requests
-b, --no-announce don't announce at program start -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 -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 -w seconds sender timeout before giving up
--version show program's version number and exit --version show program's version number and exit
-v, --verbose
The rnx Utility The rnx Utility