好友
阅读权限10
听众
最后登录1970-1-1
|
Python+aardio 个人成绩查看
序
1.大学生嘛,期末了要放假了,吸取了去年的教训,直接整了一个查成绩的小程序出来。(班长或教师可用,通过现有的班级数据生成成绩的。)
【另,我不是计算机相关专业,甚至可以放心地说班里没有比我更懂编程的了(医学),所以不加壳也不管混淆啥的了,只进行手动程序变量等的加密(规律性)】
2.python只是用作生成aardio中的列表而已,实际上真正管执行的全是aardio,python仅提供数据。
3.加密怎么写啊……求告知,编程废物在线求教…………(其实第1条,一开始想写加密的,结果发现没有系统学过真是一时没想出来……)
逻辑:(晕了的可以看下方的图示)
加密
1.利用sha每变一位数,整体不同的特性由学号生成sha224,再转换为16进制【56位】后随机乱序取出10位。
2.取随机数介于0001-9998之间且不存在重复数字,生成4位的字符串(如“1234”),将此字符串打乱顺序插入其中。
并利用此字符串的组合(1243,1324,1342……)【注:共18种排列组合方式】存储各种数据。
3.以“0000”作为固定接口储存姓名。
4.输出对应关系到Ref.txt,输出上述乱码数据到In_Score.txt(已排版完毕,可直接作为aardio数组使用)
5.一开始想再加上一些排列组合方式的,想了想太麻烦,放弃之……
解密
6.aardio硬解密即可(需要注意对应关系……)
aardio代码:
import win.ui
import win
import fonts
fonts.addFamily($".\lib\fonts\.res\梦源黑体 CN.ttf","梦源黑体 CN W9")
/*DSG{{*/
mainForm = win.form(cls="Score_FORM";text="ScoreFinder";right=481;bottom=333;border="dialog frame";max=false;mode="popup")
mainForm.add(
button={cls="button";text="查询";left=148;top=222;right=334;bottom=296;font=LOGFONT(h=-37;name='梦源黑体 CN W9';weight=420);z=2};
edit={cls="edit";text="XXXXXXXXXXXXXX";left=48;top=104;right=432;bottom=168;align="center";autohscroll=false;autovscroll=false;edge=1;font=LOGFONT(h=-43;name='梦源黑体 CN W9';weight=420);multiline=1;z=1};
static={cls="static";text="请输入密码";left=104;top=34;right=378;bottom=92;align="center";center=1;font=LOGFONT(h=-37;name='梦源黑体 CN W9';weight=420);transparent=1;z=3}
)
/*}}*/
Score = {
"aa6d1865242b0c" = {
"0000" = "XXX";
"6805" = "96";
"6580" = "63";
"6508" = "49";
"6085" = "67";
"6058" = "67"},
"1b2f157890210b" = {
"0000" = "XYZ";
"2508" = "88";
"2850" = "54";
"2805" = "62";
"2058" = "97";
"2085" = "91"}
}
function Init(i){
Show_Score = win.loadForm("\dlg\Show.aardio")
temp = mainForm.edit.text
Show_Score.N.text = Score[i]["0000"]
s_0 = string.slice(temp,3,3)
s_1 = string.slice(temp,6,6)
s_2 = string.slice(temp,8,8)
s_3 = string.slice(temp,13,13)
Show_Score.edit_S_S.text = Score[i][string.concat(s_2,s_1,s_0,s_3)]
Show_Score.edit_R_C.text = Score[i][string.concat(s_2,s_3,s_0,s_1)]
Show_Score.edit_R_G.text = Score[i][string.concat(s_2,s_3,s_1,s_0)]
Show_Score.edit_un.text = Score[i][string.concat(s_2,s_0,s_1,s_3)]
Show_Score.edit_aver.text = Score[i][string.concat(s_2,s_0,s_3,s_1)]
Show_Score.edit_points.text = Score[i][string.concat(s_2,s_1,s_3,s_0)]
Show_Score.edit_sub_1.text = Score[i][string.concat(s_0,s_1,s_3,s_2)]
Show_Score.edit_sub_2.text = Score[i][string.concat(s_0,s_2,s_1,s_3)]
Show_Score.show()
mainForm.close()
}
mainForm.button.oncommand = function(id,event){
mainForm.edit.disabled = true
mainForm.button.disabled = true
if(string.len(mainForm.edit.text) != 14){
win.msgboxErr("Error","Error",mainForm.hwnd)
mainForm.edit.text = ""
mainForm.edit.disabled = false
mainForm.button.disabled = false
}
else{
var info = 0
for i in Score{
if(i == mainForm.edit.text){
info = 1
Init(i)
}
}
if (info == 0){
win.msgboxErr("Error","Error",mainForm.hwnd)
mainForm.edit.text = ""
mainForm.edit.disabled = false
mainForm.button.disabled = false
}
}
}
mainForm.show();
return win.loopMessage();
python源码:
[Python] 纯文本查看 复制代码 import io
import pandas as pd
import hashlib
import random
Score = io.open("In_Score.txt", "w")
excel = pd.read_excel(
"D:\\Documents\\学校事务\\成绩单\\临8888.xlsx",
sheet_name="sheet1",
header=1)
Ref = io.open("Ref.txt", "w")
Score.write("Score = {\n")
def paswd():
result = ""
for i in random.sample(list(map(str, range(0, 10))), k=4):
result += str(i)
return result
def calc(num: int, pwd_source: str):
num = bytes(num, encoding="utf8")
password = str(hashlib.sha224(num).hexdigest())
password = password[38] + \
password[4] + \
pwd_source[0] +\
password[52] + \
password[25] + \
pwd_source[1] +\
password[40] + \
pwd_source[2] +\
password[19] + \
password[8] + \
password[46] + \
password[54] + \
pwd_source[3] +\
password[15]
#[2] [5] [7] [12]
return password
def r(num):
num = round(float(num), 2)
return str(num)
for i in range(0, 49):
result = paswd()
# e.g. "72jssk38frc" = {
password = calc(excel.loc[i + 5, "学号"], result)
Score.write(" \"" + password + "\" = {\n")
# e.g. "0000" = "XXX"
Ref.write(excel.loc[i + 5, "姓名"] + "," + password + "\n")
Score.write(" \"0000\" = \"" + excel.loc[i + 5, "姓名"] + "\";\n")
temp = [
result[0] + result[1] + result[3] + result[2], # subj1
result[0] + result[2] + result[1] + result[3], # subj2
result[0] + result[2] + result[3] + result[1], # subj3
result[0] + result[3] + result[1] + result[2], # subj4
result[0] + result[3] + result[2] + result[1], # subj5
result[1] + result[0] + result[2] + result[3], # subj6
result[1] + result[0] + result[3] + result[2], # subj7
result[1] + result[2] + result[0] + result[3], # subj8
result[1] + result[2] + result[3] + result[0], # subj9
result[1] + result[3] + result[0] + result[2], # subj10
result[1] + result[3] + result[2] + result[0], # subj11
result[2] + result[0] + result[1] + result[3], # 不及格
result[2] + result[0] + result[3] + result[1], # 平均分
result[2] + result[1] + result[0] + result[3], # 总分
result[2] + result[1] + result[3] + result[0], # 学分
result[2] + result[3] + result[0] + result[1], # 班级排名
result[2] + result[3] + result[1] + result[0] # 年级排名
]
for j in range(0, 17):
if(j == 12):
Score.write(
" \"" + temp[j] + "\" = \"" + r(excel.iloc[i + 5, j + 4]) + "\";\n")
elif((j == 11) or (j == 15)):
Score.write(
" \"" + temp[j] + "\" = \"" + str(int(excel.iloc[i + 5, j + 4])) + "\";\n")
elif(j == 16):
Score.write(
" \"" + temp[j] + "\" = \"" + str(int(excel.iloc[i + 5, j + 4])) + "\"")
else:
Score.write(
" \"" + temp[j] + "\" = \"" + str(excel.iloc[i + 5, j + 4]) + "\";\n")
if (i == 48):
Score.write("}\n")
else:
Score.write("};\n")
Score.write("}\n")
Score.close()
Ref.close()
最终成果:
那个2333是一个空文本框,最后是为了遮挡一下上面的各类控件。
有啥疑问欢迎提问…………
加密方式很蠢…………这……确实不会。。。要是有混淆的方法也欢迎告知……
|
免费评分
-
查看全部评分
|