From 1951b063d7ec6d6e8db8a0b5074c73f887749208 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 29 Dec 2025 22:18:04 +0800 Subject: initial commit --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..6a481a4 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# Packet Detector + +XDP program that prints "hello world" when detecting "hell0123" in packets on enp1s0. +# this has been moved to automated testing! in run_test.sh in the root dir! this file is just for documenting the basic stuff of what happens + +## Build & Run + +./build.sh # +sudo ./target/release/packet-detector + +## Test + +sudo tcpdump -i enp1s0 -X udp port 9999 +echo "hell0123" | nc -u 192.168.122.154 9999 + +^C[root@rust1 packet-detector]# sudo ./target/release/packet-detector +XDP program attached to enp1s0. Waiting for 'hell0123' at offset 42... +Press Ctrl+C to exit +hello world +hello world +root@rust1 ~]# sudo tcpdump -i enp1s0 -X udp port 9999 +dropped privs to tcpdump +tcpdump: verbose output suppressed, use -v[v]... for full protocol decode +listening on enp1s0, link-type EN10MB (Ethernet), snapshot length 262144 bytes +16:08:13.495858 IP _gateway.36253 > rust1.distinct: UDP, length 9 + 0x0000: 4500 0025 f4ed 4000 4011 cfed c0a8 7a01 E..%..@.@.....z. + 0x0010: c0a8 7a9a 8d9d 270f 0011 93fc 6865 6c6c ..z...'.....hell + 0x0020: 3031 3233 0a 0123. +16:11:26.438958 IP _gateway.51421 > rust1.distinct: UDP, length 9 + 0x0000: 4500 0025 3f88 4000 4011 8553 c0a8 7a01 E..%?.@.@..S..z. + 0x0010: c0a8 7a9a c8dd 270f 0011 58bc 6865 6c6c ..z...'...X.hell + 0x0020: 3031 3233 0a 0123. +16:20:35.902662 IP _gateway.38275 > rust1.distinct: UDP, length 9 + 0x0000: 4500 0025 fc3e 4000 4011 c89c c0a8 7a01 E..%.>@.@.....z. + 0x0010: c0a8 7a9a 9583 270f 0011 8c16 6865 6c6c ..z...'.....hell + 0x0020: 3031 3233 0a + -- cgit v1.2.3