Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
super6502
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Byron Lathi
super6502
Commits
0ff33741
Commit
0ff33741
authored
6 months ago
by
Byron Lathi
Browse files
Options
Downloads
Patches
Plain Diff
Use scapy to send real packets
parent
68fe3d18
No related branches found
Branches containing commit
No related tags found
2 merge requests
!76
Resolve "Send TCP data over M2S"
,
!74
Resolve "Network Processor"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hw/super6502_fpga/src/sub/network_processor/sim/cocotb/tests/scapy_irl_test.py
+32
-0
32 additions, 0 deletions
.../sub/network_processor/sim/cocotb/tests/scapy_irl_test.py
with
32 additions
and
0 deletions
hw/super6502_fpga/src/sub/network_processor/sim/cocotb/tests/scapy_irl_test.py
0 → 100644
+
32
−
0
View file @
0ff33741
from
scapy.layers.inet
import
Ether
,
IP
,
TCP
from
scapy.layers.l2
import
ARP
from
scapy
import
sendrecv
from
scapy.config
import
conf
from
scapy.supersocket
import
L3RawSocket
import
socket
# In order for this to work, you need to run these commands:
# sudo setcap cap_net_raw=eip $(readlink -f $(which python))
# sudo iptables -A OUTPUT -p tcp --tcp-flags RST RST -s 127.0.0.1 -j DROP
def
main
():
serversocket
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
serversocket
.
bind
((
"
127.0.0.1
"
,
5678
))
serversocket
.
listen
(
5
)
conf
.
L3socket
=
L3RawSocket
tcp_syn
=
IP
(
dst
=
"
127.0.0.1
"
)
/
TCP
(
sport
=
1234
,
dport
=
5678
,
seq
=
0
,
ack
=
0
,
flags
=
"
S
"
)
sendrecv
.
send
(
tcp_syn
,
iface
=
"
lo
"
)
pkt
=
sendrecv
.
sniff
(
filter
=
"
tcp src port 5678
"
,
iface
=
"
lo
"
,
count
=
1
)[
0
]
print
(
pkt
)
if
__name__
==
"
__main__
"
:
main
()
\ No newline at end of file
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