From a4a379510266fdeff99cf2085a5d3e6de634e40a Mon Sep 17 00:00:00 2001
From: Tomas Plesnik <plesnik@ics.muni.cz>
Date: Mon, 9 Feb 2015 16:04:59 +0100
Subject: [PATCH] pwd zjistovana pomoci modulu FindBin; smazany zakomentovane
casti kodu; timeout a priority nastaveny na undef
---
src/warden-client/bin/sender-random.pl | 50 ++++++++++----------------
1 file changed, 19 insertions(+), 31 deletions(-)
diff --git a/src/warden-client/bin/sender-random.pl b/src/warden-client/bin/sender-random.pl
index b892e9a..fc83e49 100755
--- a/src/warden-client/bin/sender-random.pl
+++ b/src/warden-client/bin/sender-random.pl
@@ -9,20 +9,13 @@ use warnings;
use Switch;
use DateTime;
-use File::Basename;
+use FindBin qw($RealBin);
+FindBin::again();
-my $bin = File::Basename::dirname(__FILE__);
-use lib "$bin/../lib";
+use lib "$RealBin/../lib";
use WardenClient;
my $service = "test";
-# service is needed in authorization process of the client,
-# therefore it can not be set randomly
-#switch (int(rand(3) + 0.5)) {
-# case 1 { $service = 'ScanDetector'; }
-# case 2 { $service = 'PhiGaro'; }
-# case 3 { $service = 'HoneyScan'; }
-# }
my $detected = DateTime->from_epoch(epoch => time());
@@ -39,7 +32,7 @@ switch (int(rand(10) + 0.5)) {
case 9 { $type = 'webattack'; }
case 10 { $type = 'other'; }
}
-
+
my $source_type = "";
switch (int(rand(3) + 0.5)) {
case 1 { $source_type = 'IP'; }
@@ -67,31 +60,26 @@ switch (int(rand(6) + 0.5)) {
my $attack_scale = (int(rand(100000) + 0.5) + 1000);
-my $note = "tohle je takova normalni jednoducha poznamka";
+my $note = "This is simple note only.";
+
+my $priority = undef;
-my $priority = int(rand(255) + 0.5);
-
-my $timeout = int(rand(255) + 0.5);
-
+my $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
+ $service,
+ $detected,
+ $type,
+ $source_type,
+ $source,
+ $target_proto,
+ $target_port,
+ $attack_scale,
+ $note,
+ $priority,
+ $timeout,
);
WardenClient::saveNewEvent(\@event);
-#foreach (@event) {
-# print "$_\n";
-#}
-
exit 0;
--
GitLab