Skip to content

Commit

Permalink
major update
Browse files Browse the repository at this point in the history
  • Loading branch information
hd80606b committed Jul 11, 2021
1 parent d565e9c commit 16bc8f7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
1. 打开电脑微信,进小程序前打开Fiddler2<br />
2. Fiddler2有显示抓到包的数据后,打开校趣多<br />
3. 依次点击 疫情防控-健康打卡<br />
4. 找到如下图这一行(Result302的下面一行,URL是/corona/submitHealthCheck?openId)点击cookies,找到图中红框的set-cookie:后接的内容,复制直到分号前
![找到cookie](https://www.z4a.net/images/2020/10/27/2020-10-27_16-46-07.png)
5. 如上图复制的则是JSESSIONID=E3A9~(省略)~09173<br />
6. 将复制的填入到**数据.ini文件**的cookie栏<br />
4. 找到如下图这一行(Result302的下面一行,URL是/corona/submitHealthCheck?openId),复制URL中openId=后到&latitude=&longitude= 之前的的字符串(一共96个字符)
![找到openid](https://www.z4a.net/images/2021/07/11/2021-07-11_22-04-26.jpg)
5. 如上图复制的则是20b21a0a4~省略~4dc12505<br />
6. 将复制的填入到**数据.ini文件**的openid栏<br />

### ini参数解释
节点名称\[test]下的均为例子,不会运行,因此无需修改<br />
需要修改的是\[1]下的参数,如果想加多个账号,就类似的在下面复制粘贴就好了<br />
|||
| ---- | ---- |
| Cookie | JSESSIONID=... |
| openid | 应该是由96个字母或数字组成 |
| CheckPlace | 打卡地点 |
| Temperature | 当前体温 |
| Phone | 联系方式 |
Expand All @@ -41,22 +41,25 @@

* 程序在运行成功后3s自动关闭,是否成功如没看到可以去查看生成的log文件,这么做是为了方便丢到windows自带的计划任务里做到每日循环,怎么做?请百度windows计划任务<br />
* 多账户的节点名称可以随意命名,本质是集合遍历
* **cookie有效期可能是7天,也就是说每7天可能需要去换一次**
* **感谢在[FengZzhi](https://github.com/FengZzhi)issues里的建议,改用openid(后面会说明)后成功实现每日全自动打卡**
* 填写计划任务时请注意 起始于 务必填写到 校趣多打卡.exe 的更目录(如图)
![计划任务](https://www.z4a.net/images/2020/10/27/2020-10-27_21-16-52.png)

### 出错详解

* 打开就闪退说明没有运行环境,请百度安装.NET Core3.1环境<br />
* 如显示的是未知错误,log里写的是cookie出错,基本就是cookie输错了或者已失效<br />
* 如显示的是未知错误,log里写的是cookie出错,基本就是openid输错了<br />
* 如果显示联系方式出错,则是Phone栏输入有误<br />
* 为什么我输的都正确返回还是错误的?先检查是不是写到test里去了,第一个用户请写在\[1]里<br />

### 已知但无法解决的bug
* 因为本地断网无法发出请求,即收到回复为空,和成功打卡时收到回复为空一致,会导致 成功打卡 的误判断
* cookie有效期不明,将在明确后更正

### 思路/博客/其他
* python版本请参看[python](https://github.com/FengZzhi/xiaoquduo)
[博客](https://hd80606b.com/xiaoquduo/)<br />
**如果你觉得可以的话,给个Star吧**

### 关于openid
* 单独起一栏说说这openid,这里的openid并不是指的**微信用户在公众号appid下的唯一用户标识**所用的openid和UnionId,详情参见微信小程序开发文档[文档](https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_4)
* 这里的openid虽说每次都有所变动,但竟然会一直保留信息,并且可以一直用于set-cookie,之前实则没有想到,正是这个原因,也要谨防泄露这串字符串,有了这串字符串就可以很容易调出上次打卡所填写的信息
28 changes: 19 additions & 9 deletions 校趣多打卡/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static void Main(string[] args)
fs.Flush();
fs.Close();
newIniFile = new IniFile(appDataDic);
newIniFile.WriteContentValue("test", "Cookie", "JSESSIONID=XXXXXXXXXXXXXXX");
newIniFile.WriteContentValue("test", "openId", "应该是由96个字母或数字组成");
newIniFile.WriteContentValue("test", "CheckPlace", "宇宙-银河系-地球");
newIniFile.WriteContentValue("test", "Temperature", "36.5");
newIniFile.WriteContentValue("test", "Phone", "XXXXXXXXXXX");
Expand All @@ -39,7 +39,7 @@ static void Main(string[] args)
newIniFile.WriteContentValue("test", "checkPlaceProvince", "宇宙");
newIniFile.WriteContentValue("test", "checkPlaceCity", "银河系");
newIniFile.WriteContentValue("test", "checkPlaceArea", "地球");
newIniFile.WriteContentValue("1", "Cookie", "JSESSIONID=");
newIniFile.WriteContentValue("1", "openId", "");
newIniFile.WriteContentValue("1", "CheckPlace", "");
newIniFile.WriteContentValue("1", "Temperature", "36.4");
newIniFile.WriteContentValue("1", "Phone", "");
Expand All @@ -54,10 +54,20 @@ static void Main(string[] args)
List<string> list = IniFile.ReadSections(appDataDic);
for (int i=1;i<list.Count;i++)
{

HttpWebRequest getcookie = (HttpWebRequest)WebRequest.Create("https://mps.zocedu.com/corona/submitHealthCheck?openId=" + newIniFile.ReadContentValue(list[i], "openId") + "&latitude=&longitude=");
getcookie.Method = "GET";
getcookie.AllowAutoRedirect = false;
HttpWebResponse reponse = (HttpWebResponse)getcookie.GetResponse();
string cookie = reponse.GetResponseHeader("Set-Cookie");
string chuli1 = System.Text.RegularExpressions.Regex.Match(cookie, @"J.*?;").ToString();
cookie = chuli1.Replace(";", "");
//Console.WriteLine(cookie);

var client = new RestClient("https://mps.zocedu.com/corona/submitHealthCheck/submit");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Cookie", newIniFile.ReadContentValue(list[i], "Cookie"));
request.AddHeader("Cookie", cookie);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("checkPlace", newIniFile.ReadContentValue(list[i], "CheckPlace"));
request.AddParameter("contactMethod", newIniFile.ReadContentValue(list[i], "Phone"));
Expand Down Expand Up @@ -91,25 +101,25 @@ static void Main(string[] args)
Console.WriteLine("已成功打卡\n");
writer.WriteLine(DateTime.Now + "\0" + list[i] + "已成功打卡\n");
writer.Flush();

}
else
if(response.Content.Contains("html"))
if (response.Content.Contains("html"))
{
Console.WriteLine(response.Content + "\n打卡失败,请检查cookie是否出错\n");
writer.WriteLine(DateTime.Now + "\0" + list[i] + "打卡失败,请检查cookie是否出错\n");
writer.Flush();

}
else
{
Console.WriteLine(response.Content + "\n打卡失败\n");
writer.WriteLine(DateTime.Now + "\0"+ list[i] + "打卡失败"+ response.Content);
writer.WriteLine(DateTime.Now + "\0" + list[i] + "打卡失败" + response.Content);
writer.Flush();

//Console.WriteLine(list[i]);
}

}
writer.Close();
Thread.Sleep(3000);
Expand Down

0 comments on commit 16bc8f7

Please sign in to comment.