Running on Vagrant
July 3, 2023 ยท View on GitHub
If you have Vagrant installed, you can run the above example with the following commands.
-
In a terminal (terminal 1), bring up the Vagrant box:
$ vagrant upThis will take a few minutes to download and provision the box.
-
Connect to the Vagrant box:
$ vagrant ssh -
Build
pwru:$ cd /pwru $ make -
Run
pwru:$ sudo ./pwru --output-tuple 'dst host 1.1.1.1 and dst port 80 and tcp' -
In a new terminal (terminal 2), connect to the Vagrant box:
$ vagrant ssh -
In terminal 2, run
curlto generate some traffic to 1.1.1.1:$ curl 1.1.1.1Observe the output of
pwruin terminal 1. -
In terminal 2, add an
iptablesrule to block traffic to 1.1.1.1:$ sudo iptables -t filter -I OUTPUT 1 -m tcp --proto tcp --dst 1.1.1.1/32 -j DROP -
In terminal 2, run
curlto generate some traffic to 1.1.1.1:$ curl 1.1.1.1Observe the output of
pwruin terminal 1. -
To clean up, press
Ctrl+Cto terminatepwruin terminal 1, exit both shells, and run:$ vagrant destroy