标签:16进制 验证 end sha code raw 程序 复制 权限
"shared_secret":"#############################"
1 import hmac 2 import hashlib 3 from base64 import b64decode 4 from time import time,sleep 5 import struct 6 from tkinter import * 7 8 ########################################### 9 # # 10 # # 11 # Python本地计算steam手机令牌码 # 12 # # 13 # by:冷溪凌寒 # 14 ########################################### 15 16 def get_steam_auth_code(secret: str, t: int = None) -> str: 17 if not t: 18 t = int(time()/30) 19 msg = struct.pack(">Q", t) 20 key = b64decode(secret) 21 mac = hmac.new(key, msg, hashlib.sha1).digest() 22 offset = mac[-1] & 0x0f 23 binary = struct.unpack(‘>L‘, mac[offset:offset+4])[0] & 0x7fffffff 24 codestr = list(‘23456789BCDFGHJKMNPQRTVWXY‘) 25 chars = [] 26 for _ in range(5): 27 chars.append(codestr[binary % 26]) 28 binary //= 26 29 code = ‘‘.join(chars) 30 return code 31 32 #print(get_steam_auth_code(‘‘,)) 33 grad=get_steam_auth_code(‘‘,)#在此填入steam密钥 34 r = Tk() 35 r.withdraw() 36 r.clipboard_clear() 37 r.clipboard_append(grad) 38 r.update() 39 sleep(.2)# 一直在占用,需要销毁,添加个0.2秒延迟自动销毁 40 r.update() 41 r.destroy()
运行程序后,自动复制到剪切板,之后只需ctrl+v即可
标签:16进制 验证 end sha code raw 程序 复制 权限
原文地址:https://www.cnblogs.com/OoGKoO/p/14824595.html