Little USB password paster

Last Updated or created 2022-07-02

When using Spice and VNC to virtual machine consoles, and remote consoles like idrac and ilo, it is not alway possible to copy-paste.

When doing maintenance it is a annoyance to type a super strong and long password by hand, Prone to typing errors, timeouts. And following lockouts.

So i wanted to auto type the password.

First solution was to bind a little bash script to a key combination.

#!/bin/bash
# Usage: make a keypress shortcut to this script
# activate shortcut, and the script wil give you 10 seconds to click and focus remote console window.
# It pastes the password, and you can press enter to login
# ( you can use xdotool also to press enter for you )
sleep 10
xdotool type "SUP3Rl00000ngandcompl3xpasswo0d@#@#@#%$%$%%$-you-cant-type-me-without-erors"

I’ve bound this to a key combination on my workstation.

gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'passpaste'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command '~/bin/passpaste.sh'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding '<Super>p'

This works, but only where this script is installed.
So not on colleagues machines, workstations with windows, and the super secret admin/root account sits in a file.

So i made a password key, which count be behind lock and key.

Using a digistump, a push-button and a resistor, the passpaster was born.

Program to flash on the digistump

#include "DigiKeyboard.h"
void setup() {
  DigiKeyboard.sendKeyStroke(0);
  DigiKeyboard.delay(1000);
}

void loop() {
  if (digitalRead(0) == HIGH) WorkPass();
  if (digitalRead(1) == HIGH) LtPass();
}

void WorkPass() {
  DigiKeyboard.print("SUP3Rl00000ngandcompl3xpasswo0d@#@#@#%$%$%%$-you-cant-type-me-without-erors");
  DigiKeyboard.println();
  DigiKeyboard.delay(50);
  setup();
}

void LtPass() {
  DigiKeyboard.print("secondlongpasswordifyouareusingtwobuttons");
  DigiKeyboard.println();
  DigiKeyboard.delay(50);
  setup();
}

Plug the Digispark into you machine, it wil emulate a HID device (Keyboard).
Get your remote console into focus, press button .. presto!

TODO:

  • 3D print a little case
  • pin protect?
  • rotary + display? (Like below)

It would be nice to have something like:

Rotary encoder 1 – selects which password to paste
Rotary encoder 2 – (1-255) does a encryption method on the password
Display shows : Password #32 – Crypt # 88
So you can have for example 255 passwords with 255 encryptions .. which to use when? Only you know.

Above can’t be done with a Digispark, so i’ll have to use a Arduino Pro Mini or a equivalent