Autotelnet

glitchlist Blog Leave a Comment

Today I will show you how I built a simple script to automate telnet connections. Sometimes I had to troubleshoot network issues and chase problems on many devices starting from the output on a log file. At each IP corresponding to a network device that I show up in the logs, I had to open a terminal, type in the connection details, and start the connection. With this script, I intercept the IP with a mouse selection and then calling up the telnet/ssh connection with the press of a function key. But let’s see how I did it.

Script recipe:
– Linux distro (Kubuntu in my case)
– #bash/script
– Keyboard shortcuts editor
– xclipboard packet
– konsole packet

Script code:

#!/bin/bash
MouseSelection="$(xclip -o)"
konsole -e telnet ${MouseSelection} &

Keyboard shortcuts configuration:

System Settings > Shortcuts > Custom Shortcuts > Edit > New > Global Shortcuts > Command/URL
Enter the path of Autotelnet script

Enjoy!

.glitchlist crew

Leave a Reply

Your email address will not be published. Required fields are marked *