You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1009 B
30 lines
1009 B
import os
|
|
import shlex
|
|
from tools.ToolBase import ToolBase
|
|
|
|
class SmtpuserenumTool(ToolBase):
|
|
def validate_instruction(self, instruction):
|
|
timeout = 0
|
|
# 分割指令为参数列表
|
|
cmd_parts = shlex.split(instruction)
|
|
new_cmd = []
|
|
# 获取当前程序所在目录
|
|
current_path = os.path.dirname(os.path.realpath(__file__))
|
|
new_user_path = os.path.join(current_path, "../payload", "users")
|
|
|
|
i = 0
|
|
while i < len(cmd_parts):
|
|
part = cmd_parts[i]
|
|
new_cmd.append(part)
|
|
# 检测到-P参数
|
|
if part == "-U" and i + 1 < len(cmd_parts): # 用户名
|
|
# 替换下一参数为指定路径
|
|
new_cmd.append(new_user_path)
|
|
i += 1 # 跳过原路径参数
|
|
i += 1
|
|
|
|
return " ".join(shlex.quote(p) for p in new_cmd),timeout
|
|
|
|
def analyze_result(self, result,instruction,stderr,stdout):
|
|
#指令结果分析
|
|
return result
|