#!/usr/local/bin/perl # # Program to check /var/log/messeges for alerts contining the word IDS and send mails # in case the word is found- including the line use strict; use warnings; use Mail::Mailer; open (INFO, "/var/log/messages"); # Open the file while { @message = / IDS/g # Read it into an array @message = $& $mailer = Mail::Mailer->new("smtp", "10.83.27.71"); $mailer->open( 'From' => 'Syslog ', 'To' => 'gabriela pinado ', 'Subject' => 'PiX Detected Attack ' ); print $mailer <<@message; close($mailer) or die "can't close mailer: $!"; #### [root@juanlinux perl]# perl ./logcheck Array found where operator expected at ./logcheck line 14, at end of line (Do you need to predeclare g?) Scalar found where operator expected at ./logcheck line 16, near "$& $mailer" (Missing semicolon on previous line?) Use of bare << to mean <<"" is deprecated at ./logcheck line 20. Array found where operator expected at ./logcheck line 22, at end of line (Might be a runaway multi-line << string starting on line 20) (Missing operator before ?) syntax error at ./logcheck line 13, near "{" Global symbol "@message" requires explicit package name at ./logcheck line 13. Global symbol "@message" requires explicit package name at ./logcheck line 14. Global symbol "$mailer" requires explicit package name at ./logcheck line 16. Global symbol "$mailer" requires explicit package name at ./logcheck line 17. Global symbol "$mailer" requires explicit package name at ./logcheck line 20. Global symbol "$mailer" requires explicit package name at ./logcheck line 20. syntax error at ./logcheck line 22, near "@message" Global symbol "@message" requires explicit package name at ./logcheck line 22. Execution of ./logcheck aborted due to compilation errors.