securecurebt5 / collective-intelligence-framework

Automatically exported from code.google.com/p/collective-intelligence-framework
0 stars 0 forks source link

nfsen lookup module #76

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Feature Description:

create a hook in nfsen for cif lookup

Target Audience:

users

Purpose:

see desc. duh.

Original issue reported on code.google.com by saxjazm...@gmail.com on 30 Aug 2011 at 12:30

GoogleCodeExporter commented 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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

Original comment by saxjazm...@gmail.com on 8 Sep 2011 at 3:04

GoogleCodeExporter commented 9 years ago

Original comment by saxjazm...@gmail.com on 28 Dec 2011 at 2:03

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/collective-intelligence-framework/wiki/ProjectsLab

Original comment by saxjazm...@gmail.com on 6 Jan 2012 at 2:03

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/collective-intelligence-framework/wiki/ProjectsLab

Original comment by saxjazm...@gmail.com on 6 Jan 2012 at 2:03