Guest User

Untitled

a guest
Oct 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. require 'rubygems'
  2. require 'net/ssh/multi'
  3. require 'socket'
  4.  
  5.  
  6. HOSTLIST = ['127.0.0.1','128.0.0.1']
  7. USERLIST = ['user','user']
  8. PASSWORD = ['userpegase','userpegase']
  9.  
  10.  
  11. Net::SSH::Multi.start(:on_error => :warn) do |session|
  12.  
  13. HOSTLIST.each_with_index do |session_server,index|
  14. session.use session_server , :user => USERLIST[index] , :password => PASSWORD[index], :timeout => 2
  15. end
  16.  
  17. session.exec 'pwd' do |ch, stream, data|
  18. puts "[#{ch[session]} : #{stream}] - #{data}"
  19. end
  20.  
  21. session.loop
  22. end
Add Comment
Please, Sign In to add comment