2 ms·
I once made the following while drunk a few years back. It was a nerd-dare... # dark magicks for hopping hosts. first version # (you'll need to specify tar
by dramaturg 12y ago
I once made the following while drunk a few years back. It was a nerd-dare...
# dark magicks for hopping hosts. first version
# (you'll need to specify target user name though)
Host *+*
VerifyHostKeyDNS=no
ProxyCommand ssh $(echo %h | sed 's/^\([^+]*\).*$/\1/') nc $(sed -n '/^Host[ \t]*\('$(echo %h | sed 's/^.*+\([^+]*\)$/\1/')'\)$/,/^$/{/^.*HostName[ \t]*/{s///; s/[ \t]*$//; h}}; ${x; /./{p; b}; s/^/'$(echo %h | sed 's/^.*+\([^+]*\)$/\1/')'/p}' ~/.ssh/config) $(sed -n '/^Host[ \t]*\('$(echo %h | sed 's/^.*+\([^+]*\)$/\1/')'\)$/,/^$/{/^.*Port[^0-9]*/{s///;s/[ \t]*$//;h;};};${x;/./{p;q;};s/^/22/p;}' ~/.ssh/config)