Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- def ssh_command(hostname, port, username, password, command):
- ssh_client = paramiko.SSHClient()
- ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh_client.load_system_host_keys()
- ssh_client.connect(hostname, port, username, password)
- stdin, stdout, stderr = ssh_client.exec_command(command)
- print(stdout.read().decode('UTF-8'))
- if __name__ == '__main__':
- hostname = input("Hostname: ")
- username = input("Username: ")
- password = input("Passowrd: ")
- port = input("Port: ")
- command = input("Command TODO: ")
- ssh_command(hostname, port, username, password, command)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement