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.
21 lines
709 B
21 lines
709 B
import re
|
|
from tools.ToolBase import ToolBase
|
|
|
|
class WhoisTool(ToolBase):
|
|
def validate_instruction(self, instruction):
|
|
#过滤
|
|
timeout = 0
|
|
return instruction,timeout
|
|
|
|
def analyze_result(self, result,instruction,stderr,stdout):
|
|
# 定义正则表达式模式来匹配所需的行
|
|
pattern = r"(Registrant:.*?\n|Registrant Contact Email:.*?\n|Sponsoring Registrar:.*?\n)"
|
|
# 使用re.findall()方法查找所有匹配项
|
|
matches = re.findall(pattern, result)
|
|
newresult = ""
|
|
# 打印结果
|
|
for match in matches:
|
|
newresult += match.strip()
|
|
if not newresult:
|
|
return result
|
|
return newresult
|