diff --git a/captcha.png b/captcha.png index 1e6316b..a266a63 100644 Binary files a/captcha.png and b/captcha.png differ diff --git a/ftp.py b/ftp.py index de5044f..6f25865 100644 --- a/ftp.py +++ b/ftp.py @@ -14,11 +14,10 @@ def set_proxy(proxy_url): socket.socket = socks.socksocket print(f"已设置代理: {proxy_host}:{proxy_port}") -def upload_file_to_ftp(server, username, password, file_path, remote_path, proxy_url=None): +def upload_file_to_ftp(server, username, password, file_path, remote_path): """上传单个文件到FTP""" try: - # 设置代理(如果有的话) - set_proxy(proxy_url) + with ftplib.FTP(server) as ftp: ftp.login(user=username, passwd=password) @@ -40,12 +39,9 @@ def create_remote_directory(ftp, remote_directory): ftp.cwd(remote_directory) # 再次进入远程目录 print(f"远程目录 {remote_directory} 已创建!") -def upload_directory_to_ftp(server, username, password, local_directory, remote_directory, proxy_url=None): +def upload_directory_to_ftp(server, username, password, local_directory, remote_directory): """上传整个目录及其子目录到FTP服务器""" try: - # 设置代理(如果有的话) - set_proxy(proxy_url) - with ftplib.FTP(server) as ftp: ftp.login(user=username, passwd=password) diff --git a/main.py b/main.py index dcc4576..7e026c3 100644 --- a/main.py +++ b/main.py @@ -16,7 +16,7 @@ from ftp import set_proxy from ftp import upload_file_to_ftp from ftp import upload_directory_to_ftp from ftp import create_remote_directory - +import requests def launch_proxy(): print("开启代理...") @@ -129,12 +129,13 @@ def shot(chromedriver_path ,chrome_path): ftp_username = matches[2] ftp_password = matches[3] # 调用上传函数 - upload_directory_to_ftp(ftp_server, ftp_username, ftp_password, local_file_path, remote_file_path, proxy_url) + upload_directory_to_ftp(ftp_server, ftp_username, ftp_password, local_file_path, remote_file_path) + + url = f"http://{matches[0]}:{matches[1]}/setup_2.php" + response = requests.get(url, cookies=session_cookies) + print(response.raise_for_status()) + print(response.text) - # url = f"http://{matches[0]}:{matches[1]}/exam_setup.php" - # response = requests.get(url, cookies=session_cookies) - # print(response.raise_for_status()) - # print(response.text) time.sleep(5) driver.get("http://125.64.9.222:8022/paper/paper.php")