Visualizing TCP connections with Powershell and Graphviz
I've recently been somewhat obsessed with Graphviz, particularly with the PSGraph Powershell Module. At work I use it as part of the CI/CD of various projects to automatically document the flow of information between functions, servers, etc. But in this post, I want to show how i start with the ss command (socket statistics), and end up with a graph that shows who you're connected to, and how. First of all, you need a few things: A Linux distro. I use Pop OS. Powershell PSGraph Graphviz (sudo apt-get install graphviz) This is the script that does all the fun: So first, I create a class with the properties I want. Then I run the ss command, and declare an empty array. Then I loop through the output of the ss command, parse it into the individual pieces of information I want, and add it to the array. Then the PSGraph magic. To be honest, I struggle to explain in great detail how it works, but the things to note are: -FromScript are the "start" boxes -ToScript are...