diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..6a481a4 --- /dev/null +++ b/README.md | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | # Packet Detector | ||
| 2 | |||
| 3 | XDP program that prints "hello world" when detecting "hell0123" in packets on enp1s0. | ||
| 4 | # 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 | ||
| 5 | |||
| 6 | ## Build & Run | ||
| 7 | |||
| 8 | ./build.sh # | ||
| 9 | sudo ./target/release/packet-detector | ||
| 10 | |||
| 11 | ## Test | ||
| 12 | |||
| 13 | sudo tcpdump -i enp1s0 -X udp port 9999 | ||
| 14 | echo "hell0123" | nc -u 192.168.122.154 9999 | ||
| 15 | |||
| 16 | ^C[root@rust1 packet-detector]# sudo ./target/release/packet-detector | ||
| 17 | XDP program attached to enp1s0. Waiting for 'hell0123' at offset 42... | ||
| 18 | Press Ctrl+C to exit | ||
| 19 | hello world | ||
| 20 | hello world | ||
| 21 | root@rust1 ~]# sudo tcpdump -i enp1s0 -X udp port 9999 | ||
| 22 | dropped privs to tcpdump | ||
| 23 | tcpdump: verbose output suppressed, use -v[v]... for full protocol decode | ||
| 24 | listening on enp1s0, link-type EN10MB (Ethernet), snapshot length 262144 bytes | ||
| 25 | 16:08:13.495858 IP _gateway.36253 > rust1.distinct: UDP, length 9 | ||
| 26 | 0x0000: 4500 0025 f4ed 4000 4011 cfed c0a8 7a01 E..%..@.@.....z. | ||
| 27 | 0x0010: c0a8 7a9a 8d9d 270f 0011 93fc 6865 6c6c ..z...'.....hell | ||
| 28 | 0x0020: 3031 3233 0a 0123. | ||
| 29 | 16:11:26.438958 IP _gateway.51421 > rust1.distinct: UDP, length 9 | ||
| 30 | 0x0000: 4500 0025 3f88 4000 4011 8553 c0a8 7a01 E..%?.@.@..S..z. | ||
| 31 | 0x0010: c0a8 7a9a c8dd 270f 0011 58bc 6865 6c6c ..z...'...X.hell | ||
| 32 | 0x0020: 3031 3233 0a 0123. | ||
| 33 | 16:20:35.902662 IP _gateway.38275 > rust1.distinct: UDP, length 9 | ||
| 34 | 0x0000: 4500 0025 fc3e 4000 4011 c89c c0a8 7a01 E..%.>@.@.....z. | ||
| 35 | 0x0010: c0a8 7a9a 9583 270f 0011 8c16 6865 6c6c ..z...'.....hell | ||
| 36 | 0x0020: 3031 3233 0a | ||
| 37 | |||
