Changeset 1206

Show
Ignore:
Timestamp:
08/13/08 23:46:41 (4 months ago)
Author:
mbr
Message:

- Added module version output for each non-core perl module used by fwknop
and fwknopd in --debug mode. This is mostly useful for the test suite
to see which versions of the modules are being used.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fwknop/trunk/ChangeLog

    r1201 r1206  
    2424      path to be manipulated via the --Lib-dir command line argument and 
    2525      'require' statements instead of the old 'use module' strategy. 
     26    - Added module version output for each non-core perl module used by fwknop 
     27      and fwknopd in --debug mode.  This is mostly useful for the test suite 
     28      to see which versions of the modules are being used. 
    2629 
    2730fwknop-1.9.6 (07/18/2008): 
  • fwknop/trunk/fwknop

    r1202 r1206  
    2929# Copyright (C) 2004-2008 Michael Rash (mbr@cipherdyne.org) 
    3030# 
    31 # License - GNU Public License version 2
     31# License - GNU Public License version 2 (GPLv2)
    3232# 
    3333#    This program is distributed in the hope that it will be useful, 
     
    687687        require Digest::MD5; 
    688688        Digest::MD5->import(qw(md5_base64)); 
     689        if ($debug) { 
     690            print "[+] Digest::MD5 $Digest::MD5::VERSION\n"; 
     691        } 
    689692        $digest = md5_base64($msg); 
    690693        print "        MD5 digest:     $digest\n" unless $quiet; 
     
    695698        require Digest::SHA; 
    696699        Digest::SHA->import(qw(sha1_base64)); 
     700        if ($debug) { 
     701            print "[+] Digest::SHA1::VERSION $Digest::SHA1::VERSION\n"; 
     702        } 
    697703        $digest = sha1_base64($msg); 
    698704        print "        SHA1 digest:    $digest\n" unless $quiet; 
     
    703709        require Digest::SHA; 
    704710        Digest::SHA->import(qw(sha256_base64)); 
     711        if ($debug) { 
     712            print "[+] Digest::SHA256::VERSION $Digest::SHA256::VERSION\n"; 
     713        } 
    705714        $digest = sha256_base64($msg); 
    706715        print "        SHA256 digest:  $digest\n" unless $quiet; 
     
    821830 
    822831    require Crypt::CBC; 
     832 
     833    if ($debug) { 
     834        print "[+] Crypt::CBC::VERSION $Crypt::CBC::VERSION\n"; 
     835    } 
    823836 
    824837    my $cipher = Crypt::CBC->new({ 
     
    900913        ### use Net::RawIP to spoof the packets 
    901914        require Net::RawIP; 
     915 
     916        if ($debug) { 
     917            print "[+] Net::RawIP::VERSION $Net::RawIP::VERSION\n"; 
     918        } 
    902919 
    903920        if ($spoof_proto eq 'udp') { 
     
    10361053            require Net::Ping::External; 
    10371054            Net::Ping::External->import(qw/ping/); 
     1055 
     1056            if ($debug) { 
     1057                print "[+] Net::Ping::External::VERSION ", 
     1058                    "$Net::Ping::External::VERSION\n"; 
     1059            } 
     1060 
    10381061            print "    icmp echo request -> $knock_dst\n"; 
    10391062            ping(hostname => "$knock_dst", count => 1, timeout => 1); 
     
    10701093    require Crypt::CBC; 
    10711094 
     1095    if ($debug) { 
     1096        print "[+] Crypt::CBC::VERSION $Crypt::CBC::VERSION\n"; 
     1097    } 
     1098 
    10721099    my $cipher = Crypt::CBC->new({ 
    10731100        'key'    => $enc_key, 
     
    12621289        ### load the GnuPG::Interface module 
    12631290        require GnuPG::Interface; 
     1291 
     1292        if ($debug) { 
     1293            print "[+] GnuPG::Interface::VERSION ", 
     1294                "$GnuPG::Interface::VERSION\n"; 
     1295        } 
    12641296 
    12651297        ### we don't need a password if we are going to acquire 
     
    13581390 
    13591391    if ($debug) { 
    1360         print STDERR "[+] import_perl_modules(): The \@INC array:\n"; 
    1361         print STDERR "$_\n" for @INC; 
    1362     } 
     1392        print "[+] import_perl_modules(): The \@INC array:\n"; 
     1393        print "$_\n" for @INC; 
     1394    } 
     1395 
     1396    require Term::ReadKey; 
     1397    Term::ReadKey->import(qw/ReadMode ReadLine/); 
    13631398 
    13641399    require Net::IPv4Addr; 
    1365     require Term::ReadKey; 
    1366  
    1367     Term::ReadKey->import(qw/ReadMode ReadLine/); 
    13681400    Net::IPv4Addr->import(qw/ipv4_in_network/); 
     1401 
     1402    if ($debug) { 
     1403        print "[+] Term::ReadKey::VERSION $Term::ReadKey::VERSION\n", 
     1404            "    Net::IPv4Addr::VERSION $Net::IPv4Addr::VERSION\n"; 
     1405    } 
    13691406 
    13701407    return; 
  • fwknop/trunk/fwknopd

    r1202 r1206  
    2929# Copyright (C) 2004-2008 Michael Rash (mbr@cipherdyne.org) 
    3030# 
    31 # License - GNU Public License version 2
     31# License - GNU Public License version 2 (GPLv2)
    3232# 
    3333#    This program is distributed in the hope that it will be useful, 
     
    6868my $blacklist_ar = []; 
    6969my $blacklist_exclude_ar = []; 
    70 my %p0f_sigs = (); 
     70my %p0f_sigs = (); 
    7171my %pid_files = (); 
    72 my %ip_sequences = (); 
     72my %ip_sequences = (); 
    7373my %digest_store = (); 
    74 my %ipt_input   = (); 
    75 my %ipt_forward = (); 
    76 my %ipt_prerouting = (); 
     74my %ipt_input    = (); 
     75my %ipt_forward = (); 
     76my %ipt_prerouting = (); 
    7777my %ipt_postrouting = (); 
    78 my %ipt_output = ();  ### optional 
    79 my @ipt_config = (); 
     78my %ipt_output = ();  ### optional 
     79my @ipt_config = (); 
    8080 
    8181my $os_fprint_only = 0; 
     
    291291 
    292292    require Net::Pcap; 
     293 
     294    if ($debug ) { 
     295        print STDERR "[+] Net::Pcap::VERSION $Net::Pcap::VERSION\n"; 
     296    } 
    293297 
    294298    &pcap_loop(); 
     
    33603364                    $access_hsh{'DATA_COLLECT_MODE'} = $ENCRYPT_SEQUENCE; 
    33613365                } elsif ($line =~ /^\s*KEY:\s*(.*)\s*;/) { 
    3362                     require Crypt::CBC unless $imported_crypt_cbc; 
     3366                    unless ($imported_crypt_cbc) { 
     3367                        require Crypt::CBC; 
     3368                        print STDERR "[+] Crypt::CBC::VERSION $Crypt::CBC::VERSION\n" 
     3369                            if $debug; 
     3370                    } 
    33633371                    $imported_crypt_cbc = 1; 
    33643372                    $access_hsh{'KEY'} = $1; 
     
    33683376                    } 
    33693377                } elsif ($line =~ /^\s*GPG_REMOTE_ID:\s*(.*)\s*;/) { 
    3370                     require GnuPG::Interface unless $imported_gpg; 
     3378                    unless ($imported_gpg) { 
     3379                        require GnuPG::Interface; 
     3380                        print STDERR "[+] GnuPG::Interface::VERSION ", 
     3381                            "$GnuPG::Interface::VERSION\n" if $debug; 
     3382                    } 
    33713383                    $imported_gpg = 1; 
    33723384                    my @arr = split /\s*\,\s*/, $1; 
     
    33753387                    } 
    33763388                } elsif ($line =~ /^\s*GPG_DECRYPT_ID:\s*(.*)\s*;/) { 
    3377                     require GnuPG::Interface unless $imported_gpg; 
     3389                    unless ($imported_gpg) { 
     3390                        require GnuPG::Interface; 
     3391                        print STDERR "[+] GnuPG::Interface::VERSION ", 
     3392                            "$GnuPG::Interface::VERSION\n" if $debug; 
     3393                    } 
    33783394                    $imported_gpg = 1; 
    33793395                    $access_hsh{'GPG_DECRYPT_ID'} = $1; 
    33803396                } elsif ($line =~ /^\s*GPG_DECRYPT_PW:\s*(.*)\s*;/) { 
    3381                     require GnuPG::Interface unless $imported_gpg; 
     3397                    unless ($imported_gpg) { 
     3398                        require GnuPG::Interface; 
     3399                        print STDERR "[+] GnuPG::Interface::VERSION ", 
     3400                            "$GnuPG::Interface::VERSION\n" if $debug; 
     3401                    } 
    33823402                    $imported_gpg = 1; 
    33833403                    $access_hsh{'GPG_DECRYPT_PW'} = $1; 
    33843404                } elsif ($line =~ /^\s*GPG_HOME_DIR:\s*(\S+)\s*;/) { 
    3385                     require GnuPG::Interface unless $imported_gpg; 
     3405                    unless ($imported_gpg) { 
     3406                        require GnuPG::Interface; 
     3407                        print STDERR "[+] GnuPG::Interface::VERSION ", 
     3408                            "$GnuPG::Interface::VERSION\n" if $debug; 
     3409                    } 
    33863410                    $imported_gpg = 1; 
    33873411                    $access_hsh{'GPG_HOME_DIR'} = $1; 
     
    42474271 
    42484272    ### Install signal handlers for debugging and for reaping zombie 
    4249     ### whois processes. 
     4273    ### processes. 
    42504274    $SIG{'__WARN__'} = \&warn_handler; 
    42514275    $SIG{'__DIE__'}  = \&die_handler; 
     
    46584682        require IPTables::Parse; 
    46594683        require IPTables::ChainMgr; 
     4684 
     4685        if ($debug) { 
     4686            print STDERR "[+] IPTables::Parse::VERSION ", 
     4687                "$IPTables::Parse::VERSION\n", 
     4688                "    IPTables::ChainMgr::VERSION ", 
     4689                "$IPTables::ChainMgr::VERSION\n"; 
     4690        } 
    46604691 
    46614692        $imported_iptables_modules = 1; 
     
    47594790    } 
    47604791 
    4761     require Unix::Syslog unless $config{'ALERTING_METHODS'} =~ /no.?syslog/i; 
    4762  
    4763     Unix::Syslog->import(qw(:subs :macros)) 
    4764         unless $config{'ALERTING_METHODS'} =~ /no.?syslog/i; 
     4792    unless ($config{'ALERTING_METHODS'} =~ /no.?syslog/i) { 
     4793        require Unix::Syslog; 
     4794        Unix::Syslog->import(qw(:subs :macros)); 
     4795 
     4796        if ($debug) { 
     4797            print STDERR "[+] Unix::Syslog::VERSION $Unix::Syslog::VERSION\n"; 
     4798        } 
     4799    } 
    47654800 
    47664801    require Net::IPv4Addr; 
    47674802    Net::IPv4Addr->import(qw/ipv4_in_network/); 
     4803 
     4804    if ($debug) { 
     4805        print STDERR "[+] Net::IPv4Addr::VERSION $Net::IPv4Addr::VERSION\n"; 
     4806    } 
    47684807 
    47694808    return; 
     
    49454984    ### MD5 sum 
    49464985    require Digest::MD5; 
     4986    Digest::MD5->import(qw(md5_base64)); 
     4987 
    49474988    require Digest::SHA; 
    4948     Digest::MD5->import(qw(md5_base64)); 
    49494989    Digest::SHA->import(qw(sha1_base64 sha256_base64)); 
     4990 
     4991    if ($debug) { 
     4992        print STDERR "[+] Digest::MD5::VERSION $Digest::MD5::VERSION\n", 
     4993            "    Digest::SHA::VERSION $Digest::SHA::VERSION\n"; 
     4994    } 
    49504995 
    49514996    return;