Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import os
- print os.name
- import paramiko
- # Connect to remote host
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect('XX.XX.XX.XX', username='admin', password='****')
- # Setup sftp connection and transmit this script
- sftp = client.open_sftp()
- sftp.put(__file__, "C:UsersDesktopremote_server.py")
- sftp.close()
- # Run the transmitted script remotely without args and show its output.
- # SSHClient.exec_command() returns the tuple (stdin,stdout,stderr)
- stdout = client.exec_command('python /tmp/remote_server.py')[1]
- for line in stdout:
- # Process each line in the remote output
- print line
- client.close()
- sys.exit(0)
- import logging
- from pywinauto import application
- pwa_app = application.Application()
- pwa_app.start_('notepad.exe')
- logging.warning("Application successfully opened")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement