Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-261
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
Gamage G.G.I.V.M
2023-261
Commits
84f0ded7
Commit
84f0ded7
authored
Nov 02, 2023
by
Gamage G.G.I.V.M
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
175c9b42
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
IT20246396/vuln1.py
IT20246396/vuln1.py
+51
-0
No files found.
IT20246396/vuln1.py
0 → 100644
View file @
84f0ded7
import
sqlite3
# Function to create the vulnerabilities table
def
create_vulnerabilities_table
():
vulnerability_connection
=
sqlite3
.
connect
(
"vulnerabilities.db"
)
vulnerability_cursor
=
vulnerability_connection
.
cursor
()
# Create the 'vulnerabilities' table with columns for details
vulnerability_cursor
.
execute
(
'''CREATE TABLE IF NOT EXISTS vulnerabilities
(id INTEGER PRIMARY KEY AUTOINCREMENT,
protocol TEXT,
source TEXT,
destination TEXT,
length INTEGER,
vulnerability_info TEXT)'''
)
vulnerability_connection
.
commit
()
vulnerability_connection
.
close
()
# Function to detect vulnerabilities and store them in a database
def
detect_vulnerabilities
():
# Connect to the SQLite database containing captured packets
connection
=
sqlite3
.
connect
(
"captured_packets.db"
)
cursor
=
connection
.
cursor
()
# Connect to the vulnerabilities database
vulnerability_connection
=
sqlite3
.
connect
(
"vulnerabilities.db"
)
vulnerability_cursor
=
vulnerability_connection
.
cursor
()
# Protocol to check for vulnerability
target_protocol
=
'DATA'
# Query to retrieve packets with the target protocol
query
=
"SELECT protocol, source, destination, length FROM packets WHERE protocol = ?"
cursor
.
execute
(
query
,
(
target_protocol
,))
packets
=
cursor
.
fetchall
()
for
packet
in
packets
:
protocol
,
source
,
destination
,
length
=
packet
vulnerability_info
=
f
"Vulnerability detected: Protocol is '{protocol}', Source: {source}, Destination: {destination}, Length: {length}"
vulnerability_query
=
"INSERT INTO vulnerabilities (protocol, source, destination, length, vulnerability_info) VALUES (?, ?, ?, ?, ?)"
vulnerability_cursor
.
execute
(
vulnerability_query
,
(
protocol
,
source
,
destination
,
length
,
vulnerability_info
))
vulnerability_connection
.
commit
()
connection
.
close
()
vulnerability_connection
.
close
()
# Call the function to create the 'vulnerabilities' table
create_vulnerabilities_table
()
# Call the function to detect 'DATA' protocol as a vulnerability and store it
detect_vulnerabilities
()
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