home

Oneliners

figlet alternative with netpbm

a nice alternative to figlet by using netpbm

date +'%a %d.%m.%Y' | pbmtext | pbmtoascii

resulting in:


              "M""""M         oM   M"""M    oM"Mo  oM      o"""o oM"Mo o"""o oM"Mo
               M   o  o oo   " M      M     M   M " M          M M   M     M M   M
               M"""M   M"      M     M      M   M   M        o"  M   M   o"  M   M
               M       M       M    M       Mo oM   M      o"  o Mo oM o"  o Mo oM
              """"    """     """   "     "  """   """   " """""  """  """""  """

ssh-keygen parallel pattern match fingerprint

this one generate lots of ed25519 ssh keypairs in your ramdisk and tries to find a keypair with a nice publickey sha256 base64 encoded fingerprint(!), matching the given pattern (e.g. your name). such a fingerprint is logged in syslog the host you'll login, and this will be an eyecatcher.

export s=YOURNAME d=/dev/shm/;ulimit 64000;yes|xargs -P 0 sh -c "ssh-keygen -t ed25519 -P '' -f \"$d/s.$$.\$\$\"|\
grep -q \"$s\"&&cp \"$d/s.$$.\$\$\" \"$d/f.$$.\$\$.$(date +%s)";rm \"$d/s.$$.\$\$\" \"$d/s.$$.\$\$.pub\";echo -n ."

it uses ssh-keygen from openssh. it will print a dot for every generated keypair, so you can add pipeviewer "|pv -b >/dev/null" for speed measurement.

just choose a special s= with your search pattern. replace YOURNAME and start the script. warning: this script will run many tasks in parallel and will generate several thousand keys per second on a modern machine.

if a keypair is found, its named "/dev/shm/f.??????.?????". the script won't terminate, just run forever and search further matching keys. all keys are deleted immediatly if they don't match.

you have to check manually ls /dev/shm/f.* if a key is found. if there is a result, choose a passphrase for the key ssh-keygen -p -f /dev/shm/f.????.???? and export your public key with ssh-keygen -y -f /dev/shm/f.?????.???? > /dev/shm/found.pub. copy both files to a safe place.

Hint: Since random input values are used to generate these keypairs, you can't really predict when you'll find a match. For short strings with 3-4 chars, you should get a result quiet fast. roll the dice. and you have to roll more than a double with lots of dices. :) This is just a quick hack.

Offtopic: Other Things that use Ed25519. So here is a tiny version of ssh-keygen: tiny-ssh-keygen-ed25519 from Péter Szabó (pts), based on tweetnacl. (local mirror. untested. do not trust in it. you would also have to modify the sourcecode to get the fingerprint of current generate key at stdout)