diff --git a/src/warden-server/lib/Warden.pm b/src/warden-server/lib/Warden.pm index 05ab9bcd6070bb66c0c6860d46bba656b4615778..9c5ece8a1ccdc24755daaf82532a79e87d99cfad 100755 --- a/src/warden-server/lib/Warden.pm +++ b/src/warden-server/lib/Warden.pm @@ -219,16 +219,49 @@ sub saveNewEvent "Unknown source type: '$source_type'"); } } + # http://my.safaribooksonline.com/book/programming/regular-expressions/9780596802837/4dot-validation-and-formatting/id2983571 if ($detected !~ /^((?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[0-1]|0[1-9]|[1-2][0-9])T(2[0-3]|[0-1][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]+)?(Z|[+-](?:2[0-3]|[0-1][0-9]):[0-5][0-9])?/) { sendMsg("err", "Unknown detected time format from [IP: '$ip'; CN(AN): $alt_names; Service: '$service'; Detected: '$detected']", "Unknown detected time format: '$detected'"); } - if ($target_port !~ /^\d+\z/) { $target_port = undef } - if ($attack_scale !~ /^\d+\z/) { $attack_scale = undef } - if ($priority !~ /^\d+\z/) { $priority = undef } - if ($timeout !~ /^\d+\z/) { $timeout = undef } + + my $change_string = ""; + if ($target_port !~ /^\d+\z/) { + $change_string = $change_string . "target_port: $target_port"; + $target_port = undef; + } + if ($attack_scale !~ /^\d+\z/) { + if ($change_string eq "") { + $change_string = $change_string . "attack_scale: $attack_scale"; + } else { + $change_string = $change_string . ", attack_scale: $attack_scale"; + } + $attack_scale = undef; + } + if ($priority !~ /^\d+\z/) { + if ($change_string eq "") { + $change_string = $change_string . "priority: $priority"; + } else { + $change_string = $change_string . ", priority: $priority"; + } + $priority = undef; + } + if ($timeout !~ /^\d+\z/) { + if ($change_string eq "") { + $change_string = $change_string . "attack_scale: $timeout"; + } else { + $change_string = $change_string . ", attack_scale: $timeout"; + } + $timeout = undef; + } + if ($change_string ne ""){ + sendMsg("info", + "Unknown event items detected {originaly - $change_string} received in $received from [IP '$ip'; CN(AN): $alt_names; Service: '$service'; Type: '$type'; Detected: '$detected']", + undef); + } + $sth=$DBH->prepare("INSERT INTO events VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"); if (!defined $sth) { sendMsg("err", @@ -446,7 +479,7 @@ sub registerSender } $sth->execute(undef, $hostname, $registered, $requestor, $service, $client_type, $type, $receive_own_events, $description_tags, $ip_net_client); sendMsg("info", - "New sender [Hostname: '$hostname', Service: '$service', CIDR: '$ip_net_client'] has been registered at Warden server '$ENV{'SERVER_NAME'}'", + "New sender [Hostname: '$hostname', Requestor: '$requestor', Service: '$service', Description_tags: '$description_tags', CIDR: '$ip_net_client'] has been registered at Warden server '$ENV{'SERVER_NAME'}'", undef); return 1; } @@ -511,7 +544,7 @@ sub registerReceiver } $sth->execute(undef, $hostname, $registered, $requestor, $service, $client_type, $type, $receive_own_events, $description_tags, $ip_net_client); sendMsg("info", - "New receiver [Hostname: '$hostname', Type: '$type', CIDR: '$ip_net_client'] has been registered at Warden server '$ENV{'SERVER_NAME'}'", + "New receiver [Hostname: '$hostname', Requestor: '$requestor' Type: '$type', ROE: '$receive_own_events', CIDR: '$ip_net_client'] has been registered at Warden server '$ENV{'SERVER_NAME'}'", undef); return 1; }