mirror of https://github.com/Cisco-Talos/clamav
parent
5d79922b9c
commit
a209be9708
@ -0,0 +1,85 @@ |
||||
#!/usr/bin/perl -w |
||||
|
||||
# Copyright (C) 2004 Nigel Horne <njh@bandsman.co.uk> |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 2 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
||||
|
||||
# clamavmon - monitor a network for virus intrusion |
||||
|
||||
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}' if 0; |
||||
|
||||
use strict; |
||||
use IO::Socket::INET; |
||||
use Tk; |
||||
use Tk::Dialog; |
||||
use threads; |
||||
|
||||
my $mw = MainWindow->new; |
||||
my $history = ""; |
||||
|
||||
my $text = $mw->Scrolled('Text', -width => 50, -scrollbars => 'ow')->pack; |
||||
|
||||
my $button1 = $mw->Button(-text => 'About', -command => \&about)->pack(-side => 'left'); |
||||
# my $button2 = $mw->Button(-text => 'Quit', -command => \&quit)->pack(-side => 'left'); |
||||
my $button2 = $mw->Button(-text => 'Quit', -command => \&exit)->pack(-side => 'left'); |
||||
|
||||
my $t = threads->new(\&listener); |
||||
|
||||
my $quitting = 0; |
||||
|
||||
MainLoop; |
||||
|
||||
sub listener { |
||||
my $MySocket = IO::Socket::INET->new( |
||||
LocalPort => 3310, |
||||
Proto => 'udp', |
||||
Type => SOCK_DGRAM) or die "$0: socket: $!\n"; |
||||
|
||||
unless($quitting) { |
||||
my $mess; |
||||
$MySocket->recv($mess, 128); |
||||
|
||||
my ($rport, $ipaddr) = sockaddr_in($MySocket->peername); |
||||
|
||||
$text->insert('end', "From " . inet_ntoa($ipaddr) . " $mess\n"); |
||||
|
||||
print "From " . inet_ntoa($ipaddr) . " $mess\n"; |
||||
|
||||
# $text->Contents($history); |
||||
$text->pack; |
||||
} |
||||
} |
||||
|
||||
sub quit { |
||||
$quitting = 1; |
||||
$t->join(); |
||||
exit; |
||||
} |
||||
|
||||
sub about { |
||||
my $about = $mw->DialogBox( |
||||
-title=>"About clamAVmon", |
||||
-buttons=>["OK"] |
||||
); |
||||
|
||||
$about->add('Label', |
||||
-anchor => 'w', |
||||
-justify => 'left', |
||||
-text => "clamAVmon\n" . |
||||
"Copyright (C) 2004 Nigel Horne njh\@bandsman.co.uk\n" . |
||||
"The GPL Licence will appear here")->pack; |
||||
|
||||
$about->Show(); |
||||
} |
Loading…
Reference in new issue