This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d76e87
commit 64110dc
Showing
9 changed files
with
756 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
user: | ||
#username 学号或者工号 | ||
username: 161105024 | ||
#password 密码,用不到,原因是:login.py获取不到MOD_AUTH_CAS | ||
# password: 161105024 | ||
#address 地址,定位信息 | ||
address: 中国四川省成都市金牛区一环路北1段-129号-附9号 | ||
#email 接受通知消息的邮箱 | ||
email: [email protected] | ||
#lon 当前位置经度,可以访问http://zuobiao.ay800.com/s/27/index.php获取 | ||
lon: '119.191475' | ||
#lat 当前位置纬度 | ||
lat: '26.058264' | ||
#school 学校全称 | ||
school: 福州大学 | ||
#今日校园相关配置 | ||
cpdaily: | ||
#表单组默认选项配置 | ||
defaults: | ||
#表单默认选项配置,按顺序,注意,只有标必填项的才处理,不会配置就执行generate.py | ||
- default: | ||
title: 今日所在位置 | ||
type: 1 | ||
value: 福建省/漳州市/芗城区 | ||
- default: | ||
title: 昨日午检体温 | ||
type: 2 | ||
value: 小于37.3度 | ||
- default: | ||
title: 今日晨检体温 | ||
type: 2 | ||
value: 小于37.3度 | ||
- default: | ||
title: 今日健康状况(可多选) | ||
type: 3 | ||
value: 健康,无症状 | ||
- default: | ||
title: 家庭成员是否有确诊感染、疑似感染新冠肺炎患者或无症状感染者 | ||
type: 2 | ||
value: 否 | ||
- default: | ||
title: 今日是否为入院状态(入院指生病住院) | ||
type: 2 | ||
value: 否 | ||
- default: | ||
title: 目前是否为新冠肺炎确诊/疑似病例或无症状感染者(若选“是“,必须已与就诊医生确认) | ||
type: 2 | ||
value: 否 | ||
- default: | ||
title: 今日隔离情况 | ||
type: 2 | ||
value: 无需隔离 | ||
- default: | ||
title: 今日是否因与确诊病人有密切接触,被当地强制隔离中 | ||
type: 2 | ||
value: 否 | ||
- default: | ||
title: 今日是否因有发热、咳嗽、乏力、呼吸困难等疑似症状在隔离中 | ||
type: 2 | ||
value: 否 | ||
- default: | ||
title: 近14日以来,你接触过疫情重点地区流出人员或确诊/疑似新冠肺炎患者等情况 | ||
type: 2 | ||
value: 无此类情况 | ||
- default: | ||
title: 近14日以来,你居住、旅行、途经疫情重点地区情况 | ||
type: 2 | ||
value: 无此类情况 | ||
- default: | ||
title: 是否在今日入闽 | ||
type: 2 | ||
value: 否 | ||
- default: | ||
title: 住址是否在今日有变动 | ||
type: 2 | ||
value: 否 | ||
- default: | ||
title: 近14日以来,你的共同居住者(包括家庭成员、共同租住人员、共同居住房东家庭成员)有无以下特殊情况(可多选) | ||
type: 3 | ||
value: 无以下特殊情况 | ||
- default: | ||
title: 本人承诺以上所填报的全部内容均属实、准确,不存在任何隐瞒与不实的情况,更无遗漏之处。 | ||
type: 2 | ||
value: 是 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import math | ||
import random | ||
import base64 | ||
from Crypto.Cipher import AES | ||
from pyDes import des, CBC, PAD_PKCS5 | ||
|
||
|
||
# DES加密 | ||
def DESEncrypt(s, key='XCE927=='): | ||
iv = b"\x01\x02\x03\x04\x05\x06\x07\x08" | ||
k = des(key, CBC, iv, pad=None, padmode=PAD_PKCS5) | ||
encrypt_str = k.encrypt(s) | ||
return base64.b64encode(encrypt_str).decode() | ||
|
||
|
||
# DES解密 | ||
def DESDecrypt(s, key='XCE927=='): | ||
s = base64.b64decode(s) | ||
iv = b"\x01\x02\x03\x04\x05\x06\x07\x08" | ||
k = des(key, CBC, iv, pad=None, padmode=PAD_PKCS5) | ||
return k.decrypt(s) | ||
|
||
|
||
# 获取随机字符串 | ||
def getRandomString(length): | ||
chs = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678' | ||
result = '' | ||
for i in range(0, length): | ||
result += chs[(math.floor(random.random() * len(chs)))] | ||
return result | ||
|
||
|
||
# AES加密 | ||
def EncryptAES(s, key, iv='1' * 16, charset='utf-8'): | ||
key = key.encode(charset) | ||
iv = iv.encode(charset) | ||
BLOCK_SIZE = 16 | ||
pad = lambda s: (s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * chr(BLOCK_SIZE - len(s) % BLOCK_SIZE)) | ||
raw = pad(s) | ||
cipher = AES.new(key, AES.MODE_CBC, iv) | ||
encrypted = cipher.encrypt(bytes(raw, encoding=charset)) | ||
return str(base64.b64encode(encrypted), charset) | ||
|
||
|
||
# AES解密 | ||
def DecryptAES(s, key, iv='1' * 16, charset='utf-8'): | ||
key = key.encode(charset) | ||
iv = iv.encode(charset) | ||
unpad = lambda s: s[:-ord(s[len(s) - 1:])] | ||
cipher = AES.new(key, AES.MODE_CBC, iv) | ||
decrypt = unpad(cipher.decrypt(base64.b64decode(s))) | ||
return str(decrypt, charset) | ||
|
||
|
||
# 金智的AES加密过程 | ||
def AESEncrypt(data, key): | ||
return EncryptAES(getRandomString(64) + data, key, key) | ||
|
||
|
||
# 金智的AES解密过程 | ||
def AESDecrypt(data, key): | ||
return DecryptAES(data, key)[64:] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# encoding: utf-8 | ||
from fzu import index as app | ||
import yaml | ||
|
||
|
||
# 生成默认配置 | ||
def generate(): | ||
form = dict(app.queryForm())['form'] | ||
# app.log(form) | ||
defaults = [] | ||
sort = 1 | ||
for formItem in form: | ||
if formItem['isRequired'] == 1: | ||
default = {} | ||
one = {} | ||
default['title'] = formItem['title'] | ||
default['type'] = formItem['fieldType'] | ||
print('问题%d:' % sort + default['title']) | ||
if default['type'] == 1: | ||
default['value'] = input("请输入文本:") | ||
if default['type'] == 2: | ||
fieldItems = formItem['fieldItems'] | ||
num = 1 | ||
for fieldItem in fieldItems: | ||
print('\t%d ' % num + fieldItem['content']) | ||
num += 1 | ||
choose = int(input("请输入序号:")) | ||
if choose < 1 or choose > num: | ||
print('输入错误,请重新执行此脚本') | ||
exit(-1) | ||
default['value'] = fieldItems[choose - 1]['content'] | ||
if default['type'] == 3: | ||
fieldItems = formItem['fieldItems'] | ||
num = 1 | ||
for fieldItem in fieldItems: | ||
print('\t%d ' % num + fieldItem['content']) | ||
num += 1 | ||
chooses = list(map(int, input('请输入序号(可输入多个,请用空格隔开):').split())) | ||
default['value'] = '' | ||
for i in range(0, len(chooses)): | ||
choose = chooses[i] | ||
if choose < 1 or choose > num: | ||
print('输入错误,请重新执行此脚本') | ||
exit(-1) | ||
if i != len(chooses) - 1: | ||
default['value'] += fieldItems[choose - 1]['content'] + ',' | ||
else: | ||
default['value'] += fieldItems[choose - 1]['content'] | ||
if default['type'] == 4: | ||
default['value'] = input("请输入图片名称:") | ||
one['default'] = default | ||
defaults.append(one) | ||
sort += 1 | ||
print('======================分隔线======================') | ||
print(yaml.dump(defaults, allow_unicode=True)) | ||
|
||
|
||
if __name__ == "__main__": | ||
generate() |
Oops, something went wrong.