Guest User

Untitled

a guest
Sep 9th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. name:xyz
  2.  
  3. pass:xyz
  4.  
  5.  
  6. >satus
  7. #writes status
  8. >magic
  9.  
  10. >UNLOCKED>
  11.  
  12. >UNLOCKED>conf
  13. >>set management cwmp enable on
  14. >>save
  15.  
  16. *configuration saved*
  17.  
  18. import paramiko
  19.  
  20. ssh = paramiko.SSHClient()
  21. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  22. ssh.connect( '192.168.2.254',port = 22, username = 'xyz', password = 'xyz')
  23. stdin, stdout, stderr = ssh.exec_command( 'status' )
  24. output = stdout.readlines()
  25. print "n".join(output)
  26. stdin, stdout, stderr = ssh.exec_command('magic')
  27. output1 = stdout.readlines()
  28. print output1
  29. stdin, stdout, stderr = ssh.exec_command('conf')
  30. output1 = stdout.readlines()
  31. print output1
  32. stdin, stdout, stderr = ssh.exec_command('set management cwmp enable on')
  33. output1 = stdout.readlines()
  34. print output1
  35.  
  36. #after executing conf command
Add Comment
Please, Sign In to add comment