Closed GoogleCodeExporter closed 9 years ago
{{{
#!/usr/bin/perl
#from puppet - do not edit
package Lookup_site;
use strict;
use warnings;
use IO::Socket::INET;
use Log;
sub Lookup {
my $socket = shift;
my $opts = shift;
if ( !exists $$opts{'lookup'} ) {
print $socket "<h3>Missing lookup parameter</h3>\n";
return;
}
my $lookup = $$opts{'lookup'};
my ($ip, $port);
if ( $lookup =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5})$/ ) {
$ip = $1;
$port = $2;
} elsif ( $lookup =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/ ) {
$ip = $1;
$port = 0;
} elsif ( $lookup =~ /^([0-9a-f]+[0-9a-f:]+)\.(\d{1,5})$/ ) {
$ip = $1;
} elsif ( $lookup =~ /^([0-9a-f]+[0-9a-f:]+)$/ ) {
$ip = $1;
$port = 0;
} elsif ( $lookup =~ /^([0-9a-f]+[0-9a-f:]+\.\.[0-9a-f:]+)\.(\d{1,5})$/ ) {
$ip = $1;
$port = $2;
} elsif ( $lookup =~ /^([0-9a-f]+[0-9a-f:]+\.\.[0-9a-f:]+)$/ ) {
$ip = $1;
$port = 0;
}
my $ipaddr = inet_aton($ip);
my $hostname = gethostbyaddr($ipaddr, AF_INET);
print $socket "<h3>$ip: $hostname</h3>\n";
open(WHOIS, "-|", "whois", $ip);
my $output = join("", <WHOIS>);
close WHOIS;
print $socket "<pre>${output}</pre>";
} # End of Lookup
1;
}}}
Original comment by saxjazm...@gmail.com
on 30 Aug 2011 at 12:30
drop the attached file in the
nfsen/libexex dir next to Lookup.pm
Original comment by saxjazm...@gmail.com
on 30 Aug 2011 at 12:31
Original comment by saxjazm...@gmail.com
on 8 Sep 2011 at 3:04
Original comment by saxjazm...@gmail.com
on 28 Dec 2011 at 2:03
http://code.google.com/p/collective-intelligence-framework/wiki/ProjectsLab
Original comment by saxjazm...@gmail.com
on 6 Jan 2012 at 2:03
http://code.google.com/p/collective-intelligence-framework/wiki/ProjectsLab
Original comment by saxjazm...@gmail.com
on 6 Jan 2012 at 2:03
Original issue reported on code.google.com by
saxjazm...@gmail.com
on 30 Aug 2011 at 12:30