Changeset 1661

Show
Ignore:
Timestamp:
11/13/06 23:47:34 (2 years ago)
Author:
mbr
Message:

started on integrating IP protocol reporting, bugfix for signature matching on IP direction, bugfix to correctly build HOME_NET string

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • psad/branches/sigdevel/psad

    r1660 r1661  
    11861186                {$pkt{'chain'}}{$pkt{'log_prefix'}}++; 
    11871187 
    1188         unless ($pkt{'proto'} eq 'icmp') { 
     1188        if ($pkt{'proto'} eq 'tcp' or $pkt{'proto'} eq 'udp') { 
    11891189            ### initialize the start and end port for the scanned port range 
    11901190            if (not defined $curr_scan{$pkt{'src'}}{$pkt{'dst'}}{$pkt{'proto'}}{'strtp'}) { 
     
    16921692                $dl = $dl_tmp if $dl_tmp > $dl; 
    16931693 
    1694                 $scan{$pkt_hr->{'src'}}{$pkt_hr->{'dst'}}{'tcp'}{'curr_sig'} 
    1695                     {$pkt_hr->{'sid'}}{$pkt_hr->{'chain'}}{'dp'} 
     1694                $scan{$pkt_hr->{'src'}}{$pkt_hr->{'dst'}}{'tcp'} 
     1695                    {'curr_sig'}{$sid}{$pkt_hr->{'chain'}}{'dp'} 
    16961696                    {$pkt_hr->{'dp'}}++; 
    16971697 
    1698                 $scan{$pkt_hr->{'src'}}{$pkt_hr->{'dst'}}{'tcp'}{'curr_sig'} 
    1699                     {$pkt_hr->{'sid'}}{$pkt_hr->{'chain'}}{'flags'} 
     1698                $scan{$pkt_hr->{'src'}}{$pkt_hr->{'dst'}}{'tcp'} 
     1699                    {'curr_sig'}{$sid}{$pkt_hr->{'chain'}}{'flags'} 
    17001700                    {$pkt_hr->{'dp'}} = $pkt_hr->{'flags'}; 
    17011701 
     
    17071707                $dl = $dl_tmp if $dl_tmp > $dl; 
    17081708 
    1709                 $scan{$pkt_hr->{'src'}}{$pkt_hr->{'dst'}}{'udp'}{'curr_sig'} 
    1710                     {$pkt_hr->{'sid'}}{$pkt_hr->{'chain'}}{'dp'} 
     1709                $scan{$pkt_hr->{'src'}}{$pkt_hr->{'dst'}}{'udp'} 
     1710                    {'curr_sig'}{$sid}{$pkt_hr->{'chain'}}{'dp'} 
    17111711                    {$pkt_hr->{'dp'}}++; 
    17121712            } 
     
    18451845                "$sig_hr->{'sid'} (psad_id: $sig_hr->{'psad_id'})\n"; 
    18461846        } 
     1847 
     1848        $scan{$pkt_hr->{'src'}}{$pkt_hr->{'dst'}}{'ip'}{'curr_sig'} 
     1849            {$sig_hr->{'sid'}}{$pkt_hr->{'chain'}}{'pkts'}++; 
     1850 
    18471851        return $sig_hr->{'dl'} 
    18481852    } 
     
    18741878 
    18751879    if ($sig_ip =~ m|$ip_re/\d+|) { 
    1876         return 1 if ipv4_in_network($pkt_ip, $sig_ip); 
     1880        return 1 if ipv4_in_network($sig_ip, $pkt_ip); 
    18771881    } elsif ($sig_ip =~ m|$ip_re|) { 
    18781882        return 1 if $pkt_ip eq $sig_ip; 
    18791883    } 
     1884 
    18801885    return 0; 
    18811886} 
     
    25652570 
    25662571        my $connected_str = ''; 
    2567         $connected_str .= "$_ " for @connected_subnets; 
    2568         $connected_str .= "$_ " for @connected_subnets_cidr; 
    2569         $connected_str =~ s|\s*$||; 
     2572        $connected_str .= "$_, " for @connected_subnets_cidr; 
     2573        $connected_str =~ s|,\s*$||; 
    25702574 
    25712575        $config{'HOME_NET'} = $connected_str; 
     
    42584262 
    42594263    for my $fh (@print_fh) { 
    4260         for my $proto qw(tcp udp icmp) { 
     4264        for my $proto qw(tcp udp icmp ip) { 
    42614265            next unless defined $scan{$src}{$dst}{$proto}; 
    42624266            my $href = $scan{$src}{$dst}{$proto}; 
     
    43494353                                        print $fh "   \"$msg\"\n", 
    43504354                                            "        sid=$sid chain=$chain packets=$pkts dp=$dp flags=[$flags] ", 
    4351                                             "** Your machine is listening on $proto port: $dp!\n"; 
     4355                                            "[*] Your machine is listening on $proto port: $dp!\n"; 
    43524356                                    } else { 
    43534357                                        print $fh "   \"$msg\"\n", 
    43544358                                            "        sid=$sid chain=$chain packets=$pkts dp=$dp ", 
    4355                                             "** Your machine is listening on $proto port: $dp!\n"; 
     4359                                            "[*] Your machine is listening on $proto port: $dp!\n"; 
    43564360                                    } 
    43574361                                } else { 
     
    43774381                        } 
    43784382                    } else { 
    4379                         my $pkts = $scan{$src}{$dst}{'icmp'
     4383                        my $pkts = $scan{$src}{$dst}{$proto
    43804384                            {'curr_sig'}{$sid}{$chain}{'pkts'}; 
    43814385                        print $fh qq(   "$msg" sid=$sid chain=$chain packets=$pkts\n);