Main Menu

CZFXP - FTPS Anonymous Login Scanner - Directory check for upload BETA v0.1

Started by CA, May 20, 2025, 04:01 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

CA



   █████████  ███████████     █████████    █████████  ███████████   █████ ███████████  ███████████ ███████████
  ███░░░░░███░█░░░░░░███     ███░░░░░███  ███░░░░░███░░███░░░░░███ ░░███ ░░███░░░░░███░█░░░███░░░█░█░░░░░░███
 ███     ░░░ ░     ███░     ░███    ░░░  ███     ░░░  ░███    ░███  ░███  ░███    ░███░   ░███  ░ ░     ███░ 
░███              ███       ░░█████████ ░███          ░██████████   ░███  ░██████████     ░███         ███   
░███             ███         ░░░░░░░░███░███          ░███░░░░░███  ░███  ░███░░░░░░      ░███        ███    
░░███     ███  ████     █    ███    ░███░░███     ███ ░███    ░███  ░███  ░███            ░███      ████     █
 ░░█████████  ███████████   ░░█████████  ░░█████████  █████   █████ █████ █████           █████    ███████████
  ░░░░░░░░░  ░░░░░░░░░░░     ░░░░░░░░░    ░░░░░░░░░  ░░░░░   ░░░░░ ░░░░░ ░░░░░           ░░░░░    ░░░░░░░░░░░


The beginning, is just happening

CZFXP - FTPS Anonymous Login Scanner - Directory check for upload BETA v0.1 Python Script(This is still needing work hence the v0.1 LOL!!!)

import ftplib
import socket
import os

def scan_ftps(ip):
    for port in [21, 990]:  # Check both port 21 and port 990
        try:
            # Connect to the FTPS server
            ftp = ftplib.FTP_TLS()
            ftp.connect(ip, port, timeout=5)
            ftp.login()  # Attempt anonymous login
            return ftp
        except (ftplib.error_perm, socket.error):
            continue  # Try the next port
    return None  # Return None if both ports fail

def upload_test_file(ftp, directory):
    try:
        # Create a test file
        test_file_path = 'testfile.txt'
        with open(test_file_path, 'w') as f:
            f.write('This is a test file.')

        # Change to the directory and upload the test file
        ftp.cwd(directory)
        with open(test_file_path, 'rb') as f:
            ftp.storbinary('STOR testfile.txt', f)
        return True
    except Exception as e:
        return False
    finally:
        os.remove(test_file_path)  # Clean up the test file

def main():
    print("WELCOME TO THE CZ FTPS SCANNER AND UPLOAD TESTER")
   
    start_ip = input("Enter the starting IP address: ")
    end_ip = input("Enter the ending IP address: ")

    # Convert IP addresses to integers for range scanning
    start_int = int(''.join(f"{int(i):03}" for i in start_ip.split('.')))
    end_int = int(''.join(f"{int(i):03}" for i in end_ip.split('.')))

    success_logins = []
    upload_successes = []

    for ip_int in range(start_int, end_int + 1):
        ip = '.'.join(str(ip_int // (256 ** i) % 256) for i in range(3, -1, -1))
        print(f"Scanning {ip}...")
       
        ftp = scan_ftps(ip)
        if ftp:
            print(f"Anonymous login successful on {ip}")
            success_logins.append(ip)
            with open('success.txt', 'a') as f:
                f.write(f"{ip}\n")

            # Attempt to list directories and upload test file
            try:
                directories = ftp.nlst()  # List directories
                for directory in directories:
                    if upload_test_file(ftp, directory):
                        print(f"Upload successful to {ip}/{directory}")
                        upload_successes.append(f"{ip}/{directory}")
                        with open('successfileupload.txt', 'a') as f:
                            f.write(f"{ip}/{directory}\n")
            except ftplib.error_perm:
                print(f"Could not list directories on {ip}")
            finally:
                ftp.quit()
        else:
            print(f"No anonymous login on {ip}")

if __name__ == "__main__":
    main()

Similar topics (5)