Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pavel Valach
Warden
Commits
3f9dc03c
Commit
3f9dc03c
authored
Aug 14, 2012
by
Jan Soukal
Browse files
Options
Downloads
Patches
Plain Diff
task #519, kod klienta uzavren do eval bloku
parent
4a2fbcab
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/warden-client/doc/example-receiver.pl.txt
+10
-7
10 additions, 7 deletions
src/warden-client/doc/example-receiver.pl.txt
src/warden-client/lib/WardenClientReceive.pm
+92
-84
92 additions, 84 deletions
src/warden-client/lib/WardenClientReceive.pm
with
102 additions
and
91 deletions
src/warden-client/doc/example-receiver.pl.txt
100644 → 100755
+
10
−
7
View file @
3f9dc03c
...
@@ -18,17 +18,14 @@ use strict;
...
@@ -18,17 +18,14 @@ use strict;
# This code should developer add into his/her application.
# This code should developer add into his/her application.
# Path to warden-client directory
# Path to warden-client directory
my $warden_path = '/
opt
/warden-client';
my $warden_path = '/
home/soukal/client-test/2.0.0_beta
/warden-client
/
';
# Inclusion of warden-client receiving functionality
# Inclusion of warden-client receiving functionality
require $warden_path . '/lib/WardenClientReceive.pm';
require $warden_path . '/lib/WardenClientReceive.pm';
# Definition of requested event type. This attributes is also set on server
# Definition of requested event type. This attributes is also set on server
# and must not change.
# and must not change.
my $requested_type = "botnet_c_c";
my $requested_type = "portscan";
# Download of new evetns from Warden server
my @new_events = WardenClientReceive::getNewEvents($warden_path, $requested_type);
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Simple code that prints out new events obtained from Warden server.
# Simple code that prints out new events obtained from Warden server.
...
@@ -37,9 +34,15 @@ print "+------------------------------------------------------------------------
...
@@ -37,9 +34,15 @@ print "+------------------------------------------------------------------------
print "| id | hostname | service | detected | type | source_type | source | target_proto | target_port | attack_scale | note | priority | timeout |\n";
print "| id | hostname | service | detected | type | source_type | source | target_proto | target_port | attack_scale | note | priority | timeout |\n";
print "+------------------------------------------------------------------------------------------------------------------------------------------+\n";
print "+------------------------------------------------------------------------------------------------------------------------------------------+\n";
foreach (@new_events) {
# Download of new evetns from Warden server
print "| " . join(' | ', @$_) . " |" . "\n";
while (my @new_events = WardenClientReceive::getNewEvents($warden_path, $requested_type)) {
foreach my $event_ref (@new_events) {
my @event = @$event_ref;
print "| " . join(' | ', @event) . " |" . "\n";
}
}
print "+------------------------------------------------------------------------------------------------------------------------------------------+\n";
}
print "+------------------------------------------------------------------------------------------------------------------------------------------+";
print "+------------------------------------------------------------------------------------------------------------------------------------------+";
print "\n";
print "\n";
print "Last events in: " . scalar(localtime(time)) . "\n";
print "Last events in: " . scalar(localtime(time)) . "\n";
...
...
This diff is collapsed.
Click to expand it.
src/warden-client/lib/WardenClientReceive.pm
+
92
−
84
View file @
3f9dc03c
...
@@ -81,6 +81,10 @@ sub c2s
...
@@ -81,6 +81,10 @@ sub c2s
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
sub
getNewEvents
sub
getNewEvents
{
{
my
@events
;
eval
{
my
$warden_path
=
shift
;
my
$warden_path
=
shift
;
my
$requested_type
=
shift
;
my
$requested_type
=
shift
;
...
@@ -132,7 +136,7 @@ sub getNewEvents
...
@@ -132,7 +136,7 @@ sub getNewEvents
# parse returned SOAP data object
# parse returned SOAP data object
my
(
$id
,
$hostname
,
$service
,
$detected
,
$type
,
$source_type
,
$source
,
$target_proto
,
$target_port
,
$attack_scale
,
$note
,
$priority
,
$timeout
);
my
(
$id
,
$hostname
,
$service
,
$detected
,
$type
,
$source_type
,
$source
,
$target_proto
,
$target_port
,
$attack_scale
,
$note
,
$priority
,
$timeout
);
my
@events
;
#
my @events;
my
@response_list
=
$response
->
valueof
('
/Envelope/Body/getNewEventsResponse/event/
');
my
@response_list
=
$response
->
valueof
('
/Envelope/Body/getNewEventsResponse/event/
');
while
(
scalar
@response_list
)
{
while
(
scalar
@response_list
)
{
my
$response_data
=
shift
(
@response_list
);
my
$response_data
=
shift
(
@response_list
);
...
@@ -169,6 +173,10 @@ sub getNewEvents
...
@@ -169,6 +173,10 @@ sub getNewEvents
print
ID
$last_id
;
print
ID
$last_id
;
close
ID
;
close
ID
;
}
}
}
# End of eval block
or
do
{
return
;
};
return
@events
;
return
@events
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment