Google 2FA 脚本

批量显示Google 2FA 工具,5秒刷新一次

secrets.csv

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
username,secret
iAvloyola,ENOG7VLRJJ7GDNZJ
LilBlue561,IWPTHMCHSR74EOSH
KwaciWorsnop,TUXN5TNLTKOPTJEY
vikeshchotai,L333DPD5JHXF3O2K
peraltasocimo,UH4EDK7425BFCXSH
makzuzu,OUIG375O7OARDXLJ
JsaFikitha,AIWBIBQGXZK3ZDE3
limliangtung,HHD2VM5LHCV6TDOV
sinhde18,L6LYS4ECQL5KKPFF
ActionDT,O64IEGT5NPCOHCQ
timansur,3ASN5ZIGJH4ICYUX
Darmyrez,BTKNH5OMOMPZ7CFY
aninditamario,G2VHH4IHFE367PNW
izzanfurkan,EYP7VV6AK6EIDIJB

批量显示验证码脚本

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import csv
import datetime

import pyotp
import time
import os
import base64

# 定义读取CSV文件的函数
def read_secrets_from_csv(csv_file_path):
secrets = []
with open(csv_file_path, mode='r') as file:
reader = csv.DictReader(file)
for row in reader:
secrets.append(row)
return secrets

# 定义验证Base32密钥的函数
def is_valid_base32(secret):
try:
# 尝试解码,如果失败则说明不是有效的Base32
base64.b32decode(secret, casefold=True)
return True
except (base64.binascii.Error, ValueError):
return False

# 定义生成2FA验证码的函数
def generate_2fa_codes(secrets):
codes = []
for secret in secrets:
if is_valid_base32(secret['secret']):
totp = pyotp.TOTP(secret['secret'])
code = totp.now()
codes.append({'username': secret['username'], 'code': code})
else:
codes.append({'username': secret['username'], 'code': '无效的Base32密钥'})
return codes

# 主函数
def main():
csv_file_path = '2fa/secrets.csv' # 请根据实际情况修改CSV文件路径
secrets = read_secrets_from_csv(csv_file_path)

while True:
os.system('cls' if os.name == 'nt' else 'clear') # 清屏
codes = generate_2fa_codes(secrets)

print(f"时间:{datetime.datetime.now()}")
for entry in codes:
print(f"用户 {entry['username']} 的当前2FA验证码是: {entry['code']}")

time.sleep(5) # 每30秒刷新一次

if __name__ == "__main__":
main()

Author

Gavin

Posted on

2024-11-03

Updated on

2024-11-03

Licensed under

Comments