Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save privateip/89b47c0c908173283c812f932b389ee9 to your computer and use it in GitHub Desktop.
Save privateip/89b47c0c908173283c812f932b389ee9 to your computer and use it in GitHub Desktop.
import paramiko
user = raw_input('Username: ')
password = raw_input('Password: ')
name = raw_input('Hostname: ')
command = raw_input('Command: ')
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname=name, username=user, password=password)
ssh.invoke_shell()
stdin, stdout, stderr = ssh.exec_command(command)
print stdout.read()
ssh.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment