当前位置:   article > 正文

某站点滑块验证码打码以及验证流程_打码平台滑块验证码

打码平台滑块验证码

import base64
from Cryptodome.Cipher import AES


class AESECB:
    def __init__(self, key):
        self.key = key  # 加密密钥
        self.mode = AES.MODE_ECB  # 设置为ECB模式
        self.bs = 16  # block size
        self.PADDING = lambda s: s + (self.bs - len(s) % self.bs) * chr(self.bs - len(s) % self.bs)

    def encrypt(self, text):
        generator = AES.new(self.key, self.mode)  # ECB模式无需向量iv
        crypt = generator.encrypt(self.PADDING(text).encode('utf-8'))
        crypted_str = base64.b64encode(crypt).decode('utf-8')
        return crypted_str

    def decrypt(self, text):
        generator = AES.new(self.key, self.mode)  # ECB模式无需向量iv
        decrpyt_bytes = base64.b64decode(text)
        meg = generator.decrypt(decrpyt_bytes).decode('utf-8')
        return meg[:-ord(meg[-1])]


if __name__ == '__main__':
    aes = AESECB('NW9dsRKN7seEyWXv'.encode("utf-8"))
    print(aes.encrypt('{"x":152.675,"y":5}'))
    print(aes.decrypt('vfI2O7n3Wz1K7/MezgkwVVKcyMLSoZA6UOTbxjQzUM8='.encode("utf-8")))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/527678
推荐阅读
相关标签
  

闽ICP备14008679号