1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
package Bot::BasicBot::Pluggable::Module::DNS;
$Bot::BasicBot::Pluggable::Module::DNS::VERSION = '1.30';
use base qw(Bot::BasicBot::Pluggable::Module);
use warnings;
use strict;
use Socket;
sub help {
return
"DNS lookups for hosts or IPs. Usage: 'dns <ip address>' for the hostname, 'nslookup <hostname>' 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;
__END__
=head1 NAME
Bot::BasicBot::Pluggable::Module::DNS - DNS lookups for hostnames or IP addresses
=head1 VERSION
version 1.30
=head1 IRC USAGE
=over 4
=item dns <ip address>
Returns the hostname of that IP address
=item nslookup <hostname>
Returns the IP address of the hostname.
=back
=head1 AUTHOR
Mario Domgoergen <mdom@cpan.org>
This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
|