█████████ ███████████ █████████ █████████ ███████████ █████ ███████████ ███████████ ███████████
███░░░░░███░█░░░░░░███ ███░░░░░███ ███░░░░░███░░███░░░░░███ ░░███ ░░███░░░░░███░█░░░███░░░█░█░░░░░░███
███ ░░░ ░ ███░ ░███ ░░░ ███ ░░░ ░███ ░███ ░███ ░███ ░███░ ░███ ░ ░ ███░
░███ ███ ░░█████████ ░███ ░██████████ ░███ ░██████████ ░███ ███
░███ ███ ░░░░░░░░███░███ ░███░░░░░███ ░███ ░███░░░░░░ ░███ ███
░░███ ███ ████ █ ███ ░███░░███ ███ ░███ ░███ ░███ ░███ ░███ ████ █
░░█████████ ███████████ ░░█████████ ░░█████████ █████ █████ █████ █████ █████ ███████████
░░░░░░░░░ ░░░░░░░░░░░ ░░░░░░░░░ ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░░░
The beginning, is just happening
CZ Python Script to replace the old Grims Ping Companion
Scans IPs listed on a file called CZFTP.txt, you need a testfile.txt in the same directory. Scanner will test every directory listed on the FTP for upload access!
import ftplib
import os
import sys
def test_ftp(ip):
success_list = [] # List to store successful uploads
try:
ftp = ftplib.FTP(ip)
ftp.login() # Anonymous login
print(f"Connected to {ip}")
# List directories
directories = ftp.nlst()
print(f"Directories on {ip}: {directories}")
for directory in directories:
try:
# Change to the directory
ftp.cwd(directory)
# Test upload
test_file_name = 'testfile.txt'
with open(test_file_name, 'wb') as f:
f.write(b'Test upload') # Create a simple test file
with open(test_file_name, 'rb') as f:
ftp.storbinary(f'STOR {test_file_name}', f)
print(f"Upload successful to {ip}/{directory}")
# Record the successful upload
success_list.append(f"{ip}/{directory}")
# Clean up: remove the test file from the server
ftp.delete(test_file_name)
print(f"Deleted test file from {ip}/{directory}")
# Change back to the parent directory
ftp.cwd('..')
except Exception as e:
print(f"Failed to upload to {ip}/{directory}: {e}")
# Continue to the next directory
ftp.quit()
except Exception as e:
print(f"Failed to connect to {ip}: {e}")
return success_list
def main():
# Print header message
header_message = (
"CZ PROVIDES YOU WITH - FTP DIRECTORY UPLOAD SCANNER - "
"PUT YOUR IP LIST INTO CZFTP.txt - AND PLACE testfile.txt IN SAME DIRECTORY - "
"GREETZ FROM THE CZ CREW\n"
)
# Check for required files
if not os.path.isfile('CZFTP.txt') or not os.path.isfile('testfile.txt'):
print(header_message)
sys.exit(1) # Exit the script if files are missing
all_success = [] # List to store all successful uploads
# Read IPs from the file
try:
with open('CZFTP.txt', 'r') as file: # Changed to CZFTP.txt
ips = file.read().splitlines()
for ip in ips:
success = test_ftp(ip)
all_success.extend(success)
# Write successful uploads to success.txt
if all_success:
with open('success.txt', 'w') as success_file:
for entry in all_success:
success_file.write(entry + '\n')
print("Success entries written to success.txt")
else:
print("No successful uploads found.")
except FileNotFoundError:
print("The file 'CZFTP.txt' was not found.")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
main()