import os import shlex import re from tools.ToolBase import ToolBase class SmtpuserenumTool(ToolBase): def validate_instruction(self, instruction): timeout = 0 # 获取当前程序所在目录 current_path = os.path.dirname(os.path.realpath(__file__)) new_user_path = os.path.join(current_path, "../payload", "users") match = re.search(r'-U\s+(\S+)', instruction) if match: file_path = match.group(1) # 检查该文件是否存在 if not os.path.isfile(file_path): # 替换原文件路径为新的路径 instruction = instruction.replace(file_path, new_user_path) return instruction,timeout def analyze_result(self, result,instruction,stderr,stdout): #指令结果分析 return result