README
1NAME
2 POE::Component::IRC::Plugin::QueryDNS - A POE::Component::IRC plugin for
3 IRC based DNS queries
4
5VERSION
6 version 1.04
7
8SYNOPSIS
9 use strict;
10 use warnings;
11 use POE qw(Component::IRC Component::IRC::Plugin::QueryDNS);
12
13 my $nickname = 'qdns' . $$;
14 my $ircname = 'QueryDNS Bot';
15 my $ircserver = $ENV{IRCSERVER} || 'irc.bleh.net';
16 my $port = 6667;
17 my $channel = '#IRC.pm';
18
19 my $irc = POE::Component::IRC->spawn(
20 nick => $nickname,
21 server => $ircserver,
22 port => $port,
23 ircname => $ircname,
24 debug => 0,
25 plugin_debug => 1,
26 options => { trace => 0 },
27 ) or die "Oh noooo! $!";
28
29 POE::Session->create(
30 package_states => [
31 'main' => [ qw(_start irc_001) ],
32 ],
33 );
34
35 $poe_kernel->run();
36 exit 0;
37
38 sub _start {
39 # Create and load our QueryDNS plugin
40 $irc->plugin_add( 'QueryDNS' =>
41 POE::Component::IRC::Plugin::QueryDNS->new() );
42
43 $irc->yield( register => 'all' );
44 $irc->yield( connect => { } );
45 undef;
46 }
47
48 sub irc_001 {
49 $irc->yield( join => $channel );
50 undef;
51 }
52
53DESCRIPTION
54 POE::Component::IRC::Plugin::QueryDNS is a POE::Component::IRC plugin
55 that provides DNS query facilities to the channels it occupies and via
56 private messaging.
57
58 It uses POE::Component::Client::DNS to do non-blocking DNS queries. By
59 default the plugin attempts to use POE::Component::IRC's internal
60 PoCo-Client-DNS resolver object, but will spawn its own copy. You can
61 supply your own resolver object via the constructor.
62
63CONSTRUCTOR
64 "new"
65 Creates a new plugin object. Takes some optional parameter:
66
67 'command', define the command that will trigger DNS queries, default is 'dns';
68 'privmsg', set to a true value to specify that the bot should reply with PRIVMSG instead of
69 NOTICE to privmsgs that it receives.
70 'resolver', specify a POE::Component::Client::DNS object that the plugin should use,
71 the default is to try and use POE::Component::IRC's resolver;
72
73IRC USAGE
74 The bot replies to requests in the following form, when addressed:
75
76 dns <query> <optional_type>
77
78 Of course, if you changed the "command" in the constructor it will be
79 something different to "dns".
80
81 "query" maybe a hostname, a zone, an IP address, anything that you want
82 to query DNS for.
83
84 "type" can be "A", "PTR", "CNAME", "NS", "MX", "TXT", "AAAA", "SRV" or
85 "SOA". If it isn't specified the default is "A" unless the "query" is an
86 IP address in which case the default is "PTR".
87
88 Some examples:
89
90 # No type, defaults to 'A'
91 < you> bot: dns www.perl.org
92 < bot> www.perl.org [ CNAME=x3.develooper.com. A=63.251.223.163 ]
93
94 # No type, defaults to 'PTR' because the query is an IP address
95 < you> bot: dns 63.251.223.163
96 < bot> 63.251.223.163 [ PTR=x3.develooper.com. ]
97
98 # Specify a type of 'MX'
99 < you> bot: dns perl.org mx
100 < bot> perl.org [ MX=5 mx.develooper.com. ]
101
102 # Specify a type of 'TXT'
103 < you> bot: dns perl.org txt
104 < bot> No answers for perl.org
105
106 # Specify a type of 'SOA'
107 < you> bot: dns perl.org soa
108 < bot> perl.org [ SOA=ns1.us.bitnames.com:dnsoper.bitnames.com:2008011304:5400:5400:604800:300 ]
109
110SEE ALSO
111 POE::Component::Client::DNS
112
113AUTHOR
114 Chris Williams <chris@bingosnet.co.uk>
115
116COPYRIGHT AND LICENSE
117 This software is copyright (c) 2011 by Chris Williams.
118
119 This is free software; you can redistribute it and/or modify it under
120 the same terms as the Perl 5 programming language system itself.
121
122