Advertisement
Guest User

Paramiko

a guest
Jun 5th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import paramiko
  2. import logging
  3.  
  4. class A(object):
  5.  
  6. def f(self):
  7.  
  8. url = "192.168.0.201"
  9.  
  10. logging.basicConfig(filename='test.log', level=logging.DEBUG)
  11. logger = logging.getLogger("my_log")
  12. logger.debug('This message should go to the log file')
  13.  
  14. client = paramiko.SSHClient()
  15. paramiko.util.log_to_file("filename.log")
  16. client.load_system_host_keys()
  17. client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  18. client.connect(url, port=8333, username='multichainrpc', password='5gPqaBfyG69HbLHq64XLPuwopKi3K7fzY9aEXeU3f9TF')
  19.  
  20. #todo ask about url, usern, and passw
  21. resp = raw_input("Type nodeinfo or networkinfo: ");
  22. if(resp=="nodeinfo"):
  23. stdin, stdout, stderr = client.exec_command('multichain-cli proof getaddednodeinfo')
  24. print(stdout.readLines())
  25. if(resp=="networkinfo"):
  26. stdin, stdout, stderr = client.exec_command('multichain-cli proof getnetworkinfo')
  27. print(stdout.readLines())
  28. client.close()
  29.  
  30. b = A()
  31. b.f()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement