21 lines
613 B
Python
21 lines
613 B
Python
from maubot import Plugin, MessageEvent
|
|
from maubot.handlers import command
|
|
from whois import NICClient
|
|
|
|
|
|
class NetTools(Plugin):
|
|
@command.new("bgptools")
|
|
@command.argument("ip", required=True)
|
|
async def bgptools_command(self, evt: MessageEvent, ip: str):
|
|
"""
|
|
Queries bgp.tools for information about the given IP address.
|
|
|
|
Usage: !nettools <ip>
|
|
"""
|
|
client = NICClient()
|
|
result = client.whois(ip, hostname="bgp.tools", flags=0)
|
|
if result:
|
|
await evt.reply(f'```\n{result}\n```')
|
|
else:
|
|
await evt.reply("no results")
|