Skip to content
Snippets Groups Projects
Commit 889c5f1a authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Removed bin, not propagated into package anyway and user should adapt and use doc/example* code

parent 820b4970
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/perl -w
#
# receiver.pl
#
# Copyright (C) 2011-2012 Cesnet z.s.p.o
#
# Use of this source is governed by a BSD-style license, see LICENSE file.
use strict;
my $warden_path = '/opt/warden-client';
require $warden_path . '/lib/WardenClientReceive.pm';
#my $requested_type = "copyright";
#my $requested_type = "botnet_c_c";
my $requested_type = "bruteforce";
my @new_events = WardenClientReceive::getNewEvents($warden_path, $requested_type);
print "+------------------------------------------------------------------------------------------------------------------------------------------+\n";
print "| id | hostname | service | detected | type | source_type | source | target_proto | target_port | attack_scale | note | priority | timeout |\n";
print "+------------------------------------------------------------------------------------------------------------------------------------------+\n";
foreach (@new_events) {
print "| " . join(' | ', @$_) . " |" . "\n";
}
print "+------------------------------------------------------------------------------------------------------------------------------------------+";
print "\n";
print "Last events in: " . scalar(localtime(time)) . "\n";
exit 0;
#!/usr/bin/perl -w
#
# sender.pl
#
# Copyright (C) 2011-2012 Cesnet z.s.p.o
#
# Use of this source is governed by a BSD-style license, see LICENSE file.
use Switch;
use strict;
use DateTime;
my $warden_path = '/opt/warden-client';
require $warden_path . '/lib/WardenClientSend.pm';
my $service = "";
switch (int(rand(2) + 0.5)) {
case 0 { $service = 'ScanDetector'; }
case 1 { $service = 'PhiGaro'; }
case 2 { $service = 'HoneyScan'; }
}
my $detected = DateTime->from_epoch(epoch => time());
my $type = "";
switch (int(rand(9) + 0.5)) {
case 0 { $type = 'portscan'; }
case 1 { $type = 'bruteforce'; }
case 2 { $type = 'spam'; }
case 3 { $type = 'phishing'; }
case 4 { $type = 'botnet_c_c'; }
case 5 { $type = 'dos'; }
case 6 { $type = 'malware'; }
case 7 { $type = 'copyright'; }
case 8 { $type = 'webattack'; }
case 9 { $type = 'other'; }
}
my $source_type = "";
switch (int(rand(2) + 0.5)) {
case 0 { $source_type = 'IP'; }
case 1 { $source_type = 'URL'; }
case 2 { $source_type = 'Reply-To:'; }
}
my $source = (int(rand(254) + 0.5) + 1) . "." . (int(rand(254) + 0.5) + 1) . "." . (int(rand(254) + 0.5) + 1) . "." . (int(rand(254) + 0.5) + 1);
my $target_proto = "";
switch (int(rand(1) + 0.5)) {
case 0 { $target_proto = 'TCP'; }
case 1 { $target_proto = 'UDP'; }
}
my $target_port = "";
switch (int(rand(5) + 0.5)) {
case 0 { $target_port = '22'; }
case 1 { $target_port = '23'; }
case 2 { $target_port = '25'; }
case 3 { $target_port = '443'; }
case 4 { $target_port = '3389'; }
case 5 { $target_port = undef; }
}
my $attack_scale = (int(rand(100000) + 0.5) + 1000);
my $note = "tohle je takova normalni jednoducha poznamka";
my $priority = "";
switch (int(rand(1) + 0.5)) {
case 0 { $priority = int(rand(255) + 0.5); }
case 1 { $priority = undef; }
}
my $timeout = "";
switch (int(rand(1) + 0.5)) {
case 0 { $timeout = int(rand(255) + 0.5); }
case 1 { $timeout = undef; }
}
my @event = (
$service, # $service
"$detected", # $detected
$type, # $type
$source_type, # $source_type
$source, # $source
$target_proto, # $target_proto
$target_port, # $target_port
$attack_scale, # $attack_scale
$note, # $note
$priority, # $priority
$timeout, # $timeout
);
WardenClientSend::saveNewEvent($warden_path, \@event);
#foreach (@event) {
# print "$_\n";
#}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment