Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
b3c0e922
Commit
b3c0e922
authored
1 year ago
by
karamchandan
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup of the DAD service implementation
parent
5967330e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!142
Release TeraFlowSDN 2.1
,
!141
Pre-release fixes and code cleanup in L3 cybersecurity components
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/l3_distributedattackdetector/service/l3_distributedattackdetector.py
+10
-7
10 additions, 7 deletions
...tedattackdetector/service/l3_distributedattackdetector.py
with
10 additions
and
7 deletions
src/l3_distributedattackdetector/service/l3_distributedattackdetector.py
+
10
−
7
View file @
b3c0e922
...
...
@@ -81,9 +81,9 @@ class l3_distributedattackdetector:
with
grpc
.
insecure_channel
(
CENTRALIZED_ATTACK_DETECTOR
)
as
channel
:
self
.
cad
=
L3CentralizedattackdetectorStub
(
channel
)
LOGGER
.
info
(
"
Connected to the
c
entralized
a
ttack
d
etector
"
)
LOGGER
.
info
(
"
Obtaining features...
"
)
LOGGER
.
info
(
"
Connected to the
C
entralized
A
ttack
D
etector
"
)
LOGGER
.
info
(
"
Obtaining features
Ids. from the Centralized Attack Detector
...
"
)
self
.
feature_ids
=
self
.
get_features_ids
()
LOGGER
.
info
(
"
Features Ids.: {:s}
"
.
format
(
str
(
self
.
feature_ids
)))
...
...
@@ -118,10 +118,10 @@ class l3_distributedattackdetector:
# start an infinite loop
while
True
:
# read last line of file
# read last line of
the
file
line
=
file
.
readline
()
# sleep if file hasn't been updated
# sleep if
the
file hasn't been updated
if
not
line
:
time
.
sleep
(
time_sleep
)
continue
...
...
@@ -135,16 +135,19 @@ class l3_distributedattackdetector:
yield
line
def
load_file
(
self
,
dirname
=
TSTAT_DIR_NAME
):
# - Client side -
def
load_file
(
self
,
dirname
=
TSTAT_DIR_NAME
):
while
True
:
here
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
tstat_piped
=
os
.
path
.
join
(
here
,
dirname
)
tstat_dirs
=
os
.
listdir
(
tstat_piped
)
if
len
(
tstat_dirs
)
>
0
:
tstat_dirs
.
sort
()
new_dir
=
tstat_dirs
[
-
1
]
tstat_file
=
tstat_piped
+
new_dir
+
"
/log_tcp_temp_complete
"
LOGGER
.
info
(
"
Following: {:s}
"
.
format
(
str
(
tstat_file
)))
return
tstat_file
else
:
LOGGER
.
info
(
"
No Tstat directory!
"
)
...
...
@@ -165,7 +168,7 @@ class l3_distributedattackdetector:
feature
=
feature_id
-
1
values
.
append
(
float
(
line
[
feature
]))
except
IndexError
:
print
(
"
IndexError: {0}
"
.
format
(
line
))
LOGGER
.
error
(
"
IndexError: {0}
"
.
format
(
line
))
return
values
...
...
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