GOTCHA - The SSH-TTY control Interface

GOTCHA - The SSH-TTY control Interface
Photo by William Bayreuther / Unsplash

I have been working on a solution to mirror the š¬šœš«šžšžš§ of another user's terminals. As part of that, I need a way to execute commands on another š­š­š²/š©š­š¬. A simple šžšœš”šØ won't work because šžšœš”šØ writes to the output buffer, while I need to push these commands to the input buffer of the š­š­š²/š©š­š¬.

I found these š«šžš©šØš¬ after some googling.

https://github.com/d-tsuji/ttycopy
https://github.com/nopernik/sshpry
https://github.com/nopernik/SSHPry2.0

To accomplish this. The previous code was adapted as follows;
#devsecops #linux #strace #python3

https://pypi.org/project/ttyGotcha/

GitHub - caputomarcos/gotcha
Contribute to caputomarcos/gotcha development by creating an account on GitHub.

::

     ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā•—  ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā•— ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā•— ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā•—ā–ˆā–ˆā•—  ā–ˆā–ˆā•— ā–ˆā–ˆā–ˆā–ˆā–ˆā•— ā–ˆā–ˆā•—ā–ˆā–ˆā•—ā–ˆā–ˆā•—
    ā–ˆā–ˆā•”ā•ā•ā•ā•ā• ā–ˆā–ˆā•”ā•ā•ā•ā–ˆā–ˆā•—ā•šā•ā•ā–ˆā–ˆā•”ā•ā•ā•ā–ˆā–ˆā•”ā•ā•ā•ā•ā•ā–ˆā–ˆā•‘  ā–ˆā–ˆā•‘ā–ˆā–ˆā•”ā•ā•ā–ˆā–ˆā•—ā–ˆā–ˆā•‘ā–ˆā–ˆā•‘ā–ˆā–ˆā•‘
    ā–ˆā–ˆā•‘  ā–ˆā–ˆā–ˆā•—ā–ˆā–ˆā•‘   ā–ˆā–ˆā•‘   ā–ˆā–ˆā•‘   ā–ˆā–ˆā•‘     ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā•‘ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā•‘ā–ˆā–ˆā•‘ā–ˆā–ˆā•‘ā–ˆā–ˆā•‘
    ā–ˆā–ˆā•‘   ā–ˆā–ˆā•‘ā–ˆā–ˆā•‘   ā–ˆā–ˆā•‘   ā–ˆā–ˆā•‘   ā–ˆā–ˆā•‘     ā–ˆā–ˆā•”ā•ā•ā–ˆā–ˆā•‘ā–ˆā–ˆā•”ā•ā•ā–ˆā–ˆā•‘ā•šā•ā•ā•šā•ā•ā•šā•ā•
    ā•šā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā•”ā•ā•šā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā•”ā•   ā–ˆā–ˆā•‘   ā•šā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā•—ā–ˆā–ˆā•‘  ā–ˆā–ˆā•‘ā–ˆā–ˆā•‘  ā–ˆā–ˆā•‘ā–ˆā–ˆā•—ā–ˆā–ˆā•—ā–ˆā–ˆā•—
    ā•šā•ā•ā•ā•ā•ā•  ā•šā•ā•ā•ā•ā•ā•    ā•šā•ā•    ā•šā•ā•ā•ā•ā•ā•ā•šā•ā•  ā•šā•ā•ā•šā•ā•  ā•šā•ā•ā•šā•ā•ā•šā•ā•ā•šā•ā•

    SSH-TTY control
    


    Usage: GOTCHA [OPTIONS]

    Args: --auto                # Lazy mode, auto-attach to first found session.
          --list                # List available SSH Sessions.
          --tty /dev/pts/XX     # Point GOTCHA to specific TTY.
          --replay <file>       # Play previously recorded session.
          --speed 4             # Replay speed multiplier (Default: 4).

                 ----- root privileges required! -----

Usage

$ sudo su
$ gotcha --auto

Installation

Requirements::

Linux syscall tracer (strace) and root privileges required!

https://strace.io

From pypi::

pip3 install ttyGotcha

From source::

git clone https://github.com/caputomarcos/gotcha.git
cd gotcha
python setup.py install

Community Distributions

Feel free! All contributions are welcome.