rust-pcap / pcap

Rust language pcap library
Apache License 2.0
595 stars 138 forks source link

(Help) Packet replacement #286

Closed amyipdev closed 1 year ago

amyipdev commented 1 year ago

Hello! I'm working on implementing pcap into a project of mine (https://github.com/amyipdev/acc). While I see how to capture and inject packets, it isn't exactly clear what to do for packet response replacement. What I mean is functioning in a similar way to a VPN - intercept (don't want it going through normally) the packet, send it somewhere else, get the response, and then re-inject that response. Is just a simple capture and reinjection of the response sufficient, or is there more I need to do to make the packet capture an intercept? (note that I do need to send packets back out on the same interface, also the packet capture should only be outgoing)

Thank you so much for making this crate - I just need some assistance with using it, since the docs are currently a bit sparse.

amyipdev commented 1 year ago

Learned recently pcap won't work, need to use TUN.