| 1 | package ThreatNet::Filter; | ||||||||||
| 2 | |||||||||||
| 3 | =pod | ||||||||||
| 4 | |||||||||||
| 5 | =head1 NAME | ||||||||||
| 6 | |||||||||||
| 7 | ThreatNet::Filter - Interface for ThreatNet event filters | ||||||||||
| 8 | |||||||||||
| 9 | =head1 DESCRIPTION | ||||||||||
| 10 | |||||||||||
| 11 | ThreatNet data sources can potentially generate a hell of a lot of | ||||||||||
| 12 | events, and it's important to be able to filter these down to just | ||||||||||
| 13 | the events that matter. | ||||||||||
| 14 | |||||||||||
| 15 | Many of the filters are stateful. For example, the standard | ||||||||||
| 16 | L<ThreatNet::Filter::ThreatCache> module provides cache objects | ||||||||||
| 17 | that filter out any threats that have already been seen in the | ||||||||||
| 18 | previous hour. (or whatever the state period is). | ||||||||||
| 19 | |||||||||||
| 20 | =head1 METHODS | ||||||||||
| 21 | |||||||||||
| 22 | The filter API is quite simple, with only a few methods. | ||||||||||
| 23 | |||||||||||
| 24 | =cut | ||||||||||
| 25 | |||||||||||
| 26 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 3 | ▶ | use Params::Util '_INSTANCE'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | 3 | ▶ | use vars qw{$VERSION}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 3 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | 3 | $VERSION = '0.20'; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | ##################################################################### | ||||||||||
| 39 | # Constructor | ||||||||||
| 40 | |||||||||||
| 41 | =pod | ||||||||||
| 42 | |||||||||||
| 43 | =head2 new ... | ||||||||||
| 44 | |||||||||||
| 45 | Since some categories of filter do not strictly need to be in the | ||||||||||
| 46 | form of an object, a default C<new> constructor is provided which just | ||||||||||
| 47 | creates an empty object. | ||||||||||
| 48 | |||||||||||
| 49 | Returns a new C<ThreatNet::Filter> object, or some sub-classes may | ||||||||||
| 50 | return C<undef> on error. | ||||||||||
| 51 | |||||||||||
| 52 | =cut | ||||||||||
| 53 | |||||||||||
| 54 | 9 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 55 | 9 | bless {}, shift; | |||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | =pod | ||||||||||
| 59 | |||||||||||
| 60 | =head2 keep $Message | ||||||||||
| 61 | |||||||||||
| 62 | The C<keep> method takes a L<ThreatNet::Message> object and examines | ||||||||||
| 63 | it to determine if the message should be kept, or filtered out. | ||||||||||
| 64 | |||||||||||
| 65 | In the default implementation of the filter, all messages are kept. | ||||||||||
| 66 | |||||||||||
| 67 | Returns true if the message should be kept, or false if the message | ||||||||||
| 68 | should be discarded. | ||||||||||
| 69 | |||||||||||
| 70 | =cut | ||||||||||
| 71 | |||||||||||
| 72 | 6 | ▶ | sub keep { _INSTANCE($_[1], 'ThreatNet::Message') ? 1 : undef } | ||||||||
|
Subroutine
keep: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 73 | |||||||||||
| 74 | 3 | 1; | |||||||||
| 75 | |||||||||||
| 76 | =pod | ||||||||||
| 77 | |||||||||||
| 78 | =head1 SUPPORT | ||||||||||
| 79 | |||||||||||
| 80 | All bugs should be filed via the bug tracker at | ||||||||||
| 81 | |||||||||||
| 82 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ThreatNet-Filter> | ||||||||||
| 83 | |||||||||||
| 84 | For other issues, or commercial enhancement and support, contact the author | ||||||||||
| 85 | |||||||||||
| 86 | =head1 AUTHORS | ||||||||||
| 87 | |||||||||||
| 88 | Adam Kennedy E<lt>adamk@cpan.orgE<gt> | ||||||||||
| 89 | |||||||||||
| 90 | =head1 SEE ALSO | ||||||||||
| 91 | |||||||||||
| 92 | L<http://ali.as/threatnet/>, L<ThreatNet::Message> | ||||||||||
| 93 | |||||||||||
| 94 | =head1 COPYRIGHT | ||||||||||
| 95 | |||||||||||
| 96 | Copyright (c) 2004 - 2005 Adam Kennedy. All rights reserved. | ||||||||||
| 97 | This program is free software; you can redistribute | ||||||||||
| 98 | it and/or modify it under the same terms as Perl itself. | ||||||||||
| 99 | |||||||||||
| 100 | The full text of the license can be found in the | ||||||||||
| 101 | LICENSE file included with this module. | ||||||||||
| 102 | |||||||||||
| 103 | =cut | ||||||||||