分享一款由python开发的全能多线程抢购神器,支持华为、京东、淘宝等商城-激活码生成脚本
上一篇为:分享一款由python开发的全能多线程抢购神器,支持华为、京东、淘宝等商城
import time from Crypto.Cipher import AES from binascii import b2a_hex, a2b_hex # 如果text不足16位的倍数就用空格补足为16位 def add_to_16(text): if len(text.encode('utf-8')) % 16: add = 16 - (len(text.encode('utf-8')) % 16) else: add = 0 text = text + ('\0' * add) return text.encode('utf-8') # 加密函数 def encrypt(text): key = 'ants' mode = AES.MODE_CBC iv = 'nfore202' text = add_to_16(text) cryptos = AES.new(add_to_16(key), mode, add_to_16(iv)) cipher_text = cryptos.encrypt(text) # 因为AES加密后的字符串不一定是ascii字符集的,输出保存可能存在问题,所以这里转为16进制字符串 return b2a_hex(cipher_text) # 解密后,去掉补足的空格用strip() 去掉 def decrypt(text): key = 'ants' iv = 'nfore202' mode = AES.MODE_CBC cryptos = AES.new(add_to_16(key), mode, add_to_16(iv)) plain_text = cryptos.decrypt(a2b_hex(text)) return bytes.decode(plain_text).rstrip('\0') if __name__ == '__main__': ret = int(time.time()*10000000+12345678900000000) print("明文:", ret) e = encrypt(str(ret)) # 加密 #print("加密:", e) e = str(e, encoding='utf-8') print("抢购软件激活码:", e) e = bytes(e.encode('utf-8')) #print("加密:", e) d = decrypt(e) # 解密 print("验证激活码:", d)