commit
8a5d7d5f53
3 changed files with 46 additions and 6 deletions
32
worker/ip.py
Normal file
32
worker/ip.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
from zzcore import StdAns
|
||||
import requests
|
||||
|
||||
class Ans(StdAns):
|
||||
def GETMSG(self):
|
||||
try:
|
||||
ip = self.parms[0]
|
||||
except:
|
||||
ip = ''
|
||||
url = 'https://api.ip.sb/geoip/'
|
||||
if ip == '' or ip == 'help':
|
||||
ret = '您可以使用 "/ip ip地址" 进行查找'
|
||||
else:
|
||||
res = requests.get(url + ip)
|
||||
rsc = res.status_code
|
||||
rem = res.json()
|
||||
if rsc == 400:
|
||||
ret = '不是正确的ip地址,您可以使用 "/ip ip地址" 进行查找'
|
||||
else:
|
||||
rlt = []
|
||||
try:
|
||||
rlt.append('IP: ' + ip)
|
||||
rlt.append('国家/地区: ' + rem['country'])
|
||||
rlt.append('ISP: ' + rem['isp'])
|
||||
rlt.append('ASN: ' + str(rem['asn']))
|
||||
rlt.append('ASN组织: ' + rem['asn_organization'])
|
||||
rlt[1] += ', ' + rem['region']
|
||||
rlt[1] += ', ' + rem['city']
|
||||
except:
|
||||
pass
|
||||
ret = '\n'.join(rlt)
|
||||
return ret
|
9
worker/ns.py
Normal file
9
worker/ns.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from zzcore import StdAns
|
||||
from subprocess import Popen
|
||||
|
||||
class Ans(StdAns):
|
||||
def GETMSG(self):
|
||||
domain = self.raw_msg['message'][4:]
|
||||
p = Popen(["nslookup ",domain])
|
||||
msg = p.read()
|
||||
return msg
|
|
@ -12,8 +12,7 @@ class Ans(StdAns):
|
|||
cmd = ''
|
||||
if cmd == '帮助':
|
||||
msg = '您可以使用以下参数:\n 动画,漫画,游戏,文学,原创,来自网络,其他,影视,诗词,网易云,哲学,抖机灵'
|
||||
else:
|
||||
if cmd == '':
|
||||
elif cmd == '':
|
||||
msg = requests.get(url).text
|
||||
elif cmd in cmdlst:
|
||||
msg = requests.get(url+cmdlst[cmd]).text
|
||||
|
|
Loading…
Reference in a new issue