XZZ/worker/ns.py
2021-01-27 11:33:32 +08:00

15 lines
No EOL
453 B
Python

from zzcore import StdAns
from subprocess import check_output
class Ans(StdAns):
def GETMSG(self):
if len(self.parms) < 2:
return '不加参数是坏文明!'
domain = self.raw_msg['raw_message'][4:]
try:
answer = check_output(['nslookup',domain],shell=False,timeout=4)
msg = bytes.decode(answer)
except:
msg = '汝干了什么! ns 超时了!'
return msg