XZZ/worker/ns.py

15 lines
453 B
Python
Raw Normal View History

2020-03-02 21:15:18 +08:00
from zzcore import StdAns
2020-03-07 17:11:08 +08:00
from subprocess import check_output
2020-03-02 21:15:18 +08:00
class Ans(StdAns):
def GETMSG(self):
2020-03-07 17:11:08 +08:00
if len(self.parms) < 2:
return '不加参数是坏文明!'
2021-01-27 11:33:32 +08:00
domain = self.raw_msg['raw_message'][4:]
2020-03-07 17:11:08 +08:00
try:
answer = check_output(['nslookup',domain],shell=False,timeout=4)
msg = bytes.decode(answer)
except:
msg = '汝干了什么! ns 超时了!'
return msg