Advertisement
Guest User

Untitled

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