11
This commit is contained in:
6
20250103/bootstrap.min.css
vendored
Normal file
6
20250103/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
7
20250103/bootstrap.min.js
vendored
Normal file
7
20250103/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
20250103/jquery.min.js
vendored
Normal file
5
20250103/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -3,9 +3,9 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>操作表</title>
|
<title>操作表</title>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
<link href="./bootstrap.min.css" rel="stylesheet">
|
||||||
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
|
<script src="./jquery.min.js"></script>
|
||||||
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
<script src="./bootstrap.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// 确保在文档加载完成后执行
|
// 确保在文档加载完成后执行
|
||||||
$(document).ready(function(operation, table) {
|
$(document).ready(function(operation, table) {
|
||||||
@ -42,7 +42,7 @@
|
|||||||
<button data-operation="del" class="btn btn-danger m-2">drop table</button>
|
<button data-operation="del" class="btn btn-danger m-2">drop table</button>
|
||||||
<button data-operation="create" class="btn btn-success m-2">create table</button>
|
<button data-operation="create" class="btn btn-success m-2">create table</button>
|
||||||
<button data-operation="select" class="btn btn-primary m-2">select table</button>
|
<button data-operation="select" class="btn btn-primary m-2">select table</button>
|
||||||
<select class="form-select m-2 " aria-label="Select table">
|
<select id="mySelect" class="form-select m-2 " aria-label="Select table">
|
||||||
<option value="user_70" selected>user_70</option>
|
<option value="user_70" selected>user_70</option>
|
||||||
<option value="nucleic_acid_test_2">nucleic_acid_test_2</option>
|
<option value="nucleic_acid_test_2">nucleic_acid_test_2</option>
|
||||||
<option value="patient_90">patient_90</option>
|
<option value="patient_90">patient_90</option>
|
||||||
|
28
20250103/setup_2.php
Normal file
28
20250103/setup_2.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
include_once("db_config.php");
|
||||||
|
mysqli_set_charset($link, 'utf8');
|
||||||
|
|
||||||
|
$query_string = "create table user_70(name char(50),address char(50),password char(50))ENGINE=MyISAM DEFAULT CHARSET=utf8";
|
||||||
|
mysqli_query($link,$query_string);
|
||||||
|
$query_string = "insert into user_70(name,address,password)values('mike','chengdu','c4ca4238a0b923820dcc509a6f75849b')";
|
||||||
|
mysqli_query($link,$query_string);
|
||||||
|
$query_string = "insert into user_70(name,address,password)values('mike','beijing','c4ca4238a0b923820dcc509a6f75849b')";
|
||||||
|
mysqli_query($link,$query_string);
|
||||||
|
$query_string = "insert into user_70(name,address,password)values('tom','chengdu','c4ca4238a0b923820dcc509a6f75849b')";
|
||||||
|
mysqli_query($link,$query_string);
|
||||||
|
$query_string = "insert into user_70(name,address,password)values('rose','chengdu','c4ca4238a0b923820dcc509a6f75849b')";
|
||||||
|
mysqli_query($link,$query_string);
|
||||||
|
|
||||||
|
|
||||||
|
$eventTime=mktime(12,12,12,12,12,2022);
|
||||||
|
$query_string = "create table nucleic_acid_test_2(id varchar(50),name varchar(50),address varchar(50),event_time int,insert_time int,code varchar(1))ENGINE=MyISAM DEFAULT CHARSET=utf8";
|
||||||
|
mysqli_query($link,$query_string);
|
||||||
|
$query_string = "insert into nucleic_acid_test_2(id,name,address,event_time,insert_time,code)values('510103199010210012','mike','shanghai',$eventTime,'1597238637','3')";
|
||||||
|
mysqli_query($link,$query_string);
|
||||||
|
$query_string ="insert into nucleic_acid_test_2(id,name,address,event_time,insert_time,code)values('510103198310607013','rose','beijing',$eventTime,'1597242237','2')";
|
||||||
|
mysqli_query($link,$query_string);
|
||||||
|
|
||||||
|
$query_string = "create table patient_90(patient_id char(50),patient_name char(50),patient_gender char(1),patient_address char(50))ENGINE=MyISAM DEFAULT CHARSET=utf8";
|
||||||
|
mysqli_query($link,$query_string);
|
||||||
|
$query_string = "insert into patient_90 values('123456','王某','1','1')";
|
||||||
|
mysqli_query($link,$query_string);
|
BIN
captcha.png
BIN
captcha.png
Binary file not shown.
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 678 B |
136
main.py
136
main.py
@ -16,105 +16,7 @@ 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
|
||||||
#
|
|
||||||
# def ftp_upload_with_proxy(server, username, password, local_file_path, remote_path, proxy):
|
|
||||||
# """使用 pycurl 上传单个文件到 FTP 服务器"""
|
|
||||||
# buffer = BytesIO()
|
|
||||||
# c = pycurl.Curl()
|
|
||||||
#
|
|
||||||
# # 设置 FTP URL
|
|
||||||
# ftp_url = f'ftp://{server}/{remote_path}'
|
|
||||||
# c.setopt(c.URL, ftp_url)
|
|
||||||
#
|
|
||||||
# # 设置 FTP 认证
|
|
||||||
# c.setopt(c.USERPWD, f"{username}:{password}")
|
|
||||||
# c.setopt(c.READDATA, open(local_file_path, 'rb'))
|
|
||||||
# c.setopt(c.UPLOAD, 1)
|
|
||||||
# c.setopt(c.PREQUOTE, ['PASV'])
|
|
||||||
#
|
|
||||||
# # 设置代理
|
|
||||||
# c.setopt(c.PROXY, proxy)
|
|
||||||
#
|
|
||||||
# try:
|
|
||||||
# c.perform()
|
|
||||||
# print(f"文件 {local_file_path} 成功上传到 {remote_path}!")
|
|
||||||
# except pycurl.error as e:
|
|
||||||
# print(f"FTP 错误: {e}")
|
|
||||||
# finally:
|
|
||||||
# c.close()
|
|
||||||
|
|
||||||
# def upload_directory_to_ftp(server, username, password, local_directory, remote_directory, proxy):
|
|
||||||
# """上传整个目录及其子目录到FTP服务器"""
|
|
||||||
# # 确保远程目录存在
|
|
||||||
# try:
|
|
||||||
# # 此段代码需要检查并创建远程目录
|
|
||||||
# # pycurl 不直接提供创建目录的功能,需要手动实现
|
|
||||||
#
|
|
||||||
# # 上传文件和子目录
|
|
||||||
# for root, dirs, files in os.walk(local_directory):
|
|
||||||
# # 上传子文件夹
|
|
||||||
# for dir_name in dirs:
|
|
||||||
# remote_dir_path = os.path.join(remote_directory,
|
|
||||||
# os.path.relpath(os.path.join(root, dir_name), local_directory)).replace(
|
|
||||||
# "\\", "/")
|
|
||||||
# print(f"准备上传目录: {remote_dir_path}")
|
|
||||||
# # 假设已确认远程目录存在
|
|
||||||
#
|
|
||||||
# # 上传文件
|
|
||||||
# for filename in files:
|
|
||||||
# local_file_path = os.path.join(root, filename) # 本地文件的完整路径
|
|
||||||
# relative_path = os.path.relpath(local_file_path, local_directory) # 计算相对路径
|
|
||||||
# remote_file_path = os.path.join(remote_directory, relative_path).replace("\\", "/") # 计算远程文件路径
|
|
||||||
#
|
|
||||||
# # 上传文件
|
|
||||||
# ftp_upload_with_proxy(server, username, password, local_file_path, remote_file_path, proxy)
|
|
||||||
#
|
|
||||||
# except Exception as e:
|
|
||||||
# print(f"上传目录时发生错误: {e}")
|
|
||||||
#
|
|
||||||
# def upload_file_to_ftp(server, username, password, file_path, remote_path):
|
|
||||||
# try:
|
|
||||||
# with ftplib.FTP(server) as ftp:
|
|
||||||
# ftp.login(user=username, passwd=password)
|
|
||||||
# with open(file_path, 'rb') as file:
|
|
||||||
# ftp.storbinary(f'STOR {remote_path}', file)
|
|
||||||
# print(f"文件 {file_path} 成功上传到 {remote_path}!")
|
|
||||||
# except ftplib.all_errors as e:
|
|
||||||
# print(f"FTP 错误: {e}")
|
|
||||||
#
|
|
||||||
# def upload_directory_to_ftp(server, username, password, local_directory, remote_directory):
|
|
||||||
# """上传整个目录及其子目录到FTP服务器"""
|
|
||||||
# try:
|
|
||||||
# with ftplib.FTP(server) as ftp:
|
|
||||||
# ftp.login(user=username, passwd=password)
|
|
||||||
#
|
|
||||||
# # 确保远程目录存在
|
|
||||||
# try:
|
|
||||||
# ftp.cwd(remote_directory) # 改变到远程目录
|
|
||||||
# except ftplib.error_perm:
|
|
||||||
# ftp.mkd(remote_directory) # 如果远程目录不存在,则创建
|
|
||||||
# ftp.cwd(remote_directory) # 再次进入远程目录
|
|
||||||
#
|
|
||||||
# # 遍历本地目录树
|
|
||||||
# for root, dirs, files in os.walk(local_directory):
|
|
||||||
# # 上传子文件夹
|
|
||||||
# for dir_name in dirs:
|
|
||||||
# remote_dir_path = os.path.join(remote_directory, os.path.relpath(os.path.join(root, dir_name), local_directory)).replace("\\", "/")
|
|
||||||
# try:
|
|
||||||
# ftp.mkd(remote_dir_path) # 在FTP服务器上创建子目录
|
|
||||||
# print(f"已创建远程目录: {remote_dir_path}")
|
|
||||||
# except ftplib.error_perm:
|
|
||||||
# pass # 如果目录已经存在则忽略
|
|
||||||
#
|
|
||||||
# # 上传文件
|
|
||||||
# for filename in files:
|
|
||||||
# local_file_path = os.path.join(root, filename) # 本地文件的完整路径
|
|
||||||
# relative_path = os.path.relpath(local_file_path, local_directory) # 计算相对路径
|
|
||||||
# remote_file_path = os.path.join(remote_directory, relative_path).replace("\\", "/") # 计算远程文件路径
|
|
||||||
# upload_file_to_ftp(server, username, password, local_file_path, remote_file_path, ) # 上传文件
|
|
||||||
#
|
|
||||||
# except ftplib.all_errors as e:
|
|
||||||
# print(f"上传目录时发生错误: {e}")
|
|
||||||
|
|
||||||
def launch_proxy():
|
def launch_proxy():
|
||||||
print("开启代理...")
|
print("开启代理...")
|
||||||
@ -227,41 +129,13 @@ def shot(chromedriver_path ,chrome_path):
|
|||||||
ftp_username = matches[2]
|
ftp_username = matches[2]
|
||||||
ftp_password = matches[3]
|
ftp_password = matches[3]
|
||||||
# 调用上传函数
|
# 调用上传函数
|
||||||
upload_directory_to_ftp(ftp_server, ftp_username, ftp_password, local_file_path, remote_file_path)
|
upload_directory_to_ftp(ftp_server, ftp_username, ftp_password, local_file_path, remote_file_path, proxy_url)
|
||||||
|
|
||||||
# url = f"http://{matches[0]}:{matches[1]}/exam_setup.php"
|
# url = f"http://{matches[0]}:{matches[1]}/exam_setup.php"
|
||||||
# response = requests.get(url, cookies=session_cookies)
|
# response = requests.get(url, cookies=session_cookies)
|
||||||
# print(response.raise_for_status())
|
# print(response.raise_for_status())
|
||||||
# print(response.text)
|
# print(response.text)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
driver.get(f"http://{matches[0]}:{matches[1]}/setup.html")
|
|
||||||
|
|
||||||
# 等待页面加载完成
|
|
||||||
# WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "kw")))
|
|
||||||
# 输入搜索词
|
|
||||||
try:
|
|
||||||
button = WebDriverWait(driver, 10).until(
|
|
||||||
EC.element_to_be_clickable((By.XPATH, "//button[text()='create table']")) # 使用按钮的文本查找元素
|
|
||||||
)
|
|
||||||
button.click() # 点击按钮
|
|
||||||
except Exception as e:
|
|
||||||
print(f"发生错误: {e}")
|
|
||||||
finally:
|
|
||||||
result_content = ""
|
|
||||||
try:
|
|
||||||
result_element = WebDriverWait(driver, 100).until(
|
|
||||||
EC.presence_of_element_located((By.ID, "result"))
|
|
||||||
)
|
|
||||||
|
|
||||||
# 获取内容
|
|
||||||
result_content = result_element.text
|
|
||||||
print(f"ID为result的内容: {result_content}")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"发生错误: {e}")
|
|
||||||
|
|
||||||
print("执行完毕:" + result_content)
|
|
||||||
|
|
||||||
|
|
||||||
driver.get("http://125.64.9.222:8022/paper/paper.php")
|
driver.get("http://125.64.9.222:8022/paper/paper.php")
|
||||||
|
|
||||||
@ -269,7 +143,7 @@ def shot(chromedriver_path ,chrome_path):
|
|||||||
wait = WebDriverWait(driver, 30)
|
wait = WebDriverWait(driver, 30)
|
||||||
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}.txt", "r", encoding="utf-8") as f:
|
with open (fillingQ_path + f"/{fillingQ_id}", "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:
|
||||||
@ -311,6 +185,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
root.title("一键执行")
|
root.title("一键执行")
|
||||||
|
|
||||||
|
|
||||||
# 设置窗口大小
|
# 设置窗口大小
|
||||||
window_width = 300
|
window_width = 300
|
||||||
@ -354,6 +229,5 @@ if __name__ == "__main__":
|
|||||||
submit_button.pack(side=tk.BOTTOM)
|
submit_button.pack(side=tk.BOTTOM)
|
||||||
submit_button.config(width=10, height=1)
|
submit_button.config(width=10, height=1)
|
||||||
|
|
||||||
|
root.mainloop()
|
||||||
|
close_proxy()
|
||||||
root.mainloop()
|
|
Reference in New Issue
Block a user