X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FModules%2Fdns.pl;h=333fd1d46e3e3192ee114cb303f6b1295235b45f;hb=2c5d80ce71ef3f11f56acc57ad19ca5ad6daf2f4;hp=73369ebaca31311d471fa5dd20b514d67f04bc95;hpb=8df0fa618dc55e5c565d45b3b76aa8858a845097;p=infobot.git diff --git a/src/Modules/dns.pl b/src/Modules/dns.pl index 73369eb..333fd1d 100644 --- a/src/Modules/dns.pl +++ b/src/Modules/dns.pl @@ -1,9 +1,9 @@ # -# dns.pl: host lookups -# Author: Tim Riker -# Source: extracted from UserExtra.pl +# dns.pl: host lookups +# Author: Tim Riker +# Source: extracted from UserExtra.pl # Licensing: Artistic License (as perl itself) -# Version: v0.1 +# Version: v0.1 # # Copyright (c) 2005 Tim Riker # @@ -13,42 +13,46 @@ package dns; use strict; sub dns::dns { - my $dns = shift; - my($match, $x, $y, $result, $pid); + my $dns = shift; + my ( $match, $x, $y, $result, $pid ); - if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) { - use Socket; + if ( $dns =~ /(\d+\.\d+\.\d+\.\d+)/ ) { + use Socket; - &main::status("DNS query by IP address: $dns"); + &::status("DNS query by IP address: $dns"); - $y = pack('C4', split(/\./, $dns)); - $x = (gethostbyaddr($y, &AF_INET)); + $y = pack( 'C4', split( /\./, $dns ) ); + $x = ( gethostbyaddr( $y, &AF_INET ) ); - if ($x !~ /^\s*$/) { - $result = "$dns is $x" unless ($x =~ /^\s*$/); - } else { - $result = "I can't find the address $dns in DNS"; - } + if ( $x !~ /^\s*$/ ) { + $result = "$dns is $x" unless ( $x =~ /^\s*$/ ); + } + else { + $result = "I can't find the address $dns in DNS"; + } - } else { + } + else { - &main::status("DNS query by name: $dns"); - $x = join('.',unpack('C4',(gethostbyname($dns))[4])); + &::status("DNS query by name: $dns"); + $x = join( '.', unpack( 'C4', ( gethostbyname($dns) )[4] ) ); - if ($x !~ /^\s*$/) { - $result = "$dns is $x"; - } else { - $result = "I can't find $dns in DNS"; - } - } + if ( $x !~ /^\s*$/ ) { + $result = "$dns is $x"; + } + else { + $result = "I can't find $dns in DNS"; + } + } - return($result); + return ($result); } sub dns::query { - &::performStrictReply(&dns(@_)); - return; + &::performStrictReply( &dns(@_) ); + return; } 1; -# vim: ts=2 sw=2 + +# vim:ts=4:sw=4:expandtab:tw=80