dns resolver
unknown
plain_text
2 years ago
919 B
10
Indexable
Never
import dnspython as dns import dns.resolver def dns_cb(data, signal, signal_data): network = signal.split(",", maxsplit=1)[0] address = signal_data.split(maxsplit=1)[0].removeprefix(":") nick = address.split("!", maxsplit=1)[0] args = signal_data.split(' ')[0:3] host = args[0][1:].split('!')[1].split('@')[1] target = args[2][1:] msg = weechat.info_get_hashtable("irc_message_parse", {"message": signal_data}) buffer = weechat.info_get("irc_buffer", f"{network},{msg['channel']}") chan_buffer = weechat.buffer_get_string(buffer, 'name') result = dns.resolver.query('host', 'A') if active_buffer.lower() == chan_buffer.lower(): weechat.prnt("", f"User {host} resulted in: {result}") return weechat.WEECHAT_RC_OK weechat.register("dns_script", "rxtx", "0.0.1", "BSD-0", "dns resolver script", "", "") weechat.hook_command('dns', '', '', '', '', 'dns_cb', '')