Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IDS PSE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Daniel Yang
IDS PSE
Commits
b10314df
Commit
b10314df
authored
3 months ago
by
Chris
Browse files
Options
Downloads
Patches
Plain Diff
added db based dns spoofing check
parent
c34a3927
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
code/src/packet_capturing.py
+5
-1
5 additions, 1 deletion
code/src/packet_capturing.py
with
6 additions
and
2 deletions
README.md
+
1
−
1
View file @
b10314df
...
...
@@ -11,7 +11,7 @@
-
[X] 3. Rate-Based Anomaly Detection
-
[X] 4. Malformed Packet Detection
-
[X] 5. ICMP Flood Detection
-
[
] 6. DNS Spoofing Detection
-
[
X
] 6. DNS Spoofing Detection
-
[X] 7. ARP Spoofing Detection
-
[ ] 8. Protocol-Specific Anomalies
-
[X] 9. Content-Learning Mismatch
...
...
This diff is collapsed.
Click to expand it.
code/src/packet_capturing.py
+
5
−
1
View file @
b10314df
...
...
@@ -147,13 +147,16 @@ def tcp_reset_attack(packet):
def
dns_spoofing
(
packet
):
if
packet
.
getlayer
(
DNS
).
qr
==
1
:
# DNS response
dns_response
=
packet
.
getlayer
(
DNS
)
db_conn
.
contains_address
()
if
dns_response
.
an
is
not
None
:
for
i
in
range
(
dns_response
.
ancount
):
dns_rr
=
dns_response
.
an
[
i
]
if
dns_rr
.
rdata
in
reserved_ips
:
print
(
f
"
Possible DNS spoofing detected:
{
dns_rr
.
rrname
}
->
{
dns_rr
.
rdata
}
"
)
def
dns_spoofing_with_db_check
(
packet
):
if
packet
.
getlayer
(
DNS
).
qr
==
1
and
db_conn
.
contains_malicious_address
(
connection
,
packet
):
# DNS response
print
(
f
"
Possible DNS spoofing: ip address
{
packet
[
IP
].
src
}
matches a known malicious ip
"
)
# Checks if checksum is corrupted
def
checksum_verification
(
packet
):
if
IP
in
packet
:
...
...
@@ -205,6 +208,7 @@ def packet_handler(packet):
tcp_reset_attack
(
packet
)
if
DNS
in
packet
:
dns_spoofing
(
packet
)
dns_spoofing_with_db_check
(
packet
)
if
Raw
in
packet
:
payload_pattern_matching
(
packet
)
content_length_mismatch
(
packet
)
...
...
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