import ftplib


def return_default(ftp):
    try:
        dir_list = ftp.nlst()
    except Exception as e:
        print(f'[-] Could not list directory content.\n'
              f'[-] Skipping to next target.\n'
              f'[-] Exception: {e}')
        return

    ret_list = []
    for file in dir_list:
        fn = file.lower()
        if '.php' in fn or '.htm' in fn or '.asp' in fn:
            print(f'[+] Found default page: {file}')
        ret_list.append(file)
    return ret_list


if __name__ == '__main__':
    host = '127.0.0.1'
    username, password = 'guest', 'guest'
    ftp = ftplib.FTP(host)
    ftp.login(username, password)
    return_default(ftp)
