ns up up up
This commit is contained in:
parent
2ddf7dd938
commit
eb04818153
1 changed files with 10 additions and 4 deletions
14
worker/ns.py
14
worker/ns.py
|
@ -1,9 +1,15 @@
|
||||||
from zzcore import StdAns
|
from zzcore import StdAns
|
||||||
from subprocess import run
|
from subprocess import check_output
|
||||||
|
|
||||||
class Ans(StdAns):
|
class Ans(StdAns):
|
||||||
def GETMSG(self):
|
def GETMSG(self):
|
||||||
|
if len(self.parms) < 2:
|
||||||
|
return '不加参数是坏文明!'
|
||||||
|
|
||||||
domain = self.raw_msg['message'][4:]
|
domain = self.raw_msg['message'][4:]
|
||||||
r = run(["nslookup",domain],capture_output=True)
|
try:
|
||||||
msg = bytes.decode(r.stdout)
|
answer = check_output(['nslookup',domain],shell=False,timeout=4)
|
||||||
return msg
|
msg = bytes.decode(answer)
|
||||||
|
except:
|
||||||
|
msg = '汝干了什么! ns 超时了!'
|
||||||
|
return msg
|
Loading…
Reference in a new issue