1.0版本(仅源代码与必要程序)
This commit is contained in:
133
KillSpecifiedProcess.cpp
Normal file
133
KillSpecifiedProcess.cpp
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
#include"stdafx.h"
|
||||||
|
#include<iostream>
|
||||||
|
#include<Windows.h>
|
||||||
|
#include "boost/filesystem.hpp"
|
||||||
|
#include "boost/iostreams/stream.hpp"
|
||||||
|
#include "boost/format.hpp"
|
||||||
|
#include "boost/algorithm/algorithm.hpp"
|
||||||
|
#include "boost/algorithm/string.hpp"
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#define READ_ONE_NUM 1024
|
||||||
|
|
||||||
|
/*
|
||||||
|
ɱ<><C9B1>ָ<EFBFBD><D6B8>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD>
|
||||||
|
*/
|
||||||
|
BOOL KillSpecifiedProcess(const std::string& p_strPath)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
C:\Users\10139>wmic process where name="notepad.exe" get executablepath,processid
|
||||||
|
ExecutablePath ProcessId
|
||||||
|
C:\WINDOWS\system32\notepad.exe 6196
|
||||||
|
C:\WINDOWS\system32\notepad.exe 6056
|
||||||
|
|
||||||
|
|
||||||
|
C:\Users\10139>taskkill /F /PID 6196 /PID 6056
|
||||||
|
<20>ɹ<EFBFBD>: <20><><EFBFBD><EFBFBD>ֹ PID Ϊ 6196 <20>Ľ<EFBFBD><C4BD>̡<EFBFBD>
|
||||||
|
<20>ɹ<EFBFBD>: <20><><EFBFBD><EFBFBD>ֹ PID Ϊ 6056 <20>Ľ<EFBFBD><C4BD>̡<EFBFBD>
|
||||||
|
*/
|
||||||
|
if(!boost::filesystem::exists(p_strPath))
|
||||||
|
{
|
||||||
|
cout << p_strPath << " not exist" << endl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
int index = p_strPath.rfind("\\");
|
||||||
|
std::string strName = p_strPath.substr(index + 1);
|
||||||
|
SECURITY_ATTRIBUTES sa;
|
||||||
|
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||||
|
sa.bInheritHandle = TRUE;
|
||||||
|
sa.lpSecurityDescriptor = NULL;
|
||||||
|
HANDLE hStdOutRead = NULL, hStdOutWrite = NULL;
|
||||||
|
if (!CreatePipe(&hStdOutRead, &hStdOutWrite, &sa, 0))
|
||||||
|
{
|
||||||
|
cout << "create pipe error," << GetLastError() << endl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
STARTUPINFOA startInfo;
|
||||||
|
PROCESS_INFORMATION procInfo;
|
||||||
|
BOOL bSuccess = FALSE;
|
||||||
|
ZeroMemory(&procInfo, sizeof(PROCESS_INFORMATION));
|
||||||
|
ZeroMemory(&startInfo, sizeof(STARTUPINFOA));
|
||||||
|
startInfo.cb = sizeof(STARTUPINFOA);
|
||||||
|
startInfo.hStdOutput = hStdOutWrite;
|
||||||
|
startInfo.dwFlags |= (STARTF_USESTDHANDLES |STARTF_USESHOWWINDOW) ;
|
||||||
|
startInfo.wShowWindow = SW_HIDE;
|
||||||
|
|
||||||
|
boost::format fmt("wmic process where name=\"%1%\" get executablepath,processid");
|
||||||
|
fmt % strName;
|
||||||
|
std::string strSQL = fmt.str();
|
||||||
|
bSuccess = CreateProcessA(NULL, (char*)strSQL.data(), NULL, NULL, TRUE, 0, NULL, NULL, &startInfo, &procInfo);
|
||||||
|
if (!bSuccess)
|
||||||
|
{
|
||||||
|
cout << "create process error," << GetLastError() << endl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
WaitForSingleObject(procInfo.hProcess,INFINITE);
|
||||||
|
CloseHandle(hStdOutWrite);
|
||||||
|
DWORD byteRead = 0;
|
||||||
|
std::string strContent;
|
||||||
|
char buffer[READ_ONE_NUM] = {0};
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
byteRead = 0;
|
||||||
|
memset(buffer, 0, READ_ONE_NUM);
|
||||||
|
BOOL bRead = ReadFile(hStdOutRead, buffer, (READ_ONE_NUM-1)* sizeof(buffer[0]) , &byteRead, NULL);
|
||||||
|
if (!bRead)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strContent.append(buffer);
|
||||||
|
}
|
||||||
|
CloseHandle(hStdOutRead);
|
||||||
|
std::vector<std::string> splitVec;
|
||||||
|
boost::split(splitVec, strContent, boost::is_any_of("\r\n"), boost::token_compress_on);
|
||||||
|
if(splitVec.size() > 0)
|
||||||
|
{
|
||||||
|
if( !boost::icontains(splitVec[0], "ExecutablePath") )
|
||||||
|
{
|
||||||
|
// û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
cout << strName << " is not runing" << endl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
// <20><><EFBFBD><EFBFBD>for<6F><72><EFBFBD>룺<EFBFBD><EBA3BA><EFBFBD><EFBFBD><EFBFBD>Ż<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>PID
|
||||||
|
// <20><>1<EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
for(int i = 1; i < splitVec.size() -1; i++)
|
||||||
|
{
|
||||||
|
std::vector<std::string> splitVec2;
|
||||||
|
boost::split(splitVec2, splitVec[i], boost::is_any_of(" "), boost::token_compress_on);
|
||||||
|
int size = splitVec2.size();
|
||||||
|
if(size >= 3)
|
||||||
|
{
|
||||||
|
std::string exePath;
|
||||||
|
// ȡ<><C8A1>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
||||||
|
for(int i = 0; i < size -1 -1; i++)
|
||||||
|
{
|
||||||
|
exePath.append(splitVec2[i]);
|
||||||
|
exePath.append(" ");
|
||||||
|
}
|
||||||
|
// <20>ж<EFBFBD>·<EFBFBD><C2B7><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȫƥ<C8AB><C6A5>
|
||||||
|
if( !boost::icontains(exePath, p_strPath) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// <20><><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>пո<D5B8><F1A3ACB5><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32>Ϊpid
|
||||||
|
std::string pId = splitVec2[size -1 -1];
|
||||||
|
std::string cmd = "taskkill /F /PID ";
|
||||||
|
cmd.append(pId);
|
||||||
|
cout << p_strPath << "->" << cmd << endl;
|
||||||
|
WinExec(cmd.c_str(), SW_HIDE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
for(int i = 1; i < argc ; i++)
|
||||||
|
{
|
||||||
|
KillSpecifiedProcess(argv[i]);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
5
data/gameid.txt
Normal file
5
data/gameid.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
龙门币:CE-6
|
||||||
|
技能:CA-5
|
||||||
|
红票:AP-5
|
||||||
|
经验:CA-5
|
||||||
|
剿灭模式:Annihilation
|
||||||
238
manage.py
Normal file
238
manage.py
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
import sqlite3
|
||||||
|
import datetime
|
||||||
|
import os
|
||||||
|
|
||||||
|
#添加用户
|
||||||
|
def add():
|
||||||
|
db=sqlite3.connect(DATABASE)
|
||||||
|
cur=db.cursor()
|
||||||
|
adminx=input("用户名:")
|
||||||
|
#用户名重复验证
|
||||||
|
while search(adminx,0)=="":
|
||||||
|
print("该用户已存在,请重新输入")
|
||||||
|
adminx=input("用户名:")
|
||||||
|
numberx=input("手机号码:")
|
||||||
|
dayx=int(input("代理天数:"))
|
||||||
|
gamex=input("关卡号:")
|
||||||
|
passwordx=input("密码:")
|
||||||
|
#应用更新
|
||||||
|
cur.execute("INSERT INTO adminx(admin,number,day,status,last,game,password) VALUES('%s','%s',%d,'y','2000-01-01','%s','%s')" %(adminx,numberx,dayx,gamex,passwordx))
|
||||||
|
db.commit()
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
return "操作成功"
|
||||||
|
|
||||||
|
#删除用户信息
|
||||||
|
def delete(id):
|
||||||
|
db=sqlite3.connect(DATABASE)
|
||||||
|
cur=db.cursor()
|
||||||
|
#检查用户是否存在
|
||||||
|
cur.execute("SELECT * FROM adminx WHERE admin='%s'" %(id))
|
||||||
|
data=cur.fetchall()
|
||||||
|
if len(data)==0:
|
||||||
|
return "未找到"+id
|
||||||
|
#应用更新
|
||||||
|
cur.execute("DELETE FROM adminx WHERE admin='%s'" %(id))
|
||||||
|
db.commit()
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
return "成功删除"+id
|
||||||
|
|
||||||
|
#检索用户信息与配置
|
||||||
|
def search(id,book):
|
||||||
|
db=sqlite3.connect(DATABASE)
|
||||||
|
cur=db.cursor()
|
||||||
|
#处理MAA路径查询
|
||||||
|
if id=="maa":
|
||||||
|
cur.execute("SELECT * FROM setting WHERE True")
|
||||||
|
pathx=cur.fetchall()
|
||||||
|
if len(pathx)>0:
|
||||||
|
return pathx[0][0]
|
||||||
|
else:
|
||||||
|
return "MAA路径未设置"
|
||||||
|
#处理用户查询与全部信息查询
|
||||||
|
if id=="all":
|
||||||
|
cur.execute("SELECT * FROM adminx WHERE True")
|
||||||
|
else:
|
||||||
|
cur.execute("SELECT * FROM adminx WHERE admin='%s'" %(id))
|
||||||
|
data=cur.fetchall()
|
||||||
|
if id=="all":
|
||||||
|
cur.execute("SELECT * FROM setting WHERE True")
|
||||||
|
pathx=cur.fetchall()
|
||||||
|
if len(pathx)>0:
|
||||||
|
print("\nMAA路径:"+pathx[0][0])
|
||||||
|
else:
|
||||||
|
print("\nMAA路径未设置")
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
data=[list(row) for row in data]
|
||||||
|
if len(data)>0:
|
||||||
|
#转译执行情况、用户状态,对全部信息查询隐去密码
|
||||||
|
curdate=datetime.date.today()
|
||||||
|
curdate=curdate.strftime('%Y-%m-%d')
|
||||||
|
for i in range(len(data)):
|
||||||
|
if data[i][4]==curdate:
|
||||||
|
data[i][4]="今日已执行"
|
||||||
|
else:
|
||||||
|
data[i][4]="今日未执行"
|
||||||
|
if data[i][3]=='y':
|
||||||
|
data[i][3]="启用"
|
||||||
|
else:
|
||||||
|
data[i][3]="禁用"
|
||||||
|
if id=="all":
|
||||||
|
data[i][6]="******"
|
||||||
|
#制表输出
|
||||||
|
if book==1:
|
||||||
|
print('')
|
||||||
|
print(unit("用户名",15),unit("手机号码",12),unit("代理天数",8),unit("状态",4),unit("执行情况",10),unit("关卡",10),unit("密码",25))
|
||||||
|
for i in range(len(data)):
|
||||||
|
print(unit(data[i][0],15),unit(data[i][1],12),unit(data[i][2],8),unit(data[i][3],4),unit(data[i][4],10),unit(data[i][5],10),unit(data[i][6],25))
|
||||||
|
return ""
|
||||||
|
elif id=="all":
|
||||||
|
return "当前没有用户记录"
|
||||||
|
else:
|
||||||
|
return "未找到"+id
|
||||||
|
|
||||||
|
#续期
|
||||||
|
def renewal(readxx):
|
||||||
|
#提取用户名与续期时间
|
||||||
|
for i in range(len(readxx)):
|
||||||
|
if readxx[i]==' ':
|
||||||
|
id=readxx[:i]
|
||||||
|
dayp=int(readxx[i+1:])
|
||||||
|
break
|
||||||
|
#检查用户是否存在
|
||||||
|
db=sqlite3.connect(DATABASE)
|
||||||
|
cur=db.cursor()
|
||||||
|
cur.execute("SELECT * FROM adminx WHERE admin='%s'" %(id))
|
||||||
|
data=cur.fetchall()
|
||||||
|
if len(data)==0:
|
||||||
|
return "未找到"+id
|
||||||
|
#应用更新
|
||||||
|
cur.execute("UPDATE adminx SET day=%d WHERE admin='%s'" %(data[0][2]+dayp,id))
|
||||||
|
db.commit()
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
return '成功更新'+id+'的代理天数至'+str(data[0][2]+dayp)+'天'
|
||||||
|
|
||||||
|
#用户状态配置
|
||||||
|
def turn(id,t):
|
||||||
|
#检查用户是否存在
|
||||||
|
db=sqlite3.connect(DATABASE)
|
||||||
|
cur=db.cursor()
|
||||||
|
cur.execute("SELECT * FROM adminx WHERE admin='%s'" %(id))
|
||||||
|
data=cur.fetchall()
|
||||||
|
if len(data)==0:
|
||||||
|
return "未找到"+id
|
||||||
|
#应用更新
|
||||||
|
if t=='y' or t=='n':
|
||||||
|
cur.execute("UPDATE adminx SET status='%s' WHERE admin='%s'" %(t,id))
|
||||||
|
db.commit()
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
if t=='y':
|
||||||
|
return '已启用'+id
|
||||||
|
else:
|
||||||
|
return '已禁用'+id
|
||||||
|
|
||||||
|
#修改刷取关卡
|
||||||
|
def gameid(readxx):
|
||||||
|
#提取用户名与修改值
|
||||||
|
for i in range(len(readxx)):
|
||||||
|
if readxx[i]==' ':
|
||||||
|
id=readxx[:i]
|
||||||
|
gamep=readxx[i+1:]
|
||||||
|
break
|
||||||
|
#检查用户是否存在
|
||||||
|
db=sqlite3.connect(DATABASE)
|
||||||
|
cur=db.cursor()
|
||||||
|
cur.execute("SELECT * FROM adminx WHERE admin='%s'" %(id))
|
||||||
|
data=cur.fetchall()
|
||||||
|
if len(data)==0:
|
||||||
|
return "未找到"+id
|
||||||
|
#导入与应用特殊关卡规则
|
||||||
|
games={}
|
||||||
|
with open('data/gameid.txt',encoding='utf-8') as f:
|
||||||
|
gameids=f.readlines()
|
||||||
|
for i in range(len(gameids)):
|
||||||
|
for j in range(len(gameids[i])):
|
||||||
|
if gameids[i][j]==':':
|
||||||
|
gamein=gameids[i][:j]
|
||||||
|
gameout=gameids[i][j+1:]
|
||||||
|
break
|
||||||
|
games[gamein]=gameout.strip()
|
||||||
|
if gamep in games:
|
||||||
|
gamep=games[gamep]
|
||||||
|
#应用更新
|
||||||
|
cur.execute("UPDATE adminx SET game='%s' WHERE admin='%s'" %(gamep,id))
|
||||||
|
db.commit()
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
return '成功更新'+id+'的关卡为'+gamep
|
||||||
|
|
||||||
|
#设置MAA路径
|
||||||
|
def setpath(pathx):
|
||||||
|
db=sqlite3.connect(DATABASE)
|
||||||
|
cur=db.cursor()
|
||||||
|
cur.execute("SELECT * FROM setting WHERE True")
|
||||||
|
pathold=cur.fetchall()
|
||||||
|
if len(pathold)>0:
|
||||||
|
cur.execute("UPDATE setting SET path='%s' WHERE True" %(pathx))
|
||||||
|
else:
|
||||||
|
cur.execute("INSERT INTO setting(path) VALUES('%s')" %(pathx))
|
||||||
|
db.commit()
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
return "MAA路径已设置为"+pathx
|
||||||
|
|
||||||
|
#统一制表单元
|
||||||
|
def unit(x,m):
|
||||||
|
#字母与连接符占1位,中文占2位
|
||||||
|
x=str(x)
|
||||||
|
n=0
|
||||||
|
for i in x:
|
||||||
|
if 'a'<=i<='z' or 'A'<=i<='Z' or '0'<=i<='9' or i=='_' or i=='-':
|
||||||
|
n+=1
|
||||||
|
return ' '+x+' '*(m-2*len(x)+n)
|
||||||
|
|
||||||
|
#初期检查
|
||||||
|
DATABASE="data/data.db"
|
||||||
|
if not os.path.exists(DATABASE):
|
||||||
|
db=sqlite3.connect(DATABASE)
|
||||||
|
cur=db.cursor()
|
||||||
|
db.execute("CREATE TABLE adminx(admin text,number text,day int,status text,last date,game text,password text)")
|
||||||
|
db.execute("CREATE TABLE setting(path text)")
|
||||||
|
readx=input("首次启动,请设置MAA路径:")
|
||||||
|
cur.execute("INSERT INTO setting(path) VALUES('%s')" %(readx))
|
||||||
|
db.commit()
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
|
||||||
|
#初始界面
|
||||||
|
print("Good evening!")
|
||||||
|
print(search("all",1))
|
||||||
|
|
||||||
|
#主程序
|
||||||
|
while True:
|
||||||
|
read=input()
|
||||||
|
if len(read)==0:
|
||||||
|
print("无法识别的输入")
|
||||||
|
elif read[0]=='+':
|
||||||
|
print(add())
|
||||||
|
elif read[0]=='-':
|
||||||
|
exit()
|
||||||
|
elif read[0]=='/':
|
||||||
|
print(setpath(read[1:]))
|
||||||
|
else:
|
||||||
|
if read[-1]=='?':
|
||||||
|
print(search(read[:-2],1))
|
||||||
|
elif read[-1]=='+':
|
||||||
|
print(renewal(read[:-2]))
|
||||||
|
elif read[-1]=='-':
|
||||||
|
print(delete(read[:-2]))
|
||||||
|
elif read[-1]=='~':
|
||||||
|
print(gameid(read[:-2]))
|
||||||
|
elif read[-1]=='y' or read[-1]=='n':
|
||||||
|
print(turn(read[:-2],read[-1]))
|
||||||
|
else:
|
||||||
|
print("无法识别的输入")
|
||||||
BIN
mytaskkill.exe
Normal file
BIN
mytaskkill.exe
Normal file
Binary file not shown.
112
run.py
Normal file
112
run.py
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
import os
|
||||||
|
import sqlite3
|
||||||
|
import datetime
|
||||||
|
import time
|
||||||
|
import json
|
||||||
|
from termcolor import colored
|
||||||
|
|
||||||
|
def ifoff():
|
||||||
|
while True:
|
||||||
|
time.sleep(10)
|
||||||
|
with open(logpath,'r',encoding='utf-8') as f:
|
||||||
|
logs=f.readlines()[-1:-10:-1]
|
||||||
|
log=''.join(logs)
|
||||||
|
print(colored('\n'.join(logs[::-1]),"green"))
|
||||||
|
if "任务已全部完成!" in log:
|
||||||
|
return True
|
||||||
|
elif ("请检查连接设置或尝试重启模拟器与 ADB 或重启电脑" in log) or ("已停止" in log):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def killpath(maapath):
|
||||||
|
kpath='.\\mytaskkill.exe '
|
||||||
|
for i in maapath:
|
||||||
|
if i=='/':
|
||||||
|
kpath=kpath+'\\'
|
||||||
|
else:
|
||||||
|
kpath=kpath+i
|
||||||
|
return kpath
|
||||||
|
|
||||||
|
def runmaa(tel,game):
|
||||||
|
with open(setpath,"r",encoding="utf-8") as f:
|
||||||
|
data = json.load(f)
|
||||||
|
data["Configurations"]["Default"]["Start.AccountName"]=tel[:3]+"****"+tel[7:]
|
||||||
|
week=str(datetime.datetime.now().strftime('%A'))
|
||||||
|
if week=="Monday":
|
||||||
|
data["Configurations"]["Default"]["MainFunction.Stage1"]="Annihilation"
|
||||||
|
else:
|
||||||
|
data["Configurations"]["Default"]["MainFunction.Stage1"]=game
|
||||||
|
with open(setpath,"w",encoding="utf-8") as f:
|
||||||
|
json.dump(data,f)
|
||||||
|
os.system('start '+maapath)
|
||||||
|
time.sleep(60)
|
||||||
|
if ifoff():
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
command=killpath(maapath)
|
||||||
|
os.system(command)
|
||||||
|
os.system('start '+maapath)
|
||||||
|
time.sleep(60)
|
||||||
|
if ifoff():
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
command=killpath(maapath)
|
||||||
|
os.system(command)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def updata(id):
|
||||||
|
db=sqlite3.connect(DATABASE)
|
||||||
|
cur=db.cursor()
|
||||||
|
cur.execute("SELECT * FROM adminx WHERE admin='%s'" %(id))
|
||||||
|
info=cur.fetchall()
|
||||||
|
cur.execute("UPDATE adminx SET day=%d WHERE admin='%s'" %(info[0][2]-1,id))
|
||||||
|
db.commit()
|
||||||
|
cur.execute("UPDATE adminx SET last='%s' WHERE admin='%s'" %(curdate,id))
|
||||||
|
print("upcurdate")
|
||||||
|
db.commit()
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
return 0
|
||||||
|
|
||||||
|
#获取PATH与用户数据
|
||||||
|
DATABASE="data/data.db"
|
||||||
|
db=sqlite3.connect(DATABASE)
|
||||||
|
cur=db.cursor()
|
||||||
|
cur.execute("SELECT * FROM setting WHERE True")
|
||||||
|
path=cur.fetchall()
|
||||||
|
path=str(path[0][0])
|
||||||
|
setpath=path+"/config/gui.json"
|
||||||
|
logpath=path+"/debug/gui.log"
|
||||||
|
maapath=path+"/MAA.exe"
|
||||||
|
cur.execute("SELECT * FROM adminx WHERE True")
|
||||||
|
data=cur.fetchall()
|
||||||
|
data=[list(row) for row in data]
|
||||||
|
cur.close()
|
||||||
|
db.close()
|
||||||
|
#开始执行
|
||||||
|
curdate=datetime.date.today()
|
||||||
|
curdate=curdate.strftime('%Y-%m-%d')
|
||||||
|
idnew=[]
|
||||||
|
idold=[]
|
||||||
|
idfail=[]
|
||||||
|
for i in range(len(data)):
|
||||||
|
if data[i][3]=='y' and data[i][4]!=curdate and data[i][2]>0:
|
||||||
|
book=runmaa(data[i][1],data[i][5])
|
||||||
|
if book:
|
||||||
|
updata(data[i][0])
|
||||||
|
idnew.append(data[i][0])
|
||||||
|
print(colored("已完成"+data[i][0]+"今日的代理","yellow"))
|
||||||
|
else:
|
||||||
|
idfail.append(data[i][0])
|
||||||
|
print(colored("异常中止"+data[i][0]+"的代理","red"))
|
||||||
|
for i in range(len(data)):
|
||||||
|
if data[i][3]=='y' and data[i][4]==curdate and data[i][2]>0:
|
||||||
|
book=runmaa(data[i][1],data[i][5])
|
||||||
|
if book:
|
||||||
|
idold.append(data[i][0])
|
||||||
|
print(colored("已重复完成"+data[i][0]+"今日的代理","yellow"))
|
||||||
|
with open("log.txt","w", encoding="utf-8") as f:
|
||||||
|
print("任务结束,已完成数:"+str(len(idnew))+",未完成数:"+str(len(idfail))+",重复执行数:"+str(len(idold)),file=f)
|
||||||
|
if len(idfail)!=0:
|
||||||
|
print("代理未完成的用户:",file=f)
|
||||||
|
for i in range(len(idfail)):
|
||||||
|
print(idfail[i],file=f)
|
||||||
7
部分代码的版权声明.txt
Normal file
7
部分代码的版权声明.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
声明:
|
||||||
|
|
||||||
|
KillSpecifiedProcess.cpp与mytaskkill.exe来自CSDN博主的文章,遵循CC 4.0 BY-SA 版权协议附加以下信息:
|
||||||
|
|
||||||
|
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
|
||||||
|
|
||||||
|
原文链接:https://blog.csdn.net/qq_29542611/article/details/122003681
|
||||||
Reference in New Issue
Block a user