Giter Club home page Giter Club logo

xxh's Introduction

You stuffed your command shell with aliases, tools, and colors but you lose it all when using ssh. The mission of xxh is to bring your favorite shell wherever you go through ssh without root access or system installations. Xonsh shell, fish, zsh, osquery and so on.

If you like the idea of xxh click โญ on the repo and tweet about it.

[xxh demo]

Portable. Preparing portable shells and plugins occurs locally, and then xxh uploads the result to the host. No installations or root access on the host required. Security and host environment are a prime focus. Hermetic. Deleting the ~/.xxh directory from the remote host will make the remote environment function as if xxh was never there. By default your home is the .xxh directory and you can choose the hermetic level of your xxh session. Careful. No blindfolded copying config files from local to remote host. Following privacy and repeatability practices, the best way is to fork the xxh plugin or shell example and pack your configs into it.
Be open and fork-ready. Every xxh repo could be forked, customized, and reused without waiting for a package management system, xxh release, or any third party packages. Five shells are currently supported and more could be added by the community. Do more. The xxh packages are not only about shells. Any type of tool or code could be behind an entrypoint. If you want to run browsh or browsr on the remote host, just put its portable version as an entrypoint in the xxh-shell. Chameleon. Switching shells is as easy as possible and you don't have to be locked in to one shell. Choose your current shell based on the task you want to solve: xxh anyhost +s xonsh for a Python environment, osquery for simple querying, fish for modern features or time-tested zsh and bash for speed.

Installation methods

pip install xxh-xxh
# OR from repo: pip install git+https://github.com/xxh/xxh

pipx - good alternative to brew and pip, read comparison

pipx install xxh-xxh

xonsh shell

xpip install xxh-xxh
conda config --add channels conda-forge
conda install xxh-xxh
brew install xxh
sudo port install xxh

Linux portable binary

mkdir ~/xxh && cd ~/xxh
wget https://github.com/xxh/xxh/releases/download/0.8.12/xxh-portable-musl-alpine-Linux-x86_64.tar.gz
tar -xzf xxh-portable-musl-alpine-Linux-x86_64.tar.gz
./xxh

Linux AppImage

mkdir ~/xxh && cd ~/xxh
wget -O xxh https://github.com/xxh/xxh/releases/download/0.8.12/xxh-x86_64.AppImage
chmod +x xxh && ./xxh

To run AppImage on Alpine Linux install alpine-pkg-glibc with localedef.

Shells

Currently supported OS for the target host is Linux on x86_64.

xxh-shell status xxh-plugins seamless demo
xonsh stable autojump, [+] xxh.xsh demo
zsh stable ohmyzsh, p10k, [+] xxh.zsh demo
fish stable ohmyfish, fisher, userconfig, [+] todo
bash stable ohmybash, [+] xxh.bash demo
osquery beta
fish-appimage alpha
elvish alpha

Search xxh shell on Github or Bitbucket or create your shell entrypoint to use another portable shell.

Prerun plugins

Prerun plugins allow you to bring any portable tools, dotfiles, or aliases to your xxh session before running the shell.

Pinned plugins: core (xxh-sudo, xxh-screen, xxh-tmux), dotfiles, docker, python, xxh, vim, zoxide, starship. There is cookiecutter template to create a prerun plugin.

Usage

Use xxh instead of ssh when connecting to Linux hosts without changing ssh arguments:

xxh <host from ~/.ssh/config>
xxh [ssh arguments] [user@]host[:port] [xxh arguments]
xxh local [xxh arguments]

Common examples (use xxh --help to get info about arguments):

xxh anyhost                                       # Connect to the host
xxh -i id_rsa -p 2222 anyhost                     # Using ssh arguments: port and key
xxh user@host +c et                               # Using EternalTerminal (https://github.com/MisterTea/EternalTerminal)
xxh anyhost +s zsh +i                             # Set the shell and install it without yes/no question
xxh anyhost +s xonsh +hhh "~"                     # Set /home/user as home directory (read Q&A)
xxh anyhost +s bash +I xxh-plugin-bash-vim        # Preinstall a plugin
xxh anyhost +if +q                                # Force reinstall xxh on the host in quiet mode
xxh anyhost +hh /tmp/xxh +hhr                     # Upload xxh to /tmp/xxh and remove when disconnecting
source xxh.zsh anyhost +I xxh-plugin-zsh-ohmyzsh  # Connect in seamless mode with ohmyzsh plugin
xxh local +s xonsh                                # Experimental: build xxh environment inplace and without ssh

For reusing arguments and simplifying xxh usage (like shortening to xxh anyhost), there is a config file.

Why the plus sign for the xxh arguments? The xxh is using the plus sign for xxh arguments to preserve the ability to use the minus sign for the original ssh arguments. This allows just replacing the first two letters in the ssh command to convert it to the xxh command. Also see the discussion.

Installing xxh packages

xxh [+I xxh-package +I ...] [+L] [+RI xxh-package +RI ...] [+R xxh-package +R ...]

Different ways to set the xxh package source:

xxh +I xxh-shell-example                                         # install from https://github.com/xxh
xxh +I https://github.com/xxh/xxh-shell-example                  # short url for github only, for other sources use examples below or add support
xxh +I https://github.com/xxh/xxh-shell-example/tree/mybranch    # short url for github only, for other sources use examples below or add support
xxh +I xxh-shell-example+git+https://github.com/xxh/xxh-shell-example                 # long url for any git repo
xxh +I xxh-shell-example+git+https://github.com/xxh/xxh-shell-example/tree/mybranch   # github only branch support
xxh +I [email protected]:githubuser/xxh-shell-example.git          # install from private repository using ssh
xxh +I xxh-shell-example+path+/home/user/my-xxh-dev/xxh-shell-example                 # install from local path

Using xxh inplace without ssh connection

This is experimental magic. Please read the text below twice.

If you have shell access on the host or you're in a docker container and you can't ssh to it then you can download and build a hermetic xxh environment inplace. The xxh local command works exactly like xxh remote_host and creates a hermetic environment in ~/.xxh by default.

At this time we don't have portable build tools like git, wget, curl, tar and others which could be required by some xxh package build scripts. When running xxh local it is expected that the tools are present on the host.

To run xxh inplace on Linux x86_64 just copy and paste these bash commands:

XH=~/.xxh \
 && XD=https://github.com/xxh/xxh-portable/raw/master/result/xxh-portable-musl-alpine-Linux-x86_64.tar.gz \
 && mkdir -p $XH && cd $XH \
 && ( [[ -x $(command -v curl) ]] && curl -L $XD || wget -O- $XD ) | tar zxf - xxh \
 && echo 'Usage: ./xxh local [+s xonsh/zsh/fish/osquery/bash]'

Next time you're on the host just run ~/.xxh/xxh local and you will enter your xxh environment.

Examples of use cases

Python with pip everywhere without installation

Way 1. Using xonsh

xxh anyhost +s xonsh

anyhost> python --version
Python 3.8.2

You'll get python-powered xonsh shell with portable python and pip on the host without any system installations on the host. You can install PyPi packages manually or bring them with you automatically by using xxh-plugin-prerun-dotfiles. Also, don't forget about xxh-plugins like zoxide.

Way 2. Using portable python on any xxh shell

xxh +RI xxh-plugin-prerun-python
xxh anyhost +s zsh

anyhost> python --version
Python 3.8.2
anyhost> pip install pandas

Using xxh-plugin-prerun-python you'll get a portable Python AppImage which can be used on a host without python and with any xxh shell.

Using docker on host without root access

Try xxh-plugin-prerun-docker:

xxh +RI xxh-plugin-prerun-docker
xxh anyhost +if

anyhost> xxh-docker-run
anyhost> docker ps                                                                                                                                                                                                                            
CONTAINER ID        IMAGE               COMMAND
anyhost> docker run --rm hello-world | grep Hello
Hello from Docker!
anyhost> xxh-docker-stop

Bring dotfiles to xxh session

There is the xxh-plugin-prerun-dotfiles plugin which creates config files when you go to the host using xxh. You can fork it and create your cozy settings once and forever.

Seamless Oh My Zsh (demo)

source xxh.zsh anyhost +I xxh-plugin-zsh-ohmyzsh +if +q 

This command brings your current Oh My Zsh session theme to the xxh session. If you need more complex settings just fork the xxh-plugin-zsh-ohmyzsh and hack it.

Read host as a table with osquery

$ xxh anyhost +s osquery
osquery> SELECT * FROM users WHERE username='news';
+-----+-----+----------+-------------+-----------------+-------------------+
| uid | gid | username | description | directory       | shell             |
+-----+-----+----------+-------------+-----------------+-------------------+
| 9   | 9   | news     | news        | /var/spool/news | /usr/sbin/nologin |
+-----+-----+----------+-------------+-----------------+-------------------+

All-in-one portable home

xxh is very agile. You can create your own xxh-shell (the shell part means it has an entrypoint), which can have any portable tools that could help you on the host. Bash xxh-shell is one of these platforms that could be forked and stuffed.

Development

xxh Development Environment

In the xxh development environment there is a full dockerised environment for development, testing, and contribution. The process of testing and development is orchestrated by xde tool and is as easy as possible.

Vagrant based Plugin Development

To develop plugins, Vagrant supports starting many configurations of virtual machines using Virtualbox.

See the Plugin Development folder for more details

We have teams

If you're in a team it does not mean you have an obligation to do something. The main goal of teams is to create groups of passionate people who could help or support solving complex problems. Some people could be an expert in one shell and a newbie in another shell and mutual assistance is the key to xxh evolution. Ask to join.

Thanks

xxh's People

Contributors

0xflotus avatar ammgws avatar anki-code avatar branchvincent avatar chitoku-k avatar drmikecrowe avatar dyuri avatar hacktheoxidation avatar idkjs avatar izissise avatar jimt avatar jonta avatar meermanr avatar moulick avatar onokatio avatar paxperscientiam avatar petarvujovic98 avatar samosica avatar sbado avatar seanfarley avatar syndicut avatar tminich avatar tpongo-afk avatar vladimyr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xxh's Issues

Support basic ssh options

It will be great if xxh will support not only xxh <destination> but ability to pass basic OpenSSH client options:

   -p port
             Port to connect to on the remote host.  
   -i identity_file
             Selects a file from which the identity (private key) for public key authentication is read.
   -l login_name
             Specifies the user to log in as on the remote machine. 
   -o option

โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

+q option in config file does not take effect

Local OS (where xxh is installed):
macOS 10.15.5

Destination host OS:
CentOS 8.1.1911

xxh version:
0.8.3

xxh-plugins installed:
xxh-shell-zsh

config:

hosts:
  ".*":
    +q

Steps to Reproduce

  1. I run xxh myhost with the config
  2. The output log:
Install xxh-shell-zsh to apricot:/home/chitoku/.xxh
Remove apricot:/home/chitoku/.xxh
First time upload using rsync (this will be omitted on the next connections)
First run xxh-shell-zsh on apricot
  1. What is the problem
    The option +q did not take effect because self.quiet does not get applied after config is loaded whilst self.verbose and self.vverbose are applied then. Related to #89.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Cookiecutter for xxh-shell, xxh-plugin-prerun, xxh-plugin

https://github.com/cookiecutter/cookiecutter

Repos names (they should be in xxh organization):

  • xxh/cookiecutter-xxh-shell
  • xxh/cookiecutter-xxh-plugin-prerun
  • xxh/cookiecutter-xxh-plugin

It should works like:

pip install cookiecutter
cookiecutter gh:xxh/cookiecutter-xxh-shell
# shell_name [Shell name]: xonsh
# email [Your email]: ...

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Add option to install only missing plugins

Is your feature request related to a problem? Please describe.
Currently you need to use +if everytime you want xxh to install new things in the remote server, which will delete all of the remote shell/plguins/existing build.

Describe the solution you'd like
After adding a new plugin in local you should be able to install only the missing plugins in the remote server, without first removing everything in remote.

It would be useful while developing as you can just remove the remote plugin folder, disconnect, and connect again to install the missing (and updated) plugin.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Support delivering any portable shell

Current workflow looks like that any portable shell could be delivered. We should abstract the process of building and delivering the xonsh shell and allow to use any portable shell.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Detecting auth using password

To avoid a user overhead to using +P/+PP manually we can detect that auth requres password and ask about password ourselves.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Unknown answer from host when getting realpath for directory {host_xxh_home}

Local OS (where xxh is installed): Ubuntu 16.04.6 LTS
Destination host OS: Red Hat 4.4.7-18 GCC
xxh version: xxh/0.6.10
xxh-plugins installed: none

Steps to Reproduce

  1. I run xxh hostname
2. The output log: CLICK to see collapsed text

$ xxh redhathostname
Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/bin/xxh", line 14, in <module>
    xxh.main()
  File "/home/linuxbrew/.linuxbrew/opt/python/lib/python3.7/site-packages/xxh_xxh/xxh.py", line 669, in main
    self.eeprint(f'Unknown answer from host when getting realpath for directory {host_xxh_home}')
UnboundLocalError: local variable 'host_xxh_home' referenced before assignment

3. What is the problem Getting error:

Unknown answer from host when getting realpath for directory {host_xxh_home}

xxh then exits.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Seamless mode

At this time we have xxh-shell for xonsh, fish and zsh. So we can detect the current local shell and use appropriate xxh-shell without installing it manually.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

ProxyCommand EMR: Unknown answer

Local OS (where xxh is installed): Mac OS
Destination host OS: Red Hat
xxh version:0.6.4
xxh-plugins installed:-

Steps to Reproduce

  1. I run xxh {hostname}
  2. The output log:
Load xxh config from /Users/akumar57/.xxh/.xxhc
Load xxh config for host uip-*
ssh arguments: ['-o', 'StrictHostKeyChecking=accept-new']
Try pexpect command: bash -c 'cat /usr/local/lib/python3.7/site-packages/xxh_xxh/host_info.sh | sed "s|_xxh_home_|~/.xxh|" | sed "s|_xxh_shell_|xxh-shell-zsh|" | ssh -v -o StrictHostKeyChecking=accept-new uip-parity-prd -T "bash -s"'
Unknown answer details:
<pexpect.pty_spawn.spawn object at 0x10bcdec50>
command: /usr/local/bin/bash
args: ['/usr/local/bin/bash', '-c', 'cat /usr/local/lib/python3.7/site-packages/xxh_xxh/host_info.sh | sed "s|_xxh_home_|~/.xxh|" | sed "s|_xxh_shell_|xxh-shell-zsh|" | ssh -v -o StrictHostKeyChecking=accept-new uip-parity-prd -T "bash -s"']
buffer (last 100 chars): b'y file /Users/akumar57/.ssh/id_rsa-cert type 4\r\r\ndebug1: Local version string SSH-2.0-OpenSSH_8.1\r\r\n'
before (last 100 chars): b'y file /Users/akumar57/.ssh/id_rsa-cert type 4\r\r\ndebug1: Local version string SSH-2.0-OpenSSH_8.1\r\r\n'
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 58832
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
Unknown answer from host
Unexpected result. Try again with +v or +vv or try ssh before xxh
  1. What is the problem

Unknown answer from host
Unexpected result. Try again with +v or +vv or try ssh before xxh

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

macOS as target host

Local OS (where xxh is installed): macOS 10.14.6
Destination host OS: 10.14.6 (local), 10.15.6 (remote)
xxh version: xxh/0.8.2
xxh-plugins installed: N/A (attempting xxh-shell-bash)

Steps to Reproduce

  1. I run xxh local +s bash
  2. The output log:
$ xxh local +s bash
...
First run xxh-shell-bash on local
bash: cd: too many arguments
...
readlink: illegal option -- f
...
mkdir: /.local/share/bash: Permission denied
  1. What is the problem
    Appears that using xxh <host> doesn't pull from ~/.ssh/config. Attempted the bash setup on localhost and it doesn't play nice with env vars and likely Appleisms on the Darwin platform.

Think that especially that last line should be expanding $HOME per issue #64.

FWIW installed via brew install xxh and running GNU bash, version 5.0.11(1)-release (x86_64-apple-darwin18.6.0)

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Uppercase alias definitions of ssh hosts doesn't work with xxh

If a host does not have hostname and only exists in .ssh/config as a following entry:

Host LINUX_BEHIND_JUMPBOX.CC
    HostName 10.11.11.11
    User gw
    Port 9022
    ProxyJump BASTION.CC

ssh connect with:

ssh LINUX_BEHIND_JUMPBOX.CC

would work.

However:

xxh LINUX_BEHIND_JUMPBOX.CC

does not work.
This is caused by fact that underlying ssh command warpper tries to connect to lowercase version of this hostname, but OpenSSH treats those entries as case sensitive. Converting hostname to lower case happens in: xxh.py in lines which retrieves hostname: url.hostname which returns lowercase result.
Simple switch to url.netloc helps with my case, but I am not sure if this doesn't break anything else.

What is pluginrc.* run order?

Hi!
This is a developer question about how xxh works so I know what to expect.

Currently when I xxh into a remote computer I have xxh-shell-fish xxh-plugin-fish-fisher and xxh-plugin-fish-userconfig set to install and all these packages get installed but fisher does not run and install the list of packages during the first login that was uploaded by the xxh-plugin-fish-userconfig plugin.

If I log out and xxh in again then fisher will run and install the packages. I believe what is happening is that xxh-plugin-fish-fisher is being installed and its pluginrc.* file is run. Then after that xxh-plugin-fish-userconfig is installed and its pluginrc.* file is run.

  1. In what order does xxh install plugins?
  2. Does it run the plugin's pluginrc.* file immediately after it installs the plugin or does it install all plugins then run all the pluginrc.* files?
  3. Is the order of install random or alphabetical or something else?
  4. Does xxh need a way to set the order that the pluginrc.* files get run?

Thanks in advance for any information your can provide about this!
Frederick

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Support for XDG Base Directory Specification

It would be nice if config file was stored under $XDG_CONFIG_HOME (which defaults to ~/.config). I was thinking about looking into implementing it, but no point if you are not interested.

This blog post lists the advantages of using the XDG Base Directory Specification as follows:

  • $HOME is a lot less cluttered.
    Backups are a lot more safer and easier. (you know that backuping your $XDG_DATA_HOME along with your files is enough)
  • A lot easier to reset a default configuration if you want/need it (and without any risk of loosing information).
  • Avoid some strange bugs that happen because you had a old version of some configuration file.
  • It is a lot more flexible and portable because no paths are hard-coded. You can use the XDG library that does the job for you or, if you donโ€™t want the dependency, implementing the XDG specification is only a few lines of code.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

In password mode ask password once

In password mode ask password once instead of asking every pre-connection.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Add CI/CD

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Add xxh dotfile with default config

Something like ~/.xxhc:

hosts:
  host1:
    -l: snail
    +if:
    ++host-xxh-home: /tmp/.xxh

  # pattern matching
  "host-(.*)":
    # the same interface as arguments
    -p: 2222

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

pip3 maybe needed to install if the default Python is a version 2 Python

Local OS (where xxh is installed): Ubuntu 16.04.6 LTS
xxh version: xxh/0.6.10

Steps to Reproduce

  1. Run pip install -U xxh-xxh to install, then
  2. Run xxh --help to test if the install was successful.
2. The output log: (Click to open)

$ pip install -U xxh-xxh
Collecting xxh-xxh
  Downloading https://files.pythonhosted.org/packages/09/7e5c58311a72a577e4ae6f41254ec85e1209b4cceab64d332da773b50d0d6b/xxh-xxh-0.6.10.tar.gz
Collecting pexpect>=4.8.0 (from xxh-xxh)
  Downloading https://files.pythonhosted.org/packages/39/7b/88dbb785881c28a102619d46423cb853b46dbccc70d3ac362d99773a78ce/pexpect-4.8.0-py2.py3-none-any.whl (59kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 61kB 1.5MB/s 
Collecting pyyaml (from xxh-xxh)
  Downloading https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz (269kB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 276kB 1.8MB/s 
Collecting ptyprocess>=0.5 (from pexpect>=4.8.0->xxh-xxh)
  Downloading https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl
Building wheels for collected packages: xxh-xxh, pyyaml
  Running setup.py bdist_wheel for xxh-xxh ... done
  Stored in directory: /home/username/.cache/pip/wheels/24/87/b2/59d8e683822e0081059d584445a4009ed2a76e250a63955e44
  Running setup.py bdist_wheel for pyyaml ... done
  Stored in directory: /home/username/.cache/pip/wheels/a7/c1/ea/cf5bd31012e735dc1dfea3131a2d5eae7978b251083d6247bd
Successfully built xxh-xxh pyyaml
Installing collected packages: ptyprocess, pexpect, pyyaml, xxh-xxh
Successfully installed pexpect-4.8.0 ptyprocess-0.6.0 pyyaml-5.3.1 xxh-xxh-0.6.10


$  xxh --help
  File "/home/username/.local/bin/xxh", line 9
    eeprint(f"Windows is not supported. WSL1 is not recommended also. WSL2 is not tested yet.")
                                                                                             ^
SyntaxError: invalid syntax

  1. What is the problem
    It appears that xxh needs Python 3 so using pip3 to install works. So run `pip3 install -U xxh-xxh' instead.
The output log: (Click to open)

$ pip3 install -U xxh-xxh                                                                                                         5s ๎‚ณ [Die Mรคr 24 11:15:41]
Collecting xxh-xxh
  Downloading https://files.pythonhosted.org/packages/44/2c/7852c1187f976a56c1c631d248966770ddb65c167dec3973a6bed261042c/xxh_xxh-0.6.10-py3-none-any.whl
Collecting pexpect>=4.8.0 (from xxh-xxh)
  Using cached https://files.pythonhosted.org/packages/39/7b/88dbb785881c28a102619d46423cb853b46dbccc70d3ac362d99773a78ce/pexpect-4.8.0-py2.py3-none-any.whl
Collecting pyyaml (from xxh-xxh)
  Using cached https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz
Collecting ptyprocess>=0.5 (from pexpect>=4.8.0->xxh-xxh)
  Using cached https://files.pythonhosted.org/packages/d1/29/605c2cc68a9992d18dada28206eeada56ea4bd07a239669da41674648b6f/ptyprocess-0.6.0-py2.py3-none-any.whl
Building wheels for collected packages: pyyaml
  Running setup.py bdist_wheel for pyyaml ... done
  Stored in directory: /home/username/.cache/pip/wheels/a7/c1/ea/cf5bd31012e735dc1dfea3131a2d5eae7978b251083d6247bd
Successfully built pyyaml
Installing collected packages: ptyprocess, pexpect, pyyaml, xxh-xxh
Successfully installed pexpect-4.8.0 ptyprocess-0.6.0 pyyaml-5.3.1 xxh-xxh-0.6.10


$ xxh --help
usage: xxh <host from ~/.ssh/config>
usage: xxh [ssh arguments] [user@]host[:port] [xxh arguments]
usage: xxh [-p SSH_PORT] [-l SSH_LOGIN] [-i SSH_PRIVATE_KEY]
           [-o SSH_OPTION -o ...] [+c SSH_COMMAND] [+P PASSWORD] [+PP]
           [user@]host[:port]
           [+i] [+if] [+iff] [+hhr] [+s SHELL] [+e NAME=VAL +e ...] [+v] [+vv] [+q]
           [+hh HOST_XXH_HOME] [+hf HOST_EXEC_FILE] [+hc HOST_EXEC_CMD]
           [+xc CONFIG_FILE] [+lh LOCAL_XXH_HOME] [-h] [-V]
usage: xxh [+I xxh-package +I ...] [+L] [+RI xxh-package +RI ...] [+R xxh-package +R ...]

Your favorite shell wherever you go through the ssh.

     ____  __________     -    _
  ______  /          \     \__/
   ____  /    ______  \   /   \           contribution
 _____  /    / __   \  \ /   _/   https://github.com/xxh/xxh
   ___ (    / /  /   \  \   /
        \   \___/    /  /  /                plugins
      ___\          /__/  /   https://github.com/search?q=xxh-plugin
     /    \________/     /
    /___________________/

required arguments:
  [user@]host[:port]    Destination may be specified as [ssh://][user@]host[:port] or host from ~/.ssh/config

common arguments:
  -h, --help            show this help message and exit
  --version, -V         show program's version number and exit

ssh arguments:
  -p SSH_PORT           Port to connect to on the remote host.
  -l SSH_LOGIN          Specifies the user to log in as on the remote machine.
  -i SSH_PRIVATE_KEY    File from which the identity (private key) for public key authentication is read.
  -o SSH_OPTION -o ...  SSH options are described in ssh man page. Example: -o Port=22 -o User=snail

xxh arguments:
  +c SSH_COMMAND        Command to execute instead of 'ssh'.
  +P PASSWORD, ++password PASSWORD
                        Password for ssh auth.
  +PP, ++password-prompt
                        Enter password manually using prompt.
  +i, ++install         Install xxh to destination host.
  +if, ++install-force  Removing the host xxh package and install xxh again.
  +iff, ++install-force-full
                        Removing the host xxh home and install xxh again. All installed packages on the host (e.g. pip packages) will be lost.
  +xc XXH_CONFIG, ++xxh-config XXH_CONFIG
                        Xxh config file in yaml. Default: /home/username/.xxh/.xxhc
  +e NAME=VAL +e ..., ++env NAME=VAL +e ...
                        Setting environment variables if supported by shell entrypoint.
  +eb NAME=BASE64 +eb ..., ++envb NAME=BASE64 +eb ...
                        Setting environment variables base64 encoded if supported by shell entrypoint.
  +lh LOCAL_XXH_HOME, ++local-xxh-home LOCAL_XXH_HOME
                        Local xxh home path. Default: /home/username/.xxh
  +hh HOST_XXH_HOME, ++host-xxh-home HOST_XXH_HOME
                        Host xxh home path. Default: ~/.xxh
  +hhr, ++host-xxh-home-remove
                        Remove xxh home on host after disconnect.
  +hf HOST_EXECUTE_FILE, ++host-execute-file HOST_EXECUTE_FILE
                        Execute script file placed on host and exit. If supported by shell entrypoint.
  +hc HOST_EXECUTE_COMMAND, ++host-execute-command HOST_EXECUTE_COMMAND
                        Execute command on host and exit. If supported by shell entrypoint.
  +heb BASE64 +heb ..., ++host-execute-bash BASE64 +heb ...
                        Bash command will be executed before shell entrypoint (base64 encoded) if supported by shell entrypoint.
  +s SHELL, ++shell SHELL
                        Xxh shell: xonsh (xxh-shell-xonsh-appimage), zsh (xxh-shell-zsh), fish (xxh-shell-fish-appimage), bash-zero (xxh-shell-bash-zero), osquery (xxh-shell-osquery)
  +v, ++verbose         Verbose mode.
  +vv, ++vverbose       Super verbose mode.
  +q, ++quiet           Quiet mode.

xxh packages:
  +I xxh-package, ++install-xxh-packages xxh-package
                        Local install xxh packages.
  +L [xxh-package [xxh-package ...]], ++list-xxh-packages [xxh-package [xxh-package ...]]
                        List local xxh packages.
  +RI xxh-package, ++reinstall-xxh-packages xxh-package
                        Local reinstall xxh packages.
  +R xxh-package, ++remove-xxh-packages xxh-package
                        Local remove xxh packages.
  +ES, ++extract-sourcing-files
                        Used for AppImage. Extract sourcing files.


$ xxh --version
xxh/0.6.10

Please add the requirement of Python3 to the installation instructions and also suggest that if python --version returns a version 2 of python to use pip3 install -U xxh-xxh to install.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Using xxh home as $HOME

To discuss.

Default xxh home is ~/.xxh.

Pros:

  • Some apps which use $HOME will save temporary or result files in xxh home

Cons:

  • When careless using +iff all working files will be deleted. Probably solution: show big warning.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Building plugin on local host and then just upload to remote host

Current solutions is to running install.xsh of plugin on the remote host. It could be not good sometimes. We need to create scenario where plugin will build on local host and then just upload to remote host.

โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

AppImage package

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Option to remove xxh directory on host after disconnect

From reddit:

It would be nice to have an option for it to remove that folder. When I am working on customer machines, I can't leave that behind.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

xclip: Can't open display: localhost:10.0

Let me get something out of the way: Thank you all for this amazing piece of software. I have to work on many different servers every day and xxh saves me so many keystrokes.

Now on to my question: I have this in my ~/.ssh/config

ForwardX11              yes

and xclip works when I ssh in. When xxh-ing in, xclip complains:

root@hostname ~# echo "test2" | xclip
Error: Can't open display: localhost:10.0

It also works with local /bin/fish. Is there any other place where I have to configure the forwarding?

I'd be grateful for any pointers.

after: <class 'pexpect.exceptions.TIMEOUT'>

Local OS (where xxh is installed): macOS
Destination host OS: Amazon Linux 2
xxh version: xxh/0.8.2
xxh-plugins installed: fish

Steps to Reproduce

  1. I run xxh +vv ocdb-dumper +s fish
  2. The output log:
Load xxh config from /Users/ericdavies/.config/xxh/config.xxhc
ssh arguments: ['-o', 'StrictHostKeyChecking=accept-new']
RUN SHELL COMMAND: mkdir -v -p /Users/ericdavies/.xxh /Users/ericdavies/.xxh/.xxh/plugins /Users/ericdavies/.xxh/.xxh/shells
Try pexpect command: bash -c 'echo -e "xxh_home_realpath=\$([ ! -x \"\$(command -v realpath)\" ] && readlink -f ~/.xxh || realpath -m ~/.xxh)\n            xxh_version=\"dir_not_found\"\n            if [[ -d \$xxh_home_realpath ]]; then\n                xxh_version=\$([ \"\$(ls -A \$xxh_home_realpath)\" ] && echo \"version_not_found\" || echo \"dir_empty\")\n                settings_path=\$xxh_home_realpath/.xxh/xxh_version\n                if [[ -f \$settings_path ]]; then\n                    xxh_version=\$(cat \$settings_path)\n                fi\n            fi\n            echo xxh_home_realpath=\$xxh_home_realpath\n            echo xxh_version=\$xxh_version\n            echo xxh_shell_exists=\`[ -d \$xxh_home_realpath/.xxh/shells/xxh-shell-fish ] && echo \"1\" ||echo \"0\"\`\n            echo xxh_home_writable=\`[ -w \$xxh_home_realpath ] && echo \"1\" ||echo \"0\"\`\n            echo xxh_parent_home_writable=\$([ -w \$(dirname \$xxh_home_realpath) ] && echo \"1\" ||echo \"0\")\n            echo rsync=\`command -v rsync\`\n            echo scp=\`command -v scp\`\n            echo shell=\`command -v fish\`\n            echo kernel=\`uname -s\`\n            echo arch=\`uname -m\`" | ssh -v -o StrictHostKeyChecking=accept-new ocdb-dumper -T "bash -s"'
Unknown answer details:
<pexpect.pty_spawn.spawn object at 0x108882c10>
command: /usr/local/bin/bash
args: ['/usr/local/bin/bash', '-c', 'echo -e "xxh_home_realpath=\\$([ ! -x \\"\\$(command -v realpath)\\" ] && readlink -f ~/.xxh || realpath -m ~/.xxh)\\n            xxh_version=\\"dir_not_found\\"\\n            if [[ -d \\$xxh_home_realpath ]]; then\\n                xxh_version=\\$([ \\"\\$(ls -A \\$xxh_home_realpath)\\" ] && echo \\"version_not_found\\" || echo \\"dir_empty\\")\\n                settings_path=\\$xxh_home_realpath/.xxh/xxh_version\\n                if [[ -f \\$settings_path ]]; then\\n                    xxh_version=\\$(cat \\$settings_path)\\n                fi\\n            fi\\n            echo xxh_home_realpath=\\$xxh_home_realpath\\n            echo xxh_version=\\$xxh_version\\n            echo xxh_shell_exists=\\`[ -d \\$xxh_home_realpath/.xxh/shells/xxh-shell-fish ] && echo \\"1\\" ||echo \\"0\\"\\`\\n            echo xxh_home_writable=\\`[ -w \\$xxh_home_realpath ] && echo \\"1\\" ||echo \\"0\\"\\`\\n            echo xxh_parent_home_writable=\\$([ -w \\$(dirname \\$xxh_home_realpath) ] && echo \\"1\\" ||echo \\"0\\")\\n            echo rsync=\\`command -v rsync\\`\\n            echo scp=\\`command -v scp\\`\\n            echo shell=\\`command -v fish\\`\\n            echo kernel=\\`uname -s\\`\\n            echo arch=\\`uname -m\\`" | ssh -v -o StrictHostKeyChecking=accept-new ocdb-dumper -T "bash -s"']
buffer (last 100 chars): b'NAL = iTerm2\r\r\ndebug1: Sending env LC_TERMINAL_VERSION = 3.3.9\r\r\ndebug1: Sending command: bash -s\r\r\n'
before (last 100 chars): b'NAL = iTerm2\r\r\ndebug1: Sending env LC_TERMINAL_VERSION = 3.3.9\r\r\ndebug1: Sending command: bash -s\r\r\n'
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 42386
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
Unknown answer from host
Answer from host is empty. Try again with +v or +vv or try ssh before xxh
  1. What is the problem

For the first few times I used it, it would sometimes return unknown answer and sometimes succeed. The second time I tried, it connected and successfully installed. The fourth time I tried, it connected and I was in a remote Fish session as expected. It did not succeed since then, despite ssh still working.

Sometimes the "buffer"/"before" text is different but the rest is consistent.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

xxh message "Install sshpass to using password"

I'm having some difficulty getting xxh to work. I can successfully ssh into a server (prompts for password and then connects me), but when I replace 'ssh' with 'xxh', it prompts for the password and then after supplied, prints the following message and does not leave me connected:
"Install sshpass to using password: https://duckduckgo.com/?q=install+sshpass
Note! There are a lot of security reasons to stop using password auth."

Is this suggesting that xxh doesn't work with password authentication?

Edit:
Sorry, I suppose I should include some other information.

Local OS (where xxh is installed):
Ubuntu 20.04.1

Destination host OS:
Fedora 30 (server edition)

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

๐Ÿ‘ฅ Join to xxh teams

Hello!

In xxh project we have teams. If you're in team it does not oblige to do something. The main goal of teams is to create group of passionate people who could help or support in complex questions. Some people could be expert in one shell and newbie in another shell and mutual assistance is the key to xxh evolution.

Teams:

  • Core: @xxh/core
  • Shells: @xxh/xonsh @xxh/zsh @xxh/fish @xxh/bash
  • Special: @xxh/appimage

If you want to be in this teams or create a new one just ask in comments.

If you are joined the team feel free to make your participation public in settings.

Ask for key password one time

Local OS (where xxh is installed): MacOS
Destination host OS: ubuntu/lxc containers
xxh version: xxh/0.8.6
xxh-plugins installed: xxh-plugin-zsh-ohmyzsh

Steps to Reproduce

  1. I run xxh ... +v root@myhost and the output log is below
Load xxh config from /Users/****/.config/xxh/config.xxhc
Load xxh config for host myhost
Final arguments list: ['+I', 'xxh-plugin-zsh-ohmyzsh', '+hhh', '~', '+v', 'root@myhost']
ssh arguments: ['-o', 'StrictHostKeyChecking=accept-new', '-o', 'User=root']
**Enter passphrase for key '/Users/****/.ssh/id_rsa':**
Pexpect result:
{'user_host_accept': None, 'user_host_password': None, 'user_key_password': "'", 'output': '\r\nxxh_home_realpath=/root/.xxh\r\nxxh_version=0.8.6\r\nxxh_shell_exists=1\r\nxxh_home_writable=1\r\nxxh_parent_home_writable=1\r\nrsync=/usr/bin/rsync\r\nscp=/usr/bin/scp\r\nshell=\r\nkernel=Linux\r\narch=x86_64\r\n'}
Host info:

xxh_home_realpath=/root/.xxh
xxh_version=0.8.6
xxh_shell_exists=1
xxh_home_writable=1
xxh_parent_home_writable=1
rsync=/usr/bin/rsync
scp=/usr/bin/scp
shell=
kernel=Linux
arch=x86_64

**Enter passphrase for key '/Users/****/.ssh/id_rsa':**
Load plugin /root/.xxh/.xxh/shells/xxh-shell-zsh/build/zsh-bin/bin/../../../../../plugins/xxh-plugin-zsh-ohmyzsh/build/pluginrc.zsh
  1. the same issue doesn't occur if using ssh.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Review and reduce count of information connections before final connect

Before final connection there are few connections to get info about remote system:

  • Getting absolute path for user home directory if ~/ used in the path
  • Check existing xxh home path
  • Getting list of plugins

It will be great if it takes one connection.

Also to think:

  • Check free space on remote host before uploading
  • Check OS version

โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Support open ssh versions <7.6

Local OS (where xxh is installed): Ubuntu 16.04.6 LTS
xxh version: xxh/0.6.10

Steps to Reproduce

  1. Run xxh +vv hostname
2. The output log: CLICK to see collapsed text

$ xxh +vv hostname                                                                                                              203ms ๎‚ณ [Die Mรคr 24 14:23:34]
Load xxh config from /home/username/.xxh/.xxhc
Load xxh config for host .*
ssh arguments: ['-o', 'StrictHostKeyChecking=accept-new']
Try pexpect command: bash -c 'cat /home/linuxbrew/.linuxbrew/opt/python/lib/python3.7/site-packages/xxh_xxh/host_info.sh | sed "s|_xxh_home_|~/.xxh|" | sed "s|_xxh_shell_|xxh-shell-fish-appimage|" | ssh -v -o StrictHostKeyChecking=accept-new hostname -T "bash -s"'
Pexpect caught pattern: <class 'pexpect.exceptions.EOF'>
Pexpect result:
{'user_host_accept': None, 'user_host_password': None, 'user_key_password': None, 'output': 'command-line line 0: unsupported option "accept-new".'}
Host info:
command-line line 0: unsupported option "accept-new".
Unknown answer from host when getting info

3. What is the problem The **accept-new** option for **StrictHostKeyChecking** was not introduced until version 7.6 of Open SSH.

Please consider adding logic to check the version of Open SSH and then if the version is lower than 7.6 set StrictHostKeyChecking to yes, otherwise set it to accept-new.

Changing accept-new to yes on line 607 of xxh.py allows xxh to start.

LTS versions of Ubuntu, and possibly other Linux distros, issue security patched versions of the older versions of OpenSSH in use in their supported releases. So, it makes sense to support these versions as well.

The following command will parse out the version of OpenSSH for my current version of 7.2p2:

ssh -V 2>&1 | awk -F ' ' '{print $1}' | awk -F _ '{print $2}' | awk -F p '{print $1}'

The following string from my version of OpenSSH can be used to test parsing:

OpenSSH_7.2p2 Ubuntu-4ubuntu2.8, OpenSSL 1.0.2g  1 Mar 2016

Thanks for considering this fix!
Frederick

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

xxh shell for Mosh

Could this work with mosh: https://mosh.org/?

Remote terminal application that allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes.

Mosh is a replacement for interactive SSH terminals. It's more robust and responsive, especially over Wi-Fi, cellular, and long-distance links.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

+hh option in config do nothing

Local OS (where xxh is installed):
ArchLinux

Destination host OS:
Debian

xxh version:
0.8.3

xxh-plugins installed:
empty

config

hosts:
  ".*":
    +hh: "/tmp/xxh"
    +s: zsh

Steps to Reproduce

  1. I run xxh server +vv with above config.
  2. The output log:
server:/home/myuser/.xxh/.xxh/shells/xxh-shell-zsh not found. Install xxh-shell-zsh? [Y/n]
  1. I run xxh server +vv +hh /tmp/xxh with above config.
    output:
server:/tmp/xxh/.xxh/shells/xxh-shell-zsh not found. Install xxh-shell-zsh? [Y/n]

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Support for user-defined prompt and pass through (two-factor auth)

Is your feature request related to a problem? Please describe.
Some of my servers enable two-step verification when connecting to SSH. That generally works out of the box if a client simply prints what server sends and a client directly sends what a user types. However xxh firstly uses pexpect to collect host information and it stucks when a connection unexpectedly blocks with something like these:

Verification code:
We've sent a notification to your mobile device. Please respond to continue.

Describe the solution you'd like
Let xxh accept user-defined patterns to either prompt or pass through server output. Configuration could look like:

hosts:
  .*:
    ++prompt-input: Verification code:
    ++prompt-pass-through: Please respond to continue.

Describe alternatives you've considered
No idea.

Additional context
Some code could be inserted here:
https://github.com/xxh/xxh/blob/04019d1/xxh_xxh/xxh.py#L105-L190

if i == 7:
    # Input
    print((sess.before + sess.after).decode("utf-8"), end='')
    sess.sendline(input())

if i == 8:
    # Pass through
    print((sess.before + sess.after).decode("utf-8"), end='')

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Testing environment

Tests and docker will help

โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

How to handle the user's shell configuration with xxh

Currently using xxh with the xxh/xxh-shell-fish repository I can get a working Fish shell on a remote host. I am looking now to add plugins for a Fish shell package managers Fisher. Fisher and other Fish shell package manager store what packages have been installed in the user's configuration. For Fisher this is by default in ~/.config/fish/fishfile and ~/.config/fisher/. Oh-my-fish another Fish shell package manager stores this by default in ~/.config/omf/.

Both of these Fish shell package managers honor $XDG_CONFIG_HOME so with the current xxh code the configuration would be stored inside the ~/.xxh/ folder, aka $XXH_HOME, on the remote host.

The question I have is how to handle user configuration that the user just wants to be present when xxhing into a new host. In the case of the package manager what packages would be installed by default. I currently have two possibilities in mind for handling user configuration.

  1. A generic plugin, in that it works for all shells, that transfers user config from the local host to the xxh remote host.
  2. The user must write a custom plugin with their configuration.

I believe the first option would encourage broader adoption of xxh as it would make it easier to on-board new users.

If the users configuration was confined to a single directory on the local host which contained nothing else, the plugin could simply copy all configuration to the remote for all shells and plugins that the user wishes to setup. I am thinking that user configuration for remote host could be stored on the local host in a folder something like, ~./xxh/user-remote-host-config/ and use the same directory structure that would be expected on the remote host in $XDG_CONFIG_HOME.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Why does a 2nd run on the same host install stuff again ?

Local OS (where xxh is installed):

Ubuntu 19.10

Destination host OS:

Debian 10

xxh version:

0.8.2 (from pip3)

xxh-plugins installed:

Here's my ~/.config/xxh/config.xxhc

hosts:
  .*:
    +s: zsh
    +I: xxh-shell-zsh
    +I: xxh-plugin-zsh-ohmyzsh
    +if:
    +e:
      - ZSH_THEME="muse"

Might be relevant, my ~/.ssh/config

Compression yes
ControlMaster auto
ControlPath ~/.ssh/ssh_control_%r@%h:%p
ControlPersist 5m
ServerAliveInterval 60
HashKnownHosts no

Host s staging
    Hostname bastion.staging.company.cloud
    User me

Steps to Reproduce

~/work/ansible แ… xxh s                        
Install xxh-shell-zsh to s:/home/rgarrigue/.xxh
Remove s:/home/rgarrigue/.xxh/.xxh
First time upload using rsync (this will be omitted on the next connections)
First run xxh-shell-zsh on s
~ แ… hostname
i-09a1ed0f0ad0401f7
~ แ… 
~/work/ansible แ… xxh s
Install xxh-shell-zsh to s:/home/rgarrigue/.xxh
Remove s:/home/rgarrigue/.xxh/.xxh
First time upload using rsync (this will be omitted on the next connections)
First run xxh-shell-zsh on s
~ แ… hostname
i-09a1ed0f0ad0401f7

I'ld expect the 2nd (and subsequent) attempt to run way faster, without the Install / Remove / First time. The SSH conf is breaking it ?

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Conda package

Create conda package

โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Homebrew package

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

--info=progress2: unknown option

Host Version: macOS Mojave
Remote version: Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-1077-aws x86_64)
xxh version: xxh/0.6.2
xxh-plugins installed:

 5685  pip3 install --upgrade xxh-xxh
 5687  xxhp i xxh-shell-zsh
 5689  xxhp i xxh-plugin-zsh-ohmyzsh
 5690  source xxh.zsh myhost +if +q
 5691  xxh -i ~/.ssh/... [email protected]
 5692  vim ~/.xxh/.xxhc
โžœ cat ~/.xxh/.xxhc
hosts:
   ".*":                     # Regex for all hosts
     +s: xxh-shell-zsh

Steps to Reproduce

  1. Ran xxh -i ~/.ssh/jumpcloud [email protected]
  2. The output log:
โžœ xxh -i ~/.ssh/jumpcloud [email protected]
111.11.11.11:/home/tyler.thrailkill/.xxh/xxh/shells/xxh-shell-zsh not found. Install xxh-shell-zsh? [Y/n] y
Install xxh-shell-zsh to 111.11.11.11:/home/tyler.thrailkill/.xxh
Upload using rsync
rsync: --info=progress2: unknown option
rsync error: syntax or usage error (code 1) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52.200.1/rsync/main.c(1337) [client=2.6.9]
rsync: --info=progress2: unknown option
rsync error: syntax or usage error (code 1) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52.200.1/rsync/main.c(1337) [client=2.6.9]
rsync: --info=progress2: unknown option
rsync error: syntax or usage error (code 1) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52.200.1/rsync/main.c(1337) [client=2.6.9]
First run xxh-shell-zsh on 111.11.11.11
bash: /home/tyler.thrailkill/.xxh/xxh/shells/xxh-shell-zsh/build/entrypoint.sh: No such file or directory

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Auto-complete xxh host name from ssh config

xxh has been awesome so far with it's core functionality - but I need to type in the exact host names from ssh config as of now. Is it possible to auto-complete this with TAB-key support?

xxh host-prefix[TAB]

host-prefix-1
host-prefix-2
host-prefix-3

๐Ÿ… Solutions:

โžก๏ธ Bash and Xonsh on Ubuntu - #82 (comment)

โžก๏ธ Zsh - #82 (comment)

โžก๏ธ Fish - #82 (comment)


For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Hide code spew on abort of ssh login

Is your feature request related to a problem? Please describe.
Some times I do not have the ssh key in my ssh agent when I go to xxh into a host. I am then asked for my password but since want to use my key I abort with Ctrl+C. Then I see this:

$ xxh remotehost +if +RI xxh-plugin-fish-userconfig+path+/home/localusername/workarea/xxh-plugin-fish-userconfig
Remove xxh-plugin-fish-userconfig
Removed /home/localusername/.xxh/.xxh/plugins/xxh-plugin-fish-userconfig
Install xxh-plugin-fish-userconfig+path+/home/localusername/workarea/xxh-plugin-fish-userconfig to local /home/localusername/.xxh/.xxh/plugins/xxh-plugin-fish-userconfig
Package source path: /home/localusername/workarea/xxh-plugin-fish-userconfig
Build xxh-plugin-fish-userconfig
Installed /home/localusername/.xxh/.xxh/plugins/xxh-plugin-fish-userconfig
remoteusername@remotehost's password: 


Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/bin/xxh", line 14, in <module>
    xxh.main()
  File "/home/linuxbrew/.linuxbrew/opt/python/lib/python3.7/site-packages/xxh_xxh/xxh.py", line 704, in main
    host_info = self.get_host_info()
  File "/home/linuxbrew/.linuxbrew/opt/python/lib/python3.7/site-packages/xxh_xxh/xxh.py", line 268, in get_host_info
    pr = self.pssh(cmd)
  File "/home/linuxbrew/.linuxbrew/opt/python/lib/python3.7/site-packages/xxh_xxh/xxh.py", line 146, in pssh
    user_host_password = getpass.getpass(prompt=(sess.before + sess.after).decode("utf-8")+' ')
  File "/home/linuxbrew/.linuxbrew/opt/python/lib/python3.7/getpass.py", line 77, in unix_getpass
    passwd = _raw_input(prompt, stream, input=input)
  File "/home/linuxbrew/.linuxbrew/opt/python/lib/python3.7/getpass.py", line 146, in _raw_input
    line = input.readline()
KeyboardInterrupt

Describe the solution you'd like
Not sure if this is possible but possibly a clean exit without all this debug info. Maybe a debug option could be set to dump this information if needed.

Describe alternatives you've considered
Live with it as it is.

Additional context
None
For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

sshpass on python

In version 0.3.0 we were added sshpass usage as time-tested way to do ssh with password. But I believe there is a way to make sshpass functionality on pure python. Using pexpect for example. It could gives xxh less dependencies.

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

xxh fails when VisualHostKey=yes

Local OS (where xxh is installed):
ArchLinux

Destination host OS:
Debian

xxh version:
xxh/0.8.3

xxh-plugins installed:
no plugin installed

xxh config
empty

Steps to Reproduce

  1. Set VisualHostKey yes to ~/.ssh/config.
  2. Run xxh server +vv
  3. The output log:
Traceback (most recent call last):
  File "/usr/bin/xxh", line 12, in <module>
    xxh.main()
  File "/usr/lib/python3.8/site-packages/xxh_xxh/xxh.py", line 773, in main
    host_info = self.get_host_info()
  File "/usr/lib/python3.8/site-packages/xxh_xxh/xxh.py", line 337, in get_host_info
    r = dict([l.split('=') for l in r.replace('\r','').split('\n') if l.strip() != '' and '=' in l])
ValueError: dictionary update sequence element #2 has length 3; 2 is required
  1. What is the problem

I inserted this line to xxh.py at line 336

self.eprint([l.split('=') for l in r.replace('\r','').split('\n') if l.strip() != '' and '=' in l]
)

Then, I got this

[['|  ..oo++ ', '+.*.E  |'], ['|  . o ', '     . o .|'], ['|          .E+o', 'o', '|'], ['|         ..', '.', '*.*|'], ['|        S o +O+', '*|'], ['|           .++', 'oB|'], ['|             + +', '|'], ['|               .', '|'], ['debug1: kex_input_ext_info: server-sig-algs', '<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>'], ['xxh_home_realpath', '/home/xxx/.xxh'], ['xxh_version', 'dir_not_found'], ['xxh_shell_exists', '0'], ['xxh_home_writable', '0'], ['xxh_parent_home_writable', '1'], ['rsync', '/usr/bin/rsync'], ['scp', '/usr/bin/scp'], ['shell', '/usr/bin/zsh'], ['kernel', 'Linux'], ['arch', 'x86_64']]
Traceback (most recent call last):
  File "/usr/bin/xxh", line 12, in <module>
    xxh.main()
  File "/usr/lib/python3.8/site-packages/xxh_xxh/xxh.py", line 773, in main
    host_info = self.get_host_info()
  File "/usr/lib/python3.8/site-packages/xxh_xxh/xxh.py", line 337, in get_host_info
    r = dict([l.split('=') for l in r.replace('\r','').split('\n') if l.strip() != '' and '=' in l])
ValueError: dictionary update sequence element #2 has length 3; 2 is required

So, I remove VisualHostKey=yes and output is this:

[['debug1: kex_input_ext_info: server-sig-algs', '<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>'], ['xxh_home_realpath', '/home/xxx/.xxh'], ['xxh_version', 'dir_not_found'], ['xxh_shell_exists', '0'], ['xxh_home_writable', '0'], ['xxh_parent_home_writable', '1'], ['rsync', '/usr/bin/rsync'], ['scp', '/usr/bin/scp'], ['shell', '/usr/bin/zsh'], ['kernel', 'Linux'], ['arch', 'x86_64']]
server:/home/xxx/.xxh/.xxh/shells/xxh-shell-zsh not found. Install xxh-shell-zsh? [Y/n]

For community:
โฌ‡๏ธ Please click the ๐Ÿ‘ reaction instead of leaving a +1 or ๐Ÿ‘ comment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.