Christophe CasalegnoAutoimmune warrior, Entrepreneur & Bio/Hacker
← All videos

Shell / Bash live coding: a per-IP connection counter on Linux - Christophe Casalegno

Duration: 16:29

English version of this page. The original recording is unchanged.

I am returning to live coding sessions with a small tool I use on my servers: counting open connections by IP address. Originally, it is almost an alias. I want to turn it into a cleaner Bash script, with output that is easy to process and use with my blacklisting tools.

I break the work down into functions to retrieve addresses, count and sort connections, ignore certain IPs and optionally display their reverse DNS. I build the processing progressively, starting from commands I already use for manual checks.

First test: the script produces absolutely nothing. I had simply forgotten to call the main function. Once that is fixed, I check the options, then move to a server with more traffic to see how it behaves in real conditions. Mission accomplished.

All my links, projects and social media: https://all.bo

Christophe Casalegno Brain 0verride

Keep it simple
and direct!