Building an anonymous FTP scanner with Python
We can use the ftplib module in order to build 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:
#!/usr/bin/env python3
import ftplib
def anonymousLogin(hostname):
try:
ftp = ftplib.FTP(hostname)
response = ftp.login('anonymous', 'anonymous')
print(response)
if "230 Anonymous access granted" in response:
...