How can I edit outgoing IP packets on the fly?
I believe NetfilterQueue would allow me to do this on Linux, so I am looking for macOS alternatives.
Overall, I want to be able to capture a packet sent from my machine to a specific IP address, edit some information in the IP header and send the packet on its way.
Edit
I have just skimmed through iptables man page and realized that mangle table would work perfectly for my usecase. As I understand, macOS's alternative to iptables is some variant of OpenBSD PF. I can't seem to find anything about altering packets in PF documentation. Is it possible to set some rules for altering packets using macOS PF?
/dev/pf
andpfctl
provides a simple accept/deny mechanism based on IP metadata, and nothing more. Altering packets is not possible with PF alone.