2 minute read

Automations: take over!

Highlights

  • Automated tests for network traffic using Scapy and tshark
  • GitHub Actions integration for continuous testing

The Long Story

Coming in, here’s what this week and next week were intended to be:

This week: conduct controlled experiments: generate recognizable traffic and predict what should appear in Wireshark; optional packet experimentation with Scapy.

Next week: cleanup and validation: test several captures, handle malformed/missing fields, improve dashboard organization, README explaining networking concepts demonstrated.

I met most of this week’s goal, but not as I originally planned. I created traffic as automated tests instead of by eye using Wireshark. Each test generates traffic with Scapy, decodes it with tshark (Wireshark’s engine) and checks the result against what I expected. I also set up GitHub Actions to run those tests on every commit. I feel better about how the program is working than I did before.

Using Scapy, I’m generating test packets, writing them to capture files and running them through my analyzer. I have to say, Scapy is awesome to work with! It’s robust, the syntax is easy to understand, and it’s helping reinforce concepts I’ve been learning about over the past few weeks.

The TCP tests made me think through the handshake process and its possible outcomes. These include a successful connection where data is exchanged and closed as intended, and a failed connection due to something like a port not listening. Testing helped find a bug where my analyzer counted a reset as completing the handshake, because an RST-ACK flag also has ACK in it making it seem as if it was a proper handshake. That’s been fixed now.

GitHub Actions now runs the tests on every commit to the repo. It checks that the code works as expected and flags breaking changes. It proved useful during setup, too. The latest Ubuntu runner couldn’t read my sample capture, so I went with Ubuntu 24.04 instead of 26.04.

My plan for next week is still cleanup and validation, plus finishing the part of this week’s goal I haven’t done yet: looking at generated traffic in Wireshark itself.

Here’s what I’d like to do next week:

Save the generated traffic from Scapy as pcap files, and compare them in Wireshark and the dashboard against my predictions Send generated traffic over loopback during a live capture, to test capture end to end Test several captures Handle malformed/missing fields Create a README explaining the networking concepts demonstrated I’ve left off the dashboard improvements because I feel it’s good enough, and I’d rather focus on functionality that supports the Network+ concepts.

Not much is blocking me other than the demands of my other classes, but I’m sure this will all come together!

I held onto the guardrail that was my plan, but deviated a bit. I feel confident this was the right decision to supporting the project longterm.