/rusty-netconn

Sample code for dumping netconns using libpcap in Rust.

Primary LanguageRustMIT LicenseMIT

rusty-netconn

Sample code for dumping netconns using libpcap in Rust.

This sample borrows liberally from libpnet's examples as well as the pcap crate example. Just experiments for me to glue together live pcap with libpnet for parsing.

Sample Output

+-------------------+-----------+-----------+-----------+
| dest ip           | tcp bytes | udp bytes | icmp reqs |
+-------------------+-----------+-----------+-----------+
| 239.255.255.250   | 0         | 21220     | 0         |
+-------------------+-----------+-----------+-----------+
| 65.52.108.197     | 140       | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| ff02::c           | 0         | 11535     | 0         |
+-------------------+-----------+-----------+-----------+
| ff02::1:fffb:e47b | 0         | 0         | 1         |
+-------------------+-----------+-----------+-----------+
| ff02::1:ff5d:9131 | 0         | 0         | 1         |
+-------------------+-----------+-----------+-----------+
| 192.30.253.125    | 495       | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 52.216.165.77     | 3161      | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 23.198.109.161    | 5562      | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 52.73.192.207     | 312384    | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 172.16.1.255      | 0         | 1607      | 0         |
+-------------------+-----------+-----------+-----------+
| 173.194.202.95    | 272       | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 65.183.192.253    | 0         | 216       | 0         |
+-------------------+-----------+-----------+-----------+
| 151.101.0.102     | 1806      | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 54.213.206.207    | 2144      | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 208.67.222.222    | 0         | 2592      | 0         |
+-------------------+-----------+-----------+-----------+
| ff02::1:ffaa:adfe | 0         | 0         | 2         |
+-------------------+-----------+-----------+-----------+
| 172.16.1.149      | 358034803 | 3839      | 0         |
+-------------------+-----------+-----------+-----------+
| 192.30.253.124    | 198       | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 172.16.0.72       | 32        | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 173.194.202.189   | 1771      | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 224.0.0.251       | 0         | 303       | 0         |
+-------------------+-----------+-----------+-----------+
| 54.202.226.136    | 2169      | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 216.58.216.129    | 127       | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 65.183.192.254    | 0         | 216       | 0         |
+-------------------+-----------+-----------+-----------+
| 216.58.216.170    | 140       | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 192.30.255.113    | 1828620   | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 255.255.255.255   | 0         | 4786      | 0         |
+-------------------+-----------+-----------+-----------+
| 54.187.218.234    | 605       | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 13.33.226.131     | 3455      | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 169.60.79.23      | 102       | 0         | 0         |
+-------------------+-----------+-----------+-----------+
| 224.0.0.253       | 0         | 96        | 0         |
+-------------------+-----------+-----------+-----------+