=head1 NAME Bot::BasicBot::Pluggable::Module::DNS - DNS lookups for hostnames or IP addresses =head1 IRC USAGE =over 4 =item dns Returns the hostname of that IP address =item nslookup Returns the IP address of the hostname. =back =head1 AUTHOR Mario Domgoergen This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut package Bot::BasicBot::Pluggable::Module::DNS; use base qw(Bot::BasicBot::Pluggable::Module); use warnings; use strict; use Socket; sub help { return "DNS lookups for hosts or IPs. Usage: 'dns ' for the hostname, 'nslookup ' for the IP address."; } sub told { my ($self, $mess) = @_; my $body = $mess->{body}; my ($command, $param) = split(/\s+/, $body, 2); $command = lc($command); if ($command eq "dns") { my $addr = inet_aton($param); my @addr = gethostbyaddr($addr, AF_INET); return "$param is $addr[0]."; } elsif ($command eq "nslookup") { my @addr = gethostbyname($param); my $straddr = inet_ntoa($addr[4]); return "$param is $straddr."; } } 1;