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:Â Â Â Â Â Â Â ...