Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
get static DNS from Mikrotik router and output in .ssh/config format with comment as username
from tikapy import TikapyClient
from pprint import pprint
client = TikapyClient('', 8728)
client.login('admin', 'banzai74')
for key, value in res.items():
if 'comment' in value:
# print("Host", value['name'], value['address'], value['comment'])
print("Host", value['name'])
print(" HostName", value['address'])
print(" User", value['comment'])
# print(value['name'], value['address'])
print("Host", value['name'])
print(" HostName", value['address'])

This comment has been minimized.

Copy link
Owner Author

@lttlrck lttlrck commented Jan 9, 2018

then use this alias to build .ssh/config for fast SSH selection to different hosts. Uses peco. Merges other hosts from ~/.ssh/config_

alias sss='ssh $(~/ > ~/.ssh/config ; cat ~/.ssh/config_ >> ~/.ssh/config ; chmod 600 ~/.ssh/config; (grep Host ~/.ssh/config | grep -v HostName | cut -d" " -f2 | sort) | sort | uniq | peco --prompt=:)'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.