Advertisement
Guest User

Untitled

a guest
Jun 7th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import sys
  2. import os
  3.  
  4. print os.name
  5. try:
  6. if sys.argv[1] == 'deploy':
  7. import paramiko
  8.  
  9. # Connect to remote host
  10. client = paramiko.SSHClient()
  11. client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  12. client.connect('XX.XX.XX.XX', username='admin', password='****')
  13.  
  14. # Setup sftp connection and transmit this script
  15. sftp = client.open_sftp()
  16. sftp.put(__file__, "C:UsersDesktopmyremote.py")
  17. sftp.close()
  18.  
  19. # Run the transmitted script remotely without args and show its output.
  20. # SSHClient.exec_command() returns the tuple (stdin,stdout,stderr)
  21. stdout = client.exec_command('python /tmp/myremote.py')[1]
  22. for line in stdout:
  23. # Process each line in the remote output
  24. print line
  25.  
  26. client.close()
  27. sys.exit(0)
  28. except IndexError:
  29. pass
  30.  
  31. import logging
  32. from pywinauto import application
  33. pwa_app = application.Application()
  34. pwa_app.start_('notepad.exe')
  35. logging.warning("Application successfully opened")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement