You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
762 B

7 years ago
  1. #!/usr/bin/python
  2. import subprocess
  3. import argparse
  4. import configparser
  5. cp = configparser.ConfigParser(interpolate=configparser.ExtendedInterpolation())
  6. cp.read('hostnames.ini')
  7. if __name__ == "__main__":
  8. parser = argparse.ArgumentParser()
  9. group = parser.add_mutually_exclusive_group(required=True)
  10. group.add_argument('-o','—-wan',action = 'store_true')
  11. group.add_argument('-l','--lan',action = 'store_true')
  12. parser.add_argument('-p','--pre-script', help= 'script to run before connecting(in config dir)')
  13. parser.add_argument('name',help='name of config file to use (sans .cfg)')
  14. parser.add_argument('arg',nargs = '*')
  15. args = parser.parse_args()
  16. cmd = ['ssh','-F','~/.ssh/{}.cfg'.format(args.name)]
  17. subprocess.call(cmd)