Skip to content
This repository was archived by the owner on Jun 4, 2023. It is now read-only.

Commit 2eec1e9

Browse files
format all
1 parent af44f8d commit 2eec1e9

File tree

12 files changed

+736
-1603
lines changed

12 files changed

+736
-1603
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
"contributions": [
4242
"code"
4343
]
44+
},
45+
{
46+
"login": "superzhaoyang",
47+
"name": "superzhaoyang",
48+
"avatar_url": "https://avatars.githubusercontent.com/u/49988452?v=4",
49+
"profile": "http://www.superzhaoyang.top",
50+
"contributions": [
51+
"code"
52+
]
4453
}
4554
],
4655
"contributorsPerLine": 7,

ClickToRun.cmd

Lines changed: 0 additions & 3 deletions
This file was deleted.

ConfigureOnce.ps1

Lines changed: 0 additions & 41 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SDUHealth
22
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3-
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
3+
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
44
<!-- ALL-CONTRIBUTORS-BADGE:END -->
55

66
山东大学学生每日健康状况填报自动打卡。
@@ -13,83 +13,6 @@
1313

1414
**[Python3](https://www.python.org)**
1515

16-
推荐使用 GitHub Actions 的运行方式,可以方便的实现每日自动打卡。
17-
18-
注意需要你使用本程序打卡前一天手动打过卡,且当天没有打过卡,之后每天就可以都只使用自动打卡了。
19-
20-
### Github Actions 运行
21-
22-
首先复制 configexample.yml 文件里面的所有内容,然后在本地进行编辑,根据文件的指示填入账号和密码,之后可以去 [yaml检测](https://www.bejson.com/validators/yaml_editor/) 检测一下文件的正确性,支持多账户,当然前提是你知道别人的密码。
23-
24-
之后 fork 本仓库到自己的 GitHub 账号,之后打开仓库的 Settings,在仓库设置界面在打开 Secrets 选项:
25-
26-
![Github Repo Secrets Settings](https://cdn.jsdelivr.net/gh/viewv/Pico@master/uPic/Screen%20Shot%202021-01-19%20at%2019.06.10.png)
27-
28-
之后新建一个 secret,Name 为 CONFIG,Value 就是你编辑的包含你的学号密码的 yaml 文件内容全部复制进去即可:
29-
30-
![New Github Repo Secret](https://cdn.jsdelivr.net/gh/viewv/Pico@master/uPic/Screen%20Shot%202021-01-19%20at%2019.08.02.png)
31-
32-
保存即可,之后转到仓库的 Actions 选项卡:
33-
34-
![Enable Github Actions workflow](https://cdn.jsdelivr.net/gh/viewv/Pico@master/uPic/Screen%20Shot%202021-01-19%20at%2019.09.06.png)
35-
36-
Enable 本仓库已经配置好的 GitHub Actions workflow,之后点击 checkin 打开配置选项:
37-
38-
![Enable checkin workflow](https://cdn.jsdelivr.net/gh/viewv/Pico@master/uPic/Screen%20Shot%202021-01-21%20at%2015.11.44.png)
39-
40-
Enable workflow,之后得到下面的界面:
41-
42-
![Checkin workflow page](https://cdn.jsdelivr.net/gh/viewv/Pico@master/uPic/Screen%20Shot%202021-01-21%20at%2015.12.33.png)
43-
44-
你现在可以选择 Run workflow 手动触发运行,本仓库也配置了每天的自动运行,你可以打开 GitHub Actions 的运行结果提示,这样就可以简单的实现每天的打卡任务。
45-
46-
> ⚠️ 注意
47-
>
48-
> 最近我们发现 GitHub Actions workflow 有延时问题, 有可能您的实际运行时间与设置的不同。
49-
>
50-
> 又由于 GitHub 可能的设计问题,您有可能需要先手动运行一次打卡 workflow 才可以激活定时运行。
51-
52-
<details>
53-
<summary>关于 repo_sync.yml 的使用说明</summary>
54-
55-
这个文件创建了一个定时自动同步源仓库内所有代码的 Github Actions workflow。
56-
57-
> ⚠️ 注意
58-
>
59-
> 该 workflow 执行后会自动覆盖原仓库内的所有代码,并更新为源仓库的代码,所有自定义的修改将不会得到保留(一般来说,也没什么需要自定义的,实在是需要自定义,可以手动执行该 workflow 之后,将其设置为 disable )。
60-
61-
在 fork 了代码之后,首先需要去申请一个 GitHub Personal Access Token,该 Token 让此 workflow 拥有了更改指定仓库代码的权限。具体操作如下:
62-
63-
先选择账户 Settings
64-
65-
![Github account Settings](https://cdn.jsdelivr.net/gh/nekomiao123/pic/img/image-20210121121329851.png)
66-
67-
然后选择 Developer Settings
68-
69-
![Github Developer Settings](https://cdn.jsdelivr.net/gh/nekomiao123/pic/img/image-20210121121525838.png)
70-
71-
之后再选择 Personal access tokens 点击里面的 Generate new token
72-
73-
![Generate new token](https://cdn.jsdelivr.net/gh/nekomiao123/pic/img/image-20210121121640260.png)
74-
75-
之后先随便取个好记的名字,然后勾选前两项
76-
77-
![New personal access token](https://cdn.jsdelivr.net/gh/nekomiao123/pic/img/image-20210121121747207.png)
78-
79-
最后点击下面的 Generate token 即可,这样就能获得一串类似这样的字符,赶紧复制下来,它只会显示这一次
80-
81-
![Personal token info](https://cdn.jsdelivr.net/gh/nekomiao123/pic/img/image-20210121121953685.png)
82-
83-
然后去新建一个 secret(跟上面建立 secret 的流程一样)
84-
85-
Name 是 PAT
86-
87-
Value 是刚才你复制的这一串字符
88-
89-
</details>
90-
91-
到这里,该 Github Actions workflow 就可以使用了,可以实现每日自动打卡,如果你也开启了 repo_sync workflow 那么也将定时自动同步本仓库以保持代码更新。
92-
9316
### 本地运行
9417

9518
在本地安装好环境后,下载或者 clone 本仓库后,到项目文件夹下运行如下命令安装 Python 所需依赖:
@@ -130,6 +53,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
13053
<td align="center"><a href="https://nekokiku.cn/"><img src="https://avatars3.githubusercontent.com/u/34064940?v=4?s=100" width="100px;" alt=""/><br /><sub><b>menma</b></sub></a><br /><a href="https://github.com/viewv/sduhealth/commits?author=nekomiao123" title="Code">💻</a></td>
13154
<td align="center"><a href="https://www.macrohard.cn"><img src="https://avatars.githubusercontent.com/u/44798266?v=4?s=100" width="100px;" alt=""/><br /><sub><b>2U</b></sub></a><br /><a href="https://github.com/viewv/sduhealth/commits?author=Singularity0909" title="Code">💻</a></td>
13255
<td align="center"><a href="https://github.com/ryuujo1573"><img src="https://avatars.githubusercontent.com/u/16525512?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ryuujo Zhang</b></sub></a><br /><a href="https://github.com/viewv/sduhealth/commits?author=ryuujo1573" title="Code">💻</a></td>
56+
<td align="center"><a href="http://www.superzhaoyang.top"><img src="https://avatars.githubusercontent.com/u/49988452?v=4?s=100" width="100px;" alt=""/><br /><sub><b>superzhaoyang</b></sub></a><br /><a href="https://github.com/viewv/sduhealth/commits?author=superzhaoyang" title="Code">💻</a></td>
13357
</tr>
13458
</table>
13559

des.py

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
PAD_NORMAL = 1
9898
PAD_PKCS5 = 2
9999

100+
100101
# PAD_PKCS5: is a method that will unambiguously remove all padding
101102
# characters after decryption, when originally encrypted with
102103
# this padding mode.
@@ -219,7 +220,7 @@ def _unpadData(self, data, pad, padmode):
219220
pad = self.getPadding()
220221
if pad:
221222
data = data[:-self.block_size] + \
222-
data[-self.block_size:].rstrip(pad)
223+
data[-self.block_size:].rstrip(pad)
223224

224225
elif padmode == PAD_PKCS5:
225226
if _pythonMajorVersion < 3:
@@ -248,6 +249,7 @@ def _guardAgainstUnicode(self, data):
248249
"pyDes can only work with encoded strings, not Unicode.")
249250
return data
250251

252+
251253
#############################################################################
252254
# DES #
253255
#############################################################################
@@ -299,37 +301,37 @@ class des(_baseDes):
299301

300302
# permuted choice key (table 2)
301303
__pc2 = [
302-
13, 16, 10, 23, 0, 4,
303-
2, 27, 14, 5, 20, 9,
304-
22, 18, 11, 3, 25, 7,
305-
15, 6, 26, 19, 12, 1,
304+
13, 16, 10, 23, 0, 4,
305+
2, 27, 14, 5, 20, 9,
306+
22, 18, 11, 3, 25, 7,
307+
15, 6, 26, 19, 12, 1,
306308
40, 51, 30, 36, 46, 54,
307309
29, 39, 50, 44, 32, 47,
308310
43, 48, 38, 55, 33, 52,
309311
45, 41, 49, 35, 28, 31
310312
]
311313

312314
# initial permutation IP
313-
__ip = [57, 49, 41, 33, 25, 17, 9, 1,
315+
__ip = [57, 49, 41, 33, 25, 17, 9, 1,
314316
59, 51, 43, 35, 27, 19, 11, 3,
315317
61, 53, 45, 37, 29, 21, 13, 5,
316318
63, 55, 47, 39, 31, 23, 15, 7,
317-
56, 48, 40, 32, 24, 16, 8, 0,
319+
56, 48, 40, 32, 24, 16, 8, 0,
318320
58, 50, 42, 34, 26, 18, 10, 2,
319321
60, 52, 44, 36, 28, 20, 12, 4,
320322
62, 54, 46, 38, 30, 22, 14, 6
321323
]
322324

323325
# Expansion table for turning 32 bit blocks into 48 bits
324326
__expansion_table = [
325-
31, 0, 1, 2, 3, 4,
326-
3, 4, 5, 6, 7, 8,
327-
7, 8, 9, 10, 11, 12,
327+
31, 0, 1, 2, 3, 4,
328+
3, 4, 5, 6, 7, 8,
329+
7, 8, 9, 10, 11, 12,
328330
11, 12, 13, 14, 15, 16,
329331
15, 16, 17, 18, 19, 20,
330332
19, 20, 21, 22, 23, 24,
331333
23, 24, 25, 26, 27, 28,
332-
27, 28, 29, 30, 31, 0
334+
27, 28, 29, 30, 31, 0
333335
]
334336

335337
# The (in)famous S-boxes
@@ -395,14 +397,14 @@ class des(_baseDes):
395397

396398
# final permutation IP^-1
397399
__fp = [
398-
39, 7, 47, 15, 55, 23, 63, 31,
399-
38, 6, 46, 14, 54, 22, 62, 30,
400-
37, 5, 45, 13, 53, 21, 61, 29,
401-
36, 4, 44, 12, 52, 20, 60, 28,
402-
35, 3, 43, 11, 51, 19, 59, 27,
403-
34, 2, 42, 10, 50, 18, 58, 26,
404-
33, 1, 41, 9, 49, 17, 57, 25,
405-
32, 0, 40, 8, 48, 16, 56, 24
400+
39, 7, 47, 15, 55, 23, 63, 31,
401+
38, 6, 46, 14, 54, 22, 62, 30,
402+
37, 5, 45, 13, 53, 21, 61, 29,
403+
36, 4, 44, 12, 52, 20, 60, 28,
404+
35, 3, 43, 11, 51, 19, 59, 27,
405+
34, 2, 42, 10, 50, 18, 58, 26,
406+
33, 1, 41, 9, 49, 17, 57, 25,
407+
32, 0, 40, 8, 48, 16, 56, 24
406408
]
407409

408410
# Type of crypting being done
@@ -528,8 +530,8 @@ def __des_crypt(self, block, crypt_type):
528530
B = [self.R[:6], self.R[6:12], self.R[12:18], self.R[18:24],
529531
self.R[24:30], self.R[30:36], self.R[36:42], self.R[42:]]
530532
# Optimization: Replaced below commented code with above
531-
#j = 0
532-
#B = []
533+
# j = 0
534+
# B = []
533535
# while j < len(self.R):
534536
# self.R[j] = self.R[j] ^ self.Kn[iteration][j]
535537
# j += 1
@@ -563,7 +565,7 @@ def __des_crypt(self, block, crypt_type):
563565
# Xor with L[i - 1]
564566
self.R = list(map(lambda x, y: x ^ y, self.R, self.L))
565567
# Optimization: This now replaces the below commented code
566-
#j = 0
568+
# j = 0
567569
# while j < len(self.R):
568570
# self.R[j] = self.R[j] ^ self.L[j]
569571
# j += 1
@@ -609,25 +611,25 @@ def crypt(self, data, crypt_type):
609611
i = 0
610612
dict = {}
611613
result = []
612-
#cached = 0
613-
#lines = 0
614+
# cached = 0
615+
# lines = 0
614616
while i < len(data):
615617
# Test code for caching encryption results
616-
#lines += 1
618+
# lines += 1
617619
# if dict.has_key(data[i:i+8]):
618620
# print "Cached result for: %s" % data[i:i+8]
619621
# cached += 1
620622
# result.append(dict[data[i:i+8]])
621623
# i += 8
622624
# continue
623625

624-
block = self.__String_to_BitList(data[i:i+8])
626+
block = self.__String_to_BitList(data[i:i + 8])
625627

626628
# Xor with IV if using CBC mode
627629
if self.getMode() == CBC:
628630
if crypt_type == des.ENCRYPT:
629631
block = list(map(lambda x, y: x ^ y, block, iv))
630-
#j = 0
632+
# j = 0
631633
# while j < len(block):
632634
# block[j] = block[j] ^ iv[j]
633635
# j += 1
@@ -637,7 +639,7 @@ def crypt(self, data, crypt_type):
637639
if crypt_type == des.DECRYPT:
638640
processed_block = list(
639641
map(lambda x, y: x ^ y, processed_block, iv))
640-
#j = 0
642+
# j = 0
641643
# while j < len(processed_block):
642644
# processed_block[j] = processed_block[j] ^ iv[j]
643645
# j += 1
@@ -648,10 +650,10 @@ def crypt(self, data, crypt_type):
648650
processed_block = self.__des_crypt(block, crypt_type)
649651

650652
# Add the resulting crypted block to our list
651-
#d = self.__BitList_to_String(processed_block)
653+
# d = self.__BitList_to_String(processed_block)
652654
# result.append(d)
653655
result.append(self.__BitList_to_String(processed_block))
654-
#dict[data[i:i+8]] = d
656+
# dict[data[i:i+8]] = d
655657
i += 8
656658

657659
# print "Lines: %d, cached: %d" % (lines, cached)
@@ -811,7 +813,7 @@ def encrypt(self, data, pad=None, padmode=None):
811813
i = 0
812814
result = []
813815
while i < len(data):
814-
block = self.__key1.crypt(data[i:i+8], ENCRYPT)
816+
block = self.__key1.crypt(data[i:i + 8], ENCRYPT)
815817
block = self.__key2.crypt(block, DECRYPT)
816818
block = self.__key3.crypt(block, ENCRYPT)
817819
self.__key1.setIV(block)
@@ -856,8 +858,8 @@ def decrypt(self, data, pad=None, padmode=None):
856858
i = 0
857859
result = []
858860
while i < len(data):
859-
iv = data[i:i+8]
860-
block = self.__key3.crypt(iv, DECRYPT)
861+
iv = data[i:i + 8]
862+
block = self.__key3.crypt(iv, DECRYPT)
861863
block = self.__key2.crypt(block, ENCRYPT)
862864
block = self.__key1.crypt(block, DECRYPT)
863865
self.__key1.setIV(iv)

0 commit comments

Comments
 (0)