Advertisement
Guest User

Giovanni

a guest
Nov 18th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. import paramiko
  2. import sys
  3.  
  4. nbytes = 4096
  5. hostname = '192.168.1.105'
  6. port = 22
  7. username = 'root'
  8. password = '123'
  9.  
  10. try:
  11.     client = paramiko.SSHClient()
  12.     client.load_system_host_keys()
  13.     client.set_missing_host_key_policy(paramiko.AutoAddPolicy())#set_missing_host_key_policy(paramiko.WarningPolicy())
  14.     client.connect(hostname, port=port, username=username, password=password)
  15.     stdin, stdout, stderr = client.exec_command('echo "Puri            IN  A   192.168.3.13" >> /var/named/dynamic/db.grupo3.net')#<---Comandos aca
  16.     print (stdout.read().decode("utf-8"))
  17.     stdin, stdout, stderr = client.exec_command("cat /var/named/dynamic/db.grupo3.net")#<---Comandos aca
  18.     print (stdout.read().decode("utf-8"))
  19. finally:
  20.     client.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement