更新 main.py 中的 sudo 密码输入逻辑,增加尝试次数计数并调整错误提示逻辑

This commit is contained in:
2025-04-07 08:48:45 +08:00
Unverified
parent 93a328bd6a
commit 811d6c5bfa

View File

@@ -79,7 +79,9 @@ def pseudo_zsh():
if args[0] == 'sudo':
flight1 = True
a = 1
for attempt in range(3): # 循环 3 次
a += 1
fake_password = getpass.getpass("Password: ")
if fake_password == "1234":
print("20250910553 is not in the sudoers file.\nThis incident has been reported to the administrator.")
@@ -90,7 +92,8 @@ def pseudo_zsh():
f.write(f"[{current_time}] {fake_password}\n") # 写入时间和密码
delay = random.uniform(0.5, 2.0) # 随机延时 0.5 到 2 秒
time.sleep(delay) # 模拟延迟
print("Sorry, try again.")
if a != 3:
print("Sorry, try again.")
if flight1:
print("sudo: 3 incorrect password attempts") # 提示错误次数
continue