11
This commit is contained in:
@ -26,3 +26,5 @@ $query_string = "create table patient_90(patient_id char(50),patient_name char(5
|
|||||||
mysqli_query($link,$query_string);
|
mysqli_query($link,$query_string);
|
||||||
$query_string = "insert into patient_90 values('123456','王某','1','1')";
|
$query_string = "insert into patient_90 values('123456','王某','1','1')";
|
||||||
mysqli_query($link,$query_string);
|
mysqli_query($link,$query_string);
|
||||||
|
|
||||||
|
echo "表创建成功"
|
@ -1,3 +1,5 @@
|
|||||||
映射URL路径
|
映射URL路径
|
||||||
|
主配置类
|
||||||
标识一个Java 类是一个控制器
|
标识一个Java 类是一个控制器
|
||||||
用于标识服务层组件
|
用于标识服务层组件
|
||||||
|
注入对象
|
BIN
captcha.png
BIN
captcha.png
Binary file not shown.
Before Width: | Height: | Size: 699 B After Width: | Height: | Size: 602 B |
2
ftp.py
2
ftp.py
@ -64,7 +64,7 @@ def upload_directory_to_ftp(server, username, password, local_directory, remote_
|
|||||||
local_file_path = os.path.join(root, filename) # 本地文件的完整路径
|
local_file_path = os.path.join(root, filename) # 本地文件的完整路径
|
||||||
relative_path = os.path.relpath(local_file_path, local_directory) # 计算相对路径
|
relative_path = os.path.relpath(local_file_path, local_directory) # 计算相对路径
|
||||||
remote_file_path = os.path.join(remote_directory, relative_path).replace("\\", "/") # 计算远程文件路径
|
remote_file_path = os.path.join(remote_directory, relative_path).replace("\\", "/") # 计算远程文件路径
|
||||||
upload_file_to_ftp(server, username, password, local_file_path, remote_file_path, proxy_url) # 上传文件
|
upload_file_to_ftp(server, username, password, local_file_path, remote_file_path) # 上传文件
|
||||||
|
|
||||||
except ftplib.all_errors as e:
|
except ftplib.all_errors as e:
|
||||||
print(f"上传目录时发生错误: {e}")
|
print(f"上传目录时发生错误: {e}")
|
||||||
|
76
main.py
76
main.py
@ -12,34 +12,34 @@ import time
|
|||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
from tkinter import messagebox # 单独导入 messagebox
|
||||||
from ftp import set_proxy
|
from ftp import set_proxy
|
||||||
from ftp import upload_file_to_ftp
|
from ftp import upload_file_to_ftp
|
||||||
from ftp import upload_directory_to_ftp
|
from ftp import upload_directory_to_ftp
|
||||||
from ftp import create_remote_directory
|
from ftp import create_remote_directory
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
def launch_proxy():
|
# def launch_proxy():
|
||||||
print("开启代理...")
|
# print("开启代理...")
|
||||||
cmd = "start ./Shadowsocks-4.4.1.0/Shadowsocks.exe"
|
# cmd = "start ./Shadowsocks-4.4.1.0/Shadowsocks.exe"
|
||||||
os.system('chcp 65001')
|
# os.system('chcp 65001')
|
||||||
os.system(cmd)
|
# os.system(cmd)
|
||||||
|
#
|
||||||
def close_proxy():
|
# def close_proxy():
|
||||||
print("杀死代理进程")
|
# print("杀死代理进程")
|
||||||
cmd = "taskkill /f /im Shadowsocks.exe"
|
# cmd = "taskkill /f /im Shadowsocks.exe"
|
||||||
os.system('chcp 65001')
|
# os.system('chcp 65001')
|
||||||
os.system(cmd)
|
# os.system(cmd)
|
||||||
cmd = """
|
# cmd = """
|
||||||
reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
|
# reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
|
||||||
"""
|
# """
|
||||||
print(cmd)
|
# print(cmd)
|
||||||
os.system(cmd)
|
# os.system(cmd)
|
||||||
|
|
||||||
|
|
||||||
def shot(chromedriver_path ,chrome_path):
|
def shot(chromedriver_path ,chrome_path):
|
||||||
|
|
||||||
options = Options()
|
options = Options()
|
||||||
options.add_experimental_option("detach", True)
|
|
||||||
options.binary_location = chrome_path
|
options.binary_location = chrome_path
|
||||||
options.add_argument("--no-sandbox")
|
options.add_argument("--no-sandbox")
|
||||||
# 初始化 WebDriver
|
# 初始化 WebDriver
|
||||||
@ -48,8 +48,6 @@ def shot(chromedriver_path ,chrome_path):
|
|||||||
driver.get("http://125.64.9.222:8022/login_exam.php")
|
driver.get("http://125.64.9.222:8022/login_exam.php")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
launch_proxy()
|
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
exam_id = name_entry.get()
|
exam_id = name_entry.get()
|
||||||
@ -137,28 +135,27 @@ def shot(chromedriver_path ,chrome_path):
|
|||||||
print(response.text)
|
print(response.text)
|
||||||
|
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
#
|
||||||
driver.get("http://125.64.9.222:8022/paper/paper.php")
|
# driver.get("http://125.64.9.222:8022/paper/paper.php")
|
||||||
|
#
|
||||||
# 等待页面加载
|
# # 等待页面加载
|
||||||
wait = WebDriverWait(driver, 30)
|
# wait = WebDriverWait(driver, 20)
|
||||||
for fillingQ_id in fillingQ_ids:
|
# for fillingQ_id in fillingQ_ids:
|
||||||
textarea = wait.until(EC.presence_of_element_located((By.ID, fillingQ_id)))
|
# textarea = wait.until(EC.presence_of_element_located((By.ID, fillingQ_id)))
|
||||||
with open (fillingQ_path + f"/{fillingQ_id}", "r", encoding="utf-8") as f:
|
# with open (fillingQ_path + f"/{fillingQ_id}"+".txt", "r", encoding="utf-8") as f:
|
||||||
textarea.send_keys(f.read()) # 填写题目
|
# textarea.send_keys(f.read()) # 填写题目
|
||||||
|
#
|
||||||
for save in fillingQ_save_ids:
|
# for save in fillingQ_save_ids:
|
||||||
driver.execute_script(f"{save}")
|
# driver.execute_script(f"{save}")
|
||||||
print(f"已保存 {save} 题目")
|
# print(f"已保存 {save} 题目")
|
||||||
time.sleep(1)
|
# time.sleep(1)
|
||||||
|
#
|
||||||
tk.messagebox.showinfo("提示","执行成功!请手动进入网站点击调试")
|
# tk.messagebox.showinfo("提示","执行成功!请手动进入网站点击调试")
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
print(f"发生错误: {e}")
|
# print(f"发生错误: {e}")
|
||||||
tk.messagebox.showerror("错误", f"发生错误: {e}")
|
# tk.messagebox.showerror("错误", f"发生错误: {e}")
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
close_proxy()
|
|
||||||
driver.quit()
|
driver.quit()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@ -231,4 +228,3 @@ if __name__ == "__main__":
|
|||||||
submit_button.config(width=10, height=1)
|
submit_button.config(width=10, height=1)
|
||||||
|
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
close_proxy()
|
|
Reference in New Issue
Block a user