Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-092
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020 - 092
2020-092
Commits
6939f1c1
Commit
6939f1c1
authored
Nov 02, 2020
by
Ashen Udayanga Sudugala
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Sakindu' into 'master'
Sakindu See merge request
!9
parents
9a6723f2
2e437b26
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6181 additions
and
0 deletions
+6181
-0
NTP Amplification Attack/.gitkeep
NTP Amplification Attack/.gitkeep
+0
-0
NTP Amplification Attack/DataPacket.csv
NTP Amplification Attack/DataPacket.csv
+6090
-0
NTP Amplification Attack/ntpModel.py
NTP Amplification Attack/ntpModel.py
+91
-0
No files found.
NTP Amplification Attack/.gitkeep
0 → 100644
View file @
6939f1c1
NTP Amplification Attack/DataPacket.csv
0 → 100644
View file @
6939f1c1
This diff is collapsed.
Click to expand it.
NTP Amplification Attack/ntpModel.py
0 → 100644
View file @
6939f1c1
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 22 19:14:10 2020
@author: Sakindu Udagedara
"""
#Importing the libraries
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
pandas
as
pd
#Importing tha dataset
dataset
=
pd
.
read_csv
(
'Sample.csv'
)
X
=
dataset
.
iloc
[:,[
1
,
3
]]
.
values
Y
=
dataset
.
iloc
[:,
5
]
.
values
#taking care of missing data
#from sklearn.preprocessing import Imputor
#imputor = Imputor (missing_values = 'NaN', strategy = 'mean' , axis = 0)
#imputor.fix(X[:,])
#encoding catagarical data
from
sklearn.preprocessing
import
LabelEncoder
lebekencoder_X
=
LabelEncoder
()
#X[:, 0] = lebekencoder_X.fit_transform(X[:, 0])
#X[:, 2] = lebekencoder_X.fit_transform(X[:, 2])
lebekencoder_Y
=
LabelEncoder
()
Y
=
lebekencoder_Y
.
fit_transform
(
Y
)
#spliting data into tarin set and test set
from
sklearn.model_selection
import
train_test_split
X_train
,
X_test
,
Y_train
,
Y_test
=
train_test_split
(
X
,
Y
,
test_size
=
0.3
,
random_state
=
0
)
#feature scaling
from
sklearn.preprocessing
import
StandardScaler
sc_X
=
StandardScaler
()
X_train
=
sc_X
.
fit_transform
(
X_train
)
X_test
=
sc_X
.
fit_transform
(
X_test
)
# Fiting SVM to the Traing set
from
sklearn.svm
import
SVC
classifier
=
SVC
(
kernel
=
'linear'
,
random_state
=
0
)
classifier
.
fit
(
X_train
,
Y_train
)
# Predicting the Test set results
y_pred
=
classifier
.
predict
(
X_test
)
#makeing the confusion matrix
from
sklearn.metrics
import
confusion_matrix
cm
=
confusion_matrix
(
Y_test
,
y_pred
)
#Visualizing the Training set results
from
matplotlib.colors
import
ListedColormap
X_set
,
Y_set
=
X_train
,
Y_train
X1
,
X2
=
np
.
meshgrid
(
np
.
arange
(
start
=
X_set
[:,
0
]
.
min
()
-
1
,
stop
=
X_set
[:,
0
]
.
max
()
+
1
,
step
=
0.01
),
np
.
arange
(
start
=
X_set
[:,
1
]
.
min
()
-
1
,
stop
=
X_set
[:,
1
]
.
max
()
+
1
,
step
=
0.01
))
plt
.
contour
(
X1
,
X2
,
classifier
.
predict
(
np
.
array
([
X1
.
ravel
(),
X2
.
ravel
()])
.
T
)
.
reshape
(
X1
.
shape
),
alpha
=
0.75
,
cmap
=
ListedColormap
((
'red'
,
'green'
)))
plt
.
xlim
(
X1
.
min
(),
X2
.
max
())
plt
.
ylim
(
X2
.
min
(),
X1
.
max
())
for
i
,
j
in
enumerate
(
np
.
unique
(
Y_set
)):
plt
.
scatter
(
X_set
[
Y_set
==
j
,
0
],
X_set
[
Y_set
==
j
,
1
],
c
=
ListedColormap
((
'red'
,
'green'
))(
i
),
label
=
j
)
plt
.
title
(
'SVM (Training set)'
)
plt
.
xlabel
(
'Source Port'
)
plt
.
ylabel
(
'Destination Port'
)
plt
.
legend
()
plt
.
show
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment