Created
May 23, 2018 20:57
-
-
Save privateip/89b47c0c908173283c812f932b389ee9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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