资源简介
用Python爬取新版正方教务系统课程表,涉及到rsa的加密密码。代码几乎封装了,改一下网站地址就可以使用了

代码片段和文件信息
class HB64(object):
b64byte = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/“
b64cpt = “=“
def hex2b64(self string):
result = ““
ptr = 0
b1 = int(“111111000000000000000000“ 2)
b2 = int(“000000111111000000000000“ 2)
b3 = int(“000000000000111111000000“ 2)
b4 = int(“000000000000000000111111“ 2)
lenth = len(string)
while ptr+6 <= lenth:
temp = int(string[ptr:ptr+6] 16)
result += self.b64byte[(temp & b1) >> 18]
result += self.b64byte[(temp & b2) >> 12]
result += self.b64byte[(temp & b3) >> 6]
result += self.b64byte[temp & b4]
ptr += 6
if lenth-ptr == 4:
temp = int(string[ptr:ptr+4] 16) << 2
result += self.b64byte[(temp & b2) >> 12]
result += self.b64byte[(temp & b3) >> 6]
result += self.b64byte[temp & b4]
result += self.b64cpt
elif lenth-ptr == 2:
temp = int(string[ptr:ptr+2] 16) << 4
result += self.b64byte[(temp & b3) >> 6]
result += self.b64byte[temp & b4]
result += self.b64cpt * 2
elif lenth-ptr == 0:
pass
else:
raise Exception
return result
def b642hex(self string):
result = ““
ptr = 0
lenth = len(string)
b1 = int(“111111110000000000000000“ 2)
b2 = int(“000000001111111100000000“ 2)
b3 = int(“000000000000000011111111“ 2)
while ptr+8 <= lenth:
temp = string[ptr:ptr+4]
temp_result = 0
for cell in range(4):
temp_result += self.b64byte.index(temp[cell]) << (6 * (3 - cell))
r1 = hex((temp_result & b1) >> 16)[2:]
r2 = hex((temp_result & b2) >> 8)[2:]
r3 = hex(temp_result & b3)[2:]
if len(r1) == 1:
r1 = ‘0‘ + r1
if len(r2) == 1:
r2 = ‘0‘ + r2
if len(r3) == 1:
r3 = ‘0‘ + r3
result += r1
result += r2
result += r3
ptr += 4
if string[-1]==“=“ and string[-2]==“=“:
temp = string[ptr:ptr+2]
temp_result = 0
temp_result += self.b64byte.index(temp[0]) << 18
temp_result += self.b64byte.index(temp[1] >> 4) << 12
r1 = hex((temp_result & b1) >> 16)[2:]
r2 = hex((temp_result & b2) >> 8)[2:]
if len(r1) == 1:
r1 = ‘0‘ + r1
if len(r2) == 1:
r2 = ‘0‘ + r2
result += r1
result += r2
elif string[-1]==“=“:
temp = string[ptr:ptr+3]
temp_result = 0
for cell in range(2):
temp_result += self.b64byte.index(temp[cell]) << (6 * (3 - cell))
temp_result += self.b64byte
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4095 2019-03-09 18:01 hex2b64.py
文件 3641 2019-03-10 21:46 login.py
文件 2942 2019-01-05 12:19 RSAJS.py
----------- --------- ---------- ----- ----
10678 3
相关资源
- RSA数字签名59991
- Python 3 Web Development. Beginners Guide
- RSA_python
- miller_rabin检测生成大素数的RSA算法实
- 编译原理词法分析器、语法分析器p
- Data Science from Scratch First Principles wit
- Data Science from Scratch First Principles wit
- subversion-1.4.6-apache-python.tar
- Python空间分析教程
- Django for beginners 2.1
- Hands On Machine Learning with Python: Concept
- GENERATIVE_ADVERSARIAL_NETWORKS_COOKBOOK
- Practical Quantum Computing for Developers
- A Practical Guide to Linux Commands Editors an
- Python编程:从入门到实践-PythonCrashC
- Python-WenshuSpiderScrapy框架爬取中国裁判
- Python Crash Course 2nd Edition (True PDF)
- Python Crash Course 原版PDF by Matthes
- Kalman and Bayesian Filters in Python
- python Programming.An.Introduction.to.Computer
- python的curses库, win平台的各种whl包
- Cython: A Guide For Python Programmers
- Machine.Learning.An.Algorithmic.Perspective.2n
- IEDriverServer_64位操作系统,支持selen
- python3实现RSA(非调用RSA库
- Packt.Python.Artificial.Intelligence.Projects.
- RSA+DES图形界面含实验报告
- Hands-On Reinforcement Learning - Sudharsan Ra
- Django for Beginners: Learn web development wi
- Python-Tensorflow实现SpatialAsDeepSpatialCNN
评论
共有 条评论