Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. ssh.py -username admin -password password -hostlist 192.168.1.1, 192.168.1.2 -commands uname -a, whoami
  2.  
  3. hostlist = ['192.168.1.1','192.168.1.2']
  4. username = 'admin'
  5. password = 'password'
  6. commands = ['uname -a','whoami']
  7.  
  8. parser = argparse.ArgumentParser()
  9. parser.add_argument('-u', '-username', help='The Username for authentication.')
  10. parser.add_argument('-p', '-password', help='The password for authentication.')
  11. parser.add_argument('-l', '-hostlist', nargs='+', help='List of devices to interact with.')
  12. parser.add_argument('-c', '-commands', nargs='+', help='An exact list of commands to run')
  13.  
  14. args = parser.parse_args()
  15. u,username = args.username
  16. p,password = args.password
  17. l,hostlist = args.hostlist
  18. c,commands = args.commands
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement