NAME

POE::Filter::Snort - a POE stream filter that parses Snort logs into hashes

SYNOPSIS

#!/usr/bin/env perl

use warnings; use strict;
use POE qw(Filter::Snort Wheel::FollowTail);

POE::Session->create(
	inline_states => {
		_start  => \&start_log,
		got_rec => \&display_record,
	},
);

POE::Kernel->run();
exit;

sub start_log {
	$_[HEAP]->{watcher} = POE::Wheel::FollowTail->new(
		Filename   => "/var/log/snort/alert",
		Filter     => POE::Filter::Snort->new(),
		InputEvent => "got_rec",
	);
}

sub display_record {
	my $rec = $_[ARG0];

	print "Got a snort record:\n";
	print "\tComment: $rec->{comment}\n"  if exists $rec->{comment};
	print "\tClass  : $rec->{class}\n"    if exists $rec->{class};
	print "\tPrio   : $rec->{priority}\n" if exists $rec->{priority};
	if (exists $rec->{src_ip}) {
		if (exists $rec->{src_port}) {
			print "\tSource : $rec->{src_ip} $rec->{src_port}\n";
			print "\tDest   : $rec->{dst_ip} $rec->{dst_port}\n";
		}
		else {
			print "\tSource : $rec->{src_ip}\n";
			print "\tDest   : $rec->{dst_ip}\n";
		}

		foreach my $xref (@{$rec->{xref}}) {
			print "\tXref   : $xref\n";
		}
	} 
}

DESCRIPTION

POE::Filter::Snort parses streams containing Snort alerts. Each alert is returned as a hash containing the following fields: comment, class, priority, src_ip, dst_ip, src_port, dst_port, xref, raw.

Most fields are optional. For example, some snort alerts don't contain a source and destination IP address. Those that do aren't always accompanied by a source and destination port.

The xref field refers to an array of URLs describing the alert in more detail. It will always exist, but it may be empty if no URLs appear in snort's configuration file.

The raw field is an arrayref containing each original line of the snort alert.

SEE ALSO

Snort - "the de facto standard for intrusion detection/prevention" http://www.snort.org/

POE

BUG TRACKER

https://rt.cpan.org/Dist/Display.html?Status=Active&Queue=POE-Filter-Snort

REPOSITORY

http://github.com/rcaputo/poe-filter-snort http://gitorious.org/poe-filter-snort

OTHER RESOURCES

http://search.cpan.org/dist/POE-Filter-Snort/

COPYRIGHT

Copyright 2005-2010, Rocco Caputo. All rights are reserved.

POE::Filter::Snort is free software; you may use, redistribute, and/or modify it under the same terms as Perl itself.