Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design2
/
2014104121
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Jihoon
2020-12-23 13:52:46 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
248d3569a41bc6a5627558604a0abe73f926bfa7
248d3569
1 parent
67dbe527
수정
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
15 deletions
Lab/detection/DoSDetection/CountingBloom.py
Lab/detection/DoSDetection/DoSDetection.py
보고서/면담확인서/1.jpg
보고서/면담확인서/2.jpg
Lab/detection/DoSDetection/CountingBloom.py
View file @
248d356
...
...
@@ -35,17 +35,6 @@ class Counting_bloom_filter(object):
keytable
.
append
(
self
.
c_bf
[
loc3
])
return
min
(
keytable
)
def
add_to_cbf
(
self
,
val
):
# cbf에 원소 삽입
# 최적의 해시 개수 hash_num에 대하여
# 3개라 가정하면, i값은 0~2까지
# 이 i값을 seed값 삼아 동일 sha1함수에 다른 seed값 부여하고 연산 진행
# 연산 결과 나온 key값이 loc, CBF 배열의 loc번째 인덱스에 increment연산 진행
# return값: 해당 값(0~threshold값 까지의 정수)
for
i
in
range
(
self
.
hash_num
):
loc
=
self
.
hash_func3
(
val
,
i
+
1
)
self
.
c_bf
[
loc
]
+=
1
return
self
.
c_bf
[
loc
]
def
hash_func1
(
self
,
val
):
#fnv32-1a
hashedVal
=
fnv
(
val
.
encode
(
'utf-8'
))
...
...
Lab/detection/DoSDetection/DoSDetection.py
View file @
248d356
import
pyshark
as
pyshark
import
os
import
subprocess
import
C
BF2
as
CBF
import
C
ountingBloom
as
CBF
import
threading
import
time
import
schedule
#pps_threshold 설정 필요
def
LiveSniffer
(
net_interface
,
cbf
):
capture
=
pyshark
.
LiveCapture
(
interface
=
net_interface
,
bpf_filter
=
'dst 192.168.219.110 && tcp'
)
# 캡쳐 프로세스 생성
...
...
@@ -39,9 +39,11 @@ def main():
try
:
capture
=
pyshark
.
LiveCapture
(
interface
=
'wlp2s0'
,
bpf_filter
=
'tcp'
,
display_filter
=
'ip.dst == 192.168.219.100'
)
# 캡쳐 프로세스 생성
#capture.set_debug()
filter
=
CBF
.
Counting_bloom_filter
(
8000
,
0.01
)
# CBF 초기화
filter
=
CBF
.
Counting_bloom_filter
(
20
,
0.001
)
# CBF 초기화, 홈 IoT 환경에서는 최대 20개 정도의 노드로부터 정보를 송수신한다고 판단, 0.001은 hash miss 비율
# false-positive 비율을 낮추기 위해서
print
(
"CB-Filter Length: "
,
filter
.
length
)
schedule
.
every
(
0.
008
)
.
seconds
.
do
(
CntDecrement
,
filter
.
c_bf
)
schedule
.
every
(
0.
1
)
.
seconds
.
do
(
CntDecrement
,
filter
.
c_bf
)
# 0.1초마다 필터 내 1이상의 모든 값을 1씩 감소
for
packet
in
capture
.
sniff_continuously
():
PktFiltering
(
packet
,
filter
)
schedule
.
run_pending
()
...
...
보고서/면담확인서/1.jpg
0 → 100644
View file @
248d356
78.4 KB
보고서/면담확인서/2.jpg
0 → 100644
View file @
248d356
71.1 KB
Please
register
or
login
to post a comment