Cliptype

Cliptype is an Open Source utility by Carles Mateo to paste (the text contents of) the Clipboard into the focused window, as if it was typed by keyboard.

Get the source code

git clone https://gitlab.com/carles.mateo/cliptype.git

Rationale

Sometimes you need to SSH to a Server, but the interface is down, and you have to go through web based SSH QEMU, KVM or similar. Or you are jumping through several layers of remote control, or using vSphere and not being able to copy and paste.

It may happen to you in a Cloud Service Provider or with your Data Center Servers, accessing a management Software.

Some of these tools do not provide copy and paste, so if you need to download a Python script and the server has not Internet (Security ACLs) you may have to type a long script by hand, with the possibility of errors, or you may have to ssh to a Server that has that capacity, losing tons of time. Imagine typing manually a Private Key to being able to access other Servers…

Cliptype allows you to grab any text from the Clipboard, sanitize it if it has \r (Windows characters \r\n for a new line) and then send the text to the application with focus via keyboard, like if you was typing.

Compatibility

Cliptype has been created to work on:

  • Linux
  • Mac
  • Windows

So far I have only tested in Windows and Mac.

Instructions

First you need to install Python, pip, and then install the required Python packages:

  • pyperclip
  • pynput


Or on Ubuntu just do:

pip3 install -r requirements.txt

In Linux/Mac:

pip install -r requirements.txt

If you use Linux you’ll need to install one of these utilities:

sudo apt-get install xsel      # to install the xsel
sudo apt-get install xclip     # to install the xclip utility
pip install gtk                # to install the gtk Python module
pip install PyQt4              # to install the PyQt4 Python module

Best Usage

The best way to use it is against a Web SSH Terminal and opening the editor on the Server we ssh’d, if it’s vi press a to start adding text, and then running the paste into option from cliptype.

Using it against VirtualBox or VMware Workstation VM’s

As the keystrokes are sent as if they were actually being sent from the keyboard, the problems you may find are similar to the ones you may find by typing.

So when you type sometimes you can loss keystrokes in VirtualBox or VMware Workstation, specially if the CPU is very busy or there is high IO.

It happens the same when you use cliptype.

So it is recommended to use only when CPU usage is not very high, and taking in count that some keystrokes can be missed.

In one of my tests VirtualBox lost several keystrokes and let b like if it was continuously being pressed. So manual supervision is recommended.

Views: 24,497 views

Rules for writing a Comment


  1. Comments are moderated
  2. I don't publish Spam
  3. Comments with a fake email are not published
  4. Disrespectful comments are not published, even if they have a valid point
  5. Please try to read all the article before asking, as in many cases questions are already responded