mirror of
https://github.com/markqvist/rnsh.git
synced 2024-10-01 01:15:37 -04:00
Added license and made a few more packaging tweaks.
This commit is contained in:
parent
ce225dfbcd
commit
ec5f9a0157
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 Aaron Heise
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
89
README.md
89
README.md
@ -1,7 +1,7 @@
|
|||||||
# `r n s h` Shell over Reticulum
|
# `r n s h` Shell over Reticulum
|
||||||
|
|
||||||
`rnsh` is a utility written in Python that facilitates opening
|
`rnsh` is a utility written in Python that facilitates shell
|
||||||
shell sessions over Reticulum networks. It is based off the `rnx`
|
sessions over Reticulum networks. It is based off the `rnx`
|
||||||
utility that ships with Reticulum.
|
utility that ships with Reticulum.
|
||||||
|
|
||||||
`rnsh` is still pretty raw; there are some things that are
|
`rnsh` is still pretty raw; there are some things that are
|
||||||
@ -12,26 +12,22 @@ out.
|
|||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
`rnsh` isn't quite ready to be available on pip, but it will be.
|
Requires Python 3.11+ on Linux or Unix. WSL probably works. Cygwin might work, too.
|
||||||
For the folks who are brave enough to try it now, you'll need
|
|
||||||
Python 3.11. Clone this repo, start a venv, and install a few
|
|
||||||
packages (I'll keep adding them as I remember more things I
|
|
||||||
installed)
|
|
||||||
|
|
||||||
- psutil
|
- Activate a virtualenv
|
||||||
- docopt
|
- `pip3 install rnsh`
|
||||||
- RNS (from source, at least one pre-release feature is used)
|
- Or from a `whl` release, `pip3 install /path/to/rnsh-0.0.1-py3-none-any.whl`
|
||||||
|
- Configure Reticulum interfaces, check with `rnstatus`
|
||||||
Then you can run it in using
|
- Ready to run `rnsh`. The options are shown below.
|
||||||
`python <path_to_rnsh>/rnsh.py <options>`
|
|
||||||
|
|
||||||
```
|
```
|
||||||
Usage:
|
Usage:
|
||||||
rnsh [--config <configdir>] [-i <identityfile>] [-s <service_name>] [-l] -p
|
rnsh [--config <configdir>] [-i <identityfile>] [-s <service_name>] [-l] -p
|
||||||
rnsh -l [--config <configfile>] [-i <identityfile>] [-s <service_name>] [-v...] [-q...] [-b]
|
rnsh -l [--config <configfile>] [-i <identityfile>] [-s <service_name>]
|
||||||
(-n | -a <identity_hash> [-a <identity_hash>]...) [--] <program> [<arg>...]
|
[-v...] [-q...] [-b] (-n | -a <identity_hash> [-a <identity_hash>]...)
|
||||||
rnsh [--config <configfile>] [-i <identityfile>] [-s <service_name>] [-v...] [-q...] [-N] [-m]
|
[--] <program> [<arg>...]
|
||||||
[-w <timeout>] <destination_hash>
|
rnsh [--config <configfile>] [-i <identityfile>] [-s <service_name>]
|
||||||
|
[-v...] [-q...] [-N] [-m] [-w <timeout>] <destination_hash>
|
||||||
rnsh -h
|
rnsh -h
|
||||||
rnsh --version
|
rnsh --version
|
||||||
|
|
||||||
@ -51,44 +47,45 @@ Options:
|
|||||||
-q --quiet Increase quietness
|
-q --quiet Increase quietness
|
||||||
--version Show version
|
--version Show version
|
||||||
-h --help Show this help
|
-h --help Show this help
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
|
### Listeners
|
||||||
|
Listener instances are the servers. Each listener is configured
|
||||||
|
with an RNS identity, and a service name. Together, RNS makes
|
||||||
|
these into a destination hash that can be used to connect to
|
||||||
|
your listener.
|
||||||
|
|
||||||
1. Set up one or more listeners. Each listener is configured
|
Multiple listeners can use the same identity. As long as
|
||||||
with an RNS identity, and a service name. Together, RNS makes
|
they are given different service names. They will have
|
||||||
these into a destination hash that can be used to connect to
|
different destination hashes and not conflict.
|
||||||
your listener.
|
|
||||||
|
|
||||||
Multiple listeners can use the same identity. As long as
|
Listeners must be configured with a command line to run (at
|
||||||
they are given different service names. They will have
|
least at this time). The identity hash string is set in the
|
||||||
different destination hashes and not conflict.
|
environment variable RNS_REMOTE_IDENTITY for use in child
|
||||||
|
programs.
|
||||||
|
|
||||||
Listeners must be configured with a command line to run (at
|
Listeners are set up using the `-l` flag.
|
||||||
least at this time). The identity hash string is set in the
|
|
||||||
environment variable RNS_REMOTE_IDENTITY for use in child
|
|
||||||
programs.
|
|
||||||
|
|
||||||
Listeners are set up using the `-l` flag.
|
### Initiators
|
||||||
|
Initiators are the clients. Each initiator has an identity
|
||||||
|
hash which is used as an authentication mechanism on Reticulum.
|
||||||
|
You'll need this value to configure the listener to allow
|
||||||
|
your connection. It is possible to run the server without
|
||||||
|
authentication, but hopefully it's obvious that this is an
|
||||||
|
advanced use case.
|
||||||
|
|
||||||
2. Set up your initiator (client) and get the identity hash.
|
To get the identity hash, use the `-p` flag.
|
||||||
You'll need this value to configure the listener to allow
|
|
||||||
your connection. It is possible to run the server without
|
|
||||||
authentication, but hopefully it's obvious that this is an
|
|
||||||
advanced use case.
|
|
||||||
|
|
||||||
To get the identity hash, use the `-p` flag.
|
With the initiator identity set up in the listener command
|
||||||
|
line, and with the listener identity copied (you'll need to
|
||||||
|
do `-p` on the listener side, too), you can run the
|
||||||
|
initiator.
|
||||||
|
|
||||||
With the initiator identity set up in the listener command
|
I recommend staying pretty vanilla to start with and
|
||||||
line, and with the listener identity copied (you'll need to
|
trying `/bin/zsh` or whatever your favorite shell is these
|
||||||
do `-p` on the listener side, too), you can run the
|
days. The shell should start in login mode. Ideally it
|
||||||
initiator.
|
works just like an `ssh` shell session.
|
||||||
|
|
||||||
I recommend staying pretty vanilla to start with and
|
|
||||||
trying `/bin/zsh` or whatever your favorite shell is these
|
|
||||||
days. The shell should start in login mode. Ideally it
|
|
||||||
works just like an `ssh` shell session.
|
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
1. Plan a better roadmap
|
1. Plan a better roadmap
|
||||||
|
@ -1 +1,21 @@
|
|||||||
# package
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 Aaron Heise
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
@ -1 +1,23 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 Aaron Heise
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
__version__ = "0.0.1"
|
__version__ = "0.0.1"
|
@ -1,3 +1,25 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 Aaron Heise
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import contextlib
|
import contextlib
|
||||||
import errno
|
import errno
|
||||||
@ -365,7 +387,7 @@ async def main():
|
|||||||
A test driver for the CallbackProcess class.
|
A test driver for the CallbackProcess class.
|
||||||
python ./process.py /bin/zsh --login
|
python ./process.py /bin/zsh --login
|
||||||
"""
|
"""
|
||||||
import testlogging
|
import rnsh.testlogging
|
||||||
|
|
||||||
log = module_logger.getChild("main")
|
log = module_logger.getChild("main")
|
||||||
if len(sys.argv) <= 1:
|
if len(sys.argv) <= 1:
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 Aaron Heise
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
|
@ -791,10 +791,11 @@ async def main():
|
|||||||
usage = '''
|
usage = '''
|
||||||
Usage:
|
Usage:
|
||||||
rnsh [--config <configdir>] [-i <identityfile>] [-s <service_name>] [-l] -p
|
rnsh [--config <configdir>] [-i <identityfile>] [-s <service_name>] [-l] -p
|
||||||
rnsh -l [--config <configfile>] [-i <identityfile>] [-s <service_name>] [-v...] [-q...] [-b]
|
rnsh -l [--config <configfile>] [-i <identityfile>] [-s <service_name>]
|
||||||
(-n | -a <identity_hash> [-a <identity_hash>]...) [--] <program> [<arg>...]
|
[-v...] [-q...] [-b] (-n | -a <identity_hash> [-a <identity_hash>]...)
|
||||||
rnsh [--config <configfile>] [-i <identityfile>] [-s <service_name>] [-v...] [-q...] [-N] [-m]
|
[--] <program> [<arg>...]
|
||||||
[-w <timeout>] <destination_hash>
|
rnsh [--config <configfile>] [-i <identityfile>] [-s <service_name>]
|
||||||
|
[-v...] [-q...] [-N] [-m] [-w <timeout>] <destination_hash>
|
||||||
rnsh -h
|
rnsh -h
|
||||||
rnsh --version
|
rnsh --version
|
||||||
|
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 Aaron Heise
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from logging import Handler, getLevelName
|
from logging import Handler, getLevelName
|
||||||
from types import GenericAlias
|
from types import GenericAlias
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
# MIT License
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 Aaron Heise
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
import logging as __logging
|
import logging as __logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user