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
e45b49a7
Commit
e45b49a7
authored
Sep 06, 2023
by
Gamage G.G.I.V.M
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
af098b05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
IT20036102/samara4.py
IT20036102/samara4.py
+57
-0
No files found.
IT20036102/samara4.py
0 → 100644
View file @
e45b49a7
from
scapy.all
import
*
import
sqlite3
# Define functions to create valid packets for different protocols
def
create_valid_ssl_packet
():
# Implement SSL packet creation with valid data
pass
def
create_valid_tcp_packet
():
# Implement TCP packet creation with valid data
pass
def
create_valid_dns_packet
():
# Implement DNS packet creation with valid data
pass
def
create_valid_erf_packet
():
# Implement ERF packet creation with valid data
pass
def
create_valid_ntp_packet
():
# Implement NTP packet creation with valid data
pass
# Function to generate test cases and store them in a database
def
generate_test_cases
():
# Connect to the SQLite database to store the test cases
connection
=
sqlite3
.
connect
(
"test_cases.db"
)
cursor
=
connection
.
cursor
()
protocols
=
[
'SSL'
,
'TCP'
,
'DNS'
,
'ERF'
,
'NTP'
]
for
protocol
in
protocols
:
if
protocol
==
'SSL'
:
valid_packet
=
create_valid_ssl_packet
()
elif
protocol
==
'TCP'
:
valid_packet
=
create_valid_tcp_packet
()
elif
protocol
==
'DNS'
:
valid_packet
=
create_valid_dns_packet
()
elif
protocol
==
'ERF'
:
valid_packet
=
create_valid_erf_packet
()
elif
protocol
==
'NTP'
:
valid_packet
=
create_valid_ntp_packet
()
# Store the valid packet in the 'test_cases' table
query
=
"INSERT INTO test_cases (protocol, source, destination, length) VALUES (?, ?, ?, ?)"
if
valid_packet
is
not
None
:
cursor
.
execute
(
query
,
(
protocol
,
'192.168.0.1'
,
'10.0.0.1'
,
len
(
valid_packet
)))
else
:
print
(
f
"Error: Failed to create valid packet for protocol {protocol}"
)
connection
.
commit
()
# Close the connection to the database
connection
.
close
()
# Call the function to generate and store test cases
generate_test_cases
()
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