65 lines
2.1 KiB
C++
65 lines
2.1 KiB
C++
#include <iostream>
|
|
#include <string>
|
|
#include <algorithm>
|
|
#include <vector>
|
|
#include <thread>
|
|
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
#include <ctime>
|
|
|
|
|
|
using namespace std;
|
|
|
|
void prepareCookie()
|
|
{
|
|
system(R"(curl -v "life.ccb.com/tran/WCCMainPlatV5?CCB_IBSVersion=V5&SERVLET_NAME=WCCMainPlatV5&TXCODE=100119&USERID=&SKEY=" --user-agent "Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1" -c temp/cookie1.txt > temp/step1.txt)");
|
|
}
|
|
|
|
void RunCommand(string stuNumber,string outputFilename)
|
|
{
|
|
string cmd=R"(curl -v "life.ccb.com/tran/WCCMainPlatV5?CCB_IBSVersion=V5&SERVLET_NAME=WCCMainPlatV5&isAjaxRequest=true&TXCODE=JF1103&OPUN_COD=370200&MERCHANT=#STUCODE#100010&COMM=#STUCODE#&BANK_COD=370000&BIll_CODE=100010&PAY_TYPE=11&BILL_FLAG=0&BIll_MERCHANT=600007&BANK_NAME=%E5%B1%B1%E4%B8%9C%E7%9C%81&OPUN_NAME=%E9%9D%92%E5%B2%9B%E5%B8%82&MERCHANT_NAME=%E9%9D%92%E5%B2%9B%E7%A7%91%E6%8A%80%E5%A4%A7%E5%AD%A6%E6%A0%A1%E5%9B%AD%E5%8D%A1%E5%85%85%E5%80%BC&BILL_TYPE=2&BRAN_NO=371000000&BILL_ITEM=01013&BILL_NAME=IC%E5%8D%A1%E3%80%81%E8%81%94%E5%90%8D%E5%8D%A1%E5%85%85%E5%80%BC&RE1CON=&RE2CON=" --user-agent "Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1" -b "temp/cookie1.txt" > )" ;
|
|
|
|
string target="#STUCODE#";
|
|
|
|
while( cmd.find(target)!= string::npos )
|
|
{
|
|
cmd=cmd.replace(cmd.find(target),target.size(),stuNumber);
|
|
}
|
|
|
|
cmd=cmd+outputFilename;
|
|
|
|
system(cmd.c_str());
|
|
}
|
|
|
|
int main()
|
|
{
|
|
printf("初始化随机数...\n");
|
|
srand(time(NULL));
|
|
printf("创建临时文件夹..\n");
|
|
system("mkdir temp");
|
|
printf("创建数据文件夹...\n");
|
|
system("mkdir data");
|
|
printf("准备Cookies文件...\n");
|
|
prepareCookie();
|
|
|
|
printf("开始查询...\n");
|
|
for(int i=0;i<40;i++)
|
|
{
|
|
char buff[1024];
|
|
sprintf(buff,"15080801%02d",i+1);
|
|
string stuCode(buff);
|
|
sprintf(buff,"data/%d.txt",i+1);
|
|
string Filename(buff);
|
|
|
|
printf("查询第 %d of %d\n",i+1,40);
|
|
RunCommand(stuCode,Filename);
|
|
|
|
this_thread::sleep_for(chrono::seconds(rand()%3+1));
|
|
}
|
|
|
|
printf("查询完成.\n");
|
|
return 0;
|
|
}
|