Building an anonymous FTP scanner with Python
We can use the ftplib
module for building a script to determine whether a server offers anonymous logins. This mechanism consists of supplying the FTP server with the word anonymous as the name and password of the user. In this way, we can make queries to the FTP server without knowing the data of a specific user. You can find the following code in the checkFTPanonymousLogin.py
file, located in the ftplib
folder in the GitHub repository:
import ftplib
def anonymousLogin(hostname):
try:
ftp = ftplib.FTP(hostname)
response = ftp.login('anonymous', 'anonymous')
print(response)
if "230 Anonymous access granted" in response:
print('\n[*] ' + str(hostname) +' FTP Anonymous Login Succeeded.')
print(ftp.getwelcome())
ftp.dir()
except Exception as exception:
print(str(exception))
print('\n[-] &apos...