█████████ ███████████ █████████ █████████ ███████████ █████ ███████████ ███████████ ███████████
███░░░░░███░█░░░░░░███ ███░░░░░███ ███░░░░░███░░███░░░░░███ ░░███ ░░███░░░░░███░█░░░███░░░█░█░░░░░░███
███ ░░░ ░ ███░ ░███ ░░░ ███ ░░░ ░███ ░███ ░███ ░███ ░███░ ░███ ░ ░ ███░
░███ ███ ░░█████████ ░███ ░██████████ ░███ ░██████████ ░███ ███
░███ ███ ░░░░░░░░███░███ ░███░░░░░███ ░███ ░███░░░░░░ ░███ ███
░░███ ███ ████ █ ███ ░███░░███ ███ ░███ ░███ ░███ ░███ ░███ ████ █
░░█████████ ███████████ ░░█████████ ░░█████████ █████ █████ █████ █████ █████ ███████████
░░░░░░░░░ ░░░░░░░░░░░ ░░░░░░░░░ ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░░░
The beginning, is just happening
This is extremely a python testing script, changes and improvements coming, this is currently untested!!
import ftplib
import ipaddress
import os
def check_ftp_anonymous(ip):
try:
ftp = ftplib.FTP(str(ip), timeout=5)
ftp.login() # Attempt to login anonymously
return ftp
except ftplib.error_perm:
return None
except Exception as e:
print(f"Error connecting to {ip}: {e}")
return None
def list_directories(ftp):
directories = []
try:
# List directories in the current directory
items = ftp.nlst()
for item in items:
try:
# Try to change to the directory
ftp.cwd(item)
directories.append(item)
ftp.cwd('..') # Go back to the parent directory
except ftplib.error_perm:
# Not a directory
continue
except Exception as e:
print(f"Error listing directories: {e}")
return directories
def upload_file(ftp, directory):
try:
# Change to the target directory
ftp.cwd(directory)
# Create a test file
with open('testfile.txt', 'w') as f:
f.write("This is a test file for FTP upload.")
# Upload the test file
with open('testfile.txt', 'rb') as f:
ftp.storbinary(f'STOR testfile.txt', f)
ftp.cwd('..') # Go back to the parent directory
return True
except Exception as e:
print(f"Error uploading to {directory}: {e}")
return False
def scan_ips(start_ip, end_ip):
successful_logins = []
successful_uploads = []
# Generate IP addresses in the specified range
for ip in ipaddress.summarize_address_range(ipaddress.IPv4Address(start_ip), ipaddress.IPv4Address(end_ip)):
for single_ip in ip:
ftp = check_ftp_anonymous(single_ip)
if ftp:
print(f"Anonymous access successful on: {single_ip}")
successful_logins.append(str(single_ip))
# List directories and attempt to upload
directories = list_directories(ftp)
for directory in directories:
if upload_file(ftp, directory):
print(f"Successfully uploaded to {single_ip}/{directory}")
successful_uploads.append(f"{single_ip}/{directory}")
ftp.quit()
return successful_logins, successful_uploads
def save_successful_logins(successful_logins, output_file):
with open(output_file, 'w') as file:
for ip in successful_logins:
file.write(f"{ip}\n")
def save_successful_uploads(successful_uploads, output_file):
with open(output_file, 'w') as file:
for entry in successful_uploads:
file.write(f"{entry}\n")
if __name__ == "__main__":
print("WELCOME TO THE CZ FTP SCANNER")
# Set the starting and ending IP addresses
start_ip = input("Enter the starting IP address (e.g., 192.168.1.1): ")
end_ip = input("Enter the ending IP address (e.g., 192.168.1.255): ")
successful_logins_file = 'success.txt'
successful_uploads_file = 'successfileupload.txt'
successful_logins, successful_uploads = scan_ips(start_ip, end_ip)
save_successful_logins(successful_logins, successful_logins_file)
save_successful_uploads(successful_uploads, successful_uploads_file)
print(f"Scan complete. Successful logins saved to {successful_logins_file}.")
print(f"Successful uploads saved to {successful_uploads_file}.")