use warnings; use Win32::GUI(); use Win32::Sound; while(1) { $filename="log2.txt"; open(TXT, $filename)||die("Could not open file!"); @filedata = ; close(TXT); @alert = qw(a b c); $i=0; foreach $element (@filedata) { if($element =~ /(\s+)(\d{1,4})(\.\d{1,4}){3}(\s+)/) { $datetime = localtime(); $alert[$i] = new Win32::GUI::Window(-name => 'Alert', -width => 500, -height => 200); $font = Win32::GUI::Font -> new(-name => "Arial", size => 46, -bold => 1); $alert[$i] -> AddLabel(-text => $datetime, -font => $font); $alert[$i] -> AddLabel(-text => $element, -font => $font, -top => 50); $alert[$i] -> AddButton(-name => "CloseButton", -text => "OK", -pos => [ 200, 100 ]); Win32::Sound::Play("SystemExclamation"); $alert[$i] -> Show(); Win32::GUI::Dialog(); ++$i; sub CloseButton_Click { $alert[$i] -> Hide(); } sub Alert_Terminate{ -1; } #open out, ">$filename"; } } } #### use warnings; use Win32::GUI(); use Win32::Sound; # Update interval in seconds $interval = 30; # current time $now = time; #if the file exists, get it's properties if ( -f "log2.txt") { $lastUpdate = (stat("log2.txt"))[9]; $difference = $now - $lastUpdate; } while ($difference > $interval) { $filename="log2.txt"; open(TXT, $filename)||die("Could not open file!"); @filedata = ; close(TXT); @alert = qw(a b c); $i=0; $datetime = localtime(); $alert = new Win32::GUI::Window( -left => 341, -top => 218, -width => 500, -height => 200, -name => "alert", -text => "alert window" ); $font = Win32::GUI::Font -> new( -name => "Arial", size => 46, -bold => 1); $alert[$i] -> AddLabel( -text => $datetime, -font => $font); $alert[$i] -> AddLabel( -text => $element, -font => $font, -top => 50); $alert->AddButton( -text => "OK", -name => "CloseButton", -left => 200, -top => 100, ); Win32::Sound::Play("SystemExclamation"); $alert[$i] -> Show(); Win32::GUI::Dialog(); ++$i; sub CloseButton_Click { $alert[$i] -> Hide(); } sub Alert_Terminate{ -1; } foreach ($element =~ /(\s+)(\d{1,4})(\.\d{1,4}){3}(\s+)/) {&show_win } } #### Time: 10/31-13:36:10.802641 event_ref: 0 192.168.0.203 -> 208.16.3.7 (portscan) TCP Portsweep Priority Count: 5 Connection Count: 8 IP Count: 13 Scanned IP Range: 208.16.3.2:208.16.3.9 Port/Proto Count: 3 Port/Proto Range: 22:3389 Time: 10/31-13:37:58.075795 event_ref: 0 192.168.0.203 -> 208.16.3.4 (portscan) TCP Portsweep Priority Count: 5 Connection Count: 9 IP Count: 13 Scanned IP Range: 208.16.3.2:208.16.3.9 Port/Proto Count: 3 Port/Proto Range: 25:3389 Time: 10/31-13:38:10.031849 event_ref: 0 192.168.0.203 -> 208.16.3.9 (portscan) ICMP Sweep Priority Count: 5 Connection Count: 13 IP Count: 12 Scanned IP Range: 208.16.3.2:208.16.3.10 Port/Proto Count: 0 Port/Proto Range: 0:0 Time: 10/31-13:38:10.032141 event_ref: 0 192.168.0.203 -> 208.16.3.7 (portscan) TCP Portscan Priority Count: 5 Connection Count: 6 IP Count: 1 Scanner IP Range: 192.168.0.203:192.168.0.203 Port/Proto Count: 7 Port/Proto Range: 21:3389