Sneaker's Stub – The Grey Stuff!

Bruteforcing FTP using ftplib: Hacking with Python

The article will guide you on how to bruteforce FTP using ftplib library in python. I have already posted an article on how to check for anonymous FTP script. FTP is File transfer protocol which is used to upload/download files from server to client. It works on Port 21. FTPLIB provides many features to python to connect and handle FTP connections.

Explanation:

The code is pretty forward. We will import the ftplib library and sys to use arguments

def logfile(target,users,passw): This function works for the user and password files. It opens them and passes them to the function bruteftp.

def bruteftp(target,users,passw): This function takes the input sent by the logfile() function and remove the carriage return and newline from the user and password which came directly from the file using *.strip(‘\r’).strip(‘\n’). Once removed, it passes the new stripped user and password to the ftp.login() to check if they are correct.