Created
June 3, 2012 02:13
-
-
Save KINGSABRI/2860989 to your computer and use it in GitHub Desktop.
Checker for correct/incorrect user/pass
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
#~~~~~~~~~~~~~~~~~~~~~~~ | |
# Checker for correct/incorrect user/pass | |
# xx.xx.xx.xx:user:pass | |
# Coded by : KING SABRI | |
# License : JUST FOR DR.Hacker | |
#~~~~~~~~~~~~~~~~~~~~~~~ | |
#=-Notes-= | |
# sudo gem install net-ssh colorize | |
#~~~~~~~~~~~~~~~~~~~~~~~ | |
require 'rubygems' | |
require 'net/ssh' | |
require 'colorize' | |
$log_file = 'log.txt' | |
$ok = "[ " +"SUCCESS!".green + " ]" | |
$nok = "[ " + "FAILED".red + " ]" | |
$time = "[ " +"TIMEOUT".yellow + " ]" | |
list = ARGV[0] | |
if list == nil | |
puts "Usage: ruby check-my-root.rb [FILE NAME]" | |
exit | |
end | |
IO.readlines(list).each do |s| | |
begin | |
# user = s.split(":")[1].to_s.chompss | |
Net::SSH.start( s.split(":")[0].to_s.chomp , 'root' , :password => s.split(":")[1].to_s.chomp , :port => 22 , :timeout => 7 ) do |ssh| | |
ssh.open_channel do |ch1| | |
ch1.on_request "exit-status" do |ch2, data| | |
$exit_status = data.read_long | |
end # end of ch2 | |
ch1.request_pty do |ch3, success| | |
ch3.exec("ls") | |
if success | |
File.open($log_file , 'a+') {|log| log.puts "#{s.split(":")[0].to_s.chomp}: #{s.split(":")[1].to_s.chomp}"} | |
puts "#{s.split(":")[0].to_s.chomp}" + "\t" + "#{$ok}" | |
sleep 0.1 | |
end | |
end # end of ch3 | |
ch1.wait | |
end # end of ch1 | |
end # end of SSH.start | |
rescue Timeout::Error | |
puts "#{s.split(":")[0].to_s.chomp}" + "\t" + "#{$time}" | |
rescue | |
puts "#{s.split(":")[0].to_s.chomp}" + "\t" + "#{$nok}" | |
end | |
end # end of IO | |
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
#~~~~~~~~~~~~~~~~~~~~~~~ | |
# Checker for correct/incorrect user/pass | |
# Coded by : KING SABRI | |
# License : JUST FOR DR.Hacker | |
#~~~~~~~~~~~~~~~~~~~~~~~ | |
#=-Notes-= | |
# sudo gem install net-ssh colorize logger | |
#~~~~~~~~~~~~~~~~~~~~~~~ | |
require 'rubygems' | |
require 'net/ssh' | |
require 'colorize' | |
require 'logger' | |
logger = Logger.new('check-my-root.log', 10, 10240) | |
$ok = "[ " +"OK".green + " ]" | |
$nok = "[ " + "FAILED".red + " ]" | |
$time = "[ " +"TIMEOUT".yellow + " ]" | |
$un = "[ " +"UNREACHABLE".yellow + " ]" | |
$ref = "[ " +"CONNECTION REFUSED".yellow + " ]" | |
list = ARGV[0] | |
if list == nil | |
puts "Usage: ruby check-my-root.rb [FILE NAME]" | |
exit | |
end | |
IO.readlines(list).each do |s| | |
begin | |
Net::SSH.start( s.split(":")[0].to_s.chomp , s.split(":")[1].to_s.chomp , :password => s.split(":")[2].to_s.chomp , :port => 22 , :timeout => 5 ) do |ssh| | |
ssh.open_channel do |ch1| | |
ch1.on_request "exit-status" do |ch2, data| | |
$exit_status = data.read_long | |
end # end of ch2 | |
ch1.request_pty do |ch3, success| | |
ch3.exec("ls") | |
if success | |
logger.info "#{s.split(":")[0].to_s.chomp} : Correct Password!" | |
puts "#{s.split(":")[0].to_s.chomp}" + "\t" + "#{$ok}" | |
sleep 0.1 | |
else | |
logger.info "#{s.split(":")[0].to_s.chomp} : Wrong Password!" | |
puts "#{s.split(":")[0].to_s.chomp}" + "\t" + $nok | |
end | |
end # end of ch3 | |
ch1.wait | |
end # end of ch1 | |
end # end of SSH.start | |
rescue Timeout::Error | |
logger.info "#{s.split(":")[0].to_s.chomp} : Timeout!" | |
puts "#{s.split(":")[0].to_s.chomp}" + "\t" + "#{$time}" | |
rescue | |
logger.info "#{s.split(":")[0].to_s.chomp} : Wrong Password!" | |
puts "#{s.split(":")[0].to_s.chomp}" + "\t" + "#{$nok}" | |
end | |
end # end of IO | |
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
#~~~~~~~~~~~~~~~~~~~~~~~ | |
# Checker for correct/incorrect user/pass | |
# Coded by : KING SABRI | |
# License : JUST FOR DR.Hacker | |
#~~~~~~~~~~~~~~~~~~~~~~~ | |
#=-Notes-= | |
# sudo gem install net-ssh colorize | |
#~~~~~~~~~~~~~~~~~~~~~~~ | |
require 'net/ssh' | |
require 'colorize' | |
$ok = "[ " +"OK".green + " ]" | |
$nok = "[ " + "FAILED".red + " ]" | |
list = ARGV[0] | |
if list == nil | |
puts "Usage: ruby check-my-root.rb [FILE NAME]" | |
exit | |
end | |
IO.readlines(list).each do |s| | |
begin | |
Net::SSH.start( s.split(":")[0].to_s.chomp , s.split(":")[1].to_s.chomp , :password => s.split(":")[2].to_s.chomp , :port => 22 ) do |ssh| | |
ssh.open_channel do |ch1| | |
ch1.on_request "exit-status" do |ch2, data| | |
$exit_status = data.read_long | |
end # end of ch2 | |
ch1.request_pty do |ch3, success| | |
ch3.exec("ls") | |
if success | |
puts "#{s.split(":")[0].to_s.chomp}" + "\t" + "#{$ok}" | |
sleep 0.1 | |
else | |
puts "hhh" + $nok | |
end | |
end # end of ch3 | |
ch1.wait | |
end # end of ch1 | |
end # end of SSH.start | |
rescue | |
puts "#{s.split(":")[0].to_s.chomp}" + "\t" + "#{$nok}" | |
end | |
end # end of IO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment