PC端google OTP验证码获取器

感觉在安全的路上走远了qwq,把安全的东西用得不怎么安全了。

PC端google OTP验证码获取器

 

import PySimpleGUI as sg
import hmac
import base64
import struct
import hashlib
import time
import sys
import requests


def get_hotp_token(secret, intervals_no):
    key = base64.b32decode(secret)
    msg = struct.pack(">Q", intervals_no)
    h = hmac.new(key, msg, hashlib.sha1).digest()
    o = h[len(h)-1] & 0x0f
    h = (struct.unpack(">I", h[o:o + 4])[0] & 0x7fffffff) % 1000000
    return h

def get_totp_token(secret):
    intervals_no = int(time.time()) // 30
    totp_token = get_hotp_token(secret, intervals_no)
    return totp_token

if __name__ == '__main__':
    
    Sec1 = 'xxx' #自己更换需要的key
    Sec2 = 'xxx'
    Sec3 = 'xxx'
    Sec1 = Sec1.replace(' ', '').upper()
    Sec2 = Sec2.replace(' ', '').upper()
    Sec3 = Sec3.replace(' ', '').upper()
    #if len(Sec1) % 8 != 0 and len(Sec2) % 8 != 0 and len(Sec3) % 8 != 0:
        #print('Illegal base32 data at input byte %d' % ((len(Sec)//8+1)*8))
        #exit(1)
        
    sg.SetOptions(text_justification='center')
    layout = [
         # key 值代表了是这个输入框输入的值,以字典的 键 值来表示,这个用于找到输入框并跟新它的值
        [sg.Text('xxxx', size=(15, 1)), sg.Input(key='HIDSCODE')],#自己设置显示
        [sg.Text('xxx4A', size=(15, 1)), sg.Input(key='HK4ACODE')],
        [sg.Text('xxx4A', size=(15, 1)), sg.Input(key='SS4ACODE')],
        [sg.Button('GET')]
    ]
	# 创建窗口及设置标题
    window = sg.Window('简易谷歌验证码获取器', layout)
    # 循环按钮元素的值
    while True:
        event, values = window.read()
            #if read == True:
        if event == 'GET':
            validation_code1 = get_totp_token(Sec1)
            validation_code2 = get_totp_token(Sec2)
            validation_code3 = get_totp_token(Sec3)
            hidscode = '%06d  [!]%02d后秒过期' % (validation_code1, 30 - int(time.time()) % 30)
            baoleijicode = '%06d  [!]%02d后秒过期' % (validation_code2, 30 - int(time.time()) % 30)
            baoleijicode2 = '%06d  [!]%02d后秒过期' % (validation_code3, 30 - int(time.time()) % 30)
            new_hidscode = window['HIDSCODE'].update(hidscode)
            new_4acode = window['HK4ACODE'].update(baoleijicode)
            new_4acode2 = window['SS4ACODE'].update(baoleijicode2)
        if event in (None, 'Exit'):
            break
    # 显示窗口
    window.read()

    window.close()

  

 

上一篇:有关浏览器(上)


下一篇:js移动端和PC端(鼠标)按下移动和释放事件