Last active
August 29, 2015 13:56
-
-
Save nanotechz9l/9337562 to your computer and use it in GitHub Desktop.
ssh.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/ssh' # more details: https://github.com/net-ssh/net-ssh | |
require 'logger' | |
if not ARGV[2] | |
puts "\n[Auto SSH login by Rick Flores (@nanotechz9l)]" | |
puts "Missing arguments. Correct useage below:\n" | |
puts "#{$0} ip user pass" | |
exit(0) | |
end | |
ip, user, pass = ARGV[0..2] | |
Net::SSH.start("#{ip}", "#{user}", :password => "#{pass}") do |ssh| | |
puts "SSH Login successful..." | |
puts "Logging out..." | |
#ssh.exec "hostname;w;ifconfig" # command chains | |
#print "Hostname =" | |
#ssh.exec "hostname\n" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment