SHARE
TWEET

Paramiko

a guest Jun 5th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top