From 008fe277e91fb2b0fdd8bc495205146485c1f521 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Tue, 23 Oct 2018 23:43:07 -0500 Subject: [PATCH] All functionality added Time to test --- hostnames.ini | 2 +- ssh-host.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hostnames.ini b/hostnames.ini index 02d5cde..cfc06f6 100644 --- a/hostnames.ini +++ b/hostnames.ini @@ -5,4 +5,4 @@ router = root@router [wan] host = rlbrhost.ddns.net room = raphael@${wan:host} -router = root@{wan:host} \ No newline at end of file +router = root@${wan:host} \ No newline at end of file diff --git a/ssh-host.py b/ssh-host.py index ab66b3a..1b4b4f3 100755 --- a/ssh-host.py +++ b/ssh-host.py @@ -13,5 +13,12 @@ if __name__ == "__main__": parser.add_argument('name',help='name of config file to use (sans .cfg)') parser.add_argument('arg',nargs = '*') args = parser.parse_args() - cmd = ['ssh','-F','~/.ssh/{}.cfg'.format(args.name)] - subprocess.call(cmd) + + pre = '~/.ssh/config/{}'.format(args.pre_script) + if args.wan: + host = cp['wan'][args.name] + elif args.lan: + host = cp['lan'][args.name] + cmd = ['ssh','-F','~/.ssh/{}.cfg'.format(args.name),host] + args.arg + subprocess.check_call(pre) + subprocess.call(cmd) \ No newline at end of file