Skip to content

Commit

Permalink
test: Add draft of a fake-TC Python script
Browse files Browse the repository at this point in the history
Signed-off-by: Casper Andersson <[email protected]>
  • Loading branch information
cappe987 committed Dec 30, 2024
1 parent 2480400 commit 96fbe2e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/fake_tc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from scapy.all import *

def change_send(pkt):
payload = pkt.lastlayer()
payload.load = payload.load[:8] + b"\x00\x00\x00\x01\x00\x00" + payload.load[14:]

if pkt.sniffed_on == 'veth2':
sendp(pkt, iface='veth3', verbose=False)
print("Forwarded veth2 -> veth3")
# elif pkt.sniffed_on == 'veth3':
# sendp(pkt, iface='veth2', verbose=False)
# print("Forwarded veth3 -> veth2")


# Sniffing on both and forwarding causes it to sniff its own packets
# sniff(iface=['veth2', 'veth3'], prn=change_send)
sniff(iface='veth2', prn=change_send)



0 comments on commit 96fbe2e

Please sign in to comment.